@Override public ResolvedType visit(ConditionalExpr node, Boolean solveLambdas) { return node.getThenExpr().accept(this, solveLambdas); }
@Override public ResolvedType visit(AssignExpr node, Boolean solveLambdas) { return node.getTarget().accept(this, solveLambdas); }
@Override public void visit(SingleMemberAnnotationExpr n, Void arg) { // performance n.getMemberValue().accept(this, arg); }
@Override public ResolvedType visit(EnclosedExpr node, Boolean solveLambdas) { return node.getInner().accept(this, solveLambdas); }
@Override public ResolvedType visit(ConditionalExpr node, Boolean solveLambdas) { return node.getThenExpr().accept(this, solveLambdas); }
@Override public ResolvedType visit(EnclosedExpr node, Boolean solveLambdas) { return node.getInner().accept(this, solveLambdas); }
@Override public ResolvedType visit(AssignExpr node, Boolean solveLambdas) { return node.getTarget().accept(this, solveLambdas); }
@Override public ResolvedType visit(EnclosedExpr node, Boolean solveLambdas) { return node.getInner().accept(this, solveLambdas); }
@Override public ResolvedType visit(ConditionalExpr node, Boolean solveLambdas) { return node.getThenExpr().accept(this, solveLambdas); }
@Override public ResolvedType visit(AssignExpr node, Boolean solveLambdas) { return node.getTarget().accept(this, solveLambdas); }
private Type useMvc(final MethodCallExpr n, final Context ctx) { if ("use".equals(n.getName())) { List<Expression> args = n.getArgs(); if (args.size() == 1) { Expression arg = args.get(0); if (arg instanceof ClassExpr) { return arg.accept(new TypeCollector(), ctx); } } } return null; }
@Override public ResolvedType visit(UnaryExpr node, Boolean solveLambdas) { switch (node.getOperator()) { case MINUS: case PLUS: return node.getExpression().accept(this, solveLambdas); case LOGICAL_COMPLEMENT: return ResolvedPrimitiveType.BOOLEAN; case POSTFIX_DECREMENT: case PREFIX_DECREMENT: case POSTFIX_INCREMENT: case PREFIX_INCREMENT: return node.getExpression().accept(this, solveLambdas); default: throw new UnsupportedOperationException(node.getOperator().name()); } }
@Override public ResolvedType visit(ArrayAccessExpr node, Boolean solveLambdas) { ResolvedType arrayUsageType = node.getName().accept(this, solveLambdas); if (arrayUsageType.isArray()) { return ((ResolvedArrayType) arrayUsageType).getComponentType(); } return arrayUsageType; }
@Override public ResolvedType visit(ArrayAccessExpr node, Boolean solveLambdas) { ResolvedType arrayUsageType = node.getName().accept(this, solveLambdas); if (arrayUsageType.isArray()) { return ((ResolvedArrayType) arrayUsageType).getComponentType(); } return arrayUsageType; }
@Override public ResolvedType visit(ArrayAccessExpr node, Boolean solveLambdas) { ResolvedType arrayUsageType = node.getName().accept(this, solveLambdas); if (arrayUsageType.isArray()) { return ((ResolvedArrayType) arrayUsageType).getComponentType(); } return arrayUsageType; }
@Override public void visit(final VariableDeclarator n, final Context ctx) { String id = n.getId().toStringWithoutComments(); values.put(id, n.getInit().accept(new LiteralCollector(), ctx)); }
@Override public void visit(ForeachStmt n, A arg) { HashSet<String> blockVariables = newHashSet(); this.localVariables.addLast(blockVariables); try { for (VariableDeclarator variableDeclarator : emptyIfNull(n.getVariable().getVars())) { blockVariables.add(variableDeclarator.getId().getName()); } n.getIterable().accept(this, arg); n.getBody().accept(this, arg); } finally { this.localVariables.removeLast(); } }
private String evaluateFieldNamed(String name, ClassOrInterfaceDeclaration classDeclarationOf) { for(BodyDeclaration b : classDeclarationOf.getMembers()) { if (b instanceof FieldDeclaration) { FieldDeclaration fieldDeclaration = (FieldDeclaration) b; for(VariableDeclarator variable : fieldDeclaration.getVariables()) { if(variable.getId().getName().equals(name)) { return variable.getInit().accept(this, ""); } } } } return ""; }
private Type type(final Expression expr, final Context ctx) { LocalStack vars = new LocalVariableCollector().accept(expr, ctx); Type type = vars.get(expr.toStringWithoutComments()); if (type == null) { type = expr.accept(new TypeCollector(), ctx); } return type; }
@Override public void visit(VariableDeclarationExpr n, A arg) { for (AnnotationExpr annotationExpr : emptyIfNull(n.getAnnotations())) { annotationExpr.accept(this, arg); } n.getType().accept(this, arg); Set<String> blockVariables = this.localVariables.getLast(); for (VariableDeclarator variableDeclarator : n.getVars()) { Expression expr = variableDeclarator.getInit(); if (expr != null) { expr.accept(this, arg); } blockVariables.add(variableDeclarator.getId().getName()); } }