Files
sdk/pkg/front_end/testcases/implicit_scope_test.dart.strong.expect
T
Peter von der Ahé 0c2b349827 Blocks and variable declarations in Forest
This is a starting point for supporting blocks and variable
declarations in the forest API. I'm not sure exactly how the
analyzer handles variable declarations, so we'll probably have
to iterate on that part.

Change-Id: I93aec818baec24f8b038f02c66699117070d6b0c
Reviewed-on: https://dart-review.googlesource.com/55683
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-05-18 13:55:47 +00:00

48 lines
1.3 KiB
Plaintext

library;
import self as self;
import "dart:core" as core;
import "package:expect/expect.dart" as exp;
class ImplicitScopeTest extends core::Object {
synthetic constructor •() → void
: super core::Object::•()
;
static method alwaysTrue() → core::bool {
return 1.{core::num::+}(1).{core::num::==}(2);
}
static method testMain() → dynamic {
core::String a = "foo";
dynamic b;
if(self::ImplicitScopeTest::alwaysTrue()) {
core::String a = "bar";
}
else {
core::String b = a;
}
exp::Expect::equals("foo", a);
exp::Expect::equals(null, b);
while (!self::ImplicitScopeTest::alwaysTrue()) {
core::String a = "bar";
core::String b = "baz";
}
exp::Expect::equals("foo", a);
exp::Expect::equals(null, b);
for (core::int i = 0; i.{core::num::<}(10); i = i.{core::num::+}(1)) {
core::String a = "bar";
core::String b = "baz";
}
exp::Expect::equals("foo", a);
exp::Expect::equals(null, b);
do {
core::String a = "bar";
core::String b = "baz";
}
while ("black".{core::String::==}("white"))
exp::Expect::equals("foo", a);
exp::Expect::equals(null, b);
}
}
static method main() → dynamic {
self::ImplicitScopeTest::testMain();
}