From 3aeaa24df63f4bdde14cc2183b44c86bb139dad2 Mon Sep 17 00:00:00 2001 From: Ned Palacios Date: Mon, 25 May 2020 16:35:55 +0800 Subject: [PATCH] repl: fix for-loop/if statement duplicate printing bug --- cmd/tools/vrepl.v | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/tools/vrepl.v b/cmd/tools/vrepl.v index 84e8439594..3a0b82673d 100644 --- a/cmd/tools/vrepl.v +++ b/cmd/tools/vrepl.v @@ -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)