本文整理汇总了Java中japa.parser.ast.expr.MethodCallExpr类的典型用法代码示例。如果您正苦于以下问题:Java MethodCallExpr类的具体用法?Java MethodCallExpr怎么用?Java MethodCallExpr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MethodCallExpr类属于japa.parser.ast.expr包,在下文中一共展示了MethodCallExpr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visit
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
public R visit(MethodCallExpr n, A arg) {
if (n.getScope() != null) {
n.getScope().accept(this, arg);
}
if (n.getTypeArgs() != null) {
for (Type t : n.getTypeArgs()) {
t.accept(this, arg);
}
}
if (n.getArgs() != null) {
for (Expression e : n.getArgs()) {
e.accept(this, arg);
}
}
return null;
}
开发者ID:rfw,项目名称:genja,代码行数:17,代码来源:GenericVisitorAdapter.java
示例2: visit
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
public Boolean visit(MethodCallExpr n1, Node arg) {
MethodCallExpr n2 = (MethodCallExpr) arg;
if (!nodeEquals(n1.getScope(), n2.getScope())) {
return Boolean.FALSE;
}
if (!objEquals(n1.getName(), n2.getName())) {
return Boolean.FALSE;
}
if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
return Boolean.FALSE;
}
if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
开发者ID:rfw,项目名称:genja,代码行数:22,代码来源:EqualsVisitor.java
示例3: visit
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
public Node visit(MethodCallExpr n, A arg) {
if (n.getScope() != null) {
n.setScope((Expression) n.getScope().accept(this, arg));
}
List<Type> typeArgs = n.getTypeArgs();
if (typeArgs != null) {
for (int i = 0; i < typeArgs.size(); i++) {
typeArgs.set(i, (Type) typeArgs.get(i).accept(this, arg));
}
removeNulls(typeArgs);
}
List<Expression> args = n.getArgs();
if (args != null) {
for (int i = 0; i < args.size(); i++) {
args.set(i, (Expression) args.get(i).accept(this, arg));
}
removeNulls(args);
}
return n;
}
开发者ID:rfw,项目名称:genja,代码行数:21,代码来源:ModifierVisitorAdapter.java
示例4: addAttachSkeleton
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
private void addAttachSkeleton() {
List<Parameter> params = Collections.emptyList();
MethodDeclaration method = new MethodDeclaration(
ModifierSet.PUBLIC, new VoidType(), "attach", params);
AnnotationExpr override = new MarkerAnnotationExpr(new NameExpr("Override"));
method.setAnnotations(Collections.singletonList(override));
BlockStmt block = new BlockStmt();
Expression e = new MethodCallExpr(new SuperExpr(), "attach");
List<Statement> sts = Collections.singletonList((Statement)new ExpressionStmt(e));
block.setStmts(sts);
method.setBody(block);
if (getType().getMembers()==null) {
getType().setMembers(new LinkedList<BodyDeclaration>());
}
getType().getMembers().add(method);
}
开发者ID:ahn,项目名称:mideaas,代码行数:19,代码来源:ControllerCode.java
示例5: addOnBecomingVisibleMethod
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
@SuppressWarnings("unused")
private void addOnBecomingVisibleMethod() {
List<Parameter> params = Collections.emptyList();
MethodDeclaration method = new MethodDeclaration(
ModifierSet.PUBLIC, new VoidType(), "onBecomingVisible", params);
AnnotationExpr override = new MarkerAnnotationExpr(new NameExpr("Override"));
method.setAnnotations(Collections.singletonList(override));
BlockStmt block = new BlockStmt();
Expression e = new MethodCallExpr(new SuperExpr(), "onBecomingVisible");
List<Statement> sts = Collections.singletonList((Statement)new ExpressionStmt(e));
block.setStmts(sts);
method.setBody(block);
if (getType().getMembers()==null) {
getType().setMembers(new LinkedList<BodyDeclaration>());
}
getType().getMembers().add(method);
}
开发者ID:ahn,项目名称:mideaas,代码行数:20,代码来源:ControllerCode.java
示例6: visit
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
@Override
public void visit(MethodCallExpr n, Object arg)
{ String name = n.getName();
String calledMethod = n.getScope()+ClassTools.CLASS_SEPARATOR+name;
if(FORBIDDEN_METHODS.contains(calledMethod) || FORBIDDEN_METHODS.contains(name))
{ int line = n.getBeginLine();
printErr("Erreur ligne "+line+" : il est interdit d'utiliser la méthode "+calledMethod+" ; à la place vous devez utiliser la méthode print de votre agent (héritant de ArtificialIntelligence) ou d'un gestionnaire (héritant de AiAbstractHandler)");
errorCount++;
}
}
开发者ID:vlabatut,项目名称:totalboumboum,代码行数:11,代码来源:AiVisitor.java
示例7: buildUnit
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
public static void buildUnit() {
CompilationUnit compUnit = new CompilationUnit();
compUnit.setPackage(new PackageDeclaration(ASTHelper
.createNameExpr("compiladores.aula")));
// create the type declaration
ClassOrInterfaceDeclaration type = new ClassOrInterfaceDeclaration(
ModifierSet.PUBLIC, false, "AulaJavaParser");
ASTHelper.addTypeDeclaration(compUnit, type);
// create a method
MethodDeclaration method = new MethodDeclaration(ModifierSet.PUBLIC,
ASTHelper.VOID_TYPE, "main");
method.setModifiers(ModifierSet.addModifier(method.getModifiers(),
ModifierSet.STATIC));
ASTHelper.addMember(type, method);
// add a parameter to the method
Parameter param = ASTHelper.createParameter(
ASTHelper.createReferenceType("String", 0), "args");
param.setVarArgs(true); //makes the parameter a ",,," array
ASTHelper.addParameter(method, param);
// add a body to the method
BlockStmt block = new BlockStmt();
method.setBody(block);
// add a statement do the method body
NameExpr clazz = new NameExpr("System");
FieldAccessExpr field = new FieldAccessExpr(clazz, "out");
MethodCallExpr call = new MethodCallExpr(field, "println");
ASTHelper.addArgument(call, new StringLiteralExpr("Hello World!"));
ASTHelper.addStmt(block, call);
System.out.println(compUnit.toString());
}
开发者ID:damorim,项目名称:compilers-cin,代码行数:38,代码来源:ParserExample.java
示例8: visit
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
@Override
public String visit(MethodCallExpr n, Void arg) {
Scope scope = (Scope) n.getData();
Scope.Type context = scope.findFirstNonBlockScope().type;
Scope lhsScope;
if (n.getScope() != null) {
String lhsType = n.getScope().accept(this, arg);
lhsScope = scope.findType(lhsType);
} else {
lhsScope = scope;
}
StringBuilder sb = new StringBuilder();
sb.append(n.getName()).append("(");
if (n.getArgs() != null) {
for (int i = 0; i < n.getArgs().size(); ++i) {
sb.append(n.getArgs().get(i).accept(this, arg));
if (i < n.getArgs().size() - 1) {
sb.append(", ");
}
}
}
sb.append(")");
String name = sb.toString();
switch (context) {
case STATIC:
case INSTANCE:
Scope enclosing = lhsScope.findEnclosingScopeForMethod(name, Scope.Type.CLASS);
if (enclosing == null) {
throw new SemanticException("method " + name + " not present in type on line " + n.getBeginLine());
}
return lhsScope.methods.get(name);
default:
throw new SemanticException("what?? on line " + n.getBeginLine());
} }
开发者ID:rfw,项目名称:genja,代码行数:40,代码来源:ExpressionAnalysis.java
示例9: visit
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
public void visit(MethodCallExpr n, Object arg) {
if (n.getScope() != null) {
n.getScope().accept(this, arg);
printer.print(".");
}
printTypeArgs(n.getTypeArgs(), arg);
printer.print(n.getName());
printArguments(n.getArgs(), arg);
}
开发者ID:rfw,项目名称:genja,代码行数:10,代码来源:DumpVisitor.java
示例10: visit
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
public void visit(MethodCallExpr n, A arg) {
if (n.getScope() != null) {
n.getScope().accept(this, arg);
}
if (n.getTypeArgs() != null) {
for (Type t : n.getTypeArgs()) {
t.accept(this, arg);
}
}
if (n.getArgs() != null) {
for (Expression e : n.getArgs()) {
e.accept(this, arg);
}
}
}
开发者ID:rfw,项目名称:genja,代码行数:16,代码来源:VoidVisitorAdapter.java
示例11: addNotification
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
private void addNotification(MethodDeclaration method, String text) {
MethodCallExpr e = new MethodCallExpr(new NameExpr("Notification"), "show");
e.setArgs(Collections.singletonList((Expression)new StringLiteralExpr(text)));
Statement statement = new ExpressionStmt(e);
addToMethod(method, statement);
ensureImport("com.vaadin.ui.Notification");
}
开发者ID:ahn,项目名称:mideaas,代码行数:8,代码来源:ControllerCode.java
示例12: visit
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
@Override
public void visit(MethodCallExpr n, Generator arg) {
throw new TransformException("don't know how to linearize");
}
开发者ID:rfw,项目名称:genja,代码行数:5,代码来源:LinearizeTransform.java
示例13: visit
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
@Override
public Boolean visit(MethodCallExpr n, Void arg) {
return false;
}
开发者ID:rfw,项目名称:genja,代码行数:5,代码来源:NodeAnnotator.java
示例14: visit
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
@Override
public void visit(MethodCallExpr n, Scope arg) {
super.visit(n, arg);
n.setData(arg);
}
开发者ID:rfw,项目名称:genja,代码行数:6,代码来源:ScopeCollector.java
示例15: visit
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
@Override
public void visit(MethodCallExpr n, Object arg) {
doTest(source, n);
super.visit(n, arg);
}
开发者ID:rfw,项目名称:genja,代码行数:6,代码来源:TestNodePositions.java
示例16: addArgument
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
/**
* 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 (args == null) {
args = new ArrayList<Expression>();
call.setArgs(args);
}
args.add(arg);
}
开发者ID:rfw,项目名称:genja,代码行数:18,代码来源:ASTHelper.java
示例17: visitPre
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
@Override
public void visitPre(MethodCallExpr n, A arg) {
}
开发者ID:kuali,项目名称:kc-rice,代码行数:5,代码来源:VoidVisitorHelperBase.java
示例18: visitPost
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
@Override
public void visitPost(MethodCallExpr n, A arg) {
}
开发者ID:kuali,项目名称:kc-rice,代码行数:5,代码来源:VoidVisitorHelperBase.java
示例19: visitPre
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
void visitPre(MethodCallExpr n, A arg);
开发者ID:kuali,项目名称:kc-rice,代码行数:2,代码来源:VoidVisitorHelper.java
示例20: visitPost
import japa.parser.ast.expr.MethodCallExpr; //导入依赖的package包/类
void visitPost(MethodCallExpr n, A arg);
开发者ID:kuali,项目名称:kc-rice,代码行数:2,代码来源:VoidVisitorHelper.java
注:本文中的japa.parser.ast.expr.MethodCallExpr类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论