mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
Add error message for not supported class constants
This commit is contained in:
parent
a57d3020f9
commit
762ecba363
@ -371,8 +371,11 @@ public abstract class WasmCodeBuilder {
|
|||||||
FunctionName name = strings.getStringConstantFunction();
|
FunctionName name = strings.getStringConstantFunction();
|
||||||
instructions.add( new WasmConstInstruction( id, ValueType.i32, javaCodePos, lineNumber ) );
|
instructions.add( new WasmConstInstruction( id, ValueType.i32, javaCodePos, lineNumber ) );
|
||||||
addCallInstruction( name, javaCodePos, lineNumber );
|
addCallInstruction( name, javaCodePos, lineNumber );
|
||||||
} else {
|
} else if( value instanceof Number ) {
|
||||||
instructions.add( new WasmConstInstruction( (Number)value, javaCodePos, lineNumber ) );
|
instructions.add( new WasmConstInstruction( (Number)value, javaCodePos, lineNumber ) );
|
||||||
|
} else {
|
||||||
|
//TODO There can be ConstantClass, MethodType and MethodHandle
|
||||||
|
throw new WasmException( "Class constants are not supported. : " + value, lineNumber );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,4 +151,17 @@ public class RuntimeErrors {
|
|||||||
return (Integer)obj;
|
return (Integer)obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void classConatnt() throws IOException {
|
||||||
|
compileErrorTest( "Class constants are not supported.", ClassConstant.class );
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ClassConstant {
|
||||||
|
@Export
|
||||||
|
static Object runnable() {
|
||||||
|
Class elemtentType = Integer.class;
|
||||||
|
return java.lang.reflect.Array.newInstance(elemtentType, 42);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user