mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
Fix multiple return values
This commit is contained in:
parent
834c049354
commit
6b85a00e4b
@ -31,7 +31,7 @@ class FunctionType extends SectionEntry {
|
|||||||
|
|
||||||
final List<ValueType> params = new ArrayList<>();
|
final List<ValueType> params = new ArrayList<>();
|
||||||
|
|
||||||
ValueType result; // Java has only one return parameter
|
final List<ValueType> results = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
@ -43,11 +43,9 @@ class FunctionType extends SectionEntry {
|
|||||||
for( ValueType valueType : this.params ) {
|
for( ValueType valueType : this.params ) {
|
||||||
stream.write( valueType.getCode() );
|
stream.write( valueType.getCode() );
|
||||||
}
|
}
|
||||||
if( this.result == null ) {
|
stream.writeVaruint32( this.results.size() );
|
||||||
stream.writeVaruint32( 0 );
|
for( ValueType valueType : this.results ) {
|
||||||
} else {
|
stream.write( valueType.getCode() );
|
||||||
stream.writeVaruint32( 1 );
|
|
||||||
stream.write( this.result.getCode() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +54,7 @@ class FunctionType extends SectionEntry {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return params.hashCode() + 31 * Objects.hashCode( result );
|
return params.hashCode() + 31 * results.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,6 +69,6 @@ class FunctionType extends SectionEntry {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
FunctionType type = (FunctionType)obj;
|
FunctionType type = (FunctionType)obj;
|
||||||
return Objects.equals( params, type.params ) && Objects.equals( result, type.result );
|
return params.equals( type.params ) && results.equals( type.results );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user