mirror of
https://github.com/aNNiMON/Own-Programming-Language-Tutorial.git
synced 2024-09-20 00:34:20 +03:00
Limit call stack function output length
This commit is contained in:
parent
02e9d1f6c5
commit
368cc8612c
@ -6,7 +6,8 @@ import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class CallStack {
|
||||
|
||||
|
||||
private static final int MAX_FUNCTION_LENGTH = 62;
|
||||
private static final Deque<CallInfo> calls = new ConcurrentLinkedDeque<>();
|
||||
|
||||
private CallStack() { }
|
||||
@ -24,6 +25,9 @@ public final class CallStack {
|
||||
if (func.contains("\n")) {
|
||||
func = func.substring(0, func.indexOf("\n")).trim();
|
||||
}
|
||||
if (func.length() > MAX_FUNCTION_LENGTH) {
|
||||
func = func.substring(0, MAX_FUNCTION_LENGTH) + "...";
|
||||
}
|
||||
calls.push(new CallInfo(name, func, range));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user