當前位置: 首頁>>代碼示例>>Java>>正文


Java Expression類代碼示例

本文整理匯總了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;
}
 
開發者ID:rpau,項目名稱:javalang,代碼行數:23,代碼來源:ModifierVisitorAdapter.java

示例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);
        }
    }

}
 
開發者ID:rpau,項目名稱:javalang-compiler,代碼行數:24,代碼來源:SymbolVisitorAdapter.java

示例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;
}
 
開發者ID:rpau,項目名稱:javalang,代碼行數:17,代碼來源:GenericVisitorAdapter.java

示例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);
    }
}
 
開發者ID:rpau,項目名稱:javalang-compiler,代碼行數:27,代碼來源:TypeVisitorAdapter.java

示例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();
                    }
                }
            }
        }
    }
 
開發者ID:rpau,項目名稱:javalang-compiler,代碼行數:23,代碼來源:RemoveUnusedSymbolsAction.java

示例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");
}
 
開發者ID:rpau,項目名稱:javalang,代碼行數:19,代碼來源:ASTParser.java

示例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();
                            }
                        }
                    }
                }
            }
        }
    }
 
開發者ID:rpau,項目名稱:javalang-compiler,代碼行數:24,代碼來源:RemoveUnusedSymbolsAction.java

示例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);
        }
    }
}
 
開發者ID:rpau,項目名稱:javalang,代碼行數:22,代碼來源:VoidVisitorAdapter.java

示例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");
}
 
開發者ID:rpau,項目名稱:javalang,代碼行數:20,代碼來源:ASTParser.java

示例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");
}
 
開發者ID:rpau,項目名稱:javalang,代碼行數:21,代碼來源:ASTParser.java

示例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");
}
 
開發者ID:rpau,項目名稱:javalang,代碼行數:19,代碼來源:ASTParser.java

示例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");
}
 
開發者ID:rpau,項目名稱:javalang,代碼行數:19,代碼來源:ASTParser.java

示例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;

}
 
開發者ID:rpau,項目名稱:javalang-compiler,代碼行數:8,代碼來源:GenericsBuilderFromMethodParameterTypes.java

示例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;
}
 
開發者ID:rpau,項目名稱:javalang-compiler,代碼行數:8,代碼來源:AbstractGenericsBuilderFromParameterTypes.java

示例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;
}
 
開發者ID:rpau,項目名稱:javalang,代碼行數:11,代碼來源:CloneVisitor.java


注:本文中的org.walkmod.javalang.ast.expr.Expression類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。