c1160d8cfa
Change-Id: Ied8777df13aa0411daf89f3ad3ec6bdda7bb4898 Reviewed-on: https://dart-review.googlesource.com/35862 Reviewed-by: Kevin Millikin <kmillikin@google.com> Commit-Queue: Jens Johansen <jensj@google.com>
48 lines
1.1 KiB
Plaintext
48 lines
1.1 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.+(1).==(2);
|
|
}
|
|
static method testMain() → dynamic {
|
|
dynamic a = "foo";
|
|
dynamic b;
|
|
if(self::ImplicitScopeTest::alwaysTrue()) {
|
|
dynamic a = "bar";
|
|
}
|
|
else {
|
|
dynamic b = a;
|
|
}
|
|
exp::Expect::equals("foo", a);
|
|
exp::Expect::equals(null, b);
|
|
while (!self::ImplicitScopeTest::alwaysTrue()) {
|
|
dynamic a = "bar";
|
|
dynamic b = "baz";
|
|
}
|
|
exp::Expect::equals("foo", a);
|
|
exp::Expect::equals(null, b);
|
|
for (core::int i = 0; i.<(10); i = i.+(1)) {
|
|
dynamic a = "bar";
|
|
dynamic b = "baz";
|
|
}
|
|
exp::Expect::equals("foo", a);
|
|
exp::Expect::equals(null, b);
|
|
do {
|
|
dynamic a = "bar";
|
|
dynamic b = "baz";
|
|
}
|
|
while ("black".==("white"))
|
|
exp::Expect::equals("foo", a);
|
|
exp::Expect::equals(null, b);
|
|
}
|
|
}
|
|
static method main() → dynamic {
|
|
self::ImplicitScopeTest::testMain();
|
|
}
|