3210fb4306
Fixed up block environment and added tests for them. Change-Id: I97375c90c9244f6dcf8294dc11b0d4e70697d114 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190320 Reviewed-by: Dmitry Stefantsov <dmitryas@google.com> Reviewed-by: Jake Macdonald <jakemac@google.com> Commit-Queue: Kallen Tu <kallentu@google.com>
44 lines
797 B
Plaintext
44 lines
797 B
Plaintext
library /*isNonNullableByDefault*/;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
import "package:expect/expect.dart" as exp;
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
static method blockTest() → void {
|
|
function x() → core::int
|
|
return 1;
|
|
exp::Expect::equals(#C1, 1);
|
|
{
|
|
function x() → core::int
|
|
return 2;
|
|
exp::Expect::equals(#C2, 2);
|
|
{
|
|
function x() → core::int
|
|
return 3;
|
|
exp::Expect::equals(#C3, 3);
|
|
}
|
|
}
|
|
exp::Expect::equals(#C1, 1);
|
|
}
|
|
static method blockTest1() → void {
|
|
function x() → core::int {
|
|
core::int z = 3;
|
|
{
|
|
core::int z = 4;
|
|
}
|
|
return z;
|
|
}
|
|
exp::Expect::equals(#C3, 3);
|
|
}
|
|
static method main() → void {
|
|
self::blockTest();
|
|
self::blockTest1();
|
|
}
|
|
|
|
constants {
|
|
#C1 = 1
|
|
#C2 = 2
|
|
#C3 = 3
|
|
}
|