예제 #1
0
        public CompilationUnit Replace(CompilationUnit cu)
        {
            var visitor = new JumpAstVisitor();

            cu.Accept(visitor);
            var jumps = visitor.Jumps.Where(AcceptJump).ToList();
            var newCu = cu.Accept(new JumpReplacer());

            newCu.Accept(new LabelInserter(jumps));
            return((CompilationUnit)newCu);
        }
예제 #2
0
        public CompilationUnit Replace(CompilationUnit cu)
        {
            var visitor = new JumpAstVisitor();

            cu.Accept(visitor);
            var jumps = visitor.Jumps.Where(jump => jump.JumpOffset > jump.StartOffset && !(jump.Condition is BooleanLiteralExpression)).OrderByDescending(jmp => jmp.JumpOffset).ThenByDescending(jmp => jmp.StartOffset).ToList();

            foreach (var jump in jumps)
            {
                cu = new CompilationUnit().AddStatements(ReplaceJump(jump, cu.Statement));
            }
            return(cu);
        }
예제 #3
0
        public CompilationUnit Replace(CompilationUnit cu)
        {
            var visitor = new PushAstVisitor();

            return(cu.Accept(visitor) as CompilationUnit);
        }
예제 #4
0
        public CompilationUnit Replace(CompilationUnit cu)
        {
            var newCu = cu.Accept(visitor);

            return((CompilationUnit)newCu);
        }