| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 return closure; | 67 return closure; |
| 68 } | 68 } |
| 69 | 69 |
| 70 lazyFn(closure, computeType) { | 70 lazyFn(closure, computeType) { |
| 71 tagLazy(closure, computeType); | 71 tagLazy(closure, computeType); |
| 72 return closure; | 72 return closure; |
| 73 } | 73 } |
| 74 | 74 |
| 75 // TODO(vsm): How should we encode the runtime type? | 75 // TODO(vsm): How should we encode the runtime type? |
| 76 final _runtimeType = JS('', 'Symbol("_runtimeType")'); | 76 final _runtimeType = JS('', 'Symbol("_runtimeType")'); |
| 77 final isNamedConstructor = JS('', 'Symbol("isNamedConstructor")'); |
| 78 final dartLibraryName = JS('', 'Symbol("dartLibraryName")'); |
| 77 | 79 |
| 78 _checkPrimitiveType(obj) { | 80 _checkPrimitiveType(obj) { |
| 79 // TODO(jmesserly): JS is used to prevent type literal wrapping. Is there a | 81 // TODO(jmesserly): JS is used to prevent type literal wrapping. Is there a |
| 80 // better way we can handle this? (sra: It is super dodgy that the values | 82 // better way we can handle this? (sra: It is super dodgy that the values |
| 81 // passed to JS are different to the values passed to a regular function - the | 83 // passed to JS are different to the values passed to a regular function - the |
| 82 // semantics are not longer that of calling an interpreter. dart2js has other | 84 // semantics are not longer that of calling an interpreter. dart2js has other |
| 83 // special functions, we could do the same.) | 85 // special functions, we could do the same.) |
| 84 | 86 |
| 85 // Check for null and undefined | 87 // Check for null and undefined |
| 86 if (obj == null) return JS('', '#', Null); | 88 if (obj == null) return JS('', '#', Null); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 173 } |
| 172 | 174 |
| 173 void tagComputed(value, compute) { | 175 void tagComputed(value, compute) { |
| 174 JS('', '#(#, #, { get: # })', defineProperty, value, _runtimeType, compute); | 176 JS('', '#(#, #, { get: # })', defineProperty, value, _runtimeType, compute); |
| 175 } | 177 } |
| 176 | 178 |
| 177 void tagLazy(value, compute) { | 179 void tagLazy(value, compute) { |
| 178 JS('', '#(#, #, { get: # })', | 180 JS('', '#(#, #, { get: # })', |
| 179 defineLazyProperty, value, _runtimeType, compute); | 181 defineLazyProperty, value, _runtimeType, compute); |
| 180 } | 182 } |
| OLD | NEW |