private void resolveScope(final ClassNode cNode) { // we need to resolve again! VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(unit); scopeVisitor.visitClass(cNode); }
@Override public void call(SourceUnit source, GeneratorContext context, ClassNode node) throws CompilationFailedException { VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(source); scopeVisitor.visitClass(node); new JavaAwareResolveVisitor(JavaStubCompilationUnit.this).startResolving(node, source); } }, Phases.CONVERSION);
public void call(SourceUnit source, GeneratorContext context, ClassNode node) throws CompilationFailedException { if (!javaSources.isEmpty()) { VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(source); scopeVisitor.visitClass(node); new JavaAwareResolveVisitor(JavaAwareCompilationUnit.this).startResolving(node, source); AnnotationConstantsVisitor acv = new AnnotationConstantsVisitor(); acv.visitClass(node, source); } } }, Phases.CONVERSION);
public void call(SourceUnit source) throws CompilationFailedException { List<ClassNode> classes = source.ast.getClasses(); for (ClassNode node : classes) { VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(source); scopeVisitor.visitClass(node); resolveVisitor.setClassNodeResolver(classNodeResolver); resolveVisitor.startResolving(node, source); } } };
@Override public void call(final SourceUnit source, final GeneratorContext context, final ClassNode classNode) throws CompilationFailedException { if (classNode.isScriptBody()) { classNode.setSuperClass(ClassHelper.make(config.getBaseTemplateClass())); createConstructor(classNode); transformRunMethod(classNode, source); VariableScopeVisitor visitor = new VariableScopeVisitor(source); visitor.visitClass(classNode); } }
new VariableScopeVisitor(source, true).visitClass(parent);
VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(sourceUnit); scopeVisitor.visitClass(cNode);
new VariableScopeVisitor(sourceUnit, true).visitClass(classNode);
private void createSortable(AnnotationNode anno, ClassNode classNode) { List<String> includes = getMemberStringList(anno, "includes"); List<String> excludes = getMemberStringList(anno, "excludes"); boolean reversed = memberHasValue(anno, "reversed", true); boolean includeSuperProperties = memberHasValue(anno, "includeSuperProperties", true); boolean allNames = memberHasValue(anno, "allNames", true); boolean allProperties = !memberHasValue(anno, "allProperties", false); if (!checkIncludeExcludeUndefinedAware(anno, excludes, includes, MY_TYPE_NAME)) return; if (!checkPropertyList(classNode, includes, "includes", anno, MY_TYPE_NAME, false, includeSuperProperties, allProperties)) return; if (!checkPropertyList(classNode, excludes, "excludes", anno, MY_TYPE_NAME, false, includeSuperProperties, allProperties)) return; if (classNode.isInterface()) { addError(MY_TYPE_NAME + " cannot be applied to interface " + classNode.getName(), anno); } List<PropertyNode> properties = findProperties(anno, classNode, includes, excludes, allProperties, includeSuperProperties, allNames); implementComparable(classNode); addGeneratedMethod(classNode, "compareTo", ACC_PUBLIC, ClassHelper.int_TYPE, params(param(newClass(classNode), OTHER)), ClassNode.EMPTY_ARRAY, createCompareToMethodBody(properties, reversed) ); for (PropertyNode property : properties) { createComparatorFor(classNode, property, reversed); } new VariableScopeVisitor(sourceUnit, true).visitClass(classNode); }
VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(source); scopeVisitor.visitClass(cNode);
newCode.addStatement(returnS(closureCallExpression)); methodNode.setCode(newCode); VariableScopeVisitor visitor = new VariableScopeVisitor(source, ownerClassNode instanceof InnerClassNode); if (ownerClassNode instanceof InnerClassNode) { visitor.visitClass(((InnerClassNode) ownerClassNode).getOuterMostClass());
private void createCloneSerialization(ClassNode cNode) { final BlockStatement body = new BlockStatement(); // def baos = new ByteArrayOutputStream() final Expression baos = varX("baos"); body.addStatement(declS(baos, ctorX(BAOS_TYPE))); // baos.withObjectOutputStream{ it.writeObject(this) } MethodCallExpression writeObject = callX(castX(OOS_TYPE, varX("it")), "writeObject", varX("this")); writeObject.setImplicitThis(false); ClosureExpression writeClos = closureX(block(stmt(writeObject))); writeClos.setVariableScope(new VariableScope()); body.addStatement(stmt(callX(baos, "withObjectOutputStream", args(writeClos)))); // def bais = new ByteArrayInputStream(baos.toByteArray()) final Expression bais = varX("bais"); body.addStatement(declS(bais, ctorX(BAIS_TYPE, args(callX(baos, "toByteArray"))))); // return bais.withObjectInputStream(getClass().classLoader){ (<type>) it.readObject() } MethodCallExpression readObject = callX(castX(OIS_TYPE, varX("it")), "readObject"); readObject.setImplicitThis(false); 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)}; addGeneratedMethod(cNode, "clone", ACC_PUBLIC, GenericsUtils.nonGeneric(cNode), Parameter.EMPTY_ARRAY, exceptions, body); }
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);
public void call(SourceUnit source) throws CompilationFailedException { List classes = source.ast.getClasses(); for (Iterator it = classes.iterator(); it.hasNext();) { ClassNode node = (ClassNode) it.next(); VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(source); scopeVisitor.visitClass(node); resolveVisitor.startResolving(node, source); GenericsVisitor genericsVisitor = new GenericsVisitor(source); genericsVisitor.visitClass(node); } } };
public void call(SourceUnit source) throws CompilationFailedException { List classes = source.ast.getClasses(); for (Iterator it = classes.iterator(); it.hasNext();) { ClassNode node = (ClassNode) it.next(); VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(source); scopeVisitor.visitClass(node); resolveVisitor.startResolving(node, source); GenericsVisitor genericsVisitor = new GenericsVisitor(source); genericsVisitor.visitClass(node); } } };
public void call(final SourceUnit source, final GeneratorContext context, final ClassNode node) throws CompilationFailedException { new VariableScopeVisitor(source).visitClass(node); new JavaAwareResolveVisitor(JavaStubCompilationUnit.this).startResolving(node, source); } },Phases.CONVERSION);
@Override public void call(SourceUnit source, GeneratorContext context, ClassNode node) throws CompilationFailedException { VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(source); scopeVisitor.visitClass(node); new JavaAwareResolveVisitor(JavaStubCompilationUnit.this).startResolving(node,source); } },Phases.CONVERSION);
public void call(final SourceUnit source, final GeneratorContext context, final ClassNode node) throws CompilationFailedException { new VariableScopeVisitor(source).visitClass(node); new JavaAwareResolveVisitor(JavaStubCompilationUnit.this).startResolving(node, source); } },Phases.CONVERSION);
public void call(SourceUnit source) throws CompilationFailedException { List<ClassNode> classes = source.ast.getClasses(); for (ClassNode node : classes) { VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(source); scopeVisitor.visitClass(node); resolveVisitor.setClassNodeResolver(classNodeResolver); resolveVisitor.startResolving(node, source); } } };
@Override public void call(final SourceUnit source, final GeneratorContext context, final ClassNode classNode) throws CompilationFailedException { if (classNode.isScriptBody()) { classNode.setSuperClass(ClassHelper.make(config.getBaseTemplateClass())); createConstructor(classNode); transformRunMethod(classNode, source); VariableScopeVisitor visitor = new VariableScopeVisitor(source); visitor.visitClass(classNode); } }