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 /// | 9 /// |
10 /// Runtime type information. This module defines the mapping from | 10 /// Runtime type information. This module defines the mapping from |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // Fallback on constructor for class types | 141 // Fallback on constructor for class types |
142 result = $obj.constructor; | 142 result = $obj.constructor; |
143 if (result == Function) { | 143 if (result == Function) { |
144 // An undecorated Function should have come from | 144 // An undecorated Function should have come from |
145 // JavaScript. Treat as untyped. | 145 // JavaScript. Treat as untyped. |
146 return $jsobject; | 146 return $jsobject; |
147 } | 147 } |
148 return result; | 148 return result; |
149 })()'''); | 149 })()'''); |
150 | 150 |
151 read(value) => JS('', '#[#]', value, _runtimeType); | 151 _getRuntimeType(value) => JS('', '#[#]', value, _runtimeType); |
152 | 152 |
153 /// Tag the runtime type of [value] to be type [t]. | 153 /// Tag the runtime type of [value] to be type [t]. |
154 void tag(value, t) { | 154 void tag(value, t) { |
155 JS('', '#[#] = #', value, _runtimeType, t); | 155 JS('', '#[#] = #', value, _runtimeType, t); |
156 } | 156 } |
157 | 157 |
158 void tagComputed(value, compute) { | 158 void tagComputed(value, compute) { |
159 JS('', '#(#, #, { get: # })', defineProperty, value, _runtimeType, compute); | 159 JS('', '#(#, #, { get: # })', defineProperty, value, _runtimeType, compute); |
160 } | 160 } |
161 | 161 |
162 void tagLazy(value, compute) { | 162 void tagLazy(value, compute) { |
163 JS('', '#(#, #, { get: # })', | 163 JS('', '#(#, #, { get: # })', |
164 defineLazyProperty, value, _runtimeType, compute); | 164 defineLazyProperty, value, _runtimeType, compute); |
165 } | 165 } |
OLD | NEW |