public static ToForInObject ( Object value, |
||
value | Object | |
engine | ||
return | Object |
internal override Object Evaluate() { AST r = this.var; if (this.initializer != null) { this.initializer.Evaluate(); } this.completion.Continue = 0; this.completion.Exit = 0; this.completion.value = null; Object coll = Convert.ToForInObject(this.collection.Evaluate(), this.Engine); bool isScriptObject = coll is ScriptObject; IEnumerator e = null; try{ e = JScriptGetEnumerator(coll); }catch (JScriptException x) { x.context = this.collection.context; throw x; } while (e.MoveNext()) { r.SetValue(e.Current); Completion c = (Completion)this.body.Evaluate(); this.completion.value = c.value; if (c.Continue > 1) { this.completion.Continue = c.Continue - 1; break; } if (c.Exit > 0) { this.completion.Exit = c.Exit - 1; break; } if (c.Return) { return(c); } } return(this.completion); }