override public void LeaveUnpackStatement(UnpackStatement node) { Block body = new Block(node.LexicalInfo); UnpackExpression(body, node.Expression, node.Declarations); ReplaceCurrentNode(body); }
public UnpackStatement CreateUnpackStatement(DeclarationCollection declarations, Expression expression) { UnpackStatement unpack = new UnpackStatement(expression.LexicalInfo); unpack.Declarations.Extend(declarations); unpack.Expression = expression; return(unpack); }
public override void Switch(IAstTransformer transformer, out Node resultingNode) { UnpackStatement thisNode = (UnpackStatement)this; Statement resultingTypedNode = thisNode; transformer.OnUnpackStatement(thisNode, ref resultingTypedNode); resultingNode = resultingTypedNode; }
public override void OnUnpackStatement(UnpackStatement us) { WriteIndented(); for (int i = 0; i < us.Declarations.Count; ++i) { if (i > 0) { Write(", "); } Switch(us.Declarations[i]); } Write(" = "); Switch(us.Expression); WriteLine(); }
public void TestUnpackStmt1() { Boo.Lang.Compiler.Ast.Module module = ParseTestCase("unpack_stmt_1.boo"); UnpackStatement us = (UnpackStatement)module.Globals.Statements[0]; Assert.AreEqual(2, us.Declarations.Count); Assert.AreEqual("arg0", us.Declarations[0].Name); Assert.AreEqual("arg1", us.Declarations[1].Name); MethodInvocationExpression mce = (MethodInvocationExpression)us.Expression; MemberReferenceExpression mre = ((MemberReferenceExpression)mce.Target); Assert.AreEqual("GetCommandLineArgs", mre.Name); Assert.AreEqual("Environment", ((ReferenceExpression)mre.Target).Name); }
override public void OnUnpackStatement(UnpackStatement us) { WriteIndented(); for (int i = 0; i < us.Declarations.Count; ++i) { if (i > 0) { Write(", "); } Visit(us.Declarations[i]); } WriteOperator(" = "); Visit(us.Expression); Visit(us.Modifier); WriteLine(); }
public void StatementModifiersOnUnpackStatement() { Boo.Lang.Compiler.Ast.Module module = ParseTestCase("stmt_modifiers_3.boo"); Block body = module.Globals; Assert.AreEqual(2, body.Statements.Count); UnpackStatement stmt = (UnpackStatement)body.Statements[0]; Assert.IsNotNull(stmt.Modifier, "Modifier"); Assert.AreEqual(StatementModifierType.If, stmt.Modifier.Type); Assert.IsTrue(stmt.Modifier.Condition is BoolLiteralExpression); Assert.AreEqual(true, ((BoolLiteralExpression)stmt.Modifier.Condition).Value); RunParserTestCase("stmt_modifiers_3.boo"); }
public override void OnUnpackStatement(UnpackStatement node) { ArrayLiteralExpression ale = node.Expression as ArrayLiteralExpression; for (int i = 0; i < node.Declarations.Count; i++) { Declaration decl = node.Declarations[i]; if (acceptImplicit && ale != null && ale.Items.Count > i) { DeclarationFound(decl.Name, decl.Type, ale.Items[i], decl.LexicalInfo); } else if (decl.Type != null) { DeclarationFound(decl.Name, decl.Type, null, decl.LexicalInfo); } } }
override public void LeaveUnpackStatement(UnpackStatement node) { LeaveStatement(node); }
public override void OnUnpackStatement(UnpackStatement node) { throw new NotImplementedException(); }
public override void OnUnpackStatement(UnpackStatement node) { base.OnUnpackStatement(node); Check(node); }
public override void LeaveUnpackStatement(UnpackStatement node) { OnStatement(node); }