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

Unified Diff: lib/src/utils.dart

Issue 1165823002: fixes #200, library prefixes for unknown imports (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/utils.dart
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index 4c7339520c673f724b77c967c1d74164a4615bbe..9f21703d7deae66f079227fafa1807afc6f289ae 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -207,8 +207,15 @@ _MemberTypeGetter _memberTypeGetter(ExecutableElement member) {
return f;
}
-bool isDynamicTarget(Expression node) =>
- node != null && !isLibraryPrefix(node) && node.staticType.isDynamic;
+bool isDynamicTarget(Expression node) {
+ if (node == null) return false;
+ var type = node.staticType;
+
+ // This is an unknown identifier, like an import that doesn't resolve.
+ if (type == null) return true;
+
+ return type.isDynamic && !isLibraryPrefix(node);
+}
bool isLibraryPrefix(Expression node) =>
node is SimpleIdentifier && node.staticElement is PrefixElement;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698