Skip to content

Commit 8afa940

Browse files
committed
fixed trace injection bug with for loop inside function def
1 parent 92bac89 commit 8afa940

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

client/scripts/debugger/debugger.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,8 +747,10 @@
747747
if (!match) {
748748
return null;
749749
}
750+
var indent = match[1].length;
751+
indent += indent%4?4-indent%4:0;
750752
return {
751-
indent: match[1].length,
753+
indent: indent ,
752754
indentString: match[1],
753755
match: match,
754756
index: match.index
@@ -778,7 +780,7 @@
778780
newCode += indent;
779781
// somehow seems to have proven useless
780782
// newCode += traceCall + "({event:'line', type:'afterwhile', frame:$B.last($B.frames_stack), line_no: " + (lastLine) + ", next_line_no: " + (lastLine) + "});\n";
781-
newCode += code.substr(res.index + indent.length);
783+
newCode += code.substr(res.index + code.substr(res.index).indexOf("}") + 1);
782784
return newCode;
783785
}
784786

client/scripts/debugger/python_expressions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,9 @@ def rec(n):
143143
rec(n-1)
144144

145145
rec(2)
146+
147+
def print_nums(x):
148+
for i in range(x):
149+
print(i)
150+
151+
print_nums(10)

0 commit comments

Comments
 (0)