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

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

Issue 11366078: Report error for deprecated #library #import #source (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 55f1401de474b152d382c48941a05063edbfbf58..cea87a635742852e250d50d23d084eaaec95614d 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Elements.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Elements.java
@@ -717,13 +717,17 @@ 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) {
+ LibrarySource library = null;
+ if (source instanceof LibrarySource) {
+ library = (LibrarySource) source;
+ }
if (source instanceof DartSource) {
DartSource dartSource = (DartSource) source;
- LibrarySource library = dartSource.getLibrary();
- if (library != null) {
- String libraryName = library.getName();
- return libraryName.endsWith(name);
- }
+ library = dartSource.getLibrary();
+ }
+ if (library != null) {
+ String libraryName = library.getName();
+ return libraryName.endsWith(name);
}
return false;
}
@@ -748,13 +752,18 @@ static FieldElementImplementation fieldFromNode(DartField node,
* implementation.
*/
public static boolean isCoreLibrarySource(Source source) {
+ if (source != null && source.getUri() != null
+ && source.getUri().toString().equals("libraries.dart")) {
+ return true;
+ }
// 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");
+ || Elements.isLibrarySource(source, "/core/coreimpl.dart")
+ || Elements.isLibrarySource(source, "/coreimpl/coreimpl.dart");
}
public static boolean isHtmlLibrarySource(Source source) {

Powered by Google App Engine
This is Rietveld 408576698