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

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

Issue 2754583002: Fix equality invocation on native objects (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 | « no previous file | tests/lib_strong/html/client_rect_test.dart » ('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) 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 runtime operations on objects used by the code 5 /// This library defines runtime operations on objects used by the code
6 /// generator. 6 /// generator.
7 part of dart._runtime; 7 part of dart._runtime;
8 8
9 class InvocationImpl extends Invocation { 9 class InvocationImpl extends Invocation {
10 final Symbol memberName; 10 final Symbol memberName;
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 return dart.as(object, this); 615 return dart.as(object, this);
616 }; 616 };
617 $ctor.is = function is_G(object) { 617 $ctor.is = function is_G(object) {
618 return dart.is(object, this); 618 return dart.is(object, this);
619 }; 619 };
620 $ctor._check = function check_G(object) { 620 $ctor._check = function check_G(object) {
621 return dart.check(object, this); 621 return dart.check(object, this);
622 }; 622 };
623 })()'''); 623 })()''');
624 624
625 // TODO(vsm): Consider optimizing this. We may be able to statically
626 // determine which == operation to invoke given the static types.
625 equals(x, y) => JS( 627 equals(x, y) => JS(
626 '', 628 '',
627 '''(() => { 629 '''(() => {
628 if ($x == null || $y == null) return $x == $y; 630 if ($x == null || $y == null) return $x == $y;
629 let eq = $x['==']; 631 let eq = $x[dartx['==']] || $x['=='];
630 return eq ? eq.call($x, $y) : $x === $y; 632 return eq ? eq.call($x, $y) : $x === $y;
631 })()'''); 633 })()''');
632 634
633 /// Checks that `x` is not null or undefined. */ 635 /// Checks that `x` is not null or undefined. */
634 notNull(x) { 636 notNull(x) {
635 if (x == null) throwNullValueError(); 637 if (x == null) throwNullValueError();
636 return x; 638 return x;
637 } 639 }
638 640
639 /// 641 ///
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 name = '+' + name; 975 name = '+' + name;
974 } 976 }
975 return name; 977 return name;
976 } 978 }
977 979
978 /// Emulates the implicit "loadLibrary" function provided by a deferred library. 980 /// Emulates the implicit "loadLibrary" function provided by a deferred library.
979 /// 981 ///
980 /// Libraries are not actually deferred in DDC, so this just returns a future 982 /// Libraries are not actually deferred in DDC, so this just returns a future
981 /// that completes immediately. 983 /// that completes immediately.
982 Future loadLibrary() => new Future.value(); 984 Future loadLibrary() => new Future.value();
OLDNEW
« no previous file with comments | « no previous file | tests/lib_strong/html/client_rect_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698