Files
sdk/pkg/front_end/testcases/general/async_function.dart.strong.expect
T
Chloe Stefantsova 3eeba4a4e2 [cfe] Refactor FunctionNode.futureValueType into emitted value type
Previously we would encode the type of the value returned in `async`
functions as the field `futureValueType` on `FunctionNode`. For all
other kinds of functions, such as `sync`, `sync*`, and `async*`, that
field would be null. This CL renames `futureValueType` into
`emittedVAlueType`, and for functions of kinds `async`, `sync*`, and
`async*` that is expected to be the type of values emitted via
`return` or `yield` statements. For `sync` functions that field is
supposed to contain `null`.

In response to https://github.com/dart-lang/sdk/issues/54159

TEST=existing

Change-Id: I1efdbcc4e75d150f5618c7ca50cfe49a0e54fce6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341662
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-12-19 08:44:43 +00:00

34 lines
1.2 KiB
Plaintext

library;
import self as self;
import "dart:async" as asy;
import "dart:core" as core;
import "dart:async";
static field core::List<core::String> stringList = <core::String>["bar"];
static method asyncString() → asy::Future<core::String> async /* emittedValueType= core::String */ {
return "foo";
}
static method asyncString2() → asy::Future<core::String> async /* emittedValueType= core::String */ {
return self::asyncString();
}
static method syncStarString() → core::Iterable<core::String> sync* /* emittedValueType= core::String */ {
yield "foo";
yield* self::syncStarString2();
yield* self::stringList;
}
static method syncStarString2() → core::Iterable<core::String> sync* /* emittedValueType= core::String */ {
yield "foo";
}
static method asyncStarString() → asy::Stream<core::String> async* /* emittedValueType= core::String */ {
yield "foo";
yield* self::asyncStarString2();
yield await self::asyncString();
}
static method asyncStarString2() → asy::Stream<core::String> async* /* emittedValueType= core::String */ {
yield "bar";
}
static method main() → dynamic async /* emittedValueType= dynamic */ {
core::String str = await self::asyncString();
}