4b7d256a06
This reverts commite9ca6a5335andd3e00fd35e. Change-Id: I346d6156be19c4fceffa202a7ce9bfa931c7c14b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99560 Reviewed-by: Sigmund Cherem <sigmund@google.com> Reviewed-by: Vijay Menon <vsm@google.com> Reviewed-by: Siva Annamalai <asiva@google.com>
174 lines
3.6 KiB
Plaintext
174 lines
3.6 KiB
Plaintext
library;
|
|
//
|
|
// Problems in library:
|
|
//
|
|
// pkg/front_end/testcases/statements.dart:15:5: Error: 'yield' can only be used in 'sync*' or 'async*' methods.
|
|
// yield x;
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/statements.dart:16:5: Error: 'yield' can only be used in 'sync*' or 'async*' methods.
|
|
// yield* x;
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/statements.dart:14:23: Error: The type 'List<dynamic>' used in the 'for' loop must implement 'Stream<dynamic>'.
|
|
// - 'List' is from 'dart:core'.
|
|
// - 'Stream' is from 'dart:async'.
|
|
// await for (var x in []) {
|
|
// ^
|
|
//
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
import "dart:async" as asy;
|
|
|
|
static method foo() → dynamic {
|
|
try {
|
|
return;
|
|
}
|
|
finally {
|
|
core::print("Hello from finally block!");
|
|
}
|
|
}
|
|
static method bar() → dynamic async {
|
|
await for (dynamic x in let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/statements.dart:14:23: Error: The type 'List<dynamic>' used in the 'for' loop must implement 'Stream<dynamic>'.
|
|
- 'List' is from 'dart:core'.
|
|
- 'Stream' is from 'dart:async'.
|
|
await for (var x in []) {
|
|
^" in <dynamic>[] as{TypeError} asy::Stream<dynamic>) {
|
|
yield x;
|
|
yield* x;
|
|
}
|
|
}
|
|
static method main() → dynamic {
|
|
do {
|
|
core::print("Hello from do-while!");
|
|
}
|
|
while (false)
|
|
do {
|
|
void x = core::print("Hello from do-while!");
|
|
}
|
|
while (false)
|
|
for (core::String s in <core::String>["Hello from for-in!"]) {
|
|
core::print(s);
|
|
}
|
|
for (core::String s in <core::String>["Hello from for-in without block!"])
|
|
core::print(s);
|
|
dynamic s;
|
|
for (final dynamic #t2 in <dynamic>["Hello from for-in without decl!"]) {
|
|
s = #t2;
|
|
core::print(s);
|
|
}
|
|
for (final dynamic #t3 in <dynamic>["Hello from for-in without decl and block!"]) {
|
|
s = #t3;
|
|
core::print(s);
|
|
}
|
|
core::print("Hello from labeled statement!");
|
|
try {
|
|
try {
|
|
throw "Hello from rethrow!";
|
|
}
|
|
on dynamic catch(final dynamic e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
on dynamic catch(final dynamic e) {
|
|
core::print(e);
|
|
}
|
|
self::foo();
|
|
core::bool done = false;
|
|
while (!done) {
|
|
done = true;
|
|
core::print("Hello from while!");
|
|
}
|
|
;
|
|
assert(true);
|
|
assert(true, "Hello from assert!");
|
|
try {
|
|
assert(false, "Hello from assert!");
|
|
}
|
|
on dynamic catch(final dynamic e) {
|
|
core::print(e);
|
|
}
|
|
#L1:
|
|
switch(1) {
|
|
#L2:
|
|
case 1:
|
|
case 2:
|
|
{
|
|
core::print("Hello from switch case!");
|
|
break #L1;
|
|
}
|
|
#L3:
|
|
default:
|
|
{
|
|
break #L1;
|
|
}
|
|
}
|
|
#L4:
|
|
switch(4) {
|
|
#L5:
|
|
case 2:
|
|
{
|
|
core::print("Hello from case 2!");
|
|
break #L4;
|
|
}
|
|
#L6:
|
|
case 1:
|
|
{
|
|
core::print("Hello from case 1!");
|
|
continue #L5;
|
|
}
|
|
#L7:
|
|
case 0:
|
|
{
|
|
core::print("Hello from case 0!");
|
|
continue #L6;
|
|
}
|
|
#L8:
|
|
case 4:
|
|
{
|
|
core::print("Hello from case 4!");
|
|
continue #L9;
|
|
}
|
|
#L9:
|
|
default:
|
|
{
|
|
continue #L7;
|
|
}
|
|
}
|
|
#L10:
|
|
switch(4) {
|
|
#L11:
|
|
case 1:
|
|
{
|
|
core::print("Hello from next case 1");
|
|
break #L10;
|
|
}
|
|
#L12:
|
|
default:
|
|
{
|
|
continue #L11;
|
|
}
|
|
}
|
|
core::int i = 0;
|
|
#L13:
|
|
do
|
|
#L14:
|
|
{
|
|
core::print("Hello from do-while!");
|
|
if((i = i.{core::num::+}(1)).{core::num::<}(3))
|
|
break #L14;
|
|
break #L13;
|
|
}
|
|
while (true)
|
|
i = 0;
|
|
#L15:
|
|
while (true)
|
|
#L16:
|
|
{
|
|
core::print("Hello from while!");
|
|
if((i = i.{core::num::+}(1)).{core::num::<}(3))
|
|
break #L16;
|
|
break #L15;
|
|
}
|
|
}
|