mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
Fix array type syntax. https://github.com/WebAssembly/wasp/issues/55
This commit is contained in:
parent
fd2131e6dd
commit
0a21fd9de9
@ -221,21 +221,27 @@ public class TextModuleWriter extends ModuleWriter {
|
|||||||
useTypeClass = true;
|
useTypeClass = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
String kind = type.getKind() == StructTypeKind.array_native ? "array" : "struct";
|
output.append( "(type $" ).append( typeName ).append( " (" );
|
||||||
output.append( "(type $" ).append( typeName ).append( " (" ).append( kind );
|
if( type.getKind() == StructTypeKind.array_native ) {
|
||||||
inset++;
|
output.append( "array (mut " );
|
||||||
for( NamedStorageType field : type.getFields() ) {
|
writeTypeName( output, type.getFields().get( 0 ).getType() );
|
||||||
newline( output );
|
output.append( ")" );
|
||||||
output.append( "(field" );
|
} else {
|
||||||
if( options.debugNames() && field.getName() != null ) {
|
output.append( "struct" );
|
||||||
output.append( " $" ).append( typeName ).append( '.' ).append( field.getName() );
|
inset++;
|
||||||
|
for( NamedStorageType field : type.getFields() ) {
|
||||||
|
newline( output );
|
||||||
|
output.append( "(field" );
|
||||||
|
if( options.debugNames() && field.getName() != null ) {
|
||||||
|
output.append( " $" ).append( typeName ).append( '.' ).append( field.getName() );
|
||||||
|
}
|
||||||
|
output.append( " (mut " );
|
||||||
|
writeTypeName( output, field.getType() );
|
||||||
|
output.append( "))" );
|
||||||
}
|
}
|
||||||
output.append( " (mut " );
|
inset--;
|
||||||
writeTypeName( output, field.getType() );
|
newline( output );
|
||||||
output.append( "))" );
|
|
||||||
}
|
}
|
||||||
inset--;
|
|
||||||
newline( output );
|
|
||||||
output.append( "))" );
|
output.append( "))" );
|
||||||
inset = oldInset;
|
inset = oldInset;
|
||||||
return 0;
|
return 0;
|
||||||
@ -336,7 +342,7 @@ public class TextModuleWriter extends ModuleWriter {
|
|||||||
*/
|
*/
|
||||||
private void writeTypeName( Appendable output, AnyType type ) throws IOException {
|
private void writeTypeName( Appendable output, AnyType type ) throws IOException {
|
||||||
if( !type.isRefType() ) {
|
if( !type.isRefType() ) {
|
||||||
String name = type == ValueType.u16 ? "i16" : type.toString();
|
String name = type == ValueType.u16 ? "i16" : type == ValueType.bool ? "i8" : type.toString();
|
||||||
output.append( name );
|
output.append( name );
|
||||||
} else if( options.useGC() ) {
|
} else if( options.useGC() ) {
|
||||||
//output.append( ValueType.eqref.toString() );
|
//output.append( ValueType.eqref.toString() );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user