Mercurial > vim
comparison src/testdir/test_vim9_disassemble.vim @ 20324:23188ef99fc2 v8.2.0717
patch 8.2.0717: Vim9: postponed constant expressions does not scale
Commit: https://github.com/vim/vim/commit/7d131b071539e73e4f8a1e6ffbb4d7bfc69a57ec
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri May 8 19:10:34 2020 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 08 May 2020 19:15:03 +0200 |
parents | 9a5e2370df0e |
children | 445c2b2ea44b |
comparison
equal
deleted
inserted
replaced
20323:ee129fd509b1 | 20324:23188ef99fc2 |
---|---|
1037 | 1037 |
1038 def s:ConcatStrings(): string | 1038 def s:ConcatStrings(): string |
1039 return 'one' .. 'two' .. 'three' | 1039 return 'one' .. 'two' .. 'three' |
1040 enddef | 1040 enddef |
1041 | 1041 |
1042 def s:ComputeConst(): number | |
1043 return 2 + 3 * 4 / 6 + 7 | |
1044 enddef | |
1045 | |
1042 def Test_simplify_const_expr() | 1046 def Test_simplify_const_expr() |
1043 let res = execute('disass s:ConcatStrings') | 1047 let res = execute('disass s:ConcatStrings') |
1044 assert_match('\<SNR>\d*_ConcatStrings.*' .. | 1048 assert_match('\<SNR>\d*_ConcatStrings.*' .. |
1045 '\d PUSHS "onetwothree".*' .. | 1049 '\d PUSHS "onetwothree".*' .. |
1046 '\d RETURN', | 1050 '\d RETURN', |
1047 res) | 1051 res) |
1052 | |
1053 res = execute('disass s:ComputeConst') | |
1054 assert_match('\<SNR>\d*_ComputeConst.*' .. | |
1055 '\d PUSHNR 11.*' .. | |
1056 '\d RETURN', | |
1057 res) | |
1048 enddef | 1058 enddef |
1049 | 1059 |
1050 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker | 1060 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |