Default values for long must in JavaScript 0n else it can't be converted to wasm i64.

This commit is contained in:
Volker Berlin 2022-10-16 20:24:36 +02:00
parent 2cdb0244d1
commit 9b3bf52173
No known key found for this signature in database
GPG Key ID: 988423EF815BE4CB

View File

@ -120,7 +120,9 @@ class WasmStructInstruction extends WasmInstruction {
js.append( type.getVTable() );
} else {
AnyType fieldType = storageType.getType();
if( fieldType instanceof ValueType && fieldType != ValueType.externref ) {
if( fieldType == ValueType.i64 ) {
js.append( "0n" );
} else if( fieldType instanceof ValueType && fieldType != ValueType.externref ) {
js.append( '0' );
} else {
js.append( "null" );