mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Fix invalid call sites in debug information for INVOKEVIRTUAL
This commit is contained in:
parent
ce78bdb07f
commit
dc3faa1727
|
@ -1284,6 +1284,9 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
|||
if (injector != null) {
|
||||
injector.generate(new InjectorContextImpl(expr.getArguments()), expr.getMethod());
|
||||
} else {
|
||||
if (expr.getType() == InvocationType.DYNAMIC) {
|
||||
expr.getArguments().get(0).acceptVisitor(this);
|
||||
}
|
||||
String className = naming.getNameFor(expr.getMethod().getClassName());
|
||||
String name = naming.getNameFor(expr.getMethod());
|
||||
String fullName = naming.getFullNameFor(expr.getMethod());
|
||||
|
@ -1293,6 +1296,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
|||
lastCallSite = callSite;
|
||||
}
|
||||
boolean virtual = false;
|
||||
System.out.println("Render invocation of " + expr.getMethod());
|
||||
switch (expr.getType()) {
|
||||
case STATIC:
|
||||
writer.append(fullName).append("(");
|
||||
|
@ -1316,7 +1320,6 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
|||
writer.append(")");
|
||||
break;
|
||||
case DYNAMIC:
|
||||
expr.getArguments().get(0).acceptVisitor(this);
|
||||
writer.append(".").append(name).append("(");
|
||||
prevCallSite = debugEmitter.emitCallSite();
|
||||
for (int i = 1; i < expr.getArguments().size(); ++i) {
|
||||
|
|
|
@ -33,10 +33,8 @@ import org.eclipse.ui.editors.text.EditorsUI;
|
|||
import org.eclipse.ui.ide.FileStoreEditorInput;
|
||||
import org.eclipse.ui.part.FileEditorInput;
|
||||
import org.teavm.debugging.CallFrame;
|
||||
import org.teavm.debugging.Value;
|
||||
import org.teavm.debugging.javascript.JavaScriptCallFrame;
|
||||
import org.teavm.debugging.javascript.JavaScriptLocation;
|
||||
import org.teavm.debugging.javascript.JavaScriptValue;
|
||||
import org.teavm.eclipse.debugger.*;
|
||||
import org.teavm.model.MethodDescriptor;
|
||||
import org.teavm.model.MethodReference;
|
||||
|
@ -96,23 +94,12 @@ public class TeaVMDebugModelPresentation extends LabelProvider implements IDebug
|
|||
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
System.out.println(element.getClass().getName());
|
||||
if (element instanceof TeaVMJavaStackFrame) {
|
||||
TeaVMJavaStackFrame stackFrame = (TeaVMJavaStackFrame)element;
|
||||
return callFrameAsString(stackFrame.getCallFrame());
|
||||
} else if (element instanceof TeaVMJSStackFrame) {
|
||||
TeaVMJSStackFrame stackFrame = (TeaVMJSStackFrame)element;
|
||||
return callFrameAsString(stackFrame.getCallFrame());
|
||||
} else if (element instanceof TeaVMJavaVariable) {
|
||||
TeaVMJavaVariable var = (TeaVMJavaVariable)element;
|
||||
return getText((TeaVMJavaValue)var.getValue());
|
||||
} else if (element instanceof TeaVMJavaValue) {
|
||||
return getText((TeaVMJavaValue)element);
|
||||
} else if (element instanceof TeaVMJSVariable) {
|
||||
TeaVMJSVariable var = (TeaVMJSVariable)element;
|
||||
return getText((TeaVMJSValue)var.getValue());
|
||||
} else if (element instanceof TeaVMJSValue) {
|
||||
return getText((TeaVMJSValue)element);
|
||||
} else if (element instanceof TeaVMDebugTarget) {
|
||||
return ((TeaVMDebugTarget)element).getName();
|
||||
} else if (element instanceof TeaVMThread) {
|
||||
|
@ -121,25 +108,6 @@ public class TeaVMDebugModelPresentation extends LabelProvider implements IDebug
|
|||
return super.getText(element);
|
||||
}
|
||||
|
||||
private String getText(TeaVMJavaValue value) {
|
||||
TeaVMDebugTarget debugTarget = value.getDebugTarget();
|
||||
Value teavmValue = value.getTeavmValue();
|
||||
if (teavmValue.getInstanceId() == null) {
|
||||
return teavmValue.getType() + " (id: " + debugTarget.getId(teavmValue.getInstanceId()) + ")";
|
||||
} else {
|
||||
return teavmValue.getRepresentation();
|
||||
}
|
||||
}
|
||||
|
||||
private String getText(TeaVMJSValue value) {
|
||||
TeaVMDebugTarget debugTarget = value.getDebugTarget();
|
||||
JavaScriptValue jsValue = value.getJavaScriptValue();
|
||||
if (jsValue.getInstanceId() == null) {
|
||||
return jsValue.getClassName() + " (id: " + debugTarget.getId(jsValue.getInstanceId()) + ")";
|
||||
} else {
|
||||
return jsValue.getRepresentation();
|
||||
}
|
||||
}
|
||||
|
||||
private String callFrameAsString(CallFrame callFrame) {
|
||||
MethodReference method = callFrame.getMethod();
|
||||
|
|
Loading…
Reference in New Issue
Block a user