| library /*isNonNullableByDefault*/; | |
| import self as self; | |
| import "dart:core" as core; | |
| import "package:expect/expect.dart" as exp; | |
| import "package:expect/expect.dart"; | |
| static const field core::int var1 = #C1; | |
| static const field core::int var1_1 = #C2; | |
| static const field core::String var2 = #C3; | |
| static const field core::int var3 = #C4; | |
| static const field core::int var4 = #C5; | |
| static const field core::int var5 = #C6; | |
| static method function1(core::int a, core::int b) → core::int { | |
| core::int x = 1.{core::num::+}(a).{core::num::+}(b); | |
| return x; | |
| } | |
| static method function2() → core::String { | |
| dynamic x = "string"; | |
| return x as{TypeError,ForDynamic,ForNonNullableByDefault} core::String; | |
| } | |
| static method function3() → core::int { | |
| core::int first = 2; | |
| core::int second = 2.{core::num::+}(first); | |
| return 2.{core::num::+}(second); | |
| } | |
| static method function4() → core::int { | |
| core::int first = 2; | |
| core::int second = 0; | |
| return first.{core::num::+}(second); | |
| } | |
| static method function5() → core::int { | |
| return #C6; | |
| } | |
| static method main() → void { | |
| exp::Expect::equals(#C1, 4); | |
| exp::Expect::equals(#C2, 5); | |
| exp::Expect::equals(#C3, "string"); | |
| exp::Expect::equals(#C4, 6); | |
| exp::Expect::equals(#C5, 2); | |
| exp::Expect::equals(#C6, 2.{core::int::unary-}()); | |
| } | |
| constants { | |
| #C1 = 4 | |
| #C2 = 5 | |
| #C3 = "string" | |
| #C4 = 6 | |
| #C5 = 2 | |
| #C6 = -2 | |
| } |