toString() for debugging

This commit is contained in:
Volker Berlin 2022-05-22 18:52:12 +02:00
parent 5a22c94b29
commit 20c6516b59
No known key found for this signature in database
GPG Key ID: 988423EF815BE4CB
4 changed files with 36 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
Copyright 2018 - 2021 Volker Berlin (i-net software)
Copyright 2018 - 2022 Volker Berlin (i-net software)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -103,6 +103,7 @@ class WasmBlockInstruction extends WasmInstruction {
AnyType getPushValueType() {
switch( op ) {
case IF:
case BLOCK:
return data != ValueType.empty ? (AnyType)data : null;
case RETURN:
return (AnyType)data;
@ -151,4 +152,12 @@ class WasmBlockInstruction extends WasmInstruction {
return null;
}
}
/**
* Only used for debugging
*/
@Override
public String toString() {
return getClass().getSimpleName() + ": " + op + (data == null || data == ValueType.empty ? "" : " " + data);
}
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2018 - 2021 Volker Berlin (i-net software)
Copyright 2018 - 2022 Volker Berlin (i-net software)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -129,4 +129,12 @@ class WasmConstInstruction extends WasmInstruction {
AnyType[] getPopValueTypes() {
return null;
}
/**
* Only used for debugging
*/
@Override
public String toString() {
return getClass().getSimpleName() + ": " + value;
}
}

View File

@ -150,4 +150,12 @@ class WasmLocalInstruction extends WasmInstruction {
AnyType[] getPopValueTypes() {
return op == get ? null : new AnyType[] { localVariables.getValueType( getIndex() ) };
}
/**
* Only used for debugging
*/
@Override
public String toString() {
return getClass().getSimpleName() + ": local." + op + ' ' + idx;
}
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2018 - 2021 Volker Berlin (i-net software)
Copyright 2018 - 2022 Volker Berlin (i-net software)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -133,4 +133,12 @@ class WasmNumericInstruction extends WasmInstruction {
return new AnyType[] { valueType, valueType };
}
}
/**
* Only used for debugging
*/
@Override
public String toString() {
return getClass().getSimpleName() + ": " + valueType + '.' + numOp;
}
}