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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 if (JS('bool', 'typeof # == "symbol"', obj)) { | 103 if (JS('bool', 'typeof # == "symbol"', obj)) { |
104 // Note: this is a JS Symbol, not a Dart one. | 104 // Note: this is a JS Symbol, not a Dart one. |
105 return JS('', '#', jsobject); | 105 return JS('', '#', jsobject); |
106 } | 106 } |
107 | 107 |
108 return null; | 108 return null; |
109 } | 109 } |
110 | 110 |
111 getFunctionType(obj) { | 111 getFunctionType(obj) { |
112 // TODO(vsm): Encode this properly on the function for Dart-generated code. | 112 // TODO(vsm): Encode this properly on the function for Dart-generated code. |
113 var args = JS('', 'Array(#.length).fill(#)', obj, dynamic); | 113 var args = JS('List', 'Array(#.length).fill(#)', obj, dynamic); |
114 return fnType(bottom, args, JS('', 'void 0')); | 114 return fnType(bottom, args, JS('', 'void 0')); |
115 } | 115 } |
116 | 116 |
117 /// Returns the runtime representation of the type of obj. | 117 /// Returns the runtime representation of the type of obj. |
118 /// | 118 /// |
119 /// The resulting object is used internally for runtime type checking. This is | 119 /// The resulting object is used internally for runtime type checking. This is |
120 /// different from the user-visible Type object returned by calling | 120 /// different from the user-visible Type object returned by calling |
121 /// `runtimeType` on some Dart object. | 121 /// `runtimeType` on some Dart object. |
122 getReifiedType(obj) { | 122 getReifiedType(obj) { |
123 var result = _checkPrimitiveType(obj); | 123 var result = _checkPrimitiveType(obj); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 if (module == null) return null; | 222 if (module == null) return null; |
223 JS('', '#[#] = #', module, _moduleName, name); | 223 JS('', '#[#] = #', module, _moduleName, name); |
224 return module; | 224 return module; |
225 } | 225 } |
226 | 226 |
227 /// Track all libraries | 227 /// Track all libraries |
228 void trackLibraries(String moduleName, libraries, sourceMap) { | 228 void trackLibraries(String moduleName, libraries, sourceMap) { |
229 JS('', '#.set(#, #)', _loadedSourceMaps, moduleName, sourceMap); | 229 JS('', '#.set(#, #)', _loadedSourceMaps, moduleName, sourceMap); |
230 JS('', '#.set(#, #)', _loadedModules, moduleName, libraries); | 230 JS('', '#.set(#, #)', _loadedModules, moduleName, libraries); |
231 } | 231 } |
OLD | NEW |