mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
post increment/decrement repl fix
This commit is contained in:
parent
706c6066d5
commit
a0c8ad7398
@ -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
|
||||
}
|
||||
|
11
vlib/compiler/tests/repl/postfix_operators.repl
Normal file
11
vlib/compiler/tests/repl/postfix_operators.repl
Normal file
@ -0,0 +1,11 @@
|
||||
mut a := 2
|
||||
a++
|
||||
a
|
||||
println(a)
|
||||
println(a++)
|
||||
a
|
||||
===output===
|
||||
3
|
||||
3
|
||||
3
|
||||
3
|
Loading…
Reference in New Issue
Block a user