override public void LeaveUnpackStatement(UnpackStatement node)
        {
            Block body = new Block(node.LexicalInfo);

            UnpackExpression(body, node.Expression, node.Declarations);
            ReplaceCurrentNode(body);
        }
Example #2
0
        public UnpackStatement CreateUnpackStatement(DeclarationCollection declarations, Expression expression)
        {
            UnpackStatement unpack = new UnpackStatement(expression.LexicalInfo);

            unpack.Declarations.Extend(declarations);
            unpack.Expression = expression;
            return(unpack);
        }
Example #3
0
        public override void Switch(IAstTransformer transformer, out Node resultingNode)
        {
            UnpackStatement thisNode           = (UnpackStatement)this;
            Statement       resultingTypedNode = thisNode;

            transformer.OnUnpackStatement(thisNode, ref resultingTypedNode);
            resultingNode = resultingTypedNode;
        }
Example #4
0
 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();
 }
Example #5
0
        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);
        }
Example #6
0
 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();
 }
Example #7
0
        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);
                }
            }
        }
Example #9
0
 override public void LeaveUnpackStatement(UnpackStatement node)
 {
     LeaveStatement(node);
 }
Example #10
0
 public override void OnUnpackStatement(UnpackStatement node)
 {
     throw new NotImplementedException();
 }
 public override void OnUnpackStatement(UnpackStatement node)
 {
     base.OnUnpackStatement(node);
     Check(node);
 }
Example #12
0
 public override void LeaveUnpackStatement(UnpackStatement node)
 {
     OnStatement(node);
 }