1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

small REPL fixes

This commit is contained in:
Alexander Medvednikov 2019-07-06 15:33:15 +02:00
parent f630d3f342
commit 59796a4168
3 changed files with 2 additions and 4 deletions

View File

@ -417,7 +417,7 @@ fn (p mut Parser) check_unused_variables() {
if var.name == '' { if var.name == '' {
break 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.scanner.line_nr = var.line_nr - 1
p.error('`$var.name` declared and not used') p.error('`$var.name` declared and not used')
} }

View File

@ -961,7 +961,6 @@ fn new_v(args[]string) *V {
fn run_repl() []string { fn run_repl() []string {
println('V $Version') println('V $Version')
println('Use Ctrl-C or `exit` to exit') 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' file := TmpPath + '/vrepl.v'
temp_file := TmpPath + '/vrepl_temp.v' temp_file := TmpPath + '/vrepl_temp.v'
mut lines := []string mut lines := []string

View File

@ -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) 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() fn (s mut Scanner) scan() ScanRes {
ScanRes {
// if s.file_path == 'd.v' { // if s.file_path == 'd.v' {
// println('\nscan()') // println('\nscan()')
// } // }