use of abs.frontend.ast.TypedVarOrFieldDecl in project abstools by abstools.
the class FinalAnnotationTypeExtension method checkAssignStmt.
@Override
public void checkAssignStmt(AssignStmt s) {
VarOrFieldDecl decl = s.getVar().getDecl();
if (decl instanceof TypedVarOrFieldDecl) {
TypedVarOrFieldDecl d = (TypedVarOrFieldDecl) decl;
// Not sure if this code will encounter delta bodies:
if (d.isFinal()) {
String name = d.getName();
boolean isField = (d instanceof FieldDecl);
String kind = isField ? "field" : "variable";
add(new TypeError(s, ErrorMessage.ASSIGN_TO_FINAL, kind, name));
}
} else {
// It's a PatternVarDecl. Assume these are never final.
}
}
Aggregations