public override void ConstructForGenericStatement(ForGenericStatement node) { this.WriteIndented("for "); for (var i = 0; i < node.Variables.Count; i++) { this.ConstructVariableExpression(node.Variables[i]); if (i < node.Variables.Count - 1) { this.Write(", "); } } this.Write(" in "); for (var i = 0; i < node.Generators.Count; i++) { this.ConstructInternal(node.Generators[i]); if (i < node.Generators.Count - 1) { this.Write(", "); } } this.WriteLine(" do"); this.Indent( ); this.ConstructStatementList(node.Body); this.Outdent( ); this.WriteIndented("end"); if (node.HasSemicolon) { this.Write(";"); } }
protected virtual Object[] AnalyseForGenericStatement(ForGenericStatement node, params Object[] args) { foreach (VariableExpression var in node.Variables) { this.Analyse(var); } foreach (ASTNode gen in node.Generators) { this.Analyse(gen); } this.Analyse(node.Body); return(null); }
protected virtual ASTNode FoldForGenericStatement(ForGenericStatement node, params Object[] args) { node.SetVariables(this.FoldNodeList(node.Variables)); node.SetGenerators(this.FoldNodeList(node.Generators)); if (node.Variables.Count == 0 || node.Generators.Count == 0) { throw new Exception("Cannot have a generic for without variables or generators."); } if (node.Body == null) { throw new Exception("Cannot have a generic for with a null body."); } node.SetBody(this.FoldStatementList(node.Body)); return(node); }
protected override ASTNode FoldForGenericStatement(ForGenericStatement node, params Object[] args) { node.SetBody(( StatementList )this.Fold(node.Body)); return(node); }
public abstract void ConstructForGenericStatement(ForGenericStatement node);