mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 02:44:47 +01:00
add isSubTypeOf(9 to the type hierarchy
This commit is contained in:
parent
bab77094c2
commit
5ec2e34c57
@ -15,6 +15,8 @@
|
||||
*/
|
||||
package de.inetsoftware.jwebassembly.wasm;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Interface of all possible types in WebAssembly. This are predefined (native) types and custom types in the type section.
|
||||
* <pre><code>
|
||||
@ -36,4 +38,13 @@ public interface AnyType {
|
||||
* @return the code
|
||||
*/
|
||||
public int getCode();
|
||||
|
||||
/**
|
||||
* Check if this is a sub type of given type.
|
||||
*
|
||||
* @param type
|
||||
* type to check
|
||||
* @return true, if both are identical or the type is a sub type
|
||||
*/
|
||||
public boolean isSubTypeOf( @Nonnull AnyType type );
|
||||
}
|
||||
|
@ -50,6 +50,14 @@ public class ArrayType implements AnyType {
|
||||
return ValueType.anyref.getCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isSubTypeOf( AnyType type ) {
|
||||
return type == this || type == ValueType.anyref;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -57,4 +57,12 @@ public enum ValueType implements AnyType {
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isSubTypeOf( AnyType type ) {
|
||||
return type == this;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user