示例#1
0
 // VoidExpression
 private void DefaultWalk(VoidExpression node)
 {
     if (Walk(node))
     {
         WalkNode(node.Statement);
     }
     PostWalk(node);
 }
示例#2
0
 // VoidExpression
 private void Dump(VoidExpression node)
 {
     Out(".void {");
     Indent();
     WalkNode(node.Statement);
     Dedent();
     Out("}");
 }
 protected internal override void PostWalk(VoidExpression node) {
     _voidExpressionsDepth--;
 }
        // Normally, expressions do not affect control-flow significantly. Only statements do.
        // Only statements check whether they should keep executing more statements or if
        // they should return a value. However, VoidExpression is a way to mix up expressions 
        // and statements. If a VoidExpression contains control flow, that causes a problem

        protected internal override bool Walk(VoidExpression node) {
            _voidExpressionsDepth++;
            return true;
        }
 protected override void PostWalk(VoidExpression node)
 {
     node.Statement = Rewrite(node.Statement);
 }
示例#6
0
 // VoidExpression
 private void DefaultWalk(VoidExpression node)
 {
     if (Walk(node)) {
         WalkNode(node.Statement);
     }
     PostWalk(node);
 }
        static Statement Rewrite(VoidExpression ve)
        {
          var block = new List<Statement>();
          var s = Rewrite(ve.Statement);
          if (s is BlockStatement)
          {
            block.AddRange(((BlockStatement)s).Statements);
          }
          else
          {
            block.Add(s);
          }

          block.Add(Ast.Return(Unspecified));

          return Rewrite(Ast.Block(block));
        }
 protected internal override void PostWalk(VoidExpression node)
 {
     _voidExpressionsDepth--;
 }
        // Normally, expressions do not affect control-flow significantly. Only statements do.
        // Only statements check whether they should keep executing more statements or if
        // they should return a value. However, VoidExpression is a way to mix up expressions
        // and statements. If a VoidExpression contains control flow, that causes a problem

        protected internal override bool Walk(VoidExpression node)
        {
            _voidExpressionsDepth++;
            return(true);
        }
示例#10
0
 // Void expression triggers rewrite
 protected internal override void PostWalk(VoidExpression node)
 {
     _rewrite = true;
 }
示例#11
0
 // Void expression triggers rewrite
 protected internal override void PostWalk(VoidExpression node) {
     _rewrite = true;
 }
示例#12
0
        // VoidExpression
        private Expression Rewrite(VoidExpression node)
        {
            Statement statement = RewriteStatement(node.Statement);

            return(Ast.Void(statement));
        }