f343c3ceb7
This splits cached expression by receiver type such that the initializing expression for a cached variable isn't stored in the late variable initializer, if it can be obtained in different ways. For instance having both a list pattern and a map pattern in the same switch will trigger caching of the .length property but obtaining expression differ base on the receiver type, in the first case List.length and in second case Map.length. Closes #51138 Closes #51140 Change-Id: Ic4d8ca394a872113114514f72274413b836fdfb5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280081 Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
21 lines
769 B
Plaintext
21 lines
769 B
Plaintext
library /*isNonNullableByDefault*/;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
import "dart:_internal" as _in;
|
|
|
|
static const field core::int annotation = #C1;
|
|
static method f(dynamic x) → dynamic {
|
|
dynamic a;
|
|
{
|
|
final dynamic #0#0 = x;
|
|
if(!(#0#0 is{ForNonNullableByDefault} core::Map<dynamic, dynamic> && #0#0{core::Map<dynamic, dynamic>}.{core::Map::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C2 && #0#0{core::Map<dynamic, dynamic>}.{core::Map::containsKey}(#C3){(core::Object?) → core::bool} && (let final dynamic #t1 = a = #0#0{core::Map<dynamic, dynamic>}.{core::Map::[]}(#C3){(core::Object?) → dynamic} in true)))
|
|
throw new _in::ReachabilityError::•();
|
|
}
|
|
}
|
|
|
|
constants {
|
|
#C1 = 0
|
|
#C2 = 1
|
|
#C3 = "a"
|
|
}
|