org.codehaus.groovy.ast.expr.MethodCallExpression Java Examples
The following examples show how to use
org.codehaus.groovy.ast.expr.MethodCallExpression.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TraitReceiverTransformer.java From groovy with Apache License 2.0 | 6 votes |
private Expression transformMethodCallOnThis(final MethodCallExpression call) { Expression method = call.getMethod(); Expression arguments = call.getArguments(); if (method instanceof ConstantExpression) { String methodName = method.getText(); List<MethodNode> methods = traitClass.getMethods(methodName); for (MethodNode methodNode : methods) { if (methodName.equals(methodNode.getName()) && methodNode.isPrivate()) { if (inClosure) { return transformPrivateMethodCallOnThisInClosure(call, arguments, methodName); } return transformPrivateMethodCallOnThis(call, arguments, methodName); } } } if (inClosure) { return transformMethodCallOnThisInClosure(call); } return transformMethodCallOnThisFallBack(call, method, arguments); }
Example #2
Source File: GroovyASTUtils.java From groovy-language-server with Apache License 2.0 | 6 votes |
public static List<MethodNode> getMethodOverloadsFromCallExpression(MethodCall node, ASTNodeVisitor astVisitor) { if (node instanceof MethodCallExpression) { MethodCallExpression methodCallExpr = (MethodCallExpression) node; ClassNode leftType = getTypeOfNode(methodCallExpr.getObjectExpression(), astVisitor); if (leftType != null) { return leftType.getMethods(methodCallExpr.getMethod().getText()); } } else if (node instanceof ConstructorCallExpression) { ConstructorCallExpression constructorCallExpr = (ConstructorCallExpression) node; ClassNode constructorType = constructorCallExpr.getType(); if (constructorType != null) { return constructorType.getDeclaredConstructors().stream().map(constructor -> (MethodNode) constructor) .collect(Collectors.toList()); } } return Collections.emptyList(); }
Example #3
Source File: FindMethodUtils.java From netbeans with Apache License 2.0 | 6 votes |
private static MethodNode findMostAccurateMethod(MethodCallExpression methodCall, List<MethodNode> methods) { final List<MethodNode> possibleMethods = new ArrayList<MethodNode>(); for (MethodNode methodNode : methods) { if (Methods.isSameMethod(methodNode, methodCall)) { possibleMethods.add(methodNode); } } if (possibleMethods.size() > 0) { // In the future we should distinguish between 'size == 1' and 'size > 1' // If the size is more than 1, it means we are dealing with more methods // with the same name and the same number of parameters. In that case we // should either try to interfere parameter types or show some user dialog // with selection box and let the user to choose what he want to find return possibleMethods.get(0); } return null; }
Example #4
Source File: AstBuilderTransformation.java From groovy with Apache License 2.0 | 6 votes |
@Override protected boolean handleTargetMethodCallExpression(MethodCallExpression call) { ClosureExpression closureExpression = getClosureArgument(call); List<Expression> otherArgs = getNonClosureArguments(call); String source = convertClosureToSource(closureExpression); // parameter order is build(CompilePhase, boolean, String) otherArgs.add(new ConstantExpression(source)); call.setArguments(new ArgumentListExpression(otherArgs)); call.setMethod(new ConstantExpression("buildFromBlock")); call.setSpreadSafe(false); call.setSafe(false); call.setImplicitThis(false); return false; }
Example #5
Source File: GroovyGradleParser.java From size-analyzer with Apache License 2.0 | 6 votes |
@Override public void visitTupleExpression(TupleExpression tupleExpression) { if (!methodCallStack.isEmpty()) { MethodCallExpression call = Iterables.getLast(methodCallStack); if (call.getArguments() == tupleExpression) { String parent = call.getMethodAsString(); String parentParent = getParentParent(); if (!(tupleExpression instanceof ArgumentListExpression)) { Map<String, String> namedArguments = new HashMap<>(); for (Expression subExpr : tupleExpression.getExpressions()) { if (subExpr instanceof NamedArgumentListExpression) { NamedArgumentListExpression nale = (NamedArgumentListExpression) subExpr; for (MapEntryExpression mae : nale.getMapEntryExpressions()) { namedArguments.put( mae.getKeyExpression().getText(), mae.getValueExpression().getText()); } } } checkMethodCall(parent, parentParent, namedArguments); } } } super.visitTupleExpression(tupleExpression); }
Example #6
Source File: GeneralUtils.java From groovy with Apache License 2.0 | 6 votes |
public static boolean copyStatementsWithSuperAdjustment(final ClosureExpression pre, final BlockStatement body) { Statement preCode = pre.getCode(); boolean changed = false; if (preCode instanceof BlockStatement) { BlockStatement block = (BlockStatement) preCode; List<Statement> statements = block.getStatements(); for (int i = 0, n = statements.size(); i < n; i += 1) { Statement statement = statements.get(i); // adjust the first statement if it's a super call if (i == 0 && statement instanceof ExpressionStatement) { ExpressionStatement es = (ExpressionStatement) statement; Expression preExp = es.getExpression(); if (preExp instanceof MethodCallExpression) { MethodCallExpression mce = (MethodCallExpression) preExp; String name = mce.getMethodAsString(); if ("super".equals(name)) { es.setExpression(new ConstructorCallExpression(ClassNode.SUPER, mce.getArguments())); changed = true; } } } body.addStatement(statement); } } return changed; }
Example #7
Source File: StaticTypesBinaryExpressionMultiTypeDispatcher.java From groovy with Apache License 2.0 | 6 votes |
@Override protected void writePostOrPrefixMethod(final int op, final String method, final Expression expression, final Expression orig) { MethodNode mn = orig.getNodeMetaData(DIRECT_METHOD_CALL_TARGET); if (mn != null) { controller.getOperandStack().pop(); MethodCallExpression call = callX(expression, method); call.setMethodTarget(mn); call.visit(controller.getAcg()); return; } ClassNode top = controller.getOperandStack().getTopOperand(); if (ClassHelper.isPrimitiveType(top) && (ClassHelper.isNumberType(top) || char_TYPE.equals(top))) { MethodVisitor mv = controller.getMethodVisitor(); visitInsnByType(top, mv, ICONST_1, LCONST_1, FCONST_1, DCONST_1); if ("next".equals(method)) { visitInsnByType(top, mv, IADD, LADD, FADD, DADD); } else { visitInsnByType(top, mv, ISUB, LSUB, FSUB, DSUB); } return; } super.writePostOrPrefixMethod(op, method, expression, orig); }
Example #8
Source File: AutoNewLineTransformer.java From groovy with Apache License 2.0 | 6 votes |
@Override public void visitMethodCallExpression(final MethodCallExpression call) { boolean old = inBuilderMethod; inBuilderMethod = false; if (call.isImplicitThis() && call.getArguments() instanceof TupleExpression) { List<Expression> expressions = ((TupleExpression) call.getArguments()).getExpressions(); if (!expressions.isEmpty()) { Expression lastArg = expressions.get(expressions.size() - 1); if (lastArg instanceof ClosureExpression) { call.getObjectExpression().visit(this); call.getMethod().visit(this); for (Expression expression : expressions) { inBuilderMethod = (expression == lastArg); expression.visit(this); } } } } else { super.visitMethodCallExpression(call); } inBuilderMethod = old; }
Example #9
Source File: FindMethodUsagesVisitor.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void visitMethodCallExpression(MethodCallExpression methodCall) { Expression expression = methodCall.getObjectExpression(); if (expression instanceof VariableExpression) { VariableExpression variableExpression = ((VariableExpression) expression); Variable variable = variableExpression.getAccessedVariable(); if (variable != null) { if (variable.isDynamicTyped()) { addDynamicVarUsages(methodCall, variable); } else { addStaticVarUsages(methodCall, variable); } } else { addThisUsages(methodCall); } } else if (expression instanceof ConstructorCallExpression) { addConstructorUsages(methodCall, (ConstructorCallExpression) expression); } super.visitMethodCallExpression(methodCall); }
Example #10
Source File: MethodCallExpressionTransformer.java From groovy with Apache License 2.0 | 6 votes |
private static MethodCallExpression transformToMopSuperCall(final ClassNode superCallReceiver, final MethodCallExpression expr) { MethodNode mn = expr.getNodeMetaData(StaticTypesMarker.DIRECT_METHOD_CALL_TARGET); String mopName = MopWriter.getMopMethodName(mn, false); MethodNode direct = new MethodNode( mopName, ACC_PUBLIC | ACC_SYNTHETIC, mn.getReturnType(), mn.getParameters(), mn.getExceptions(), EmptyStatement.INSTANCE ); direct.setDeclaringClass(superCallReceiver); MethodCallExpression result = new MethodCallExpression( new VariableExpression("this"), mopName, expr.getArguments() ); result.setImplicitThis(true); result.setSpreadSafe(false); result.setSafe(false); result.setSourcePosition(expr); result.setMethodTarget(direct); return result; }
Example #11
Source File: TypeInferenceVisitor.java From netbeans with Apache License 2.0 | 6 votes |
public void visitField(FieldNode node) { if (sameVariableName(leaf, node)) { if (node.hasInitialExpression()){ Expression expression = node.getInitialExpression(); if (expression instanceof ConstantExpression && !expression.getText().equals("null")) { // NOI18N guessedType = ((ConstantExpression) expression).getType(); } else if (expression instanceof ConstructorCallExpression) { guessedType = ((ConstructorCallExpression) expression).getType(); } else if (expression instanceof MethodCallExpression) { int newOffset = ASTUtils.getOffset(doc, expression.getLineNumber(), expression.getColumnNumber()); AstPath newPath = new AstPath(path.root(), newOffset, doc); guessedType = MethodInference.findCallerType(expression, newPath, doc, newOffset); } } } }
Example #12
Source File: AndroidGradleDependenciesVisitor.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
@Override public void visitMethodCallExpression(MethodCallExpression call) { if (call.getMethodAsString().equals("buildscript")) { buildScript = true; //exlude } else if (call.getMethodAsString().equals("dependencies") && !buildScript) { //find dependencies lines dependenceStartLineNum = call.getLineNumber(); dependenceEndLineNum = call.getLastLineNumber(); dependencies = new AndroidGradleDependencies(call.getLineNumber(), call.getColumnNumber(), call.getLastLineNumber(), call.getLastColumnNumber()); } else if (call.getLineNumber() > dependenceStartLineNum && call.getLineNumber() < dependenceEndLineNum && call.getLineNumber() > currentBlockEnd) { //find dependency block currentBlockEnd = call.getLastLineNumber(); currentBlockStart = call.getLineNumber(); currentBlockStartColumn = call.getColumnNumber(); currentBlockEndColumn = call.getLastColumnNumber(); currentDependency = null; androidDependency = null; } super.visitMethodCallExpression(call); }
Example #13
Source File: GroovyTypeAnalyzer.java From netbeans with Apache License 2.0 | 6 votes |
public Set<ClassNode> getTypes(AstPath path, int astOffset) { ASTNode caller = path.leaf(); if (caller instanceof VariableExpression) { ModuleNode moduleNode = (ModuleNode) path.root(); TypeInferenceVisitor typeVisitor = new TypeInferenceVisitor(moduleNode.getContext(), path, document, astOffset); typeVisitor.collect(); ClassNode guessedType = typeVisitor.getGuessedType(); if (guessedType != null) { return Collections.singleton(guessedType); } } if (caller instanceof MethodCallExpression) { return Collections.singleton(MethodInference.findCallerType(caller, path, document, astOffset)); } return Collections.emptySet(); }
Example #14
Source File: StaticTypesCallSiteWriter.java From groovy with Apache License 2.0 | 5 votes |
private void makeDynamicGetProperty(final Expression receiver, final String propertyName, final boolean safe) { MethodNode target = safe ? INVOKERHELPER_GETPROPERTYSAFE_METHOD : INVOKERHELPER_GETPROPERTY_METHOD; MethodCallExpression call = callX( classX(INVOKERHELPER_TYPE), target.getName(), args(receiver, constX(propertyName)) ); call.setImplicitThis(false); call.setMethodTarget(target); call.setSafe(false); call.visit(controller.getAcg()); }
Example #15
Source File: ExternalizeMethodsASTTransformation.java From groovy with Apache License 2.0 | 5 votes |
private static void createWriteExternal(ClassNode cNode, List<String> excludes, List<FieldNode> list) { final BlockStatement body = new BlockStatement(); Parameter out = param(OBJECTOUTPUT_TYPE, "out"); for (FieldNode fNode : list) { if (excludes != null && excludes.contains(fNode.getName())) continue; if ((fNode.getModifiers() & ACC_TRANSIENT) != 0) continue; MethodCallExpression writeObject = callX(varX(out), "write" + suffixForField(fNode), varX(fNode)); writeObject.setImplicitThis(false); body.addStatement(stmt(writeObject)); } ClassNode[] exceptions = {make(IOException.class)}; addGeneratedMethod(cNode, "writeExternal", ACC_PUBLIC, ClassHelper.VOID_TYPE, params(out), exceptions, body); }
Example #16
Source File: TraitReceiverTransformer.java From groovy with Apache License 2.0 | 5 votes |
private Expression transformMethodCallOnThisFallBack(final MethodCallExpression call, final Expression method, final Expression arguments) { MethodCallExpression transformed = new MethodCallExpression( weaved, method, transform(arguments) ); transformed.setSourcePosition(call); transformed.setSafe(call.isSafe()); transformed.setSpreadSafe(call.isSpreadSafe()); transformed.setImplicitThis(false); return transformed; }
Example #17
Source File: BinaryExpressionHelper.java From groovy with Apache License 2.0 | 5 votes |
protected void evaluateArrayAssignmentWithOperator(final String method, final BinaryExpression expression, final BinaryExpression leftBinExpr) { // e.g. x[a] += b // to avoid loading x and a twice we transform the expression to use // ExpressionAsVariableSlot // -> subscript=a, receiver=x, receiver[subscript]+b, =, receiver[subscript] // -> subscript=a, receiver=x, receiver#getAt(subscript)#plus(b), =, receiver#putAt(subscript) // -> subscript=a, receiver=x, receiver#putAt(subscript, receiver#getAt(subscript)#plus(b)) // the result of x[a] += b is x[a]+b, thus: // -> subscript=a, receiver=x, receiver#putAt(subscript, ret=receiver#getAt(subscript)#plus(b)), ret ExpressionAsVariableSlot subscript = new ExpressionAsVariableSlot(controller, leftBinExpr.getRightExpression(), "subscript"); ExpressionAsVariableSlot receiver = new ExpressionAsVariableSlot(controller, leftBinExpr.getLeftExpression(), "receiver"); MethodCallExpression getAt = callX(receiver, "getAt", args(subscript)); MethodCallExpression operation = callX(getAt, method, expression.getRightExpression()); ExpressionAsVariableSlot ret = new ExpressionAsVariableSlot(controller, operation, "ret"); MethodCallExpression putAt = callX(receiver, "putAt", args(subscript, ret)); AsmClassGenerator acg = controller.getAcg(); putAt.visit(acg); OperandStack os = controller.getOperandStack(); os.pop(); os.load(ret.getType(), ret.getIndex()); CompileStack compileStack = controller.getCompileStack(); compileStack.removeVar(ret.getIndex()); compileStack.removeVar(subscript.getIndex()); compileStack.removeVar(receiver.getIndex()); }
Example #18
Source File: ModelBlockTransformer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void call(SourceUnit source) throws CompilationFailedException { if (!isEnabled()) { return; } List<Statement> statements = source.getAST().getStatementBlock().getStatements(); for (Statement statement : statements) { ScriptBlock scriptBlock = AstUtils.detectScriptBlock(statement, SCRIPT_BLOCK_NAMES); if (scriptBlock == null) { // Look for model(«») (i.e. call to model with anything other than non literal closure) MethodCallExpression methodCall = AstUtils.extractBareMethodCall(statement); if (methodCall == null) { continue; } String methodName = AstUtils.extractConstantMethodName(methodCall); if (methodName == null) { continue; } if (methodName.equals(MODEL)) { source.getErrorCollector().addError( new SyntaxException(NON_LITERAL_CLOSURE_TO_TOP_LEVEL_MODEL_MESSAGE, statement.getLineNumber(), statement.getColumnNumber()), source ); } } else { RuleVisitor ruleVisitor = new RuleVisitor(source); RulesVisitor rulesVisitor = new RulesVisitor(source, ruleVisitor); scriptBlock.getClosureExpression().getCode().visit(rulesVisitor); } } }
Example #19
Source File: MethodSignatureBuilder.java From netbeans with Apache License 2.0 | 5 votes |
public MethodSignatureBuilder appendReturnType(MethodCallExpression methodCall) { builder.append(" : "); // NOI18N final MethodNode methodTarget = methodCall.getMethodTarget(); if (methodTarget != null && methodTarget.getReturnType() != null) { builder.append(methodTarget.getReturnType().getNameWithoutPackage()); } else { // We don't know exact return type - just show an Object for now builder.append("Object"); // NOI18N } return this; }
Example #20
Source File: MacroClassTransformation.java From groovy with Apache License 2.0 | 5 votes |
@Override public void visitConstructorCallExpression(final ConstructorCallExpression call) { ClassNode type = call.getType(); if (type instanceof InnerClassNode) { if (((InnerClassNode) type).isAnonymous() && MACROCLASS_TYPE.getNameWithoutPackage().equals(type.getSuperClass().getNameWithoutPackage())) { try { String source = convertInnerClassToSource(type); MethodCallExpression macroCall = callX( propX(classX(ClassHelper.makeWithoutCaching(MacroBuilder.class, false)), "INSTANCE"), MACRO_METHOD, args( constX(source), MacroGroovyMethods.buildSubstitutions(sourceUnit, type), classX(ClassHelper.make(ClassNode.class)) ) ); macroCall.setSpreadSafe(false); macroCall.setSafe(false); macroCall.setImplicitThis(false); call.putNodeMetaData(MacroTransformation.class, macroCall); List<ClassNode> classes = sourceUnit.getAST().getClasses(); for (Iterator<ClassNode> iterator = classes.iterator(); iterator.hasNext(); ) { final ClassNode aClass = iterator.next(); if (aClass == type || type == aClass.getOuterClass()) { iterator.remove(); } } } catch (Exception e) { // FIXME e.printStackTrace(); } return; } } super.visitConstructorCallExpression(call); }
Example #21
Source File: GroovyClassFilterTransformer.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected Expression unwrapTransformedArguments(Expression transformedArgs, Expression originalArgs) { if (!(transformedArgs instanceof MethodCallExpression)) { return null; } MethodCallExpression transformedArgsCall = (MethodCallExpression) transformedArgs; Expression transformedObject = transformedArgsCall.getObjectExpression(); Expression transformedMethod = transformedArgsCall.getMethod(); if (!(transformedObject instanceof ListExpression) || !(transformedMethod instanceof ConstantExpression) || !("toArray".equals(transformedMethod.getText()))) { return null; } List<Expression> transformedExpressions = ((ListExpression) transformedObject).getExpressions(); if (originalArgs instanceof ArgumentListExpression) { List<Expression> originalExpressions = ((ArgumentListExpression) originalArgs).getExpressions(); if (transformedExpressions.equals(originalExpressions)) { return originalArgs; } return new ArgumentListExpression(transformedExpressions); } return null; }
Example #22
Source File: StaticCompilationVisitor.java From groovy with Apache License 2.0 | 5 votes |
@Override public void visitMethodCallExpression(final MethodCallExpression call) { super.visitMethodCallExpression(call); MethodNode target = call.getNodeMetaData(DIRECT_METHOD_CALL_TARGET); if (target != null) { call.setMethodTarget(target); memorizeInitialExpressions(target); } if (call.getMethodTarget() == null && call.getLineNumber() > 0) { addError("Target method for method call expression hasn't been set", call); } }
Example #23
Source File: FindAndroidVisitor.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
@Override public void visitMethodCallExpression(MethodCallExpression call) { if (!"buildscript".equals(call.getMethodAsString())) { if ("android".equals(call.getMethodAsString())) { androidProject = true; } } super.visitMethodCallExpression(call); }
Example #24
Source File: FindMethodUsagesVisitor.java From netbeans with Apache License 2.0 | 5 votes |
/** * Tries to find exact MethodNode in the given ClassNode. The MethodNode is * based on MethodCallExpresion. If there is an exact match, the methodCall * is added into the usages list. * * @param type * @param methodCall */ private void findAndAdd(ClassNode type, MethodCallExpression methodCall) { if (method == null || methodCall == null) { return; } if (methodName.equals(methodCall.getMethodAsString()) && Methods.hasSameParameters(method, methodCall)) { usages.add(methodCall.getMethod()); } }
Example #25
Source File: StaticTypesBinaryExpressionMultiTypeDispatcher.java From groovy with Apache License 2.0 | 5 votes |
@Override protected void assignToArray(final Expression parent, final Expression receiver, final Expression index, final Expression rhsValueLoader, final boolean safe) { ClassNode arrayType = controller.getTypeChooser().resolveType(receiver, controller.getClassNode()); int operationType = getOperandType(arrayType.getComponentType()); BinaryExpressionWriter bew = binExpWriter[operationType]; if (bew.arraySet(true) && arrayType.isArray() && !safe) { super.assignToArray(parent, receiver, index, rhsValueLoader, safe); } else { /* * This code path is needed because ACG creates array access expressions */ StaticTypeCheckingVisitor visitor = new StaticCompilationVisitor(controller.getSourceUnit(), controller.getClassNode()); // GROOVY-6061 if (rhsValueLoader instanceof VariableSlotLoader && parent instanceof BinaryExpression) { rhsValueLoader.putNodeMetaData(INFERRED_TYPE, controller.getTypeChooser().resolveType(parent, controller.getClassNode())); } // let's replace this assignment to a subscript operator with a method call // e.g. x[5] = 10 // -> (x, [], 5), =, 10 // -> methodCall(x, "putAt", [5, 10]) MethodCallExpression call = callX(receiver, "putAt", args(index, rhsValueLoader)); call.setSafe(safe); call.setSourcePosition(parent); visitor.visitMethodCallExpression(call); OperandStack operandStack = controller.getOperandStack(); int height = operandStack.getStackLength(); call.visit(controller.getAcg()); operandStack.pop(); operandStack.remove(operandStack.getStackLength() - height); // return value of assignment rhsValueLoader.visit(controller.getAcg()); } }
Example #26
Source File: MethodRefactoringElement.java From netbeans with Apache License 2.0 | 5 votes |
private String getMethodSignature(MethodCallExpression methodCall) { final MethodSignatureBuilder builder = new MethodSignatureBuilder(); builder.appendMethodName(methodCall); builder.appendMethodParams(methodCall); builder.appendReturnType(methodCall); return builder.toString(); }
Example #27
Source File: MethodRefactoringElement.java From netbeans with Apache License 2.0 | 5 votes |
private List<String> getParamTypes(MethodCallExpression methodCall) { final Expression arguments = methodCall.getArguments(); final List<String> paramTypes = new ArrayList<String>(); if (arguments instanceof ArgumentListExpression) { ArgumentListExpression argumentList = ((ArgumentListExpression) arguments); if (argumentList.getExpressions().size() > 0) { for (Expression argument : argumentList.getExpressions()) { paramTypes.add(ElementUtils.getTypeName(argument.getType())); } } } return paramTypes; }
Example #28
Source File: InvocationWriter.java From groovy with Apache License 2.0 | 5 votes |
protected void writeNormalConstructorCall(final ConstructorCallExpression call) { Expression arguments = call.getArguments(); if (arguments instanceof TupleExpression) { TupleExpression tupleExpression = (TupleExpression) arguments; int size = tupleExpression.getExpressions().size(); if (size == 0) { arguments = MethodCallExpression.NO_ARGUMENTS; } } Expression receiver = new ClassExpression(call.getType()); controller.getCallSiteWriter().makeCallSite(receiver, CallSiteWriter.CONSTRUCTOR, arguments, false, false, false, false); }
Example #29
Source File: FindMethodUtils.java From netbeans with Apache License 2.0 | 5 votes |
public static MethodNode findMethod(AstPath path, MethodCallExpression methodCall) { final ClassNode methodType = findMethodType(path, methodCall); if (methodType != null) { return findMethod(methodType, methodCall); } else { return findDynamicMethodType(); } }
Example #30
Source File: AstPathTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testScript() throws Exception { Iterator<ASTNode> it = getPath("testfiles/GroovyScopeTestcase.groovy", "pri^ntln \"Starting testcase\"").iterator(); assertEquals(ConstantExpression.class, it.next().getClass()); assertEquals(MethodCallExpression.class, it.next().getClass()); assertEquals(ExpressionStatement.class, it.next().getClass()); assertEquals(BlockStatement.class, it.next().getClass()); assertEquals(MethodNode.class, it.next().getClass()); assertEquals(ClassNode.class, it.next().getClass()); assertEquals(ModuleNode.class, it.next().getClass()); assertFalse(it.hasNext()); }