Chromium Code Reviews| Index: sdk/lib/_internal/lib/js_helper.dart |
| diff --git a/sdk/lib/_internal/lib/js_helper.dart b/sdk/lib/_internal/lib/js_helper.dart |
| index 9147ae536e3aae27091536c0a31b24355b6255a4..f062751967c140dfe502bf0c787b6e1bdac2a3c8 100644 |
| --- a/sdk/lib/_internal/lib/js_helper.dart |
| +++ b/sdk/lib/_internal/lib/js_helper.dart |
| @@ -48,7 +48,8 @@ import 'dart:_internal' show MappedIterable; |
| import 'dart:_js_names' show |
| extractKeys, |
| mangledNames, |
| - unmangleGlobalNameIfPreservedAnyways; |
| + unmangleGlobalNameIfPreservedAnyways, |
| + unmangleAllIdentifiersIfPreservedAnyways; |
| part 'annotations.dart'; |
| part 'constant_map.dart'; |
| @@ -650,11 +651,16 @@ class Primitives { |
| /// Creates a string containing the complete type for the class [className] |
| /// with the given type arguments. |
| + /// |
| + /// In minified mode, uses the unminified names if available. |
| static String formatType(String className, List typeArguments) { |
| - return '$className${joinArguments(typeArguments, 0)}'; |
| + return unmangleAllIdentifiersIfPreservedAnyways |
| + ('$className${joinArguments(typeArguments, 0)}'); |
| } |
| /// Returns the type of [object] as a string (including type arguments). |
| + /// |
| + /// In minified mode, uses the unminified names if available. |
| static String objectTypeName(Object object) { |
| String name = constructorNameFallback(getInterceptor(object)); |
| if (name == 'Object') { |
| @@ -676,6 +682,7 @@ class Primitives { |
| return formatType(name, getRuntimeTypeInfo(object)); |
| } |
| + /// In minified mode, uses the unminified names if available. |
| static String objectToString(Object object) { |
| String name = objectTypeName(object); |
| return "Instance of '$name'"; |
| @@ -1071,44 +1078,8 @@ class Primitives { |
| return JS('var', '#.apply(#, #)', jsFunction, function, arguments); |
| } |
| - static getConstructorOrInterceptorToken(String className) { |
| - // TODO(ahe): Generalize this and improve test coverage of |
| - // reflecting on intercepted classes. |
| - |
| - // We should probably not be mappling the dart:core interface names to the |
| - // interceptor library implementation classes like this. `JSArray` is just |
| - // one implementation of `List`, there are others that have no relationship |
| - // with JSArray other than implementing a common interface. |
| - // |
| - // For now `List` in dart:core and `JSArray` is in dart:_interceptors. We |
| - // need to maintain a distinction to get the correct library mirror. |
| - // |
| - // TODO(17394): Short term: Refactor to avoid two copies of the list of |
| - // known interceptor implementations. |
| - // |
| - // TODO(17394): Longer term: The proper interfaces with abstract methods |
| - // should be emitted. |
| - |
| - if (JS('bool', '# == "String"', className)) return const JSString(); |
| - if (JS('bool', '# == "int"', className)) return const JSInt(); |
| - if (JS('bool', '# == "double"', className)) return const JSDouble(); |
| - if (JS('bool', '# == "num"', className)) return const JSNumber(); |
| - if (JS('bool', '# == "bool"', className)) return const JSBool(); |
| - if (JS('bool', '# == "List"', className)) return const JSArray(); |
| - if (JS('bool', '# == "Null"', className)) return const JSNull(); |
| - return JS('var', 'init.allClasses[#]', className); |
| - } |
| - |
| - static bool isInterceptorToken(var object) { |
| - // This must match the list of tokens returned by |
| - // [getConstructorOrInterceptorToken] above. |
| - return JS('bool', '# === #', object, const JSString()) |
| - || JS('bool', '# === #', object, const JSInt()) |
| - || JS('bool', '# === #', object, const JSDouble()) |
| - || JS('bool', '# === #', object, const JSNumber()) |
| - || JS('bool', '# === #', object, const JSBool()) |
| - || JS('bool', '# === #', object, const JSArray()) |
| - || JS('bool', '# === #', object, const JSNull()); |
| + static _mangledNameMatchesType(String mangledName, TypeImpl type) { |
| + return JS('bool', '#== #', mangledName, type._typeName); |
|
karlklose
2014/04/28 14:04:25
Missing space before ==.
floitsch
2014/04/30 19:04:38
Done.
|
| } |
| static bool identicalImplementation(a, b) { |