Mercurial > vim
comparison src/testdir/test_vim9_disassemble.vim @ 20528:489cb75c76b6 v8.2.0818
patch 8.2.0818: Vim9: using a discovery phase doesn't work well
Commit: https://github.com/vim/vim/commit/822ba24743af9ee1b5e7f656a7a61a38f3638bca
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 24 23:00:18 2020 +0200
patch 8.2.0818: Vim9: using a discovery phase doesn't work well
Problem: Vim9: using a discovery phase doesn't work well.
Solution: Remove the discovery phase, instead compile a function only when
it is used. Add :defcompile to compile def functions earlier.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 24 May 2020 23:15:04 +0200 |
parents | 33166d945b54 |
children | 0d7465881b06 |
comparison
equal
deleted
inserted
replaced
20527:37ac4c5b4d27 | 20528:489cb75c76b6 |
---|---|
421 def Test_disassemble_update_instr() | 421 def Test_disassemble_update_instr() |
422 let res = execute('disass s:FuncWithForwardCall') | 422 let res = execute('disass s:FuncWithForwardCall') |
423 assert_match('FuncWithForwardCall\_s*' .. | 423 assert_match('FuncWithForwardCall\_s*' .. |
424 'return g:DefinedLater("yes")\_s*' .. | 424 'return g:DefinedLater("yes")\_s*' .. |
425 '\d PUSHS "yes"\_s*' .. | 425 '\d PUSHS "yes"\_s*' .. |
426 '\d UCALL g:DefinedLater(argc 1)\_s*' .. | 426 '\d DCALL DefinedLater(argc 1)\_s*' .. |
427 '\d CHECKTYPE string stack\[-1]\_s*' .. | |
428 '\d RETURN', | 427 '\d RETURN', |
429 res) | 428 res) |
430 | 429 |
431 " Calling the function will change UCALL into the faster DCALL | 430 " Calling the function will change UCALL into the faster DCALL |
432 assert_equal('yes', FuncWithForwardCall()) | 431 assert_equal('yes', FuncWithForwardCall()) |
434 res = execute('disass s:FuncWithForwardCall') | 433 res = execute('disass s:FuncWithForwardCall') |
435 assert_match('FuncWithForwardCall\_s*' .. | 434 assert_match('FuncWithForwardCall\_s*' .. |
436 'return g:DefinedLater("yes")\_s*' .. | 435 'return g:DefinedLater("yes")\_s*' .. |
437 '\d PUSHS "yes"\_s*' .. | 436 '\d PUSHS "yes"\_s*' .. |
438 '\d DCALL DefinedLater(argc 1)\_s*' .. | 437 '\d DCALL DefinedLater(argc 1)\_s*' .. |
439 '\d CHECKTYPE string stack\[-1]\_s*' .. | |
440 '\d RETURN', | 438 '\d RETURN', |
441 res) | 439 res) |
442 enddef | 440 enddef |
443 | 441 |
444 | 442 |
602 '\d STORE $0\_s*' .. | 600 '\d STORE $0\_s*' .. |
603 'return F("x")\_s*' .. | 601 'return F("x")\_s*' .. |
604 '\d PUSHS "x"\_s*' .. | 602 '\d PUSHS "x"\_s*' .. |
605 '\d LOAD $0\_s*' .. | 603 '\d LOAD $0\_s*' .. |
606 '\d PCALL (argc 1)\_s*' .. | 604 '\d PCALL (argc 1)\_s*' .. |
607 '\d CHECKTYPE string stack\[-1]', | 605 '\d RETURN', |
608 instr) | 606 instr) |
609 enddef | 607 enddef |
610 | 608 |
611 def AndOr(arg: any): string | 609 def AndOr(arg: any): string |
612 if arg == 1 && arg != 2 || arg == 4 | 610 if arg == 1 && arg != 2 || arg == 4 |