1
0
forked from aniani/vim

patch 8.2.0717: Vim9: postponed constant expressions does not scale

Problem:    Vim9: postponed constant expressions does not scale.
Solution:   Add a structure to pass around postponed constants.
This commit is contained in:
Bram Moolenaar
2020-05-08 19:10:34 +02:00
parent 5c2fe64443
commit 7d131b0715
3 changed files with 182 additions and 135 deletions

View File

@@ -1039,12 +1039,22 @@ def s:ConcatStrings(): string
return 'one' .. 'two' .. 'three'
enddef
def s:ComputeConst(): number
return 2 + 3 * 4 / 6 + 7
enddef
def Test_simplify_const_expr()
let res = execute('disass s:ConcatStrings')
assert_match('\<SNR>\d*_ConcatStrings.*' ..
'\d PUSHS "onetwothree".*' ..
'\d RETURN',
res)
res = execute('disass s:ComputeConst')
assert_match('\<SNR>\d*_ComputeConst.*' ..
'\d PUSHNR 11.*' ..
'\d RETURN',
res)
enddef
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker