c4724e5a89
This adds a `forErrorHandling` to the `Throw` node. This is used that the `throw` is *not* present in the source code but added to ensure correctness and/or soundness of the generated code. This is used for instance in the lowering for handling duplicate writes to a late final field or for pattern assignments that don't match. In response to https://github.com/dart-lang/sdk/issues/53519 TEST=updated ast-to-text Change-Id: Ie103829d98fda9cd7b64e9e3d893e77d1e86d7d8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347900 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Jens Johansen <jensj@google.com> Reviewed-by: Liam Appelbe <liama@google.com>
19 lines
1011 B
Plaintext
19 lines
1011 B
Plaintext
library;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
static method f(dynamic x) → dynamic {
|
|
hoisted has-declared-initializer dynamic a;
|
|
{
|
|
final synthesized dynamic #0#0 = x as{TypeError,ForDynamic} core::Map<dynamic, dynamic>;
|
|
synthesized dynamic #0#4;
|
|
synthesized core::bool #0#4#isSet = false;
|
|
if(!(#0#0 is core::Map<dynamic, dynamic> && (!((#0#4#isSet ?{dynamic} #0#4{dynamic} : let final dynamic #t1 = #0#4#isSet = true in #0#4 = #0#0{core::Map<dynamic, dynamic>}.{core::Map::[]}(#C1){(core::Object?) → dynamic}) == null) || null is dynamic && #0#0{core::Map<dynamic, dynamic>}.{core::Map::containsKey}(#C1){(core::Object?) → core::bool}) && (let final dynamic #t2 = a = #0#4#isSet ?{dynamic} #0#4{dynamic} : let final dynamic #t3 = #0#4#isSet = true in #0#4 = #0#0{core::Map<dynamic, dynamic>}.{core::Map::[]}(#C1){(core::Object?) → dynamic} in true)))
|
|
throw{for-error-handling} new core::StateError::•("Pattern matching error");
|
|
}
|
|
}
|
|
|
|
constants {
|
|
#C1 = "a"
|
|
}
|