Пример #1
0
 public override bool Walk(AssignmentStatement node)
 {
     foreach (var lhs in node.Left) {
         DefineExpr(lhs);
     }
     node.Right.Walk(this);
     return false;
 }
Пример #2
0
        private Statement FinishAssignments(Expression right)
        {
            List<Expression> left = null;
            List<string> assignWhiteSpace = MakeWhiteSpaceList();
            Expression singleLeft = null;

            while (MaybeEat(TokenKind.Assign)) {
                if (assignWhiteSpace != null) {
                    assignWhiteSpace.Add(_tokenWhiteSpace);
                }
                string assignError = right.CheckAssign();
                if (assignError != null) {
                    ReportSyntaxError(right.StartIndex, right.EndIndex, assignError, ErrorCodes.SyntaxError | ErrorCodes.NoCaret);
                }

                if (singleLeft == null) {
                    singleLeft = right;
                } else {
                    if (left == null) {
                        left = new List<Expression>();
                        left.Add(singleLeft);
                    }
                    left.Add(right);
                }

                if (_langVersion >= JLanguageVersion.V71 && MaybeEat(TokenKind.KeywordYield)) {
                    right = ParseYieldExpression();
                } else {
                    right = ParseTestListAsExpr();
                }
            }

            AssignmentStatement assign;
            if (left != null) {
                Debug.Assert(left.Count > 0);

                assign = new AssignmentStatement(left.ToArray(), right);
                assign.SetLoc(left[0].StartIndex, right.EndIndex);
            } else {
                Debug.Assert(singleLeft != null);

                assign = new AssignmentStatement(new[] { singleLeft }, right);
                assign.SetLoc(singleLeft.StartIndex, right.EndIndex);
            }
            if (assignWhiteSpace != null) {
                AddListWhiteSpace(assign, assignWhiteSpace.ToArray());
            }
            return assign;
        }
Пример #3
0
 public AssignmentScopeNode(JAst ast, AssignmentStatement assign, NameExpression name)
 {
     _assign = assign;
     _name = name;
     _ast = ast;
 }
Пример #4
0
 // AssignStmt
 public override bool Walk(AssignmentStatement node)
 {
     node.Right.Walk(this);
     foreach (Expression e in node.Left) {
         e.Walk(_fdef);
     }
     return false;
 }
Пример #5
0
 public override void PostWalk(AssignmentStatement node)
 {
 }
Пример #6
0
 public override bool Walk(AssignmentStatement node)
 {
     UpdateChildRanges(node);
     foreach (var nameExpr in node.Left.OfType<NameExpression>()) {
         _scope.AddVariable(nameExpr.Name, CreateVariableInDeclaredScope(nameExpr));
     }
     return base.Walk(node);
 }
Пример #7
0
 // AssignmentStatement
 public override bool Walk(AssignmentStatement node)
 {
     return ShouldWalkWorker(node);
 }
Пример #8
0
 public override void PostWalk(AssignmentStatement node)
 {
     PostWalkWorker(node);
 }