Skip to content

Commit

Permalink
toString() for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Horcrux7 committed May 22, 2022
1 parent 5a22c94 commit 20c6516
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -103,6 +103,7 @@ public void writeTo( @Nonnull ModuleWriter writer ) throws IOException {
AnyType getPushValueType() {
switch( op ) {
case IF:
case BLOCK:
return data != ValueType.empty ? (AnyType)data : null;
case RETURN:
return (AnyType)data;
Expand Down Expand Up @@ -151,4 +152,12 @@ AnyType[] getPopValueTypes() {
return null;
}
}

/**
* Only used for debugging
*/
@Override
public String toString() {
return getClass().getSimpleName() + ": " + op + (data == null || data == ValueType.empty ? "" : " " + data);
}
}
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -129,4 +129,12 @@ int getPopCount() {
AnyType[] getPopValueTypes() {
return null;
}

/**
* Only used for debugging
*/
@Override
public String toString() {
return getClass().getSimpleName() + ": " + value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,12 @@ int getPopCount() {
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;
}
}
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -133,4 +133,12 @@ AnyType[] getPopValueTypes() {
return new AnyType[] { valueType, valueType };
}
}

/**
* Only used for debugging
*/
@Override
public String toString() {
return getClass().getSimpleName() + ": " + valueType + '.' + numOp;
}
}

0 comments on commit 20c6516

Please sign in to comment.