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

Unified Diff: lib/compiler/implementation/dart_backend/placeholder_collector.dart

Issue 10966044: Properly process dart:core classes if dart:core is imported with prefix. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | « lib/compiler/implementation/dart_backend/backend.dart ('k') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/dart_backend/placeholder_collector.dart
diff --git a/lib/compiler/implementation/dart_backend/placeholder_collector.dart b/lib/compiler/implementation/dart_backend/placeholder_collector.dart
index 91dea96eccfcd4842326578a43b5dfa2282b0880..dd9a07863ed5dbe60eedca5ca8e250c459e593af 100644
--- a/lib/compiler/implementation/dart_backend/placeholder_collector.dart
+++ b/lib/compiler/implementation/dart_backend/placeholder_collector.dart
@@ -435,26 +435,31 @@ class PlaceholderCollector extends AbstractVisitor {
// We call [resolveReturnType] to allow having 'void'.
final type = compiler.resolveReturnType(currentElement, node);
if (type is InterfaceType || type is TypedefType) {
- var target = node.typeName;
+ Node target = node.typeName;
+ bool hasPrefix = false;
if (node.typeName is Send) {
final element = treeElements[node];
if (element !== null) {
final send = node.typeName.asSend();
Identifier receiver = send.receiver;
Identifier selector = send.selector;
- hasPrefix() {
- if (element is TypedefElement) return true;
- ClassElement classElement = element;
- final constructor = classElement.lookupConstructor(
- receiver.source, selector.source);
- return constructor === null;
- }
- if (!hasPrefix()) target = send.receiver;
+ getConstructor() =>
+ (element as ClassElement).lookupConstructor(
+ receiver.source, selector.source);
+ hasPrefix = (element is TypedefElement) || getConstructor() === null;
+ if (!hasPrefix) target = receiver;
}
}
// TODO(antonm): is there a better way to detect unresolved types?
if (type.element !== compiler.types.dynamicType.element) {
- makeTypePlaceholder(target, type);
+ // Corner case: dart:core type with a prefix.
+ // Most probably there are some additional problems with
+ // coreLibPrefix.Dynamic and coreLibPrefix.topLevels.
+ if (type.element.getLibrary() === coreLibrary && hasPrefix) {
+ makeNullPlaceholder(node.typeName.receiver);
+ } else {
+ makeTypePlaceholder(target, type);
+ }
} else {
if (!isDynamicType(node)) makeUnresolvedPlaceholder(target);
}
« no previous file with comments | « lib/compiler/implementation/dart_backend/backend.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698