public boolean endvisit(LambdaFunctionDeclaration lambdaMethod) throws Exception { methodGlobalVars.pop(); this.fInMethod = false; if (!fNodes.isEmpty() && fNodes.peek() == lambdaMethod) { fRequestor.exitMethod(lambdaMethod.sourceEnd() - 1); fNodes.pop(); } for (final PHPSourceElementRequestorExtension visitor : extensions) { visitor.endvisit(lambdaMethod); } return true; }
public boolean visit(LambdaFunctionDeclaration lambdaMethod) throws Exception { fNodes.push(lambdaMethod); methodGlobalVars.add(new HashSet<String>()); // Declaration parentDeclaration = null; // if (!declarations.empty() // && declarations.peek() instanceof MethodDeclaration) { // parentDeclaration = declarations.peek(); // // In case we are entering a nested element - just add to the // // deferred list and get out of the nested element visiting process // deferredDeclarations.add(lambdaMethod); // return visitGeneral(lambdaMethod); // } final Collection<FormalParameter> arguments = lambdaMethod.getArguments(); final StringBuilder metadata = new StringBuilder(); final String[] parameters = new String[arguments.size()]; // if (arguments != null) { final Iterator<FormalParameter> i = arguments.iterator(); int indx = 0; while (i.hasNext()) { final Argument arg = i.next(); metadata.append(arg.getName()); parameters[indx] = arg.getName(); indx++; if (i.hasNext()) { metadata.append(","); } } // } // Add method declaration: for (final PHPSourceElementRequestorExtension visitor : extensions) { visitor.visit(lambdaMethod); } final ISourceElementRequestor.MethodInfo mi = new ISourceElementRequestor.MethodInfo(); mi.parameterNames = parameters; mi.name = PHPCoreConstants.ANONYMOUS; mi.modifiers = Modifiers.AccPublic; mi.nameSourceStart = lambdaMethod.sourceStart(); mi.nameSourceEnd = lambdaMethod.sourceEnd(); mi.declarationStart = mi.nameSourceStart; mi.isConstructor = false; this.fRequestor.enterMethod(mi); this.fInMethod = true; for (final Argument arg : arguments) { final ISourceElementRequestor.FieldInfo info = new ISourceElementRequestor.FieldInfo(); info.name = arg.getName(); info.modifiers = Modifiers.AccPublic; info.nameSourceStart = arg.getNameStart(); info.nameSourceEnd = arg.getNameEnd() - 1; info.declarationStart = arg.sourceStart(); fRequestor.enterField(info); fRequestor.exitField(arg.sourceEnd() - 1); } return true; }