Chromium Code Reviews| Index: lib/compiler/implementation/lib/js_helper.dart |
| diff --git a/lib/compiler/implementation/lib/js_helper.dart b/lib/compiler/implementation/lib/js_helper.dart |
| index 8d1f3013035ed67bb9683086263fe286aa45f756..8f13a2c0432b39fa5f4dc144ffb1535c33a2f22a 100644 |
| --- a/lib/compiler/implementation/lib/js_helper.dart |
| +++ b/lib/compiler/implementation/lib/js_helper.dart |
| @@ -1289,3 +1289,23 @@ void throwNoSuchMethod(obj, name, arguments) { |
| void throwCyclicInit(String staticName) { |
| throw new RuntimeError("Cyclic initialization for static $staticName"); |
| } |
| + |
| +class TypeImpl implements Type { |
| + var s; |
|
kasperl
2012/09/14 07:26:48
This s will be visible to the outside. Give it a b
ngeoffray
2012/09/14 07:30:21
var s -> String s?
karlklose
2012/09/14 12:07:13
Done.
karlklose
2012/09/14 12:07:13
Done.
|
| + TypeImpl(this.s); |
| + toString() => s; |
| +} |
| + |
| +Type getOrCreateCachedRuntimeType(String key) { |
| + Type runtimeType = JS('Object', @'$.runtimeTypeCache[#]', key); |
| + if (runtimeType == null) { |
| + runtimeType = new TypeImpl(key); |
| + JS('void', @'$.runtimeTypeCache[#] = #', key, runtimeType); |
| + } |
| + return runtimeType; |
| +} |
| + |
| +String getRuntimeTypeString(var object) { |
| + var typeInfo = JS('Object', @'#.builtin$typeInfo', object); |
| + return JS('String', @'#.runtimeType', typeInfo); |
| +} |