mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 15:37:52 +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;
|
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.
|
* Interface of all possible types in WebAssembly. This are predefined (native) types and custom types in the type section.
|
||||||
* <pre><code>
|
* <pre><code>
|
||||||
@ -36,4 +38,13 @@ public interface AnyType {
|
|||||||
* @return the code
|
* @return the code
|
||||||
*/
|
*/
|
||||||
public int getCode();
|
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();
|
return ValueType.anyref.getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isSubTypeOf( AnyType type ) {
|
||||||
|
return type == this || type == ValueType.anyref;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@ -57,4 +57,12 @@ public enum ValueType implements AnyType {
|
|||||||
public int getCode() {
|
public int getCode() {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isSubTypeOf( AnyType type ) {
|
||||||
|
return type == this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user