small REPL fixes

pull/1025/head
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 == '' {
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')
}

View File

@ -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

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