From 72fd1e01d287ccf819ec27a2ef7cbabcf0bcab7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Wed, 20 Dec 2023 08:31:25 +0000 Subject: [PATCH] [dart2wasm] Simplify and fix async* element type computation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Martin Kustermann --- pkg/dart2wasm/lib/transformers.dart | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/pkg/dart2wasm/lib/transformers.dart b/pkg/dart2wasm/lib/transformers.dart index db79faa5c2b..e8c3d9b37e3 100644 --- a/pkg/dart2wasm/lib/transformers.dart +++ b/pkg/dart2wasm/lib/transformers.dart @@ -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` 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,