Files
sdk/pkg/front_end/testcases/patterns/irrefutable_infix.dart.weak.expect
T
Johnni Winther c6347389d2 [cfe] Move irrefutable tails into the case body
This moves pattern variable assignments of fully matched expressions into the case body. This will help backends (dart2js in particular) to reason about the code flow.

Closes #54115

Change-Id: I598a384a829f16e91ab2d6a309499cf20b9cc121
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339122
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2023-12-07 11:13:30 +00:00

63 lines
3.2 KiB
Plaintext

library;
import self as self;
import "dart:core" as core;
abstract class Foo extends core::Object {
synthetic constructor •() → self::Foo
: super core::Object::•()
;
abstract get a() → core::int;
abstract get b() → core::num;
abstract get c() → core::num;
}
static method method1(dynamic o) → dynamic {
{
hoisted core::int a;
hoisted core::int b;
final synthesized dynamic #0#0 = o;
synthesized core::num #0#3;
synthesized core::bool #0#3#isSet = false;
if(#0#0 is self::Foo && (let final dynamic #t1 = a = #0#0{self::Foo}.{self::Foo::a}{core::int} in true) && (#0#3#isSet ?{core::num} #0#3{core::num} : let final dynamic #t2 = #0#3#isSet = true in #0#3 = #0#0{self::Foo}.{self::Foo::b}{core::num}) is core::int) {
b = (#0#3#isSet ?{core::num} #0#3{core::num} : let final dynamic #t3 = #0#3#isSet = true in #0#3 = #0#0{self::Foo}.{self::Foo::b}{core::num}) as{Unchecked} core::int;
{
core::print(a.{core::num::+}(b){(core::num) → core::int});
}
}
}
}
static method method2(dynamic o) → dynamic {
{
hoisted core::int a;
hoisted core::num b;
hoisted core::int c;
final synthesized dynamic #0#0 = o;
synthesized core::num #0#4;
synthesized core::bool #0#4#isSet = false;
if(#0#0 is self::Foo && (let final dynamic #t4 = a = #0#0{self::Foo}.{self::Foo::a}{core::int} in true) && (let final dynamic #t5 = b = #0#0{self::Foo}.{self::Foo::b}{core::num} in true) && (#0#4#isSet ?{core::num} #0#4{core::num} : let final dynamic #t6 = #0#4#isSet = true in #0#4 = #0#0{self::Foo}.{self::Foo::c}{core::num}) is core::int) {
c = (#0#4#isSet ?{core::num} #0#4{core::num} : let final dynamic #t7 = #0#4#isSet = true in #0#4 = #0#0{self::Foo}.{self::Foo::c}{core::num}) as{Unchecked} core::int;
{
core::print(a.{core::num::+}(b){(core::num) → core::num}.{core::num::+}(c){(core::num) → core::num});
}
}
}
}
static method method3(dynamic o) → dynamic {
{
hoisted core::int a;
hoisted core::bool isEven;
hoisted core::int c;
final synthesized dynamic #0#0 = o;
synthesized core::num #0#3;
synthesized core::bool #0#3#isSet = false;
synthesized core::num #0#6;
synthesized core::bool #0#6#isSet = false;
if(#0#0 is self::Foo && (let final dynamic #t8 = a = #0#0{self::Foo}.{self::Foo::a}{core::int} in true) && ((#0#3#isSet ?{core::num} #0#3{core::num} : let final dynamic #t9 = #0#3#isSet = true in #0#3 = #0#0{self::Foo}.{self::Foo::b}{core::num}) is core::int && (let final dynamic #t10 = isEven = ((#0#3#isSet ?{core::num} #0#3{core::num} : let final dynamic #t11 = #0#3#isSet = true in #0#3 = #0#0{self::Foo}.{self::Foo::b}{core::num}) as{Unchecked} core::int).{core::int::isEven}{core::bool} in true)) && (#0#6#isSet ?{core::num} #0#6{core::num} : let final dynamic #t12 = #0#6#isSet = true in #0#6 = #0#0{self::Foo}.{self::Foo::c}{core::num}) is core::int) {
c = (#0#6#isSet ?{core::num} #0#6{core::num} : let final dynamic #t13 = #0#6#isSet = true in #0#6 = #0#0{self::Foo}.{self::Foo::c}{core::num}) as{Unchecked} core::int;
{
core::print(a.{core::num::+}(c){(core::num) → core::int});
core::print(isEven);
}
}
}
}