add the field name as comment on get/set

This commit is contained in:
Volker Berlin 2022-03-08 16:21:58 +01:00
parent c44e24c373
commit 7823db2708

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2018 - 2021 Volker Berlin (i-net software) Copyright 2018 - 2022 Volker Berlin (i-net software)
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -198,6 +198,7 @@ class WasmStructInstruction extends WasmInstruction {
*/ */
@Override @Override
public void writeTo( @Nonnull ModuleWriter writer ) throws IOException { public void writeTo( @Nonnull ModuleWriter writer ) throws IOException {
String comment = null;
int idx = -1; int idx = -1;
switch( op ) { switch( op ) {
case GET: case GET:
@ -225,6 +226,7 @@ class WasmStructInstruction extends WasmInstruction {
} }
} }
} }
comment = fieldName.getName();
break; break;
case INSTANCEOF: case INSTANCEOF:
case CAST: case CAST:
@ -236,7 +238,7 @@ class WasmStructInstruction extends WasmInstruction {
if( idx >= 0 ) { if( idx >= 0 ) {
writer.writeConst( idx, ValueType.i32 ); writer.writeConst( idx, ValueType.i32 );
} }
writer.writeFunctionCall( functionName, null ); writer.writeFunctionCall( functionName, comment );
if( op == StructOperator.CAST && options.useGC() ) { if( op == StructOperator.CAST && options.useGC() ) {
writer.writeStructOperator( StructOperator.RTT_CANON, type, null, -1 ); writer.writeStructOperator( StructOperator.RTT_CANON, type, null, -1 );
writer.writeStructOperator( op, type, null, -1 ); writer.writeStructOperator( op, type, null, -1 );