REPL - Fix variable declare and not used by print
by using an empty line to call the variablespull/452/head
parent
9b1514320a
commit
d71410dff5
|
@ -812,6 +812,8 @@ fn run_repl() []string {
|
||||||
// so that it doesn't get called during the next print.
|
// so that it doesn't get called during the next print.
|
||||||
if line.starts_with('print') {
|
if line.starts_with('print') {
|
||||||
// TODO remove this once files without main compile correctly
|
// TODO remove this once files without main compile correctly
|
||||||
|
void_line := line.substr(line.index('(') + 1, line.len - 1)
|
||||||
|
lines << void_line
|
||||||
source_code := 'fn main(){' + lines.join('\n') + '\n' + line + '}'
|
source_code := 'fn main(){' + lines.join('\n') + '\n' + line + '}'
|
||||||
os.write_file(file, source_code)
|
os.write_file(file, source_code)
|
||||||
mut v := new_v( ['v', '-repl', file])
|
mut v := new_v( ['v', '-repl', file])
|
||||||
|
|
Loading…
Reference in New Issue