本文整理汇总了Java中org.walkmod.javalang.ast.body.VariableDeclarator.getInit方法的典型用法代码示例。如果您正苦于以下问题:Java VariableDeclarator.getInit方法的具体用法?Java VariableDeclarator.getInit怎么用?Java VariableDeclarator.getInit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.walkmod.javalang.ast.body.VariableDeclarator
的用法示例。
在下文中一共展示了VariableDeclarator.getInit方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeField
import org.walkmod.javalang.ast.body.VariableDeclarator; //导入方法依赖的package包/类
public void removeField(Symbol<?> symbol, SymbolTable table, FieldDeclaration fd) {
int modifiers = fd.getModifiers();
if (ModifierSet.isPrivate(modifiers)) {
List<VariableDeclarator> vds = fd.getVariables();
if (vds != null) {
Iterator<VariableDeclarator> it = vds.iterator();
while (it.hasNext()) {
VariableDeclarator vd = it.next();
if (vd.getId().getName().equals(symbol.getName())) {
Expression init = vd.getInit();
if (isReadOnlyExpression(init)) {
if (vds.size() == 1) {
remove(fd);
} else {
it.remove();
}
}
}
}
}
}
}
示例2: visit
import org.walkmod.javalang.ast.body.VariableDeclarator; //导入方法依赖的package包/类
public void visit(VariableDeclarator n, A arg) {
if (n.getInit() != null) {
Symbol<?> aux = symbolTable.findSymbol(n.getId().getName(), ReferenceType.VARIABLE);
Scope scope = new Scope(aux);
aux.setInnerScope(scope);
symbolTable.pushScope(scope);
n.getInit().accept(expressionTypeAnalyzer, arg);
symbolTable.popScope();
}
}
示例3: visit
import org.walkmod.javalang.ast.body.VariableDeclarator; //导入方法依赖的package包/类
@Override
public void visit(VariableDeclarator n, A arg) {
n.getId().accept(this, arg);
Expression init = n.getInit();
if (init != null) {
Symbol<?> aux = symbolTable.findSymbol(n.getId().getName(), ReferenceType.VARIABLE);
Scope innerscope = new Scope(aux);
aux.setInnerScope(innerscope);
symbolTable.pushScope(innerscope);
if (init instanceof LambdaExpr || init instanceof MethodReferenceExpr) {
ArrayFilter<Method> filter = new ArrayFilter<Method>(null);
SymbolType scope = symbolTable.getType(n.getId().getName(), ReferenceType.VARIABLE);
filter.appendPredicate(
new CompatibleFunctionalMethodPredicate<A>(scope, this, null, arg, symbolTable, null, null));
SymbolData sd = null;
try {
sd = MethodInspector.findMethodType(scope, null, filter, null, null);
} catch (Exception e) {
throw new NoSuchExpressionTypeException(e);
}
if (init instanceof LambdaExpr) {
init.setSymbolData(sd);
} else {
init.setSymbolData(scope);
MethodReferenceExpr methodRef = (MethodReferenceExpr) init;
methodRef.accept(this, arg);
}
} else {
init.accept(this, arg);
}
symbolTable.popScope();
}
}
示例4: visit
import org.walkmod.javalang.ast.body.VariableDeclarator; //导入方法依赖的package包/类
public R visit(VariableDeclarator n, A arg) {
n.getId().accept(this, arg);
if (n.getInit() != null) {
n.getInit().accept(this, arg);
}
return null;
}
示例5: visit
import org.walkmod.javalang.ast.body.VariableDeclarator; //导入方法依赖的package包/类
public void visit(VariableDeclarator n, Object arg) {
prepareComments(n);
printPreviousComments(n, arg);
n.getId().accept(this, arg);
if (n.getInit() != null) {
printer.print(" = ");
n.getInit().accept(this, arg);
}
}
示例6: visit
import org.walkmod.javalang.ast.body.VariableDeclarator; //导入方法依赖的package包/类
public Node visit(VariableDeclarator n, A arg) {
n.setId((VariableDeclaratorId) n.getId().accept(this, arg));
if (n.getInit() != null) {
n.setInit((Expression) n.getInit().accept(this, arg));
}
return n;
}
示例7: visit
import org.walkmod.javalang.ast.body.VariableDeclarator; //导入方法依赖的package包/类
@Override
public Object visit(VariableDeclarator n, Void arg) {
return n.getInit() != null ? n.getInit().accept(this, arg) : null;
}
示例8: visit
import org.walkmod.javalang.ast.body.VariableDeclarator; //导入方法依赖的package包/类
public void visit(VariableDeclarator n, A arg) {
n.getId().accept(this, arg);
if (n.getInit() != null) {
n.getInit().accept(this, arg);
}
}