From 59796a41685340dcf51cc326dfe5e915e22a3c14 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sat, 6 Jul 2019 15:33:15 +0200 Subject: [PATCH] small REPL fixes --- compiler/fn.v | 2 +- compiler/main.v | 1 - compiler/scanner.v | 3 +-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/compiler/fn.v b/compiler/fn.v index 48297bb09e..1307da373e 100644 --- a/compiler/fn.v +++ b/compiler/fn.v @@ -417,7 +417,7 @@ fn (p mut Parser) check_unused_variables() { if var.name == '' { break } - if !var.is_used && !var.is_arg && !p.pref.translated && var.name != '_' { + if !var.is_used && !p.pref.is_repl && !var.is_arg && !p.pref.translated && var.name != '_' { p.scanner.line_nr = var.line_nr - 1 p.error('`$var.name` declared and not used') } diff --git a/compiler/main.v b/compiler/main.v index f8e7dcd55b..35ac0bb35c 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -961,7 +961,6 @@ fn new_v(args[]string) *V { fn run_repl() []string { println('V $Version') println('Use Ctrl-C or `exit` to exit') - println('For now you have to use println() to print values, this will be fixed soon\n') file := TmpPath + '/vrepl.v' temp_file := TmpPath + '/vrepl_temp.v' mut lines := []string diff --git a/compiler/scanner.v b/compiler/scanner.v index fae0afa029..7a7303f4eb 100644 --- a/compiler/scanner.v +++ b/compiler/scanner.v @@ -165,8 +165,7 @@ fn (s mut Scanner) cao_change(operator string) { s.text = s.text.substr(0, s.pos - operator.len) + ' = ' + s.get_var_name(s.pos - operator.len) + ' ' + operator + ' ' + s.text.substr(s.pos + 1, s.text.len) } -fn (s mut Scanner) scan() -ScanRes { +fn (s mut Scanner) scan() ScanRes { // if s.file_path == 'd.v' { // println('\nscan()') // }