}
// @Override
public boolean visit(JClassType x, Context ctx) {
// have I already been visited as a super type?
JsScope myScope = (JsScope) classScopes.get(x);
if (myScope != null) {
push(myScope);
return false;
}
// My seed function name
names.put(x, topScope.declareName(getNameString(x), x.getShortName()));
// My class scope
if (x.extnds == null) {
myScope = objectScope;
} else {
JsScope parentScope = (JsScope) classScopes.get(x.extnds);
// Run my superclass first!
if (parentScope == null) {
accept(x.extnds);
}
parentScope = (JsScope) classScopes.get(x.extnds);
assert (parentScope != null);
/*
* WEIRD: we wedge the global interface scope in between object and all
* of its subclasses; this ensures that interface method names trump all
* (except Object method names)
*/
if (parentScope == objectScope) {
parentScope = interfaceScope;
}
myScope = new JsScope(parentScope, "class " + x.getShortName());
}
classScopes.put(x, myScope);
// Make a name for my package if it doesn't already exist
String packageName = getPackageName(x.getName());