| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 lazyAnonymousJSType(name) { | 176 lazyAnonymousJSType(name) { |
| 177 if (JS('bool', '#.has(#)', _lazyJSTypes, name)) { | 177 if (JS('bool', '#.has(#)', _lazyJSTypes, name)) { |
| 178 return JS('', '#.get(#)', _lazyJSTypes, name); | 178 return JS('', '#.get(#)', _lazyJSTypes, name); |
| 179 } | 179 } |
| 180 var ret = JS('', 'new #(null, #)', LazyJSType, name); | 180 var ret = JS('', 'new #(null, #)', LazyJSType, name); |
| 181 JS('', '#.set(#, #)', _lazyJSTypes, name, ret); | 181 JS('', '#.set(#, #)', _lazyJSTypes, name, ret); |
| 182 return ret; | 182 return ret; |
| 183 } | 183 } |
| 184 | 184 |
| 185 /// Given a WrappedType, return the internal runtime type object. | 185 /// Given a WrappedType, return the internal runtime type object. |
| 186 unwrapType(obj) => obj._wrappedType; | 186 unwrapType(WrappedType obj) => obj._wrappedType; |
| 187 | 187 |
| 188 _getRuntimeType(value) => JS('', '#[#]', value, _runtimeType); | 188 _getRuntimeType(value) => JS('', '#[#]', value, _runtimeType); |
| 189 getIsNamedConstructor(value) => JS('', '#[#]', value, isNamedConstructor); | 189 getIsNamedConstructor(value) => JS('', '#[#]', value, isNamedConstructor); |
| 190 // TODO(bmilligan): Define the symbol in rtti.dart instead of dart_library.js | 190 // TODO(bmilligan): Define the symbol in rtti.dart instead of dart_library.js |
| 191 // and get rid of the call to dart_library in the JS here. | 191 // and get rid of the call to dart_library in the JS here. |
| 192 getDartLibraryName(value) => JS('', '#[dart_library.dartLibraryName]', value); | 192 getDartLibraryName(value) => JS('', '#[dart_library.dartLibraryName]', value); |
| 193 | 193 |
| 194 /// Tag the runtime type of [value] to be type [t]. | 194 /// Tag the runtime type of [value] to be type [t]. |
| 195 void tag(value, t) { | 195 void tag(value, t) { |
| 196 JS('', '#[#] = #', value, _runtimeType, t); | 196 JS('', '#[#] = #', value, _runtimeType, t); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void tagComputed(value, compute) { | 199 void tagComputed(value, compute) { |
| 200 JS('', '#(#, #, { get: # })', defineProperty, value, _runtimeType, compute); | 200 JS('', '#(#, #, { get: # })', defineProperty, value, _runtimeType, compute); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void tagLazy(value, compute) { | 203 void tagLazy(value, compute) { |
| 204 JS('', '#(#, #, { get: # })', defineLazyProperty, value, _runtimeType, | 204 JS('', '#(#, #, { get: # })', defineLazyProperty, value, _runtimeType, |
| 205 compute); | 205 compute); |
| 206 } | 206 } |
| OLD | NEW |