/// <include file='Doc/Nodes.xml' path='doc/method[@name="Statement.Analyze"]/*'/> internal override Statement/*!*/ Analyze(Analyzer/*!*/ analyzer) { if (analyzer.IsThisCodeUnreachable()) { analyzer.ReportUnreachableCode(position); return EmptyStmt.Unreachable; } //next version: array.SetSeqPoint(); enumeree.Analyze(analyzer, ExInfoFromParent.DefaultExInfo); if (keyVariable != null) keyVariable.Analyze(analyzer); valueVariable.Analyze(analyzer); analyzer.EnterLoopBody(); body = body.Analyze(analyzer); analyzer.LeaveLoopBody(); return this; }
/// <include file='Doc/Nodes.xml' path='doc/method[@name="Statement.Analyze"]/*'/> internal override Statement/*!*/ Analyze(Analyzer/*!*/ analyzer) { if (analyzer.IsThisCodeUnreachable()) { analyzer.ReportUnreachableCode(position); return EmptyStmt.Unreachable; } Evaluation cond_eval = condExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo); if (cond_eval.HasValue) { if (Convert.ObjectToBoolean(cond_eval.Value)) { // unbounded loop: condExpr = null; } else { // unreachable body: if (type == Type.While) { body.ReportUnreachable(analyzer); return EmptyStmt.Unreachable; } } } condExpr = cond_eval.Literalize(); analyzer.EnterLoopBody(); body = body.Analyze(analyzer); analyzer.LeaveLoopBody(); return this; }
/// <include file='Doc/Nodes.xml' path='doc/method[@name="Statement.Analyze"]/*'/> internal override Statement Analyze(Analyzer analyzer) { if (analyzer.IsThisCodeUnreachable()) { analyzer.ReportUnreachableCode(position); return EmptyStmt.Unreachable; } ExInfoFromParent info = new ExInfoFromParent(this); info.Access = AccessType.None; for (int i = 0; i < initExList.Count; i++) { initExList[i] = initExList[i].Analyze(analyzer, info).Literalize(); } if (condExList.Count > 0) { // all but the last expression is evaluated and the result is ignored (AccessType.None), // the last is read: for (int i = 0; i < condExList.Count - 1; i++) { condExList[i] = condExList[i].Analyze(analyzer, info).Literalize(); } condExList[condExList.Count - 1] = condExList[condExList.Count - 1].Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize(); } for (int i = 0; i < actionExList.Count; i++) { actionExList[i] = actionExList[i].Analyze(analyzer, info).Literalize(); } analyzer.EnterLoopBody(); body = body.Analyze(analyzer); analyzer.LeaveLoopBody(); return this; }