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

Side by Side Diff: sdk/lib/_internal/js_runtime/lib/js_rti.dart

Issue 2735983003: Type of InstanceMirror on class should still be a ClassMirror when class has call method (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/js_mirrors.dart ('k') | tests/lib/lib.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 /** 5 /**
6 * This part contains helpers for supporting runtime type information. 6 * This part contains helpers for supporting runtime type information.
7 * 7 *
8 * The helper use a mixture of Dart and JavaScript objects. To indicate which is 8 * The helper use a mixture of Dart and JavaScript objects. To indicate which is
9 * used where we adopt the scheme of using explicit type annotation for Dart 9 * used where we adopt the scheme of using explicit type annotation for Dart
10 * objects and 'var' or omitted return type for JavaScript objects. 10 * objects and 'var' or omitted return type for JavaScript objects.
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 283 }
284 return allDynamic ? '' : '<$buffer>'; 284 return allDynamic ? '' : '<$buffer>';
285 } 285 }
286 286
287 /** 287 /**
288 * Returns a human-readable representation of the type of [object]. 288 * Returns a human-readable representation of the type of [object].
289 * 289 *
290 * In minified mode does *not* use unminified identifiers (even when present). 290 * In minified mode does *not* use unminified identifiers (even when present).
291 */ 291 */
292 String getRuntimeTypeString(var object) { 292 String getRuntimeTypeString(var object) {
293 // Check for function type first, since non-tearoff closures look like classes 293 if (object is Closure) {
294 // due to closure conversion. 294 // This excludes classes that implement Function via a `call` method, but
295 var functionRti = extractFunctionTypeObjectFrom(object); 295 // includes classes generated to represent closures in closure conversion.
296 if (functionRti != null) return runtimeTypeToString(functionRti); 296 var functionRti = extractFunctionTypeObjectFrom(object);
297 if (functionRti != null) {
298 return runtimeTypeToString(functionRti);
299 }
300 }
297 String className = getClassName(object); 301 String className = getClassName(object);
298 if (object == null) return className; 302 if (object == null) return className;
299 String rtiName = JS_GET_NAME(JsGetName.RTI_NAME); 303 String rtiName = JS_GET_NAME(JsGetName.RTI_NAME);
300 var rti = JS('var', r'#[#]', object, rtiName); 304 var rti = JS('var', r'#[#]', object, rtiName);
301 return "$className${joinArguments(rti, 0)}"; 305 return "$className${joinArguments(rti, 0)}";
302 } 306 }
303 307
304 Type getRuntimeType(var object) { 308 Type getRuntimeType(var object) {
305 String type = getRuntimeTypeString(object); 309 String type = getRuntimeTypeString(object);
306 return new TypeImpl(type); 310 return new TypeImpl(type);
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 * `null` and `undefined` (which we can avoid). 768 * `null` and `undefined` (which we can avoid).
765 */ 769 */
766 bool isIdentical(var s, var t) => JS('bool', '# === #', s, t); 770 bool isIdentical(var s, var t) => JS('bool', '# === #', s, t);
767 771
768 /** 772 /**
769 * Returns `true` if the JavaScript values [s] and [t] are not identical. We use 773 * Returns `true` if the JavaScript values [s] and [t] are not identical. We use
770 * this helper instead of [identical] because `identical` needs to merge 774 * this helper instead of [identical] because `identical` needs to merge
771 * `null` and `undefined` (which we can avoid). 775 * `null` and `undefined` (which we can avoid).
772 */ 776 */
773 bool isNotIdentical(var s, var t) => JS('bool', '# !== #', s, t); 777 bool isNotIdentical(var s, var t) => JS('bool', '# !== #', s, t);
OLDNEW
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/js_mirrors.dart ('k') | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698