| Index: compiler/java/com/google/dart/compiler/resolver/Elements.java
|
| diff --git a/compiler/java/com/google/dart/compiler/resolver/Elements.java b/compiler/java/com/google/dart/compiler/resolver/Elements.java
|
| index 18ef336ea63978e03b75bc524726d664b510ce95..a1489db4597bff2b6ff584eeb425fbe3e660b09b 100644
|
| --- a/compiler/java/com/google/dart/compiler/resolver/Elements.java
|
| +++ b/compiler/java/com/google/dart/compiler/resolver/Elements.java
|
| @@ -35,6 +35,7 @@ import com.google.dart.compiler.common.SourceInfo;
|
| import com.google.dart.compiler.parser.Token;
|
| import com.google.dart.compiler.resolver.LabelElement.LabeledStatementType;
|
| import com.google.dart.compiler.type.InterfaceType;
|
| +import com.google.dart.compiler.type.InterfaceType.Member;
|
| import com.google.dart.compiler.type.Type;
|
| import com.google.dart.compiler.type.TypeVariable;
|
| import com.google.dart.compiler.util.Paths;
|
| @@ -703,19 +704,33 @@ static FieldElementImplementation fieldFromNode(DartField node,
|
| /**
|
| * @return <code>true</code> if given {@link Source} represents library with given name.
|
| */
|
| - public static boolean isLibrarySource(Source source, String name) {
|
| + private static boolean isLibrarySource(Source source, String name) {
|
| if (source instanceof DartSource) {
|
| DartSource dartSource = (DartSource) source;
|
| LibrarySource library = dartSource.getLibrary();
|
| if (library != null) {
|
| String libraryName = library.getName();
|
| - return libraryName.endsWith("/core/" + name);
|
| + return libraryName.endsWith(name);
|
| }
|
| }
|
| return false;
|
| }
|
|
|
| /**
|
| + * @return <code>true</code> if given {@link Source} represents code library declaration or
|
| + * implementation.
|
| + */
|
| + public static boolean isCoreLibrarySource(Source source) {
|
| + // TODO (danrubel) remove these when dartc libraries are removed
|
| + // Old core library file names
|
| + return Elements.isLibrarySource(source, "/core/corelib.dart")
|
| + || Elements.isLibrarySource(source, "/core/corelib_impl.dart")
|
| + // New core library file names
|
| + || Elements.isLibrarySource(source, "/core/core.dart")
|
| + || Elements.isLibrarySource(source, "/core/coreimpl.dart");
|
| + }
|
| +
|
| + /**
|
| * @return the {@link LibraryElement} which declares given {@link Element}.
|
| */
|
| public static LibraryElement getDeclaringLibrary(Element element) {
|
| @@ -830,4 +845,16 @@ static FieldElementImplementation fieldFromNode(DartField node,
|
| Modifiers modifiers = field.getModifiers();
|
| return modifiers.isStatic() || modifiers.isConstant();
|
| }
|
| +
|
| + /**
|
| + * @return <code>true</code> if given {@link InterfaceType} overrides "noSuchMethod".
|
| + */
|
| + public static boolean handlesNoSuchMethod(InterfaceType type) {
|
| + Member member = type.lookupMember("noSuchMethod");
|
| + if (member == null) {
|
| + return false;
|
| + }
|
| + Source source = member.getElement().getSourceInfo().getSource();
|
| + return !isCoreLibrarySource(source);
|
| + }
|
| }
|
|
|