| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// This library defines the association between runtime objects and | 5 /// This library defines the association between runtime objects and |
| 6 /// runtime types. | 6 /// runtime types. |
| 7 part of dart._runtime; | 7 part of dart._runtime; |
| 8 | 8 |
| 9 /// Runtime type information. This module defines the mapping from | 9 /// Runtime type information. This module defines the mapping from |
| 10 /// runtime objects to their runtime type information. See the types | 10 /// runtime objects to their runtime type information. See the types |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 result = getExtensionType(obj); | 131 result = getExtensionType(obj); |
| 132 if (result != null) return result; | 132 if (result != null) return result; |
| 133 | 133 |
| 134 // Fallback on constructor for class types | 134 // Fallback on constructor for class types |
| 135 result = JS('', '#.constructor', obj); | 135 result = JS('', '#.constructor', obj); |
| 136 if (JS('bool', '# === Function', result)) { | 136 if (JS('bool', '# === Function', result)) { |
| 137 // An undecorated Function should have come from JavaScript. | 137 // An undecorated Function should have come from JavaScript. |
| 138 // Treat as untyped. | 138 // Treat as untyped. |
| 139 return JS('', '#', jsobject); | 139 return JS('', '#', jsobject); |
| 140 } | 140 } |
| 141 if (result == null) { |
| 142 return JS('', '#', jsobject); |
| 143 } |
| 141 return result; | 144 return result; |
| 142 } | 145 } |
| 143 | 146 |
| 144 /// Given an internal runtime type object, wraps it in a `WrappedType` object | 147 /// Given an internal runtime type object, wraps it in a `WrappedType` object |
| 145 /// that implements the dart:core Type interface. | 148 /// that implements the dart:core Type interface. |
| 146 wrapType(type) { | 149 wrapType(type) { |
| 147 // If we've already wrapped this type once, use the previous wrapper. This | 150 // If we've already wrapped this type once, use the previous wrapper. This |
| 148 // way, multiple references to the same type return an identical Type. | 151 // way, multiple references to the same type return an identical Type. |
| 149 if (JS('bool', '#.hasOwnProperty(#)', type, _typeObject)) { | 152 if (JS('bool', '#.hasOwnProperty(#)', type, _typeObject)) { |
| 150 return JS('', '#[#]', type, _typeObject); | 153 return JS('', '#[#]', type, _typeObject); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 163 } | 166 } |
| 164 | 167 |
| 165 void tagComputed(value, compute) { | 168 void tagComputed(value, compute) { |
| 166 JS('', '#(#, #, { get: # })', defineProperty, value, _runtimeType, compute); | 169 JS('', '#(#, #, { get: # })', defineProperty, value, _runtimeType, compute); |
| 167 } | 170 } |
| 168 | 171 |
| 169 void tagLazy(value, compute) { | 172 void tagLazy(value, compute) { |
| 170 JS('', '#(#, #, { get: # })', | 173 JS('', '#(#, #, { get: # })', |
| 171 defineLazyProperty, value, _runtimeType, compute); | 174 defineLazyProperty, value, _runtimeType, compute); |
| 172 } | 175 } |
| OLD | NEW |