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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
Anton Muhin 2012/08/15 13:45:46 time to merge into placeholder_collect.dart?
Roman 2012/08/15 13:59:14 Done.
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class Placeholder { 5 class LocalPlaceholder implements Hashable {
6 const Placeholder(); 6 final String identifier;
7 abstract String rename(ConflictingRenamer renamer); 7 final Set<Node> nodes;
8 LocalPlaceholder(this.identifier) : nodes = new Set<Node>();
9 int hashCode() => identifier.hashCode();
10 String toString() =>
11 '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.
8 } 12 }
9
10 class NullPlaceholder extends Placeholder {
11 String rename(ConflictingRenamer renamer) => '';
12 String toString() => 'null_placeholder[]';
13 }
14
15 class PrivatePlaceholder extends Placeholder {
16 final LibraryElement library;
17 final Identifier node;
18 PrivatePlaceholder(this.library, this.node);
19 String rename(ConflictingRenamer renamer) =>
20 renamer.renamePrivateIdentifier(library, node.source.slowToString());
21 String toString() => 'private_placeholder[node($node), $library]';
22 }
23
24 class ElementPlaceholder extends Placeholder {
25 final Element element;
26 ElementPlaceholder(this.element);
27 String rename(ConflictingRenamer renamer) => renamer.renameElement(element);
28 String toString() => 'element_placeholder[$element]';
29 }
30
31 class UnresolvedPlaceholder extends Placeholder {
32 const UnresolvedPlaceholder();
33 String rename(ConflictingRenamer renamer) =>
34 renamer.generateUniqueName('unresolved');
35 String toString() => 'unresolved_placeholder';
36 }
37
38 class LocalPlaceholder extends Placeholder {
39 final FunctionElement scope;
40 final String identifier;
41 LocalPlaceholder(this.scope, this.identifier);
42
43 String rename(ConflictingRenamer renamer) =>
44 renamer.renameLocalIdentifier(scope, identifier);
45 String toString() =>
46 'local_placeholder[scope($scope), id($identifier)]';
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698