Skip to content

Commit

Permalink
fixes #200, library prefixes for unknown imports
Browse files Browse the repository at this point in the history
R=vsm@google.com

Review URL: https://codereview.chromium.org/1165823002
  • Loading branch information
John Messerly committed Jun 2, 2015
1 parent 2b55297 commit f6a2ec2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/dev_compiler/lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f6a2ec2

Please sign in to comment.