示例#1
0
        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));
        }
示例#3
0
 void IHxlLanguageVisitor.Visit(HxlForEachElement element)
 {
     VisitForEach(element);
 }
示例#4
0
 protected virtual void VisitForEach(HxlForEachElement element)
 {
     DefaultVisit(element);
 }
        public IEnumerable <string> End(HxlForEachElement e)
        {
            yield return(EmitVarLoopStatusIncrement(e));

            yield return("}");
        }