Skip to content

Commit

Permalink
Move add argument to method call expr
Browse files Browse the repository at this point in the history
  • Loading branch information
matozoid committed Aug 19, 2016
1 parent 5fe2eaf commit 94f2f51
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
19 changes: 0 additions & 19 deletions javaparser-core/src/main/java/com/github/javaparser/ASTHelper.java
Expand Up @@ -61,25 +61,6 @@ private ASTHelper() {
// nop
}

/**
* Adds the given argument to the method call. The list of arguments will be
* initialized if it is <code>null</code>.
*
* @param call
* method call
* @param arg
* argument value
*/
public static void addArgument(MethodCallExpr call, Expression arg) {
List<Expression> args = call.getArgs();
if (isNullOrEmpty(args)) {
args = new ArrayList<>();
call.setArgs(args);
}
args.add(arg);
arg.setParentNode(call);
}

/**
* Adds the given type declaration to the compilation unit. The list of
* types will be initialized if it is <code>null</code>.
Expand Down
Expand Up @@ -26,6 +26,7 @@
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;

import java.util.ArrayList;
import java.util.List;

import static com.github.javaparser.utils.Utils.*;
Expand Down Expand Up @@ -65,6 +66,24 @@ public MethodCallExpr(final Range range, final Expression scope, final List<Type
setArgs(args);
}


/**
* Adds the given argument to the method call. The list of arguments will be
* initialized if it is <code>null</code>.
*
* @param arg
* argument value
*/
public void addArgument(Expression arg) {
List<Expression> args = getArgs();
if (isNullOrEmpty(args)) {
args = new ArrayList<>();
setArgs(args);
}
args.add(arg);
arg.setParentNode(this);
}

@Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
return v.visit(this, arg);
}
Expand Down

0 comments on commit 94f2f51

Please sign in to comment.