public System.Object VisitForStatement(System.Management.Automation.Language.ForStatementAst forStatementAst) { IScriptExtent mappedExtent = MapExtent(forStatementAst.Extent); PipelineBaseAst mappedInitializer = _VisitPipelineBase(forStatementAst.Initializer); PipelineBaseAst mappedCondition = _VisitPipelineBase(forStatementAst.Condition); PipelineBaseAst mappedIterator = _VisitPipelineBase(forStatementAst.Iterator); StatementBlockAst mappedBody = (StatementBlockAst)VisitStatementBlock(forStatementAst.Body); return(new ForStatementAst(mappedExtent, forStatementAst.Label, mappedInitializer, mappedCondition, mappedIterator, mappedBody)); }
public object VisitForStatement(ForStatementAst forStatementAst) { if (forStatementAst.Initializer != null) { forStatementAst.Initializer.Accept(this); } Action generateCondition = null; if (forStatementAst.Condition != null) { generateCondition = delegate { forStatementAst.Condition.Accept(this); }; } this.GenerateWhileLoop(forStatementAst.Label, generateCondition, delegate { forStatementAst.Body.Accept(this); }, forStatementAst.Iterator); return(null); }
public override AstVisitAction VisitForStatement(ForStatementAst ast) { return CheckParent(ast); }
public object VisitForStatement(ForStatementAst forStatementAst) { return(false); }
public object VisitForStatement(ForStatementAst forStatementAst) { throw PSTraceSource.NewArgumentException("ast"); }
public override AstVisitAction VisitForStatement(ForStatementAst ast) { return(Check(ast)); }
public override AstVisitAction VisitForStatement(ForStatementAst forStatementAst) { /* * The controlling expression for-condition must have type bool or * be implicitly convertible to that type. The loop body, which * consists of statement-block, is executed repeatedly while the * controlling expression tests True. The controlling expression * is evaluated before each execution of the loop body. * * Expression for-initializer is evaluated before the first * evaluation of the controlling expression. Expression * for-initializer is evaluated for its side effects only; any * value it produces is discarded and is not written to the * pipeline. * * Expression for-iterator is evaluated after each execution of * the loop body. Expression for-iterator is evaluated for its * side effects only; any value it produces is discarded and is * not written to the pipeline. * * If expression for-condition is omitted, the controlling * expression tests True. */ EvaluateAst(forStatementAst.Initializer); while ((bool)((PSObject)EvaluateAst(forStatementAst.Condition)).BaseObject) { this._pipelineCommandRuntime.WriteObject(EvaluateAst(forStatementAst.Body), true); EvaluateAst(forStatementAst.Iterator); } return AstVisitAction.SkipChildren; }
public override AstVisitAction VisitForStatement(ForStatementAst forStatementAst) { /* * The controlling expression for-condition must have type bool or * be implicitly convertible to that type. The loop body, which * consists of statement-block, is executed repeatedly while the * controlling expression tests True. The controlling expression * is evaluated before each execution of the loop body. * * Expression for-initializer is evaluated before the first * evaluation of the controlling expression. Expression * for-initializer is evaluated for its side effects only; any * value it produces is discarded and is not written to the * pipeline. * * Expression for-iterator is evaluated after each execution of * the loop body. Expression for-iterator is evaluated for its * side effects only; any value it produces is discarded and is * not written to the pipeline. * * If expression for-condition is omitted, the controlling * expression tests True. */ if (forStatementAst.Initializer != null) { EvaluateAst(forStatementAst.Initializer); } while (forStatementAst.Condition != null ? LanguagePrimitives.ConvertTo<bool>(EvaluateAst(forStatementAst.Condition)) : true) { // TODO: pass loop label if (!EvaluateLoopBodyAst(forStatementAst.Body, null)) { break; } if (forStatementAst.Iterator != null) { EvaluateAst(forStatementAst.Iterator); } } return AstVisitAction.SkipChildren; }
public override AstVisitAction VisitForStatement(ForStatementAst forStatementAst) { this.ReportError(forStatementAst, () => ParserStrings.ForWhileStatementNotSupportedInDataSection, new object[0]); return(AstVisitAction.Continue); }
public object VisitForStatement(ForStatementAst forStatementAst) { throw new UnexpectedElementException(); }
/// <summary/> public virtual AstVisitAction VisitForStatement(ForStatementAst forStatementAst) => DefaultVisit(forStatementAst);
public object VisitForStatement(ForStatementAst forStatementAst) { Expression expression = (forStatementAst.Initializer != null) ? this.CaptureStatementResults(forStatementAst.Initializer, CaptureAstContext.Assignment, null) : null; Func<Expression> generateCondition = null; if (forStatementAst.Condition != null) { generateCondition = () => Expression.Block(this.UpdatePosition(forStatementAst.Condition), this.CaptureStatementResults(forStatementAst.Condition, CaptureAstContext.Condition, null)); } Expression expression2 = this.GenerateWhileLoop(forStatementAst.Label, generateCondition, delegate (List<Expression> loopBody, LabelTarget breakTarget, LabelTarget continueTarget) { loopBody.Add(this.Compile(forStatementAst.Body)); }, forStatementAst.Iterator); if (expression != null) { return Expression.Block(expression, expression2); } return expression2; }
public override AstVisitAction VisitForStatement(ForStatementAst forStatementAst) { return AstVisitAction.SkipChildren; }
/// <summary/> public virtual object VisitForStatement(ForStatementAst forStatementAst) { return null; }
/// <summary> /// Visit for statement /// </summary> /// <param name="forStatementAst"></param> /// <returns></returns> public object VisitForStatement(ForStatementAst forStatementAst) { if (forStatementAst == null) return null; if (forStatementAst.Initializer != null) { forStatementAst.Initializer.Visit(this.Decorator); } var generateCondition = forStatementAst.Condition != null ? () => forStatementAst.Condition.Visit(this.Decorator) : (Action)null; GenerateWhileLoop(forStatementAst.Label, generateCondition, () => forStatementAst.Body.Visit(this.Decorator), forStatementAst.Iterator); return null; }
/// <summary/> public virtual object VisitForStatement(ForStatementAst forStatementAst) { return _decorated.VisitForStatement(forStatementAst); }
public override AstVisitAction VisitForStatement(ForStatementAst ast) { return this.Check(ast); }
public override AstVisitAction VisitForStatement(ForStatementAst forStatementAst) { throw new NotImplementedException(); //VisitForStatement(forStatementAst); }
public object VisitForStatement(ForStatementAst forStatementAst) { return AutomationNull.Value; }
public virtual AstVisitAction VisitForStatement(ForStatementAst forStatementAst) { return AstVisitAction.Continue; }
/// <summary/> public virtual object VisitForStatement(ForStatementAst forStatementAst) { return(null); }
public object VisitForStatement(ForStatementAst forStatementAst) { // We should not preserve the partial output if exception is thrown when evaluating the initializer. var init = (forStatementAst.Initializer != null) ? CaptureStatementResults(forStatementAst.Initializer, CaptureAstContext.AssignmentWithoutResultPreservation) : null; var generateCondition = forStatementAst.Condition != null ? () => Expression.Block(UpdatePosition(forStatementAst.Condition), CaptureStatementResults(forStatementAst.Condition, CaptureAstContext.Condition)) : (Func<Expression>)null; var loop = GenerateWhileLoop(forStatementAst.Label, generateCondition, (loopBody, breakTarget, continueTarget) => loopBody.Add(Compile(forStatementAst.Body)), forStatementAst.Iterator); if (init != null) { return Expression.Block(init, loop); } return loop; }
public object VisitForStatement(ForStatementAst forStatementAst) { return false; }
public override AstVisitAction VisitForStatement(ForStatementAst forStatementAst) { this.ReportError(forStatementAst, () => ParserStrings.ForWhileStatementNotSupportedInDataSection, new object[0]); return AstVisitAction.Continue; }
/// <summary/> public virtual AstVisitAction VisitForStatement(ForStatementAst forStatementAst) { return(AstVisitAction.Continue); }
public object VisitForStatement(ForStatementAst forStatementAst) { if (forStatementAst.Initializer != null) { forStatementAst.Initializer.Accept(this); } Action generateCondition = null; if (forStatementAst.Condition != null) { generateCondition = delegate { forStatementAst.Condition.Accept(this); }; } this.GenerateWhileLoop(forStatementAst.Label, generateCondition, delegate { forStatementAst.Body.Accept(this); }, forStatementAst.Iterator); return null; }
public object VisitForStatement(ForStatementAst forStatementAst) { return(AutomationNull.Value); }
public object VisitForStatement(ForStatementAst forStatementAst) { throw new NotImplementedException(); }