Index: sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
index 2dccf1c79f892854b97258516c45618e69cf4195..36f86abc3d66139b1e30d3bbc1aa8a2f639d58de 100644 |
--- a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
@@ -1139,6 +1139,7 @@ class Null { |
} |
setRuntimeTypeInfo(target, typeInfo) { |
+ assert(typeInfo == null || isJsArray(typeInfo)); |
// We have to check for null because factories may return null. |
if (target != null) JS('var', r'#.builtin$typeInfo = #', target, typeInfo); |
} |
@@ -1489,9 +1490,26 @@ class TypeImpl implements Type { |
} |
} |
+String getClassName(var object) { |
ngeoffray
2012/11/16 13:47:35
Duplicating Primitives.objectTypeName?
karlklose
2012/11/20 10:35:26
Only in some cases: if constructorNameFallback can
|
+ return JS('String', r'#.constructor.builtin$cls', object); |
+} |
+ |
String getRuntimeTypeString(var object) { |
+ String className = isJsArray(object) ? 'List' : getClassName(object); |
var typeInfo = JS('var', r'#.builtin$typeInfo', object); |
- return JS('String', r'#.runtimeType', typeInfo); |
+ if (typeInfo == null) return className; |
+ StringBuffer arguments = new StringBuffer(); |
+ for (var i = 0; i < typeInfo.length; i++) { |
+ if (i > 0) { |
+ arguments.add(', '); |
+ } |
+ var argument = typeInfo[i]; |
+ if (argument == null) { |
+ argument = 'dynamic'; |
+ } |
+ arguments.add(argument); |
+ } |
+ return '$className<$arguments>'; |
} |
createRuntimeType(String name) => new TypeImpl(name); |