Chromium Code Reviews| Index: lib/compiler/implementation/dart_backend/usage.dart |
| diff --git a/lib/compiler/implementation/dart_backend/usage.dart b/lib/compiler/implementation/dart_backend/usage.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..492599d5a3c0c9cd013a06828f93adf47b215ca7 |
| --- /dev/null |
| +++ b/lib/compiler/implementation/dart_backend/usage.dart |
| @@ -0,0 +1,46 @@ |
| +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| +// 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 UsageKind { |
|
Anton Muhin
2012/08/07 16:00:30
where do you use kinds?
Roman
2012/08/08 06:46:14
Removed
|
| + final String id; |
| + const UsageKind(String this.id); |
| + |
| + static final UsageKind TYPE = |
| + const UsageKind('type'); |
| + static final UsageKind METHOD = |
| + const UsageKind('method'); |
| + // Common-case resolved element. This should go away. |
| + static final UsageKind ELEMENT = |
| + const UsageKind('element'); |
| + // Do not emit. |
| + static final UsageKind NULL = |
| + const UsageKind('null'); |
| +} |
| + |
| +class Usage { |
| + final UsageKind kind; |
| + Usage(this.kind); |
| + abstract String rename(ConflictingRenamer renamer); |
| +} |
| + |
| +class TypeUsage extends Usage { |
| + final Type type; |
| + TypeUsage(this.type) : super(UsageKind.TYPE); |
| + String rename(ConflictingRenamer renamer) => |
| + 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
|
| +} |
| +class MethodUsage extends Usage { |
| + final Element method; |
| + MethodUsage(this.method) : super(UsageKind.METHOD); |
| + String rename(ConflictingRenamer renamer) => renamer.renameElement(method); |
| +} |
| +class NullUsage extends Usage { |
| + NullUsage() : super(UsageKind.NULL); |
| + String rename(ConflictingRenamer renamer) => ''; |
| +} |
| +class ElementUsage extends Usage { |
| + final Element element; |
| + ElementUsage(this.element) : super(UsageKind.ELEMENT); |
| + String rename(ConflictingRenamer renamer) => renamer.renameElement(element); |
| +} |