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

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

Issue 82693004: Fix function subtyping bug. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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
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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 int sPos = 0; 668 int sPos = 0;
669 int tPos = pos; 669 int tPos = pos;
670 // Check the remaining parameters of [t] with the first optional parameters 670 // Check the remaining parameters of [t] with the first optional parameters
671 // of [s]. 671 // of [s].
672 for (; tPos < tParametersLen ; sPos++, tPos++) { 672 for (; tPos < tParametersLen ; sPos++, tPos++) {
673 if (!isAssignable(getIndex(sOptionalParameterTypes, sPos), 673 if (!isAssignable(getIndex(sOptionalParameterTypes, sPos),
674 getIndex(tParameterTypes, tPos))) { 674 getIndex(tParameterTypes, tPos))) {
675 return false; 675 return false;
676 } 676 }
677 } 677 }
678 sPos = 0; 678 tPos = 0;
679 // Check the optional parameters of [t] with the remaing optional parameters 679 // Check the optional parameters of [t] with the remaining optional
680 // of [s]: 680 // parameters of [s]:
681 for (; tPos < tOptionalParametersLen ; sPos++, tPos++) { 681 for (; tPos < tOptionalParametersLen ; sPos++, tPos++) {
682 if (!isAssignable(getIndex(tOptionalParameterTypes, sPos), 682 if (!isAssignable(getIndex(sOptionalParameterTypes, sPos),
683 getIndex(tOptionalParameterTypes, tPos))) { 683 getIndex(tOptionalParameterTypes, tPos))) {
684 return false; 684 return false;
685 } 685 }
686 } 686 }
687 } 687 }
688 688
689 var sNamedParameters = 689 var sNamedParameters =
690 getField(s, '${JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG()}'); 690 getField(s, '${JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG()}');
691 var tNamedParameters = 691 var tNamedParameters =
692 getField(t, '${JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG()}'); 692 getField(t, '${JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG()}');
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 * and [t] are Dart values. 762 * and [t] are Dart values.
763 */ 763 */
764 bool isIdentical(var s, var t) => JS('bool', '# === #', s, t); 764 bool isIdentical(var s, var t) => JS('bool', '# === #', s, t);
765 765
766 /** 766 /**
767 * Returns [:true:] if the JavaScript values [s] and [t] are not identical. We 767 * Returns [:true:] if the JavaScript values [s] and [t] are not identical. We
768 * use this helper to avoid generating code under the invalid assumption that 768 * use this helper to avoid generating code under the invalid assumption that
769 * [s] and [t] are Dart values. 769 * [s] and [t] are Dart values.
770 */ 770 */
771 bool isNotIdentical(var s, var t) => JS('bool', '# !== #', s, t); 771 bool isNotIdentical(var s, var t) => JS('bool', '# !== #', s, t);
OLDNEW
« no previous file with comments | « no previous file | tests/language/function_subtype2_test.dart » ('j') | tests/language/function_subtype2_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698