public override bool Walk(ForIn node) { if (CheckBlock(node.Body)) { Span = GetTargetStatement(node).GetSpan(_tree.LocationResolver); return(false); } return(base.Walk(node)); }
public virtual void Visit(ForIn node) { if (node != null) { if (node.Variable != null) { node.Variable.Accept(this); } if (node.Collection != null) { node.Collection.Accept(this); } if (node.Body != null) { node.Body.Accept(this); } } }
public override bool Walk(ForIn node) { var coll = _eval.Evaluate(node.Collection); var variable = node.Variable as Var; var lookupVar = node.Variable as ExpressionStatement; if (variable != null) { string varName = variable.First().Name; Debug.Assert(_eval.Scope.ContainsVariable(varName)); var prevVar = _eval.Scope.GetVariable(node.Variable, _unit, varName); bool walkedBody = false; if (coll.Count == 1) { foreach (var value in coll) { var values = value.GetEnumerationValues(node, _unit); if (values.Count < 50) { walkedBody = true; Debug.WriteLine(String.Format("Enumerating: {1} {0}", value, values.Count)); foreach (var individualValue in values) { var newVar = new LocalNonEnqueingVariableDef(); _eval.Scope.ReplaceVariable(variable.First().Name, newVar); _eval.Scope.AssignVariable( varName, node, _unit, individualValue ); node.Body.Walk(this); prevVar.AddTypes( _unit, newVar.GetTypesNoCopy( _unit.ProjectEntry, _unit.ProjectEntry ) ); } } } } if (!walkedBody) { foreach (var value in coll) { var values = value.GetEnumerationValues(node, _unit); prevVar.AddTypes( _unit, values ); } // we replace the variable here so that we analyze w/ empty // types, but we do the assignment so users get completions against // anything in the for body. var newVar = new LocalNonEnqueingVariableDef(); _eval.Scope.ReplaceVariable(variable.First().Name, newVar); node.Body.Walk(this); } _eval.Scope.ReplaceVariable(varName, prevVar); } else if (lookupVar != null) { // TODO: _eval.AssignTo(node, lookupVar.Expression, values); node.Body.Walk(this); } return(false); }
internal protected virtual T Visit(ForIn node) { return(Visit(node as CodeNode)); }
public override bool Walk(ForIn node) { AddNode(node); return(true); }
public virtual void Visit(ForIn node) { if (node != null) { AcceptChildren(node); } }
public void Visit(ForIn node) { // not applicable; terminate }
public virtual void PostWalk(ForIn node) { }
public virtual bool Walk(ForIn node) { return true; }
protected override EP_VP1 Visit(ForIn node) { return(Visit(node as CodeNode)); }
public virtual bool Walk(ForIn node) { return(true); }
public virtual void PostWalk(ForIn node) { }
public virtual void Visit(ForIn node) { if (node != null) { if (node.Variable != null) { node.Variable.Accept(this); } if (node.Collection != null) { node.Collection.Accept(this); } if (node.Body != null) { node.Body.Accept(this); } } }