mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
Fix the lineNumer in some WasmExceptions
This commit is contained in:
parent
cd7e20f5ed
commit
0ad94fbc56
@ -80,11 +80,12 @@ class JavaMethodWasmCodeBuilder extends WasmCodeBuilder {
|
|||||||
* if some Java code can't converted
|
* if some Java code can't converted
|
||||||
*/
|
*/
|
||||||
private void writeCode( CodeInputStream byteCode, ConstantPool constantPool, boolean hasReturn ) throws WasmException {
|
private void writeCode( CodeInputStream byteCode, ConstantPool constantPool, boolean hasReturn ) throws WasmException {
|
||||||
|
int lineNumber = -1;
|
||||||
try {
|
try {
|
||||||
boolean wide = false;
|
boolean wide = false;
|
||||||
while( byteCode.available() > 0 ) {
|
while( byteCode.available() > 0 ) {
|
||||||
int codePos = byteCode.getCodePosition();
|
int codePos = byteCode.getCodePosition();
|
||||||
int lineNumber = byteCode.getLineNumber();
|
lineNumber = byteCode.getLineNumber();
|
||||||
int op = byteCode.readUnsignedByte();
|
int op = byteCode.readUnsignedByte();
|
||||||
switch( op ) {
|
switch( op ) {
|
||||||
case 0: // nop
|
case 0: // nop
|
||||||
@ -654,10 +655,8 @@ class JavaMethodWasmCodeBuilder extends WasmCodeBuilder {
|
|||||||
// But WebAssembly need the dead code to validate
|
// But WebAssembly need the dead code to validate
|
||||||
addBlockInstruction( WasmBlockOperator.UNREACHABLE, null, byteCode.getCodePosition(), byteCode.getLineNumber() );
|
addBlockInstruction( WasmBlockOperator.UNREACHABLE, null, byteCode.getCodePosition(), byteCode.getLineNumber() );
|
||||||
}
|
}
|
||||||
} catch( WasmException ex ) {
|
|
||||||
throw ex;
|
|
||||||
} catch( Exception ex ) {
|
} catch( Exception ex ) {
|
||||||
throw WasmException.create( ex, byteCode.getLineNumber() );
|
throw WasmException.create( ex, lineNumber );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user