private void copyInvocationParameters(MethodInvocation invocation, AST ast) throws JavaModelException { String[] names= fTargetMethod.getParameterNames(); for (int i= 0; i < names.length; i++) invocation.arguments().add(ast.newSimpleName(names[i])); }
private void copyInvocationParameters(MethodInvocation invocation, AST ast) throws JavaModelException { String[] names= fTargetMethod.getParameterNames(); for (int i= 0; i < names.length; i++) invocation.arguments().add(ast.newSimpleName(names[i])); }
private void processIndexerInvocation(MethodInvocation node, IMethodBinding binding, MemberMapping mapping) { if (node.arguments().size() == 1) { processIndexerGetter(node); } else { processIndexerSetter(node); } }
private CSAnonymousClassBuilder mapAnonymousEventListener(MethodInvocation node) { ClassInstanceCreation creation = (ClassInstanceCreation) node.arguments().get(0); return mapAnonymousClass(creation.getAnonymousClassDeclaration()); }
private void processUnwrapInvocation(MethodInvocation node) { final List arguments = node.arguments(); if (arguments.size() != 1) { unsupportedConstruct(node, SharpenAnnotations.SHARPEN_UNWRAP + " only works against single argument methods."); } pushExpression(mapExpression((Expression) arguments.get(0))); }
final List internalGetChildListProperty(ChildListPropertyDescriptor property) { if (property == ARGUMENTS_PROPERTY) { return arguments(); } if (property == TYPE_ARGUMENTS_PROPERTY) { return typeArguments(); } // allow default implementation to flag the error return super.internalGetChildListProperty(property); }
final List internalGetChildListProperty(ChildListPropertyDescriptor property) { if (property == ARGUMENTS_PROPERTY) { return arguments(); } if (property == TYPE_ARGUMENTS_PROPERTY) { return typeArguments(); } // allow default implementation to flag the error return super.internalGetChildListProperty(property); }
@Override final List internalGetChildListProperty(ChildListPropertyDescriptor property) { if (property == ARGUMENTS_PROPERTY) { return arguments(); } if (property == TYPE_ARGUMENTS_PROPERTY) { return typeArguments(); } // allow default implementation to flag the error return super.internalGetChildListProperty(property); }
public boolean visit(MethodInvocation invocation) { if (invocation.getExpression() == null) qualifyUnqualifiedMemberNameIfNecessary(invocation.getName()); else invocation.getExpression().accept(this); for (Iterator it= invocation.arguments().iterator(); it.hasNext();) ((Expression) it.next()).accept(this); return false; }
private void processIndexerSetter(MethodInvocation node) { // target(arg0 ... argN) => target[arg0... argN-1] = argN; final CSIndexedExpression indexer = new CSIndexedExpression(mapIndexerTarget(node)); final List arguments = node.arguments(); final Expression lastArgument = (Expression)arguments.get(arguments.size() - 1); for (int i=0; i<arguments.size()-1; ++i) { indexer.addIndex(mapExpression((Expression) arguments.get(i))); } pushExpression(CSharpCode.newAssignment(indexer, mapExpression(lastArgument))); }
private void processIndexerGetter(MethodInvocation node) { final Expression singleArgument = (Expression) node.arguments().get(0); pushExpression( new CSIndexedExpression( mapIndexerTarget(node), mapExpression(singleArgument))); }
@Override public void endVisit(MethodInvocation node) { endVisitMethodInvocation(node, node.getExpression(), node.arguments(), getMethodBinding(node.getName())); }
ASTNode clone0(AST target) { MethodInvocation result = new MethodInvocation(target); result.setSourceRange(getStartPosition(), getLength()); result.setName((SimpleName) getName().clone(target)); result.setExpression( (Expression) ASTNode.copySubtree(target, getExpression())); if (this.ast.apiLevel >= AST.JLS3_INTERNAL) { result.typeArguments().addAll(ASTNode.copySubtrees(target, typeArguments())); } result.arguments().addAll(ASTNode.copySubtrees(target, arguments())); return result; }
ASTNode clone0(AST target) { MethodInvocation result = new MethodInvocation(target); result.setSourceRange(getStartPosition(), getLength()); result.setName((SimpleName) getName().clone(target)); result.setExpression( (Expression) ASTNode.copySubtree(target, getExpression())); if (this.ast.apiLevel >= AST.JLS3) { result.typeArguments().addAll(ASTNode.copySubtrees(target, typeArguments())); } result.arguments().addAll(ASTNode.copySubtrees(target, arguments())); return result; }
@Override public boolean visit(MethodInvocation node) { handleTypeArguments(node.typeArguments()); handleInvocation(node, node.getName()); handleCommas(node.arguments(), this.options.insert_space_before_comma_in_method_invocation_arguments, this.options.insert_space_after_comma_in_method_invocation_arguments); return true; }
ASTNode clone0(AST target) { MethodInvocation result = new MethodInvocation(target); result.setSourceRange(getStartPosition(), getLength()); result.setName((SimpleName) getName().clone(target)); result.setExpression( (Expression) ASTNode.copySubtree(target, getExpression())); if (this.ast.apiLevel >= AST.JLS3_INTERNAL) { result.typeArguments().addAll(ASTNode.copySubtrees(target, typeArguments())); } result.arguments().addAll(ASTNode.copySubtrees(target, arguments())); return result; }
@Override public boolean visit(MethodInvocation node) { handleTypeArguments(node.typeArguments()); handleInvocation(node, node.getName()); handleCommas(node.arguments(), this.options.insert_space_before_comma_in_method_invocation_arguments, this.options.insert_space_after_comma_in_method_invocation_arguments); return true; }
@Override public boolean visit(MethodInvocation node) { evalQualifyingExpression(node.getExpression(), node.getName()); doVisitChildren(node.typeArguments()); doVisitChildren(node.arguments()); return false; }
protected ASTNode createBody(BodyDeclaration bd) throws JavaModelException { MethodDeclaration methodDeclaration= (MethodDeclaration) bd; final MethodInvocation invocation= getAst().newMethodInvocation(); invocation.setName(getAst().newSimpleName(getNewElementName())); invocation.setExpression(createSimpleTargetAccessExpression(methodDeclaration)); fNeededInsertion= createArgumentList(methodDeclaration, invocation.arguments(), new VisibilityAdjustingArgumentFactory(getAst(), fRewrites, fAdjustments)); final Block block= getAst().newBlock(); block.statements().add(createMethodInvocation(methodDeclaration, invocation)); if (!fSourceRewrite.getCu().equals(fTargetType.getCompilationUnit())) fSourceRewrite.getImportRemover().registerRemovedNode(methodDeclaration.getBody()); return block; }
private void processMacroInvocation(MethodInvocation node) { final MethodDeclaration declaration = (MethodDeclaration)declaringNode(node.resolveMethodBinding()); final TagElement macro = effectiveAnnotationFor(declaration, SharpenAnnotations.SHARPEN_MACRO); final CSMacro code = new CSMacro(JavadocUtility.singleTextFragmentFrom(macro)); code.addVariable("expression", mapExpression(node.getExpression())); code.addVariable("arguments", mapExpressions(node.arguments())); pushExpression(new CSMacroExpression(code)); }