}
}
}.accept(func);
for (int i = 0; i < nameRefs.size(); ++i) {
JsNameRef nameRef = (JsNameRef) nameRefs.get(i);
SourceInfo info = nativeMethod.getSourceInfo();
// TODO: make this tighter when we have real source info
// JSourceInfo info = translateInfo(nameRef.getInfo());
String ident = nameRef.getIdent();
HasEnclosingType node = (HasEnclosingType) program.jsniMap.get(ident);
if (node == null) {
node = parseJsniRef(info, x, ident);
if (node == null) {
continue; // already reported error
}
program.jsniMap.put(ident, node);
}
assert (node != null);
CanBeStatic canBeStatic = (CanBeStatic) node;
HasName hasName = (HasName) node;
boolean isField = node instanceof JField;
assert (isField || node instanceof JMethod);
if (canBeStatic.isStatic() && nameRef.getQualifier() != null) {
reportJsniError(info, x,
"Cannot make a qualified reference to the static "
+ (isField ? "field " : "method ") + hasName.getName());
} else if (!canBeStatic.isStatic() && nameRef.getQualifier() == null) {
reportJsniError(info, x,
"Cannot make an unqualified reference to the instance "
+ (isField ? "field " : "method ") + hasName.getName());
}