Chromium Code Reviews| Index: lib/compiler/implementation/ssa/ssa.dart |
| diff --git a/lib/compiler/implementation/ssa/ssa.dart b/lib/compiler/implementation/ssa/ssa.dart |
| index 3f84b30b8866e9f9ecd2a03ae050de8f1f7ea899..c16f0f52c7b50bb427dd02337eb14d721ab0cc8d 100644 |
| --- a/lib/compiler/implementation/ssa/ssa.dart |
| +++ b/lib/compiler/implementation/ssa/ssa.dart |
| @@ -24,3 +24,30 @@ |
| #source('types_propagation.dart'); |
| #source('validate.dart'); |
| #source('value_set.dart'); |
| + |
| +class RuntimeTypeInformation { |
| + String asJsString(InterfaceType type) { |
| + ClassElement element = type.element; |
| + StringBuffer buffer = new StringBuffer(); |
| + buffer.add('{'); |
| + Link<Type> arguments = type.arguments; |
| + int index = 0; |
| + element.typeParameters.forEach((name, _) { |
| + buffer.add("${name.slowToString()}: '${arguments.head}'"); |
| + if (++index < element.typeParameters.length) { |
| + buffer.add(', '); |
| + } |
| + }); |
| + buffer.add('}'); |
| + return buffer.toString(); |
|
kasperl
2012/04/30 08:48:32
How about adding the { } as part of the return:
karlklose
2012/05/01 11:20:55
Done.
|
| + } |
| + |
| + bool hasTypeArguments(Type type) { |
|
ngeoffray
2012/04/30 08:51:12
Why is that not on the Type class?
karlklose
2012/05/01 11:20:55
It isn't really used elsewhere, so I did not want
|
| + if (type is InterfaceType) { |
| + InterfaceType interfaceType = type; |
| + return (!interfaceType.arguments.isEmpty() && |
| + interfaceType.arguments.tail.isEmpty()); |
| + } |
| + return false; |
| + } |
| +} |