web: fix js-number patches to avoid assignment errors

Change-Id: Ie4ae4b1aa1a67a0153168d30d27d16d005c564a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176483
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Sigmund Cherem
2020-12-17 04:35:53 +00:00
committed by commit-bot@chromium.org
parent fce355b8b0
commit 368d9f375f
4 changed files with 6 additions and 11 deletions
@@ -3,8 +3,6 @@ ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/i
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1718|7|5|Superinterfaces don't have a valid override for '>>': JSNumber.>> (num Function(num)), int.>> (int Function(int)).
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1718|7|5|Superinterfaces don't have a valid override for '\|': JSNumber.\| (num Function(num)), int.\| (int Function(int)).
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1718|7|5|Superinterfaces don't have a valid override for '^': JSNumber.^ (num Function(num)), int.^ (int Function(int)).
ERROR|COMPILE_TIME_ERROR|RETURN_OF_INVALID_TYPE|lib/_internal/js_runtime/lib/interceptors.dart|1573|14|45|A value of type 'double' can't be returned from method '%' because it has a return type of 'JSNumber'.
ERROR|COMPILE_TIME_ERROR|RETURN_OF_INVALID_TYPE|lib/_internal/js_runtime/lib/interceptors.dart|1575|14|45|A value of type 'double' can't be returned from method '%' because it has a return type of 'JSNumber'.
ERROR|COMPILE_TIME_ERROR|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1735|28|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|COMPILE_TIME_ERROR|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1737|27|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|COMPILE_TIME_ERROR|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1740|17|1|The operator '&' isn't defined for the type 'JSInt'.
@@ -2,9 +2,6 @@ ERROR|COMPILE_TIME_ERROR|CONST_CONSTRUCTOR_THROWS_EXCEPTION|lib/core/core.dart|3
ERROR|COMPILE_TIME_ERROR|CONST_CONSTRUCTOR_THROWS_EXCEPTION|lib/core/core.dart|7888|5|97|Const constructors can't throw exceptions.
ERROR|COMPILE_TIME_ERROR|CONST_CONSTRUCTOR_THROWS_EXCEPTION|lib/core/core.dart|893|5|95|Const constructors can't throw exceptions.
ERROR|COMPILE_TIME_ERROR|CONST_CONSTRUCTOR_THROWS_EXCEPTION|lib/core/core.dart|926|5|94|Const constructors can't throw exceptions.
ERROR|COMPILE_TIME_ERROR|INVALID_ASSIGNMENT|lib/_internal/js_dev_runtime/private/interceptors.dart|1358|18|27|A value of type 'double' can't be assigned to a variable of type 'int'.
ERROR|COMPILE_TIME_ERROR|RETURN_OF_INVALID_TYPE|lib/_internal/js_dev_runtime/private/interceptors.dart|1225|14|38|A value of type 'double' can't be returned from method '%' because it has a return type of 'JSNumber'.
ERROR|COMPILE_TIME_ERROR|RETURN_OF_INVALID_TYPE|lib/_internal/js_dev_runtime/private/interceptors.dart|1227|14|38|A value of type 'double' can't be returned from method '%' because it has a return type of 'JSNumber'.
ERROR|SYNTACTIC_ERROR|CONST_FACTORY|lib/core/core.dart|3677|3|5|Only redirecting factory constructors can be declared to be 'const'.
ERROR|SYNTACTIC_ERROR|CONST_FACTORY|lib/core/core.dart|7886|3|5|Only redirecting factory constructors can be declared to be 'const'.
ERROR|SYNTACTIC_ERROR|CONST_FACTORY|lib/core/core.dart|891|3|5|Only redirecting factory constructors can be declared to be 'const'.
@@ -285,9 +285,9 @@ class JSNumber extends Interceptor implements int, double {
if (result == 0) return (0 as JSNumber); // Make sure we don't return -0.0.
if (result > 0) return result;
if (JS<JSNumber>('!', '#', other) < 0) {
return result - JS<JSNumber>('!', '#', other);
return JS<JSNumber>('!', '# - #', result, other);
} else {
return result + JS<JSNumber>('!', '#', other);
return JS<JSNumber>('!', '# + #', result, other);
}
}
@@ -418,7 +418,7 @@ class JSNumber extends Interceptor implements int, double {
@notNull
int get bitLength {
int nonneg = this < 0 ? -this - 1 : this;
int nonneg = JS<int>('!', '#', this < 0 ? -this - 1 : this);
int wordBits = 32;
while (nonneg >= 0x100000000) {
nonneg = nonneg ~/ 0x100000000;
@@ -310,9 +310,9 @@ class JSNumber extends Interceptor implements double {
if (result == 0) return JS('num', '0'); // Make sure we don't return -0.0.
if (result > 0) return result;
if (JS('num', '#', other) < 0) {
return result - JS<JSNumber>('JSNumber', '#', other);
return JS<JSNumber>('JSNumber', '# - #', result, other);
} else {
return result + JS<JSNumber>('JSNumber', '#', other);
return JS<JSNumber>('JSNumber', '# + #', result, other);
}
}
@@ -486,7 +486,7 @@ class JSInt extends JSNumber implements int {
}
int get bitLength {
int nonneg = (this < 0 ? -this - 1 : this) as int;
int nonneg = JS<int>('int', '#', this < 0 ? -this - 1 : this);
int wordBits = 32;
while (nonneg >= 0x100000000) {
nonneg = nonneg ~/ 0x100000000;