Exemplo n.º 1
0
      public void Execute(JSFunctionMetadata funcMetadata)
      {
        if (funcMetadata.IsAnalyzed)
          return;

        if (!funcMetadata.Scope.IsEvalFunction)
          return; //This is not the body in an eval()
        _currFuncMetadata = funcMetadata;
        _implicitReturn = _currFuncMetadata.Scope.GetOrAddSymbol("_implicit_eval_return");
        _implicitReturn.SymbolType = JSSymbol.SymbolTypes.HiddenLocal;

        _currBlock = null;
        _currStatementIndex = -1;
        _currExpressionStatement = null;

        VisitNode(_currFuncMetadata.FunctionIR.Statement);

        _currFuncMetadata.FunctionIR.Statement.Statements.Add(
            new ReturnStatement(
                new ReadIdentifierExpression(_implicitReturn)
            )
        );
      }
Exemplo n.º 2
0
 public override void Visit(ExpressionStatement node)
 {
   var stackState = _localVars.GetTemporaryStackState();
   base.Visit(node);
   _localVars.PopTemporariesAfter(stackState);
 }
Exemplo n.º 3
0
 public override void Visit(ExpressionStatement node)
 {
   VisitNode(node.Expression);
   Visit((Statement)node);
 }
Exemplo n.º 4
0
 public override void Visit(ExpressionStatement node)
 {
   PushLocation(node);
   VisitNode(node.Expression);
   AsVoid();
   PopLocation();
 }
Exemplo n.º 5
0
 public override void Visit(ExpressionStatement node)
 {
   Debug.Assert(_currExpressionStatement == null, "Invalid situation");
   _currExpressionStatement = node;
   VisitNode(node.Expression);
   _currExpressionStatement = null;
 }