| 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 d5c854f0396dd965e59da3c9897999d33ffcbcd0..3561852ad315fe6a4f844f41c51e9be5345f3320 100644
|
| --- a/compiler/java/com/google/dart/compiler/resolver/Elements.java
|
| +++ b/compiler/java/com/google/dart/compiler/resolver/Elements.java
|
| @@ -7,6 +7,8 @@ package com.google.dart.compiler.resolver;
|
| import com.google.common.annotations.VisibleForTesting;
|
| import com.google.common.base.Objects;
|
| import com.google.common.collect.Lists;
|
| +import com.google.dart.compiler.DartSource;
|
| +import com.google.dart.compiler.LibrarySource;
|
| import com.google.dart.compiler.Source;
|
| import com.google.dart.compiler.ast.DartClass;
|
| import com.google.dart.compiler.ast.DartClassMember;
|
| @@ -536,4 +538,19 @@ static FieldElementImplementation fieldFromNode(DartField node,
|
| }
|
| return null;
|
| }
|
| +
|
| + /**
|
| + * @return <code>true</code> if given {@link Source} represents library with given name.
|
| + */
|
| + public 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.startsWith("dart://") && libraryName.endsWith("/" + name);
|
| + }
|
| + }
|
| + return false;
|
| + }
|
| }
|
|
|