Search in sources :

Example 1 with LocalLocation

use of scenelib.annotations.el.LocalLocation in project checker-framework by typetools.

the class ToIndexFileConverter method visit.

@Override
public Void visit(VariableDeclarationExpr expr, AElement elem) {
    List<AnnotationExpr> annos = expr.getAnnotations();
    AMethod method = (AMethod) elem;
    List<VariableDeclarator> varDecls = expr.getVariables();
    for (int i = 0; i < varDecls.size(); i++) {
        VariableDeclarator decl = varDecls.get(i);
        LocalLocation loc = new LocalLocation(decl.getNameAsString(), i);
        AField field = method.body.locals.vivify(loc);
        visitType(expr.getCommonType(), field.type);
        if (annos != null) {
            for (AnnotationExpr annoExpr : annos) {
                Annotation anno = extractAnnotation(annoExpr);
                field.tlAnnotationsHere.add(anno);
            }
        }
    }
    return null;
}
Also used : AnnotationExpr(com.github.javaparser.ast.expr.AnnotationExpr) LocalLocation(scenelib.annotations.el.LocalLocation) AMethod(scenelib.annotations.el.AMethod) Annotation(scenelib.annotations.Annotation) VariableDeclarator(com.github.javaparser.ast.body.VariableDeclarator) AField(scenelib.annotations.el.AField)

Aggregations

VariableDeclarator (com.github.javaparser.ast.body.VariableDeclarator)1 AnnotationExpr (com.github.javaparser.ast.expr.AnnotationExpr)1 Annotation (scenelib.annotations.Annotation)1 AField (scenelib.annotations.el.AField)1 AMethod (scenelib.annotations.el.AMethod)1 LocalLocation (scenelib.annotations.el.LocalLocation)1