JS interop object literal constructors with extension types fail to compile when serializing codegen with sharding enabled #57008
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
web-js-interop
Issues that impact all js interop
This should emit code that looks like
{foo: 0}
. We should visit theStaticInvocation
in dart2js, and emit anHForeignCode
in SSA. This exists today:sdk/pkg/compiler/lib/src/ssa/builder.dart
Line 5804 in ae0510d
external
. Therefore, it results in a JS fragment like#.ObjectLiteral|constructor#(#)
because it directly uses the name, which is invalid JS code, and therefore results in a crash.The solution is to just skip the generated procedure.
One thing that still isn't clear though is why we don't need to do this for all the other generated procedures for interop extension type members. I believe it's because we replace all the invocations of such procedures in
js_util_optimizer.dart
whereas we defer the lowering for object literal constructors until later in dart2js. This may allow dart2js to tree-shake away those procedures early since there is no code referring to them anymore. Experimentally, that looks to be the case.cc @rakudrama @stereotype441 @natebiggs
The text was updated successfully, but these errors were encountered: