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

Side by Side Diff: lib/compiler/implementation/dart_backend/usage.dart

Issue 10836128: A visitor that builds a map from node to "Usage". (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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 class UsageKind {
Anton Muhin 2012/08/07 16:00:30 where do you use kinds?
Roman 2012/08/08 06:46:14 Removed
6 final String id;
7 const UsageKind(String this.id);
8
9 static final UsageKind TYPE =
10 const UsageKind('type');
11 static final UsageKind METHOD =
12 const UsageKind('method');
13 // Common-case resolved element. This should go away.
14 static final UsageKind ELEMENT =
15 const UsageKind('element');
16 // Do not emit.
17 static final UsageKind NULL =
18 const UsageKind('null');
19 }
20
21 class Usage {
22 final UsageKind kind;
23 Usage(this.kind);
24 abstract String rename(ConflictingRenamer renamer);
25 }
26
27 class TypeUsage extends Usage {
28 final Type type;
29 TypeUsage(this.type) : super(UsageKind.TYPE);
30 String rename(ConflictingRenamer renamer) =>
31 renamer.renameElement(type.element);
Anton Muhin 2012/08/07 16:00:30 do you need to pass renamer if you may pass a func
Roman 2012/08/08 06:46:14 I would like to leave more info to Placeholder abo
32 }
33 class MethodUsage extends Usage {
34 final Element method;
35 MethodUsage(this.method) : super(UsageKind.METHOD);
36 String rename(ConflictingRenamer renamer) => renamer.renameElement(method);
37 }
38 class NullUsage extends Usage {
39 NullUsage() : super(UsageKind.NULL);
40 String rename(ConflictingRenamer renamer) => '';
41 }
42 class ElementUsage extends Usage {
43 final Element element;
44 ElementUsage(this.element) : super(UsageKind.ELEMENT);
45 String rename(ConflictingRenamer renamer) => renamer.renameElement(element);
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698