1bad9304a0
Also remove some duplicated code so libraries are mostly only printed in one place. Change-Id: I7cb86bff1938f05631d7eb3432deda2c9939f402 Reviewed-on: https://dart-review.googlesource.com/c/90226 Reviewed-by: Peter von der Ahé <ahe@google.com> Commit-Queue: Jens Johansen <jensj@google.com>
50 lines
1.3 KiB
Plaintext
50 lines
1.3 KiB
Plaintext
library;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
import "package:expect/expect.dart" as exp;
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
class ImplicitScopeTest extends core::Object {
|
|
synthetic constructor •() → self::ImplicitScopeTest
|
|
: 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();
|
|
}
|