本文整理汇总了Java中org.walkmod.javalang.ast.expr.Expression类的典型用法代码示例。如果您正苦于以下问题:Java Expression类的具体用法?Java Expression怎么用?Java Expression使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Expression类属于org.walkmod.javalang.ast.expr包,在下文中一共展示了Expression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.walkmod.javalang.ast.expr.Expression; //导入依赖的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;
}
示例2: visit
import org.walkmod.javalang.ast.expr.Expression; //导入依赖的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);
}
}
}
示例3: visit
import org.walkmod.javalang.ast.expr.Expression; //导入依赖的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;
}
示例4: visit
import org.walkmod.javalang.ast.expr.Expression; //导入依赖的package包/类
@Override
public void visit(ArrayInitializerExpr n, A arg) {
if (n.getValues() != null) {
List<Expression> values = n.getValues();
SymbolType st = null;
for (Expression expr : values) {
expr.accept(this, arg);
SymbolData sd = expr.getSymbolData();
if (st == null && sd != null) {
st = (SymbolType) sd;
st = st.clone();
} else if (sd != null) {
st = (SymbolType) st.merge(sd);
}
}
if (values != null && !values.isEmpty() && st != null) {
st.setArrayCount(st.getArrayCount() + 1);
}
n.setSymbolData(st);
}
}
示例5: removeVariable
import org.walkmod.javalang.ast.expr.Expression; //导入依赖的package包/类
public void removeVariable(Symbol<?> symbol, SymbolTable table, VariableDeclarationExpr vd) {
List<VariableDeclarator> vds = vd.getVars();
if (vds.size() == 1) {
Expression init = vds.get(0).getInit();
if (isReadOnlyExpression(init)) {
remove(vd.getParentNode());
}
} else {
Iterator<VariableDeclarator> it = vds.iterator();
boolean finish = false;
while (it.hasNext() && !finish) {
VariableDeclarator current = it.next();
if (current.getId().getName().equals(symbol.getName())) {
if (isReadOnlyExpression(current.getInit())) {
finish = true;
it.remove();
}
}
}
}
}
示例6: SynchronizedStatement
import org.walkmod.javalang.ast.expr.Expression; //导入依赖的package包/类
final public SynchronizedStmt SynchronizedStatement() throws ParseException {
Expression expr;
BlockStmt block;
int line;
int column;
jj_consume_token(SYNCHRONIZED);
line = token.beginLine;
column = token.beginColumn;
jj_consume_token(LPAREN);
expr = Expression();
jj_consume_token(RPAREN);
block = Block();
{
if (true)
return new SynchronizedStmt(line, column, token.endLine, token.endColumn, expr, block);
}
throw new Error("Missing return statement in function");
}
示例7: removeField
import org.walkmod.javalang.ast.expr.Expression; //导入依赖的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();
}
}
}
}
}
}
}
示例8: visit
import org.walkmod.javalang.ast.expr.Expression; //导入依赖的package包/类
public void visit(ObjectCreationExpr 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);
}
}
n.getType().accept(this, arg);
if (n.getArgs() != null) {
for (Expression e : n.getArgs()) {
e.accept(this, arg);
}
}
if (n.getAnonymousClassBody() != null) {
for (BodyDeclaration member : n.getAnonymousClassBody()) {
member.accept(this, arg);
}
}
}
示例9: VariableDeclarator
import org.walkmod.javalang.ast.expr.Expression; //导入依赖的package包/类
final public VariableDeclarator VariableDeclarator() throws ParseException {
VariableDeclaratorId id;
Expression init = null;
id = VariableDeclaratorId();
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case ASSIGN:
jj_consume_token(ASSIGN);
init = VariableInitializer();
break;
default:
jj_la1[38] = jj_gen;;
}
{
if (true)
return new VariableDeclarator(id.getBeginLine(), id.getBeginColumn(), token.endLine, token.endColumn,
id, init);
}
throw new Error("Missing return statement in function");
}
示例10: DoStatement
import org.walkmod.javalang.ast.expr.Expression; //导入依赖的package包/类
final public DoStmt DoStatement() throws ParseException {
Expression condition;
Statement body;
int line;
int column;
jj_consume_token(DO);
line = token.beginLine;
column = token.beginColumn;
body = Statement();
jj_consume_token(WHILE);
jj_consume_token(LPAREN);
condition = Expression();
jj_consume_token(RPAREN);
jj_consume_token(SEMICOLON);
{
if (true)
return new DoStmt(line, column, token.endLine, token.endColumn, body, condition);
}
throw new Error("Missing return statement in function");
}
示例11: WhileStatement
import org.walkmod.javalang.ast.expr.Expression; //导入依赖的package包/类
final public WhileStmt WhileStatement() throws ParseException {
Expression condition;
Statement body;
int line;
int column;
jj_consume_token(WHILE);
line = token.beginLine;
column = token.beginColumn;
jj_consume_token(LPAREN);
condition = Expression();
jj_consume_token(RPAREN);
body = Statement();
{
if (true)
return new WhileStmt(line, column, token.endLine, token.endColumn, condition, body);
}
throw new Error("Missing return statement in function");
}
示例12: PrimaryExpression
import org.walkmod.javalang.ast.expr.Expression; //导入依赖的package包/类
final public Expression PrimaryExpression() throws ParseException {
Expression ret;
Expression inner;
ret = PrimaryPrefix();
label_53: while (true) {
if (jj_2_25(2)) {
;
} else {
break label_53;
}
ret = PrimarySuffix(ret);
}
{
if (true)
return ret;
}
throw new Error("Missing return statement in function");
}
示例13: GenericsBuilderFromMethodParameterTypes
import org.walkmod.javalang.ast.expr.Expression; //导入依赖的package包/类
public GenericsBuilderFromMethodParameterTypes(Map<String, SymbolType> typeMapping, List<Expression> args,
SymbolType scope, SymbolType[] typeArgs, List<Type> callArgs, SymbolTable symbolTable) {
super(typeMapping, args, typeArgs, symbolTable);
this.callArgs = callArgs;
this.scope = scope;
}
示例14: AbstractGenericsBuilderFromParameterTypes
import org.walkmod.javalang.ast.expr.Expression; //导入依赖的package包/类
public AbstractGenericsBuilderFromParameterTypes(Map<String, SymbolType> typeMapping, List<Expression> args,
SymbolType[] typeArgs, SymbolTable symTable) {
this.typeMapping = typeMapping;
this.args = args;
this.typeArgs = typeArgs;
this.symTable = symTable;
}
示例15: visit
import org.walkmod.javalang.ast.expr.Expression; //导入依赖的package包/类
@Override
public Node visit(EnumConstantDeclaration _n, Object _arg) {
JavadocComment javaDoc = cloneNodes(_n.getJavaDoc(), _arg);
List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
List<Expression> args = visit(_n.getArgs(), _arg);
List<BodyDeclaration> classBody = visit(_n.getClassBody(), _arg);
EnumConstantDeclaration r = new EnumConstantDeclaration(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(),
_n.getEndColumn(), javaDoc, annotations, _n.getName(), args, classBody);
return r;
}