mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 21:10:22 +00:00
[dart2wasm] Simplify and fix async* element type computation
Fixes tests: - co19/Language/Functions/element_type_A02_t03 - co19/Language/Functions/element_type_A02_t04 Change-Id: Ifc186cb463fee26c59f81012c6da8925d902d9d9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342561 Commit-Queue: Ömer Ağacan <omersa@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
parent
6bca7060de
commit
72fd1e01d2
|
@ -602,17 +602,7 @@ class _WasmTransformer extends Transformer {
|
|||
|
||||
// Finally call cast.
|
||||
|
||||
// Stream element type is defined in language spec section 9. If the return
|
||||
// type is `Stream<U>` then the element type is `U`. Otherwise it needs to
|
||||
// be a supertype of `Object` and the element type is `dynamic`.
|
||||
final DartType streamTypeArgument;
|
||||
final DartType functionReturnType = functionNode.returnType;
|
||||
if (functionReturnType is InterfaceType &&
|
||||
functionReturnType.classNode == coreTypes.streamClass) {
|
||||
streamTypeArgument = functionReturnType.typeArguments.single;
|
||||
} else {
|
||||
streamTypeArgument = const DynamicType();
|
||||
}
|
||||
final DartType streamTypeArgument = functionNode.emittedValueType!;
|
||||
Procedure castProc =
|
||||
coreTypes.index.getProcedure('dart:async', 'Stream', 'cast');
|
||||
final returnStreamType = InterfaceType(coreTypes.streamClass,
|
||||
|
|
Loading…
Reference in a new issue