mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
repl: fix for-loop/if statement duplicate printing bug
This commit is contained in:
parent
96808a0e2a
commit
3aeaa24df6
@ -219,6 +219,13 @@ fn run_repl(workdir string, vrepl_prefix string) {
|
||||
if temp_line.starts_with('import ') || temp_line.starts_with('#include ') {
|
||||
temp_source_code = '${temp_line}\n' + r.current_source_code(false)
|
||||
} else {
|
||||
for i, l in r.lines {
|
||||
if (l.starts_with('for ') || l.starts_with('if ')) && l.contains('println') {
|
||||
r.lines.delete(i)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
temp_source_code = r.current_source_code(true) + '\n${temp_line}\n'
|
||||
}
|
||||
os.write_file(temp_file, temp_source_code)
|
||||
|
Loading…
Reference in New Issue
Block a user