Skip to content

Commit

Permalink
fixes #200, library prefixes for unknown imports
Browse files Browse the repository at this point in the history
Take 2. The first version passed checker_test but not inferred_type_test. The library prefix staticElement check needs to come first.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1161603009
  • Loading branch information
John Messerly committed Jun 3, 2015
1 parent 33eee25 commit 8865229
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 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,16 @@ _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;

if (isLibraryPrefix(node)) return false;

// Null type happens when we have unknown identifiers, like a dart: import
// that doesn't resolve.
var type = node.staticType;
return type == null || type.isDynamic;
}

bool isLibraryPrefix(Expression node) =>
node is SimpleIdentifier && node.staticElement is PrefixElement;
Expand Down

0 comments on commit 8865229

Please sign in to comment.