Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/rtti.dart

Issue 2859703003: fix #29544, mixins to a class with named constructors (Closed)
Patch Set: fix to use safeGetOwnProperty Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return closure; 65 return closure;
66 } 66 }
67 67
68 lazyFn(closure, computeType) { 68 lazyFn(closure, computeType) {
69 tagLazy(closure, computeType); 69 tagLazy(closure, computeType);
70 return closure; 70 return closure;
71 } 71 }
72 72
73 // TODO(vsm): How should we encode the runtime type? 73 // TODO(vsm): How should we encode the runtime type?
74 final _runtimeType = JS('', 'Symbol("_runtimeType")'); 74 final _runtimeType = JS('', 'Symbol("_runtimeType")');
75 final isNamedConstructor = JS('', 'Symbol("isNamedConstructor")');
76 75
77 final _moduleName = JS('', 'Symbol("_moduleName")'); 76 final _moduleName = JS('', 'Symbol("_moduleName")');
78 77
79 _checkPrimitiveType(obj) { 78 _checkPrimitiveType(obj) {
80 // TODO(jmesserly): JS is used to prevent type literal wrapping. Is there a 79 // TODO(jmesserly): JS is used to prevent type literal wrapping. Is there a
81 // better way we can handle this? (sra: It is super dodgy that the values 80 // better way we can handle this? (sra: It is super dodgy that the values
82 // passed to JS are different to the values passed to a regular function - the 81 // passed to JS are different to the values passed to a regular function - the
83 // semantics are not longer that of calling an interpreter. dart2js has other 82 // semantics are not longer that of calling an interpreter. dart2js has other
84 // special functions, we could do the same.) 83 // special functions, we could do the same.)
85 84
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 180 }
182 var ret = JS('', 'new #(null, #)', LazyJSType, name); 181 var ret = JS('', 'new #(null, #)', LazyJSType, name);
183 JS('', '#.set(#, #)', _lazyJSTypes, name, ret); 182 JS('', '#.set(#, #)', _lazyJSTypes, name, ret);
184 return ret; 183 return ret;
185 } 184 }
186 185
187 /// Given a WrappedType, return the internal runtime type object. 186 /// Given a WrappedType, return the internal runtime type object.
188 unwrapType(WrappedType obj) => obj._wrappedType; 187 unwrapType(WrappedType obj) => obj._wrappedType;
189 188
190 _getRuntimeType(value) => JS('', '#[#]', value, _runtimeType); 189 _getRuntimeType(value) => JS('', '#[#]', value, _runtimeType);
191 getIsNamedConstructor(value) => JS('', '#[#]', value, isNamedConstructor);
192 190
193 /// Return the module name for a raw library object. 191 /// Return the module name for a raw library object.
194 getModuleName(value) => JS('', '#[#]', value, _moduleName); 192 getModuleName(value) => JS('', '#[#]', value, _moduleName);
195 193
196 /// Tag the runtime type of [value] to be type [t]. 194 /// Tag the runtime type of [value] to be type [t].
197 void tag(value, t) { 195 void tag(value, t) {
198 JS('', '#[#] = #', value, _runtimeType, t); 196 JS('', '#[#] = #', value, _runtimeType, t);
199 } 197 }
200 198
201 void tagComputed(value, compute) { 199 void tagComputed(value, compute) {
(...skipping 22 matching lines...) Expand all
224 if (module == null) return null; 222 if (module == null) return null;
225 JS('', '#[#] = #', module, _moduleName, name); 223 JS('', '#[#] = #', module, _moduleName, name);
226 return module; 224 return module;
227 } 225 }
228 226
229 /// Track all libraries 227 /// Track all libraries
230 void trackLibraries(String moduleName, libraries, sourceMap) { 228 void trackLibraries(String moduleName, libraries, sourceMap) {
231 JS('', '#.set(#, #)', _loadedSourceMaps, moduleName, sourceMap); 229 JS('', '#.set(#, #)', _loadedSourceMaps, moduleName, sourceMap);
232 JS('', '#.set(#, #)', _loadedModules, moduleName, libraries); 230 JS('', '#.set(#, #)', _loadedModules, moduleName, libraries);
233 } 231 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698