Наследование: AstRecursiveVisitor
        // Only have if, switch, cil, continuation, try - no other type of statement
        // Blocks will only start with cil or try
        // Will end with null, if, switch or continuation
        // If ending in 'if', 'then' and 'else' will both have continuations only
        // 'try' statements will have only 0 or 1 catch clauses

        public static ICode V(ICode ast) {
            var v = new VisitorConvertCilToSsa(ast);
            ast = v.Visit(ast);
            foreach (var instResult in v.instResults.Values) {
                var var = new ExprVarLocal(ast.Ctx, instResult.Type);
                ast = VisitorReplace.V(ast, instResult, var);
            }
            return ast;
        }
Пример #2
0
        // Only have if, switch, cil, continuation, try - no other type of statement
        // Blocks will only start with cil or try
        // Will end with null, if, switch or continuation
        // If ending in 'if', 'then' and 'else' will both have continuations only
        // 'try' statements will have only 0 or 1 catch clauses

        public static ICode V(ICode ast)
        {
            var v = new VisitorConvertCilToSsa(ast);

            ast = v.Visit(ast);
            foreach (var instResult in v.instResults.Values)
            {
                var var = new ExprVarLocal(ast.Ctx, instResult.Type);
                ast = VisitorReplace.V(ast, instResult, var);
            }
            return(ast);
        }