public static While ( Expression test, Expression body, Expression @else ) : LoopExpression | ||
test | Expression | |
body | Expression | |
@else | Expression | |
리턴 | LoopExpression |
private MSAst.Expression ReduceWorker(bool optimizeDynamicConvert) { // Only the body is "in the loop" for the purposes of break/continue // The "else" clause is outside ConstantExpression constTest = _test as ConstantExpression; if (constTest != null && constTest.Value is int) { // while 0: / while 1: int val = (int)constTest.Value; if (val == 0) { // completely optimize the loop away if (_else == null) { return(MSAst.Expression.Empty()); } else { return(_else); } } MSAst.Expression test = MSAst.Expression.Constant(true); MSAst.Expression res = AstUtils.While( test, _body, _else, _break, _continue ); if (GlobalParent.IndexToLocation(_test.StartIndex).Line != GlobalParent.IndexToLocation(_body.StartIndex).Line) { res = GlobalParent.AddDebugInfoAndVoid(res, _test.Span); } return(res); } return(AstUtils.While( GlobalParent.AddDebugInfo( optimizeDynamicConvert ? TransformAndDynamicConvert(_test, typeof(bool)) : GlobalParent.Convert(typeof(bool), Microsoft.Scripting.Actions.ConversionResultKind.ExplicitCast, _test), Header ), _body, _else, _break, _continue )); }