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

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

Issue 10836261: dart2dart Preproces placeholders instead of renaming them lazily, (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
Index: lib/compiler/implementation/dart_backend/placeholder.dart
diff --git a/lib/compiler/implementation/dart_backend/placeholder.dart b/lib/compiler/implementation/dart_backend/placeholder.dart
index 0c847170c978bbb46a800806a9535878e1da3324..62e564edcf5f45b774c6af8ad67fe49f988da092 100644
--- a/lib/compiler/implementation/dart_backend/placeholder.dart
+++ b/lib/compiler/implementation/dart_backend/placeholder.dart
@@ -2,46 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-class Placeholder {
- const Placeholder();
- abstract String rename(ConflictingRenamer renamer);
-}
-
-class NullPlaceholder extends Placeholder {
- String rename(ConflictingRenamer renamer) => '';
- String toString() => 'null_placeholder[]';
-}
-
-class PrivatePlaceholder extends Placeholder {
- final LibraryElement library;
- final Identifier node;
- PrivatePlaceholder(this.library, this.node);
- String rename(ConflictingRenamer renamer) =>
- renamer.renamePrivateIdentifier(library, node.source.slowToString());
- String toString() => 'private_placeholder[node($node), $library]';
-}
-
-class ElementPlaceholder extends Placeholder {
- final Element element;
- ElementPlaceholder(this.element);
- String rename(ConflictingRenamer renamer) => renamer.renameElement(element);
- String toString() => 'element_placeholder[$element]';
-}
-
-class UnresolvedPlaceholder extends Placeholder {
- const UnresolvedPlaceholder();
- String rename(ConflictingRenamer renamer) =>
- renamer.generateUniqueName('unresolved');
- String toString() => 'unresolved_placeholder';
-}
-
-class LocalPlaceholder extends Placeholder {
- final FunctionElement scope;
+class LocalPlaceholder implements Hashable {
final String identifier;
- LocalPlaceholder(this.scope, this.identifier);
-
- String rename(ConflictingRenamer renamer) =>
- renamer.renameLocalIdentifier(scope, identifier);
+ final Set<Node> nodes;
+ LocalPlaceholder(this.identifier) : nodes = new Set<Node>();
+ int hashCode() => identifier.hashCode();
String toString() =>
- 'local_placeholder[scope($scope), id($identifier)]';
+ 'local_placeholder[nodes($nodes), id($identifier)]';
Anton Muhin 2012/08/15 13:45:46 nit: swap id and nodes to match declaration order.
Roman 2012/08/15 13:59:14 Done.
}

Powered by Google App Engine
This is Rietveld 408576698