| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of _js_helper; | 5 part of _js_helper; |
| 6 | 6 |
| 7 String typeNameInChrome(obj) { | 7 String typeNameInChrome(obj) { |
| 8 String name = JS('String', "#.constructor.name", obj); | 8 String name = JS('String', "#.constructor.name", obj); |
| 9 return typeNameInWebKitCommon(name); | 9 return typeNameInWebKitCommon(name); |
| 10 } | 10 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 if (name == 'Object') { | 70 if (name == 'Object') { |
| 71 if (JS('bool', 'window.DataView && (# instanceof window.DataView)', obj)) { | 71 if (JS('bool', 'window.DataView && (# instanceof window.DataView)', obj)) { |
| 72 return 'DataView'; | 72 return 'DataView'; |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 return name; | 75 return name; |
| 76 } | 76 } |
| 77 | 77 |
| 78 String constructorNameFallback(object) { | 78 String constructorNameFallback(object) { |
| 79 if (object == null) return 'Null'; | 79 if (object == null) return 'Null'; |
| 80 object = getInterceptor(object); |
| 80 var constructor = JS('var', "#.constructor", object); | 81 var constructor = JS('var', "#.constructor", object); |
| 81 if (identical(JS('String', "typeof(#)", constructor), 'function')) { | 82 if (identical(JS('String', "typeof(#)", constructor), 'function')) { |
| 82 var name = JS('var', r'#.builtin$cls', constructor); | 83 var name = JS('var', r'#.builtin$cls', constructor); |
| 83 if (name != null) return name; | 84 if (name != null) return name; |
| 84 // The constructor isn't null or undefined at this point. Try | 85 // The constructor isn't null or undefined at this point. Try |
| 85 // to grab hold of its name. | 86 // to grab hold of its name. |
| 86 name = JS('var', '#.name', constructor); | 87 name = JS('var', '#.name', constructor); |
| 87 // If the name is a non-empty string, we use that as the type | 88 // If the name is a non-empty string, we use that as the type |
| 88 // name of this object. On Firefox, we often get 'Object' as | 89 // name of this object. On Firefox, we often get 'Object' as |
| 89 // the constructor name even for more specialized objects so | 90 // the constructor name even for more specialized objects so |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 } | 302 } |
| 302 var isLeaf = | 303 var isLeaf = |
| 303 (leafTags != null) && JS('bool', '(#[#]) === true', leafTags, tag); | 304 (leafTags != null) && JS('bool', '(#[#]) === true', leafTags, tag); |
| 304 if (isLeaf) { | 305 if (isLeaf) { |
| 305 return makeDispatchRecord(interceptor, false, null); | 306 return makeDispatchRecord(interceptor, false, null); |
| 306 } else { | 307 } else { |
| 307 var proto = JS('', 'Object.getPrototypeOf(#)', obj); | 308 var proto = JS('', 'Object.getPrototypeOf(#)', obj); |
| 308 return makeDispatchRecord(interceptor, proto, null); | 309 return makeDispatchRecord(interceptor, proto, null); |
| 309 } | 310 } |
| 310 } | 311 } |
| OLD | NEW |