Exemplo n.º 1
0
 public override bool Walk(AssignmentStatement node) {
     foreach (var lhs in node.Left) {
         DefineExpr(lhs);
     }
     node.Right.Walk(this);
     return false;
 }
 // AssignmentStatement
 public override bool Walk(AssignmentStatement node)
 {
     foreach (Expression e in node.Left)
     {
         e.Walk(_define);
     }
     return(true);
 }
Exemplo n.º 3
0
 // AssignStmt
 public override bool Walk(AssignmentStatement node)
 {
     node.Right.Walk(this);
     foreach (Expression e in node.Left)
     {
         e.Walk(_fdef);
     }
     return(false);
 }
Exemplo n.º 4
0
 public override bool Walk(AssignmentStatement node) {
     CanComplete = true;
     CommitByDefault = true;
     if (node.Right != null) {
         node.Right.Walk(this);
     }
     return false;
 }
Exemplo n.º 5
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 >= PythonLanguageVersion.V25 && PeekToken(TokenKind.KeywordYield)) {
                    if (!AllowYieldSyntax && AllowAsyncAwaitSyntax) {
                        ReportSyntaxError("'yield' inside async function");
                    }
                    Eat(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;
        }
Exemplo n.º 6
0
 // AssignmentStatement
 public override bool Walk(AssignmentStatement node) {
     foreach (Expression e in node.Left) {
         e.Walk(_define);
     }
     return true;
 }
Exemplo n.º 7
0
        public override bool Walk(AssignmentStatement node) {
            UpdateLineInfo(node);

            return base.Walk(node);
        }
Exemplo n.º 8
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);
 }
Exemplo n.º 9
0
 public override bool Walk(AssignmentStatement node) {
     var m = _scope.Peek();
     if (m != null) {
         var value = GetValueFromExpression(node.Right, m);
         foreach (var ne in node.Left.OfType<NameExpression>()) {
             m[ne.Name] = value;
         }
     }
     return base.Walk(node);
 }
Exemplo n.º 10
0
 public override void PostWalk(AssignmentStatement node) { }
Exemplo n.º 11
0
 // AssignStmt
 public override bool Walk(AssignmentStatement node) {
     node.Right.Walk(this);
     foreach (Expression e in node.Left) {
         e.Walk(_fdef);
     }
     return false;
 }
Exemplo n.º 12
0
 public AssignmentScopeNode(PythonAst ast, AssignmentStatement assign, NameExpression name) {
     _assign = assign;
     _name = name;
     _ast = ast;
 }
Exemplo n.º 13
0
 public override void PostWalk(AssignmentStatement node)
 {
 }
Exemplo n.º 14
0
 public override void PostWalk(AssignmentStatement node) { PostWalkWorker(node); }
Exemplo n.º 15
0
 // AssignmentStatement
 public override bool Walk(AssignmentStatement node) { return ShouldWalkWorker(node); }