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

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

Issue 10823346: Properly rename typedefs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | 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 76bc31d41b60119eea82f51abc3bd068d5f78e0e..b6318b8a27a610c9b284958d94d1cbffe5b0fa0d 100644
--- a/lib/compiler/implementation/dart_backend/placeholder_collector.dart
+++ b/lib/compiler/implementation/dart_backend/placeholder_collector.dart
@@ -331,24 +331,26 @@ class PlaceholderCollector extends AbstractVisitor {
}
}
final type = compiler.resolveTypeAnnotation(currentElement, node);
- if (type is !InterfaceType) return null;
- var target = node.typeName;
- 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;
- final hasPrefix = element.lookupConstructor(
- receiver.source, selector.source) === null;
- if (!hasPrefix) target = send.receiver;
+ if (type is InterfaceType || type is FunctionType) {
+ var target = node.typeName;
+ 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;
+ final hasPrefix = element is TypedefElement ||
+ element.lookupConstructor(receiver.source, selector.source)
+ === null;
+ if (!hasPrefix) target = send.receiver;
+ }
+ }
+ // TODO(antonm): is there a better way to detect unresolved types?
+ if (type !== compiler.types.dynamicType) {
+ makeTypePlaceholder(target, type);
+ } else {
+ if (!isDynamicType(node)) makeUnresolvedPlaceholder(target);
}
- }
- // TODO(antonm): is there a better way to detect unresolved types?
- if (type !== compiler.types.dynamicType) {
- makeTypePlaceholder(target, type);
- } else {
- if (!isDynamicType(node)) makeUnresolvedPlaceholder(target);
}
node.visitChildren(this);
}
@@ -403,4 +405,10 @@ class PlaceholderCollector extends AbstractVisitor {
makeElementPlaceholder(node.name, currentElement);
node.visitChildren(this);
}
+
+ visitTypedef(Typedef node) {
+ assert(currentElement is TypedefElement);
+ makeElementPlaceholder(node.name, currentElement);
+ node.visitChildren(this);
+ }
}
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698