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

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
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 interface Placeholder {}
Anton Muhin 2012/08/15 12:19:30 no interfaces, please. Esp. empty ones.
Roman 2012/08/15 12:43:21 Why not?
6 const Placeholder();
7 abstract String rename(ConflictingRenamer renamer);
8 }
9 6
10 class NullPlaceholder extends Placeholder { 7 class NullPlaceholder implements Placeholder {
11 String rename(ConflictingRenamer renamer) => '';
12 String toString() => 'null_placeholder[]'; 8 String toString() => 'null_placeholder[]';
13 } 9 }
14 10
15 class PrivatePlaceholder extends Placeholder { 11 class PrivatePlaceholder implements Placeholder {
16 final LibraryElement library; 12 final LibraryElement library;
17 final Identifier node; 13 final Identifier node;
18 PrivatePlaceholder(this.library, this.node); 14 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]'; 15 String toString() => 'private_placeholder[node($node), $library]';
22 } 16 }
23 17
24 class ElementPlaceholder extends Placeholder { 18 class ElementPlaceholder implements Placeholder {
25 final Element element; 19 final Element element;
26 ElementPlaceholder(this.element); 20 ElementPlaceholder(this.element);
27 String rename(ConflictingRenamer renamer) => renamer.renameElement(element);
28 String toString() => 'element_placeholder[$element]'; 21 String toString() => 'element_placeholder[$element]';
29 } 22 }
30 23
31 class UnresolvedPlaceholder extends Placeholder { 24 class UnresolvedPlaceholder implements Placeholder {
32 const UnresolvedPlaceholder(); 25 const UnresolvedPlaceholder();
33 String rename(ConflictingRenamer renamer) =>
34 renamer.generateUniqueName('unresolved');
35 String toString() => 'unresolved_placeholder'; 26 String toString() => 'unresolved_placeholder';
36 } 27 }
37 28
38 class LocalPlaceholder extends Placeholder { 29 class LocalPlaceholder implements Placeholder {
39 final FunctionElement scope; 30 final FunctionElement scope;
40 final String identifier; 31 final String identifier;
41 LocalPlaceholder(this.scope, this.identifier); 32 LocalPlaceholder(this.scope, this.identifier);
42
43 String rename(ConflictingRenamer renamer) =>
44 renamer.renameLocalIdentifier(scope, identifier);
45 String toString() => 33 String toString() =>
46 'local_placeholder[scope($scope), id($identifier)]'; 34 'local_placeholder[scope($scope), id($identifier)]';
47 } 35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698