| 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..52bef9d0ce3778b0a9d7efe2d3d98584811f0051
|
| --- /dev/null
|
| +++ b/lib/compiler/implementation/dart_backend/usage.dart
|
| @@ -0,0 +1,54 @@
|
| +// 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 {
|
| + final String id;
|
| + const UsageKind(String this.id);
|
| +
|
| + static final UsageKind CONSTRUCTOR_NAME =
|
| + const UsageKind('constructor_name');
|
| + 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 ConstructorNameUsage extends Usage {
|
| + final FunctionElement constructor;
|
| + ConstructorNameUsage(this.constructor) : super(UsageKind.CONSTRUCTOR_NAME);
|
| + String rename(ConflictingRenamer renamer) =>
|
| + renamer.renameConstructorName(constructor);
|
| +}
|
| +class TypeUsage extends Usage {
|
| + final Type type;
|
| + TypeUsage(this.type) : super(UsageKind.TYPE);
|
| + String rename(ConflictingRenamer renamer) =>
|
| + renamer.renameElement(type.element);
|
| +}
|
| +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);
|
| +}
|
|
|