From 465dc685cc88b0af70a79010daa2451a53b29583 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 24 May 2020 14:16:38 +0300 Subject: [PATCH] repl: treat `=x` at the start of a new line, the same as `println(x)` --- cmd/tools/vrepl.v | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/tools/vrepl.v b/cmd/tools/vrepl.v index 13c99ee03b..84e8439594 100644 --- a/cmd/tools/vrepl.v +++ b/cmd/tools/vrepl.v @@ -178,6 +178,9 @@ fn run_repl(workdir string, vrepl_prefix string) { // Save the source only if the user is printing something, // but don't add this print call to the `lines` array, // so that it doesn't get called during the next print. + if r.line.starts_with('='){ + r.line = 'println(' + r.line[1..] + ')' + } if r.line.starts_with('print') { source_code := r.current_source_code(false) + '\n${r.line}\n' os.write_file(file, source_code)