File tree 1 file changed +7
-4
lines changed
sdk/lib/_internal/js_dev_runtime/private 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -335,13 +335,16 @@ class JSNumber extends Interceptor implements int, double {
335
335
return _shrOtherPositive (other);
336
336
}
337
337
338
- int operator >>> (@nullCheck num other) =>
339
- throw UnimplementedError ('int.>>> is not implemented yet' );
338
+ @notNull
339
+ int operator >>> (@nullCheck num other) {
340
+ if (JS <num >('!' , '#' , other) < 0 ) throwArgumentErrorValue (other);
341
+ return _shrUnsigned (other);
342
+ }
340
343
341
344
@notNull
342
345
int _shrOtherPositive (@notNull num other) {
343
346
return JS <num >('!' , '#' , this ) > 0
344
- ? _shrBothPositive (other)
347
+ ? _shrUnsigned (other)
345
348
// For negative numbers we just clamp the shift-by amount.
346
349
// `this` could be negative but not have its 31st bit set.
347
350
// The ">>" would then shift in 0s instead of 1s. Therefore
@@ -350,7 +353,7 @@ class JSNumber extends Interceptor implements int, double {
350
353
}
351
354
352
355
@notNull
353
- int _shrBothPositive (@notNull num other) {
356
+ int _shrUnsigned (@notNull num other) {
354
357
return JS <bool >('!' , r'# > 31' , other)
355
358
// JavaScript only looks at the last 5 bits of the shift-amount. In JS
356
359
// shifting by 33 is hence equivalent to a shift by 1. Shortcut the
You can’t perform that action at this time.
0 commit comments