mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 11:58:13 +00:00
[3.0 alpha][dart2js] Remove use of NullThrownError
It is being removed in Dart 3.0 and a `TypeError` should be used instead. This is true in legacy code as well and all test expectations will be updated. Change-Id: I021fa4ecb1a9bbc404598113c65349e17926cd91 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275782 Commit-Queue: Nicholas Shahan <nshahan@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
parent
0a1e05acab
commit
c39ac36ed3
|
@ -2141,7 +2141,7 @@ class KernelTypeGraphBuilder extends ir.Visitor<TypeInformation?>
|
||||||
Local local = _localsMap.getLocalVariable(exception);
|
Local local = _localsMap.getLocalVariable(exception);
|
||||||
_state.updateLocal(
|
_state.updateLocal(
|
||||||
_inferrer, _capturedAndBoxed, local, mask, _dartTypes.dynamicType(),
|
_inferrer, _capturedAndBoxed, local, mask, _dartTypes.dynamicType(),
|
||||||
excludeNull: true /* `throw null` produces a NullThrownError */);
|
excludeNull: true /* `throw null` produces a TypeError */);
|
||||||
}
|
}
|
||||||
final stackTrace = node.stackTrace;
|
final stackTrace = node.stackTrace;
|
||||||
if (stackTrace != null) {
|
if (stackTrace != null) {
|
||||||
|
|
|
@ -2104,7 +2104,7 @@ class KernelTypeGraphBuilder extends ir.Visitor<TypeInformation?>
|
||||||
Local local = _localsMap.getLocalVariable(exception);
|
Local local = _localsMap.getLocalVariable(exception);
|
||||||
_state.updateLocal(
|
_state.updateLocal(
|
||||||
_inferrer, _capturedAndBoxed, local, mask, _dartTypes.dynamicType(),
|
_inferrer, _capturedAndBoxed, local, mask, _dartTypes.dynamicType(),
|
||||||
excludeNull: true /* `throw null` produces a NullThrownError */);
|
excludeNull: true /* `throw null` produces a TypeError */);
|
||||||
}
|
}
|
||||||
final stackTrace = node.stackTrace;
|
final stackTrace = node.stackTrace;
|
||||||
if (stackTrace != null) {
|
if (stackTrace != null) {
|
||||||
|
|
|
@ -1122,7 +1122,7 @@ String checkString(value) {
|
||||||
/// object out of the wrapper again.
|
/// object out of the wrapper again.
|
||||||
@pragma('dart2js:noInline')
|
@pragma('dart2js:noInline')
|
||||||
wrapException(ex) {
|
wrapException(ex) {
|
||||||
if (ex == null) ex = new NullThrownError();
|
if (ex == null) ex = new TypeError();
|
||||||
var wrapper = JS('', 'new Error()');
|
var wrapper = JS('', 'new Error()');
|
||||||
// [unwrapException] looks for the property 'dartException'.
|
// [unwrapException] looks for the property 'dartException'.
|
||||||
JS('void', '#.dartException = #', wrapper, ex);
|
JS('void', '#.dartException = #', wrapper, ex);
|
||||||
|
@ -1586,8 +1586,8 @@ class ExceptionAndStackTrace {
|
||||||
/// Some native exceptions are mapped to new Dart instances, others are
|
/// Some native exceptions are mapped to new Dart instances, others are
|
||||||
/// returned unmodified.
|
/// returned unmodified.
|
||||||
Object unwrapException(Object? ex) {
|
Object unwrapException(Object? ex) {
|
||||||
// Dart converts `null` to `NullThrownError()`. JavaScript can still throw a
|
// Null safe Dart can't throw null, and it is now a `TypeError` in unsound
|
||||||
// nullish value.
|
// code. JavaScript can still throw a nullish value.
|
||||||
if (ex == null) {
|
if (ex == null) {
|
||||||
return NullThrownFromJavaScriptException(ex);
|
return NullThrownFromJavaScriptException(ex);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue