diff --git a/compiler/main.v b/compiler/main.v index 93a9df14ca..f8e7dcd55b 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -963,6 +963,7 @@ fn run_repl() []string { 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 for { print('>>> ') @@ -982,13 +983,52 @@ fn run_repl() []string { lines << void_line source_code := lines.join('\n') + '\n' + line os.write_file(file, source_code) - mut v := new_v( ['v', '-repl', file]) - v.compile() - s := os.exec(TmpPath + '/vrepl') - println(s) + s := os.exec('v run '+TmpPath+'/vrepl.v') + mut vals := s.split('\n') + if s.contains('panic: ') { + if !s.contains('declared and not used') { + for i:=1; i