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

repl: remove void line for unused and compile as repl

This commit is contained in:
Henrixounez 2019-07-08 03:16:28 +02:00 committed by Alexander Medvednikov
parent 932f6d1bef
commit 26af513e1b

View File

@ -1020,11 +1020,9 @@ fn run_repl() []string {
// but don't add this print call to the `lines` array,
// so that it doesn't get called during the next print.
if line.starts_with('print') {
void_line := line.substr(line.index('(') + 1, line.len - 1)
lines << void_line
source_code := lines.join('\n') + '\n' + line
os.write_file(file, source_code)
s := os.exec('v run '+TmpPath+'/vrepl.v')
s := os.exec('v run '+TmpPath+'/vrepl.v -repl')
mut vals := s.split('\n')
if s.contains('panic: ') {
if !s.contains('declared and not used') {
@ -1051,7 +1049,7 @@ fn run_repl() []string {
}
temp_source_code := lines.join('\n') + '\n' + temp_line
os.write_file(temp_file, temp_source_code)
s := os.exec('v run '+TmpPath+'/vrepl_temp.v')
s := os.exec('v run '+TmpPath+'/vrepl_temp.v -repl')
if s.contains('panic: ') {
if !s.contains('declared and not used') {
mut vals := s.split('\n')