mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-23 00:24:11 -08:00
Fixes bugs related to stepping
This commit is contained in:
parent
6272c3a79a
commit
97e107635b
|
@ -108,18 +108,8 @@ public class Debugger {
|
||||||
if (callSiteLoc != null) {
|
if (callSiteLoc != null) {
|
||||||
callMethod = debugInfo.getCallSite(callSiteLoc);
|
callMethod = debugInfo.getCallSite(callSiteLoc);
|
||||||
}
|
}
|
||||||
SourceLocation[] following = debugInfo.getFollowingLines(frame.getLocation());
|
exits = addFollowing(debugInfo, frame.getLocation(), script, new HashSet<SourceLocation>(),
|
||||||
if (following != null) {
|
successors);
|
||||||
for (SourceLocation successor : following) {
|
|
||||||
if (successor == null) {
|
|
||||||
exits = true;
|
|
||||||
} else {
|
|
||||||
for (GeneratedLocation loc : debugInfo.getGeneratedLocations(successor)) {
|
|
||||||
successors.add(new JavaScriptLocation(script, loc.getLine(), loc.getColumn()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (enterMethod && callMethod != null) {
|
if (enterMethod && callMethod != null) {
|
||||||
for (MethodReference potentialMethod : debugInfo.getOverridingMethods(callMethod)) {
|
for (MethodReference potentialMethod : debugInfo.getOverridingMethods(callMethod)) {
|
||||||
for (GeneratedLocation loc : debugInfo.getMethodEntrances(potentialMethod)) {
|
for (GeneratedLocation loc : debugInfo.getMethodEntrances(potentialMethod)) {
|
||||||
|
@ -140,6 +130,32 @@ public class Debugger {
|
||||||
javaScriptDebugger.resume();
|
javaScriptDebugger.resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean addFollowing(DebugInformation debugInfo, SourceLocation location, String script,
|
||||||
|
Set<SourceLocation> visited, Set<JavaScriptLocation> successors) {
|
||||||
|
if (!visited.add(location)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SourceLocation[] following = debugInfo.getFollowingLines(location);
|
||||||
|
boolean exits = false;
|
||||||
|
if (following != null) {
|
||||||
|
for (SourceLocation successor : following) {
|
||||||
|
if (successor == null) {
|
||||||
|
exits = true;
|
||||||
|
} else {
|
||||||
|
Collection<GeneratedLocation> genLocations = debugInfo.getGeneratedLocations(successor);
|
||||||
|
if (!genLocations.isEmpty()) {
|
||||||
|
for (GeneratedLocation loc : genLocations) {
|
||||||
|
successors.add(new JavaScriptLocation(script, loc.getLine(), loc.getColumn()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
exits |= addFollowing(debugInfo, successor, script, visited, successors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return exits;
|
||||||
|
}
|
||||||
|
|
||||||
private List<DebugInformation> debugInformationBySource(String sourceFile) {
|
private List<DebugInformation> debugInformationBySource(String sourceFile) {
|
||||||
Map<DebugInformation, Object> list = debugInformationFileMap.get(sourceFile);
|
Map<DebugInformation, Object> list = debugInformationFileMap.get(sourceFile);
|
||||||
return list != null ? new ArrayList<>(list.keySet()) : Collections.<DebugInformation>emptyList();
|
return list != null ? new ArrayList<>(list.keySet()) : Collections.<DebugInformation>emptyList();
|
||||||
|
|
|
@ -631,9 +631,15 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
||||||
public void visit(ConditionalStatement statement) {
|
public void visit(ConditionalStatement statement) {
|
||||||
try {
|
try {
|
||||||
while (true) {
|
while (true) {
|
||||||
|
if (statement.getCondition().getLocation() != null) {
|
||||||
|
pushLocation(statement.getCondition().getLocation());
|
||||||
|
}
|
||||||
writer.append("if").ws().append("(");
|
writer.append("if").ws().append("(");
|
||||||
statement.getCondition().acceptVisitor(this);
|
statement.getCondition().acceptVisitor(this);
|
||||||
writer.append(")").ws().append("{").softNewLine().indent();
|
writer.append(")").ws().append("{").softNewLine().indent();
|
||||||
|
if (statement.getCondition().getLocation() != null) {
|
||||||
|
popLocation();
|
||||||
|
}
|
||||||
for (Statement part : statement.getConsequent()) {
|
for (Statement part : statement.getConsequent()) {
|
||||||
part.acceptVisitor(this);
|
part.acceptVisitor(this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user