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

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

Issue 11026027: [dart2dart] Make sure we collect element placeholders only for identifiers by ensuring (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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/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 70b81f5a63b014299c749d145761ca56ae5586ae..f3753032538b3561a5ae934db9533736fa0ae914 100644
--- a/lib/compiler/implementation/dart_backend/placeholder_collector.dart
+++ b/lib/compiler/implementation/dart_backend/placeholder_collector.dart
@@ -143,7 +143,7 @@ class PlaceholderCollector extends Visitor {
final Map<Element, ElementAst> elementAsts;
final Set<Node> nullNodes; // Nodes that should not be in output.
final Set<Identifier> unresolvedNodes;
- final Map<Element, Set<Node>> elementNodes;
+ final Map<Element, Set<Identifier>> elementNodes;
final Map<FunctionElement, FunctionScope> functionScopes;
final Map<LibraryElement, Set<Identifier>> privateNodes;
final List<DeclarationTypePlaceholder> declarationTypePlaceholders;
@@ -162,7 +162,7 @@ class PlaceholderCollector extends Visitor {
PlaceholderCollector(this.compiler, this.fixedMemberNames, this.elementAsts) :
nullNodes = new Set<Node>(),
unresolvedNodes = new Set<Identifier>(),
- elementNodes = new Map<Element, Set<Node>>(),
+ elementNodes = new Map<Element, Set<Identifier>>(),
functionScopes = new Map<FunctionElement, FunctionScope>(),
privateNodes = new Map<LibraryElement, Set<Identifier>>(),
declarationTypePlaceholders = new List<DeclarationTypePlaceholder>(),
@@ -295,6 +295,13 @@ class PlaceholderCollector extends Visitor {
}
void makeTypePlaceholder(Node node, DartType type) {
+ if (node is Send) {
+ // Prefix.
+ assert(node.receiver is Identifier);
+ assert(node.selector is Identifier);
+ makeNullPlaceholder(node.receiver);
Anton Muhin 2012/10/04 15:34:37 is it okay if we use a name with a prefix from pla
Roman 2012/10/04 16:05:59 We never use existing prefixes in the renamer anyw
Anton Muhin 2012/10/04 16:07:14 Fair. On 2012/10/04 16:05:59, Roman wrote:
+ node = node.selector;
+ }
makeElementPlaceholder(node, type.element);
}
@@ -321,7 +328,7 @@ class PlaceholderCollector extends Visitor {
nullNodes.add(node);
}
- void makeElementPlaceholder(Node node, Element element) {
+ void makeElementPlaceholder(Identifier node, Element element) {
assert(element !== null);
if (element === entryFunction) return;
if (element.getLibrary() === coreLibrary) return;
@@ -333,7 +340,7 @@ class PlaceholderCollector extends Visitor {
'Should never make element placeholder for dynamic type element',
node);
}
- elementNodes.putIfAbsent(element, () => new Set<Node>()).add(node);
+ elementNodes.putIfAbsent(element, () => new Set<Identifier>()).add(node);
}
void makePrivateIdentifier(Identifier node) {
@@ -466,6 +473,12 @@ class PlaceholderCollector extends Visitor {
typeElement === dynamicTypeElement)) {
makeNullPlaceholder(node.typeName.asSend().receiver);
} else {
+ if (hasPrefix) {
+ assert(node.typeName is Send);
+ assert(node.typeName.receiver is Identifier);
+ assert(node.typeName.selector is Identifier);
+ makeNullPlaceholder(node.typeName.receiver);
Anton Muhin 2012/10/04 15:34:37 ditto
+ }
if (typeElement !== dynamicTypeElement) {
makeTypePlaceholder(target, type);
} else {
« 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