post increment/decrement repl fix

pull/3358/head
Shivanjan Chakravorty 2020-01-07 16:56:49 +05:30 committed by Alexander Medvednikov
parent 706c6066d5
commit a0c8ad7398
2 changed files with 19 additions and 1 deletions

View File

@ -151,7 +151,14 @@ pub fn run_repl() []string {
mut temp_line := r.line
mut temp_flag := false
func_call := r.function_call(r.line)
if !(r.line.contains(' ') || r.line.contains(':') || r.line.contains('=') || r.line.contains(',') || r.line == '') && !func_call {
if !(
r.line.contains(' ') ||
r.line.contains(':') ||
r.line.contains('=') ||
r.line.contains(',') ||
r.line.ends_with('++') ||
r.line.ends_with('--') ||
r.line == '') && !func_call {
temp_line = 'println($r.line)'
temp_flag = true
}

View File

@ -0,0 +1,11 @@
mut a := 2
a++
a
println(a)
println(a++)
a
===output===
3
3
3
3