protected Decl getEnclosingScope(Class c) { for (int i = enclosingScopes.size() - 1; i >= 0; --i) { Decl d = enclosingScopes.get(i); if (c.isInstance(d)) { return d; } } return null; }