static AstNode RemoveUnreachableCode(AstDo doStatement)
    {
        if (TypeConverter.ToBoolean(doStatement.Condition.ConstValue() ?? AstTrue.Instance))
        {
            return(doStatement);
        }

        LoopControlFinderTreeWalker.Walk(doStatement);

        if (doStatement.HasBreak || doStatement.HasContinue)
        {
            return
                (doStatement); // if do-while contains break or continue we cannot inline it without more sophisticated inspection
        }
        switch (doStatement.Body)
        {
        case null:     // Body should not be null at all
            return(Remove);

        default:
            return(doStatement.Body);
        }
    }
Пример #2
0
 private void CompileDo(AstDo node, Syt syt, StringBuilder sb)
 {
     CompileRecursive(node.exprCall, syt, sb);
     sb.AppendLine("pop temp 0");
 }