36641368bb
This changes ast-to-text to mark legacy libraries instead of non-nullable-by-default libraries. TEST=existing Change-Id: Ib01147e4ef48c2c5b2ffc6b23547998344dfdf2e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307121 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com>
106 lines
2.5 KiB
Plaintext
106 lines
2.5 KiB
Plaintext
library;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
static method test(dynamic o) → core::int {
|
|
#L1:
|
|
{
|
|
core::int #t1 = 1.{core::int::unary-}(){() → core::int};
|
|
final synthesized dynamic #0#0 = o;
|
|
#L2:
|
|
{
|
|
{
|
|
hoisted dynamic a;
|
|
if(#0#0 is core::List<dynamic> && #0#0{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C1 && (let final dynamic #t2 = a = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic} in true)) {
|
|
{
|
|
return a as{TypeError,ForDynamic} core::int;
|
|
}
|
|
}
|
|
}
|
|
{
|
|
if(#C2 =={core::num::==}{(core::Object) → core::bool} #0#0) {
|
|
{
|
|
#t1 = 0;
|
|
break #L2;
|
|
}
|
|
}
|
|
}
|
|
{
|
|
if(#C1 =={core::num::==}{(core::Object) → core::bool} #0#0) {
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
}
|
|
{
|
|
if(#C3 =={core::num::==}{(core::Object) → core::bool} #0#0) {
|
|
#t1 = 0;
|
|
break #L2;
|
|
}
|
|
}
|
|
{
|
|
if(#C4 =={core::num::==}{(core::Object) → core::bool} #0#0) {
|
|
{
|
|
#t1 = 1;
|
|
break #L2;
|
|
}
|
|
}
|
|
}
|
|
{
|
|
if(#C5 =={core::num::==}{(core::Object) → core::bool} #0#0) {
|
|
{
|
|
return 4;
|
|
}
|
|
}
|
|
}
|
|
{
|
|
{
|
|
#t1 = 1;
|
|
break #L2;
|
|
}
|
|
}
|
|
}
|
|
switch(#t1) /* dynamic */ {
|
|
#L3:
|
|
case #C2:
|
|
{
|
|
{
|
|
return 2;
|
|
}
|
|
}
|
|
#L4:
|
|
case #C1:
|
|
default:
|
|
{
|
|
{
|
|
return 1.{core::int::unary-}(){() → core::int};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
static method main() → dynamic {
|
|
self::expect(0, self::test(<core::int>[0]));
|
|
self::expect(1, self::test(<core::int>[1]));
|
|
self::expect(2, self::test(0));
|
|
self::expect(1, self::test(1));
|
|
self::expect(2, self::test(2));
|
|
self::expect(1.{core::int::unary-}(){() → core::int}, self::test(3));
|
|
self::expect(4, self::test(4));
|
|
self::expect(1.{core::int::unary-}(){() → core::int}, self::test(5));
|
|
self::expect(1.{core::int::unary-}(){() → core::int}, self::test(<dynamic>[]));
|
|
}
|
|
static method expect(dynamic expected, dynamic actual) → dynamic {
|
|
if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual)) {
|
|
throw "Expected ${expected}, actual ${actual}";
|
|
}
|
|
}
|
|
|
|
constants {
|
|
#C1 = 1
|
|
#C2 = 0
|
|
#C3 = 2
|
|
#C4 = 3
|
|
#C5 = 4
|
|
}
|