mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-05 06:34:11 -08:00
JS: fix stack trace decoder with new CCE support
This commit is contained in:
parent
4c0c7872a1
commit
67c639b875
|
@ -37,6 +37,7 @@ import org.teavm.vm.RenderingException;
|
||||||
public class RuntimeRenderer {
|
public class RuntimeRenderer {
|
||||||
private static final String STRING_CLASS = String.class.getName();
|
private static final String STRING_CLASS = String.class.getName();
|
||||||
private static final String THREAD_CLASS = Thread.class.getName();
|
private static final String THREAD_CLASS = Thread.class.getName();
|
||||||
|
private static final String STE_CLASS = StackTraceElement.class.getName();
|
||||||
|
|
||||||
private static final MethodReference NPE_INIT_METHOD = new MethodReference(NullPointerException.class,
|
private static final MethodReference NPE_INIT_METHOD = new MethodReference(NullPointerException.class,
|
||||||
"<init>", void.class);
|
"<init>", void.class);
|
||||||
|
@ -68,6 +69,7 @@ public class RuntimeRenderer {
|
||||||
renderRuntimeString();
|
renderRuntimeString();
|
||||||
renderRuntimeUnwrapString();
|
renderRuntimeUnwrapString();
|
||||||
renderRuntimeObjcls();
|
renderRuntimeObjcls();
|
||||||
|
renderRuntimeThrowablecls();
|
||||||
renderRuntimeNullCheck();
|
renderRuntimeNullCheck();
|
||||||
renderRuntimeIntern();
|
renderRuntimeIntern();
|
||||||
renderRuntimeThreads();
|
renderRuntimeThreads();
|
||||||
|
@ -190,6 +192,17 @@ public class RuntimeRenderer {
|
||||||
writer.append("function $rt_objcls() { return ").appendClass("java.lang.Object").append("; }").newLine();
|
writer.append("function $rt_objcls() { return ").appendClass("java.lang.Object").append("; }").newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void renderRuntimeThrowablecls() throws IOException {
|
||||||
|
writer.append("function $rt_stecls()").ws().append("{").indent().softNewLine();
|
||||||
|
writer.append("return ");
|
||||||
|
if (classSource.get(STE_CLASS) != null) {
|
||||||
|
writer.appendClass(STE_CLASS);
|
||||||
|
} else {
|
||||||
|
writer.appendClass("java.lang.Object");
|
||||||
|
}
|
||||||
|
writer.append(";").softNewLine().outdent().append("}").newLine();
|
||||||
|
}
|
||||||
|
|
||||||
private void renderRuntimeThreads() throws IOException {
|
private void renderRuntimeThreads() throws IOException {
|
||||||
ClassReader threadCls = classSource.get(THREAD_CLASS);
|
ClassReader threadCls = classSource.get(THREAD_CLASS);
|
||||||
MethodReader currentThreadMethod = threadCls != null ? threadCls.getMethod(CURRENT_THREAD_METHOD) : null;
|
MethodReader currentThreadMethod = threadCls != null ? threadCls.getMethod(CURRENT_THREAD_METHOD) : null;
|
||||||
|
|
|
@ -297,7 +297,7 @@ function $rt_exception(ex) {
|
||||||
function $rt_fillStack(err, ex) {
|
function $rt_fillStack(err, ex) {
|
||||||
if (typeof $rt_decodeStack === "function" && err.stack) {
|
if (typeof $rt_decodeStack === "function" && err.stack) {
|
||||||
var stack = $rt_decodeStack(err.stack);
|
var stack = $rt_decodeStack(err.stack);
|
||||||
var javaStack = $rt_createArray($rt_objcls(), stack.length);
|
var javaStack = $rt_createArray($rt_stecls(), stack.length);
|
||||||
var elem;
|
var elem;
|
||||||
var noStack = false;
|
var noStack = false;
|
||||||
for (var i = 0; i < stack.length; ++i) {
|
for (var i = 0; i < stack.length; ++i) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user