| Index: sdk/lib/_internal/compiler/implementation/runtime_types.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/runtime_types.dart b/sdk/lib/_internal/compiler/implementation/runtime_types.dart
|
| index 3f7967a2809f62dd4f77037207c9f77fa6c79945..33a4fb9b3e34acb2cc4ff9edb9677951852468c8 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/runtime_types.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/runtime_types.dart
|
| @@ -17,8 +17,16 @@ class RuntimeTypeInformation {
|
| */
|
| final Map<String, Element> usedNames = new Map<String, Element>();
|
|
|
| + final Compiler compiler;
|
| +
|
| + RuntimeTypeInformation(this.compiler) {
|
| + // Reserve the name 'dynamic' for the dynamic type.
|
| + usedNames['dynamic'] = compiler.dynamicClass;
|
| + }
|
| +
|
| /** Get a unique name for the element. */
|
| String getName(Element element) {
|
| + if (element == compiler.dynamicClass) return 'dynamic';
|
| String guess = element.name.slowToString();
|
| String name = guess;
|
| int id = 0;
|
| @@ -30,6 +38,31 @@ class RuntimeTypeInformation {
|
| return name;
|
| }
|
|
|
| + // TODO(karlklose): remove when using type representations.
|
| + String buildStringRepresentation(DartType type) {
|
| + StringBuffer builder = new StringBuffer();
|
| + void build(DartType t) {
|
| + builder.add(getName(t.element));
|
| + if (t is InterfaceType) {
|
| + InterfaceType interface = t;
|
| + if (interface.arguments.isEmpty) return;
|
| + bool firstArgument = true;
|
| + builder.add('<');
|
| + for (DartType argument in interface.arguments) {
|
| + if (firstArgument) {
|
| + firstArgument = false;
|
| + } else {
|
| + builder.add(', ');
|
| + }
|
| + build(argument);
|
| + }
|
| + builder.add('>');
|
| + }
|
| + }
|
| + build(type);
|
| + return builder.toString();
|
| + }
|
| +
|
| bool hasTypeArguments(DartType type) {
|
| if (type is InterfaceType) {
|
| InterfaceType interfaceType = type;
|
|
|