mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
Add support for Wat instruction struct.set
This commit is contained in:
parent
d9e78ef414
commit
4a802a8b15
@ -291,6 +291,8 @@ public class WatParser extends WasmCodeBuilder {
|
|||||||
i = addMemoryInstruction( MemoryOperator.load8_u, ValueType.i32, tokens, i, lineNumber );
|
i = addMemoryInstruction( MemoryOperator.load8_u, ValueType.i32, tokens, i, lineNumber );
|
||||||
break;
|
break;
|
||||||
case "struct.get":
|
case "struct.get":
|
||||||
|
case "struct.set":
|
||||||
|
StructOperator op = "struct.get".equals( tok ) ? StructOperator.GET : StructOperator.SET;
|
||||||
String typeName = get( tokens, ++i );
|
String typeName = get( tokens, ++i );
|
||||||
String fieldName = get( tokens, ++i );
|
String fieldName = get( tokens, ++i );
|
||||||
NamedStorageType fieldNameType = null;
|
NamedStorageType fieldNameType = null;
|
||||||
@ -306,7 +308,7 @@ public class WatParser extends WasmCodeBuilder {
|
|||||||
if( fieldNameType == null ) {
|
if( fieldNameType == null ) {
|
||||||
fieldNameType = new NamedStorageType( ValueType.externref, "", fieldName );
|
fieldNameType = new NamedStorageType( ValueType.externref, "", fieldName );
|
||||||
}
|
}
|
||||||
addStructInstruction( StructOperator.GET, typeName, fieldNameType, javaCodePos, lineNumber );
|
addStructInstruction( op, typeName, fieldNameType, javaCodePos, lineNumber );
|
||||||
break;
|
break;
|
||||||
case "array.len":
|
case "array.len":
|
||||||
typeName = get( tokens, ++i );
|
typeName = get( tokens, ++i );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user