Package org.codehaus.groovy.classgen

Examples of org.codehaus.groovy.classgen.VariableScopeVisitor


        keepStubs = Boolean.TRUE.equals(options.get("keepStubs"));
       
        addPhaseOperation(new PrimaryClassNodeOperation() {
            public void call(SourceUnit source, GeneratorContext context, ClassNode node) throws CompilationFailedException {
                if (javaSources.size() != 0) {
                  VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(source);
                  scopeVisitor.visitClass(node);
                  new JavaAwareResolveVisitor(JavaAwareCompilationUnit.this).startResolving(node,source);
                }
            }
        },Phases.CONVERSION);
View Full Code Here


        keepStubs = Boolean.TRUE.equals(options.get("keepStubs"));
       
        addPhaseOperation(new PrimaryClassNodeOperation() {
            public void call(SourceUnit source, GeneratorContext context, ClassNode node) throws CompilationFailedException {
                if (javaSources.size() != 0) {
                  VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(source);
                  scopeVisitor.visitClass(node);
                  new JavaAwareResolveVisitor(JavaAwareCompilationUnit.this).startResolving(node,source);
                }
            }
        },Phases.CONVERSION);
View Full Code Here

    public static void processVariableScopes(SourceUnit source, ClassNode classNode) {
        processVariableScopes(source, classNode, null);
    }
   
    public static void processVariableScopes(SourceUnit source, ClassNode classNode, MethodNode methodNode) {
        VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(source);
        if(methodNode == null) {
            scopeVisitor.visitClass(classNode);
        } else {
            scopeVisitor.prepareVisit(classNode);
            scopeVisitor.visitMethod(methodNode);
        }
    }
View Full Code Here

        }
    }

    private void resolveScope(final ClassNode cNode) {
        // we need to resolve again!
        VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(unit);
        scopeVisitor.visitClass(cNode);
    }
View Full Code Here

        ClosureExpression readClos = closureX(block(stmt(castX(GenericsUtils.nonGeneric(cNode), readObject))));
        readClos.setVariableScope(new VariableScope());
        Expression classLoader = callX(callThisX("getClass"), "getClassLoader");
        body.addStatement(returnS(callX(bais, "withObjectInputStream", args(classLoader, readClos))));

        new VariableScopeVisitor(sourceUnit, true).visitClass(cNode);
        ClassNode[] exceptions = {make(CloneNotSupportedException.class)};
        cNode.addMethod("clone", ACC_PUBLIC, GenericsUtils.nonGeneric(cNode), Parameter.EMPTY_ARRAY, exceptions, body);
    }
View Full Code Here

        };
        transformer.visitClass(classNode);

        // GROOVY-6373: references to 'log' field are normally already FieldNodes by now, so revisit scoping
        new VariableScopeVisitor(sourceUnit, true).visitClass(classNode);
    }
View Full Code Here

                method.setParameters(newParams);

                expressionTransformer.visitMethod(method);
            }
        }
        new VariableScopeVisitor(source, true).visitClass(parent);
    }
View Full Code Here

            super.visitClass(cNode);
            // GROOVY-5207 So that Closures can see newly added fields
            // (not super efficient for a very large class with many @Fields but we chose simplicity
            // and understandability of this solution over more complex but efficient alternatives)
            VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(source);
            scopeVisitor.visitClass(cNode);
        }
    }
View Full Code Here

            MethodCallExpression closureCallExpression = callX(
                    fieldX(memoizedClosureField), CLOSURE_CALL_METHOD_NAME, args(methodNode.getParameters()));
            closureCallExpression.setImplicitThis(false);
            newCode.addStatement(returnS(closureCallExpression));
            methodNode.setCode(newCode);
            VariableScopeVisitor visitor = new VariableScopeVisitor(source);
            visitor.visitClass(ownerClassNode);
        }
    }
View Full Code Here

        ));

        for (PropertyNode property : properties) {
            createComparatorFor(classNode, property);
        }
        new VariableScopeVisitor(sourceUnit, true).visitClass(classNode);
    }
View Full Code Here

TOP

Related Classes of org.codehaus.groovy.classgen.VariableScopeVisitor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.