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

Side by Side Diff: sdk/lib/_internal/compiler/js_lib/js_rti.dart

Issue 1082463003: dart2js: Remove obsolete shortcut code in function-type checking. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 if (rti != null) { 393 if (rti != null) {
394 // If the type has type variables (that is, `rti != null`), make a copy of 394 // If the type has type variables (that is, `rti != null`), make a copy of
395 // the type arguments and insert [o] in the first position to create a 395 // the type arguments and insert [o] in the first position to create a
396 // compound type representation. 396 // compound type representation.
397 rti = JS('JSExtendableArray', '#.slice()', rti); // Make a copy. 397 rti = JS('JSExtendableArray', '#.slice()', rti); // Make a copy.
398 JS('', '#.splice(0, 0, #)', rti, type); // Insert type at position 0. 398 JS('', '#.splice(0, 0, #)', rti, type); // Insert type at position 0.
399 type = rti; 399 type = rti;
400 } else if (hasField(t, '${JS_FUNCTION_TYPE_TAG()}')) { 400 } else if (hasField(t, '${JS_FUNCTION_TYPE_TAG()}')) {
401 // Functions are treated specially and have their type information stored 401 // Functions are treated specially and have their type information stored
402 // directly in the instance. 402 // directly in the instance.
403 var signatureName =
404 '${JS_OPERATOR_IS_PREFIX()}_${getField(t, JS_FUNCTION_TYPE_TAG())}';
405 if (hasField(o, signatureName)) return true;
406 var targetSignatureFunction = getField(o, '${JS_SIGNATURE_NAME()}'); 403 var targetSignatureFunction = getField(o, '${JS_SIGNATURE_NAME()}');
407 if (targetSignatureFunction == null) return false; 404 if (targetSignatureFunction == null) return false;
408 type = invokeOn(targetSignatureFunction, o, null); 405 type = invokeOn(targetSignatureFunction, o, null);
409 return isFunctionSubtype(type, t); 406 return isFunctionSubtype(type, t);
410 } 407 }
411 return isSubtype(type, t); 408 return isSubtype(type, t);
412 } 409 }
413 410
414 Object subtypeOfRuntimeTypeCast(Object object, var type) { 411 Object subtypeOfRuntimeTypeCast(Object object, var type) {
415 if (object != null && !checkSubtypeOfRuntimeType(object, type)) { 412 if (object != null && !checkSubtypeOfRuntimeType(object, type)) {
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 * `null` and `undefined` (which we can avoid). 675 * `null` and `undefined` (which we can avoid).
679 */ 676 */
680 bool isIdentical(var s, var t) => JS('bool', '# === #', s, t); 677 bool isIdentical(var s, var t) => JS('bool', '# === #', s, t);
681 678
682 /** 679 /**
683 * Returns `true` if the JavaScript values [s] and [t] are not identical. We use 680 * Returns `true` if the JavaScript values [s] and [t] are not identical. We use
684 * this helper instead of [identical] because `identical` needs to merge 681 * this helper instead of [identical] because `identical` needs to merge
685 * `null` and `undefined` (which we can avoid). 682 * `null` and `undefined` (which we can avoid).
686 */ 683 */
687 bool isNotIdentical(var s, var t) => JS('bool', '# !== #', s, t); 684 bool isNotIdentical(var s, var t) => JS('bool', '# !== #', s, t);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698