// TODO(brianwilkerson) Report this error?
}
simpleIdentifier.setStaticElement(element);
if (node.getNewKeyword() != null) {
if (element instanceof ClassElement) {
ConstructorElement constructor = ((ClassElement) element).getUnnamedConstructor();
if (constructor == null) {
// TODO(brianwilkerson) Report this error.
} else {
simpleIdentifier.setStaticElement(constructor);
}
} else {
// TODO(brianwilkerson) Report this error.
}
}
}
} else if (identifier instanceof PrefixedIdentifier) {
PrefixedIdentifier prefixedIdentifier = (PrefixedIdentifier) identifier;
SimpleIdentifier prefix = prefixedIdentifier.getPrefix();
SimpleIdentifier name = prefixedIdentifier.getIdentifier();
Element element = resolveSimpleIdentifier(prefix);
if (element == null) {
// resolver.reportError(StaticWarningCode.UNDEFINED_IDENTIFIER, prefix, prefix.getName());
} else {
if (element instanceof PrefixElement) {
prefix.setStaticElement(element);
// TODO(brianwilkerson) The prefix needs to be resolved to the element for the import that
// defines the prefix, not the prefix's element.
// TODO(brianwilkerson) Report this error?
element = resolver.getNameScope().lookup(identifier, definingLibrary);
name.setStaticElement(element);
return null;
}
LibraryElement library = element.getLibrary();
if (library == null) {
// TODO(brianwilkerson) We need to understand how the library could ever be null.
AnalysisEngine.getInstance().getLogger().logError(
"Found element with null library: " + element.getName());
} else if (!library.equals(definingLibrary)) {
// TODO(brianwilkerson) Report this error.
}
name.setStaticElement(element);
if (node.getNewKeyword() == null) {
if (element instanceof ClassElement) {
Element memberElement = lookupGetterOrMethod(
((ClassElement) element).getType(),
name.getName());
if (memberElement == null) {
memberElement = ((ClassElement) element).getNamedConstructor(name.getName());
if (memberElement == null) {
memberElement = lookUpSetter(
prefix,
((ClassElement) element).getType(),
name.getName());
}
}
if (memberElement == null) {
// reportGetterOrSetterNotFound(prefixedIdentifier, name, element.getDisplayName());
} else {
name.setStaticElement(memberElement);
}
} else {
// TODO(brianwilkerson) Report this error.
}
} else {
if (element instanceof ClassElement) {
ConstructorElement constructor = ((ClassElement) element).getNamedConstructor(name.getName());
if (constructor == null) {
// TODO(brianwilkerson) Report this error.
} else {
name.setStaticElement(constructor);
}