Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Unified Diff: compiler/java/com/google/dart/compiler/resolver/Elements.java

Issue 9149008: Fixes for parsing warnigs, issue 1060. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698