void ESTreeIRGen::initCaptureStateInES5FunctionHelper() {
  // Capture "this", "new.target" and "arguments" if there are inner arrows.
  if (!curFunction()->getSemInfo()->containsArrowFunctions)
    return;

  auto *scope = curFunction()->function->getFunctionScope();

  // "this".
  curFunction()->capturedThis = Builder.createVariable(
      scope, Variable::DeclKind::Var, genAnonymousLabelName("this"));
  emitStore(
      Builder,
      Builder.getFunction()->getThisParameter(),
      curFunction()->capturedThis,
      true);

  // "new.target".
  curFunction()->capturedNewTarget = Builder.createVariable(
      scope, Variable::DeclKind::Var, genAnonymousLabelName("new.target"));
  emitStore(
      Builder,
      Builder.createGetNewTargetInst(),
      curFunction()->capturedNewTarget,
      true);

  // "arguments".
  if (curFunction()->getSemInfo()->containsArrowFunctionsUsingArguments) {
    curFunction()->capturedArguments = Builder.createVariable(
        scope, Variable::DeclKind::Var, genAnonymousLabelName("arguments"));
    emitStore(
        Builder,
        curFunction()->createArgumentsInst,
        curFunction()->capturedArguments,
        true);
  }
}
void ESTreeIRGen::initCaptureStateInES5FunctionHelper() {
   
  if (!curFunction()->getSemInfo()->containsArrowFunctions)
    return;

  auto *scope = curFunction()->function->getFunctionScope();

   
  curFunction()->capturedThis = Builder.createVariable(
      scope, Variable::DeclKind::Var, genAnonymousLabelName("this"));
  emitStore(
      Builder,
      Builder.getFunction()->getThisParameter(),
      curFunction()->capturedThis,
      true);

   
  curFunction()->capturedNewTarget = Builder.createVariable(
      scope, Variable::DeclKind::Var, genAnonymousLabelName("new.target"));
  emitStore(
      Builder,
      Builder.createGetNewTargetInst(),
      curFunction()->capturedNewTarget,
      true);

   
  if (curFunction()->getSemInfo()->containsArrowFunctionsUsingArguments) {
    curFunction()->capturedArguments = Builder.createVariable(
        scope, Variable::DeclKind::Var, genAnonymousLabelName("arguments"));
    emitStore(
        Builder,
        curFunction()->createArgumentsInst,
        curFunction()->capturedArguments,
        true);
  }
}