internal override HxlLangElement ConvertToElement() { HxlForEachElement e = (HxlForEachElement)this.OwnerDocument.CreateElement("c:foreach"); e.Var = this.Var; e.In = Expression.Parse(this.Value); return(e); }
// IScriptGenerator implementation public IEnumerable <string> Start(HxlForEachElement e) { yield return(EmitVarLoopStatus(e)); var inExp = RewriteExpressionSyntax.BindVariables(e.In); yield return(string.Format("foreach (var {0} in {1}) {{", e.Var, inExp)); yield return(string.Format("__closure.{0} = {0};", e.Var)); yield return(EmitVarLoopStatusCurrent(e)); }
void IHxlLanguageVisitor.Visit(HxlForEachElement element) { VisitForEach(element); }
protected virtual void VisitForEach(HxlForEachElement element) { DefaultVisit(element); }
public IEnumerable <string> End(HxlForEachElement e) { yield return(EmitVarLoopStatusIncrement(e)); yield return("}"); }