mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 15:37:52 +01:00
fix parsing of i8 and i16 arrays
This commit is contained in:
parent
724ead3742
commit
8cd9d16a33
@ -62,6 +62,17 @@ public class ValueTypeParser implements Iterator<AnyType> {
|
|||||||
* @return next type or null
|
* @return next type or null
|
||||||
*/
|
*/
|
||||||
public AnyType next() {
|
public AnyType next() {
|
||||||
|
return next( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the next value in the signature or null if the parameter are end or the signature is end.
|
||||||
|
*
|
||||||
|
* @param isArray
|
||||||
|
* true, if this is an element type of an array
|
||||||
|
* @return next type or null
|
||||||
|
*/
|
||||||
|
private AnyType next( boolean isArray ) {
|
||||||
if( !hasNext() ) {
|
if( !hasNext() ) {
|
||||||
throw new NoSuchElementException();
|
throw new NoSuchElementException();
|
||||||
}
|
}
|
||||||
@ -69,7 +80,7 @@ public class ValueTypeParser implements Iterator<AnyType> {
|
|||||||
case ')':
|
case ')':
|
||||||
return null;
|
return null;
|
||||||
case '[': // array
|
case '[': // array
|
||||||
return types.arrayType( next() );
|
return types.arrayType( next( true ) );
|
||||||
case 'L':
|
case 'L':
|
||||||
int idx2 = sig.indexOf( ';', idx );
|
int idx2 = sig.indexOf( ';', idx );
|
||||||
String name = sig.substring( idx, idx2 );
|
String name = sig.substring( idx, idx2 );
|
||||||
@ -77,8 +88,10 @@ public class ValueTypeParser implements Iterator<AnyType> {
|
|||||||
return "java/lang/Object".equals( name ) ? ValueType.anyref : types.valueOf( name );
|
return "java/lang/Object".equals( name ) ? ValueType.anyref : types.valueOf( name );
|
||||||
case 'Z': // boolean
|
case 'Z': // boolean
|
||||||
case 'B': // byte
|
case 'B': // byte
|
||||||
|
return isArray ? ValueType.i8 : ValueType.i32;
|
||||||
case 'C': // char
|
case 'C': // char
|
||||||
case 'S': // short
|
case 'S': // short
|
||||||
|
return isArray ? ValueType.i16 : ValueType.i32;
|
||||||
case 'I': // int
|
case 'I': // int
|
||||||
return ValueType.i32;
|
return ValueType.i32;
|
||||||
case 'D': // double
|
case 'D': // double
|
||||||
|
Loading…
x
Reference in New Issue
Block a user