本文整理汇总了Java中org.walkmod.javalang.ast.stmt.ExplicitConstructorInvocationStmt类的典型用法代码示例。如果您正苦于以下问题:Java ExplicitConstructorInvocationStmt类的具体用法?Java ExplicitConstructorInvocationStmt怎么用?Java ExplicitConstructorInvocationStmt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExplicitConstructorInvocationStmt类属于org.walkmod.javalang.ast.stmt包,在下文中一共展示了ExplicitConstructorInvocationStmt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.walkmod.javalang.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Override
public void visit(ExplicitConstructorInvocationStmt n, A arg) {
if (!n.isThis()) {
if (n.getExpr() != null) {
n.getExpr().accept(expressionTypeAnalyzer, arg);
n.setSymbolData(n.getExpr().getSymbolData());
}
}
// resolve constructor symbol data
n.accept(expressionTypeAnalyzer, 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(expressionTypeAnalyzer, arg);
}
}
}
示例2: visit
import org.walkmod.javalang.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
public R visit(ExplicitConstructorInvocationStmt n, A arg) {
if (!n.isThis()) {
if (n.getExpr() != null) {
n.getExpr().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;
}
示例3: visit
import org.walkmod.javalang.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
public void visit(ExplicitConstructorInvocationStmt n, Object arg) {
prepareComments(n);
printPreviousComments(n, arg);
if (n.isThis()) {
printTypeArgs(n.getTypeArgs(), arg);
printer.print("this");
} else {
if (n.getExpr() != null) {
n.getExpr().accept(this, arg);
printer.print(".");
}
printTypeArgs(n.getTypeArgs(), arg);
printer.print("super");
}
printArguments(n.getArgs(), arg);
printer.print(";");
}
示例4: visit
import org.walkmod.javalang.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
public void visit(ExplicitConstructorInvocationStmt n, A arg) {
if (!n.isThis()) {
if (n.getExpr() != null) {
n.getExpr().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);
}
}
}
示例5: visit
import org.walkmod.javalang.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
public Node visit(ExplicitConstructorInvocationStmt n, A arg) {
if (!n.isThis()) {
if (n.getExpr() != null) {
n.setExpr((Expression) n.getExpr().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;
}
示例6: visit
import org.walkmod.javalang.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
public void visit(ExplicitConstructorInvocationStmt n, VisitorContext ctx) {
Object o = ctx.get(NODE_TO_COMPARE_KEY);
if (o != null && o instanceof ExplicitConstructorInvocationStmt) {
ExplicitConstructorInvocationStmt aux = (ExplicitConstructorInvocationStmt) o;
boolean backup = isUpdated();
setIsUpdated(false);
inferASTChanges(n.getTypeArgs(), aux.getTypeArgs());
inferASTChanges(n.getArgs(), aux.getArgs());
inferASTChanges(n.getExpr(), aux.getExpr());
if (!isUpdated()) {
increaseUnmodifiedNodes(ExplicitConstructorInvocationStmt.class);
} else {
applyUpdate(n, aux, n.getArgs(), aux.getArgs());
applyUpdate(n, aux, n.getTypeArgs(), aux.getTypeArgs());
increaseUpdatedNodes(ExplicitConstructorInvocationStmt.class);
}
setIsUpdated(backup || isUpdated());
} else if (o != null) {
setIsUpdated(true);
applyUpdate(n, (Node) o);
}
}
示例7: visit
import org.walkmod.javalang.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Override
public void visit(ExplicitConstructorInvocationStmt n, A arg) {
if (n.getTypeArgs() != null) {
for (Type t : n.getTypeArgs()) {
t.accept(this, arg);
}
}
Node p = n.getParentNode();
while (p != null && !(p instanceof ConstructorDeclaration)) {
p = p.getParentNode();
}
if (p != null) {
final SymbolType st;
final ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) p;
if (n.isThis()) {
st = (SymbolType) constructorDeclaration.getSymbolData();
} else {
final ClassOrInterfaceDeclaration parentNode =
(ClassOrInterfaceDeclaration) constructorDeclaration.getParentNode();
final List<ClassOrInterfaceType> anExtends = parentNode.getExtends();
st = anExtends != null && !anExtends.isEmpty() ? (SymbolType) anExtends.get(0).getSymbolData() : null;
}
if (st != null) {
resolveConstructor(n, n.getArgs(), st, arg);
}
}
}
示例8: testExplicitThisConstructorInvocationResolution
import org.walkmod.javalang.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Test
public void testExplicitThisConstructorInvocationResolution() throws Exception {
CompilationUnit cu = run(
"public class A { private String name; public A() { this(\"empty\"); } public A(String name){this.name = name;}}");
ExplicitConstructorInvocationStmt st =
(ExplicitConstructorInvocationStmt) ((ConstructorDeclaration) cu.getTypes().get(0).getMembers().get(1))
.getBlock().getStmts().get(0);
Assert.assertNotNull(st.getSymbolData());
Assert.assertEquals("public A(java.lang.String)", st.getSymbolData().getConstructor().toString());
}
示例9: testExplicitSuperConstructorInvocationResolution
import org.walkmod.javalang.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Test
public void testExplicitSuperConstructorInvocationResolution() throws Exception {
CompilationUnit cu = run("class A { private String name; public A(String name){this.name = name;}}"
+ "class B extends A { B() { super(\"empty\"); } } ");
ExplicitConstructorInvocationStmt st =
(ExplicitConstructorInvocationStmt) ((ConstructorDeclaration) cu.getTypes().get(1).getMembers().get(0))
.getBlock().getStmts().get(0);
Assert.assertNotNull(st.getSymbolData());
Assert.assertEquals("public A(java.lang.String)", st.getSymbolData().getConstructor().toString());
}
示例10: visit
import org.walkmod.javalang.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
public Boolean visit(ExplicitConstructorInvocationStmt n1, Node arg) {
ExplicitConstructorInvocationStmt n2 = (ExplicitConstructorInvocationStmt) arg;
if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
return Boolean.FALSE;
}
if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
return Boolean.FALSE;
}
if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
示例11: visit
import org.walkmod.javalang.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Override
public Node visit(ExplicitConstructorInvocationStmt _n, Object _arg) {
List<Type> typeArgs = visit(_n.getTypeArgs(), _arg);
Expression expr = cloneNodes(_n.getExpr(), _arg);
List<Expression> args = visit(_n.getArgs(), _arg);
ExplicitConstructorInvocationStmt r = new ExplicitConstructorInvocationStmt(_n.getBeginLine(),
_n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), typeArgs, _n.isThis(), expr, args);
return r;
}
示例12: visit
import org.walkmod.javalang.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
public void visit(ExplicitConstructorInvocationStmt n, VisitorContext arg) {
if (preVisitor != null) {
preVisitor.visit(n, arg);
}
super.visit(n, arg);
if (postVisitor != null) {
postVisitor.visit(n, arg);
}
}
示例13: ConstructorDeclaration
import org.walkmod.javalang.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
final public ConstructorDeclaration ConstructorDeclaration(Modifier modifier) throws ParseException {
List typeParameters = null;
String name;
List parameters;
List throws_ = null;
ExplicitConstructorInvocationStmt exConsInv = null;
List stmts;
int line = modifier.beginLine;
int column = modifier.beginColumn;
int bbLine = 0;
int bbColumn = 0;
int beLine = 0;
int beColumn = 0;
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case LT:
typeParameters = TypeParameters();
int[] lineCol = (int[]) typeParameters.remove(0);
if (line == -1) {
line = lineCol[0];
column = lineCol[1];
}
break;
default:
jj_la1[52] = jj_gen;;
}
jj_consume_token(IDENTIFIER);
name = token.image;
if (line == -1) {
line = token.beginLine;
column = token.beginColumn;
}
parameters = FormalParameters();
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case THROWS:
jj_consume_token(THROWS);
throws_ = ClassOrInterfaceTypeList();
break;
default:
jj_la1[53] = jj_gen;;
}
jj_consume_token(LBRACE);
bbLine = token.beginLine;
bbColumn = token.beginColumn;
if (jj_2_8(2147483647)) {
exConsInv = ExplicitConstructorInvocation();
} else {
;
}
stmts = Statements();
jj_consume_token(RBRACE);
if (exConsInv != null) {
stmts = add(0, stmts, exConsInv);
}
{
if (true)
return new ConstructorDeclaration(line, column, token.endLine, token.endColumn, popJavadoc(),
modifier.modifiers, modifier.annotations, typeParameters, name, parameters, throws_,
new BlockStmt(bbLine, bbColumn, token.endLine, token.endColumn, stmts));
}
throw new Error("Missing return statement in function");
}
示例14: visit
import org.walkmod.javalang.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
public R visit(ExplicitConstructorInvocationStmt n, A arg);
示例15: visit
import org.walkmod.javalang.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
public void visit(ExplicitConstructorInvocationStmt n, A arg);