mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 9.0.1875: Vim9: improve test for disassemble + static
Problem: Vim9: improve test for disassemble + static Solution: Add a Vim9 script disassemble test for an interface with static members closes: #13037 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
committed by
Christian Brabandt
parent
1c7397f3f1
commit
28a60f898d
@@ -3046,4 +3046,88 @@ def Test_disassemble_class_function()
|
|||||||
unlet g:instr
|
unlet g:instr
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
" Disassemble instructions for using an interface with static and regular member
|
||||||
|
" variables.
|
||||||
|
def Test_disassemble_interface_static_member()
|
||||||
|
var lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
interface I
|
||||||
|
public static s_var: number
|
||||||
|
public this.o_var: number
|
||||||
|
public static s_var2: number
|
||||||
|
public this.o_var2: number
|
||||||
|
endinterface
|
||||||
|
|
||||||
|
class C implements I
|
||||||
|
public static s_var: number
|
||||||
|
public this.o_var: number
|
||||||
|
public static s_var2: number
|
||||||
|
public this.o_var2: number
|
||||||
|
endclass
|
||||||
|
|
||||||
|
def F1(i: I)
|
||||||
|
var x: number
|
||||||
|
x = i.s_var
|
||||||
|
x = i.o_var
|
||||||
|
x = i.s_var2
|
||||||
|
x = i.o_var2
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def F2(o: C)
|
||||||
|
var x: number
|
||||||
|
x = o.s_var
|
||||||
|
x = o.o_var
|
||||||
|
x = o.s_var2
|
||||||
|
x = o.o_var2
|
||||||
|
enddef
|
||||||
|
|
||||||
|
g:instr1 = execute('disassemble F1')
|
||||||
|
g:instr2 = execute('disassemble F2')
|
||||||
|
END
|
||||||
|
v9.CheckScriptSuccess(lines)
|
||||||
|
assert_match('<SNR>\d*_F1\_s*' ..
|
||||||
|
'var x: number\_s*' ..
|
||||||
|
'x = i.s_var\_s*' ..
|
||||||
|
'0 LOAD arg\[-1\]\_s*' ..
|
||||||
|
'1 ITF_MEMBER 0 on I \[STATIC\]\_s*' ..
|
||||||
|
'2 STORE $0\_s*' ..
|
||||||
|
'x = i.o_var\_s*' ..
|
||||||
|
'3 LOAD arg\[-1\]\_s*' ..
|
||||||
|
'4 ITF_MEMBER 0 on I\_s*' ..
|
||||||
|
'5 STORE $0\_s*' ..
|
||||||
|
'x = i.s_var2\_s*' ..
|
||||||
|
'6 LOAD arg\[-1\]\_s*' ..
|
||||||
|
'7 ITF_MEMBER 1 on I \[STATIC\]\_s*' ..
|
||||||
|
'8 STORE $0\_s*' ..
|
||||||
|
'x = i.o_var2\_s*' ..
|
||||||
|
'9 LOAD arg\[-1\]\_s*' ..
|
||||||
|
'10 ITF_MEMBER 1 on I\_s*' ..
|
||||||
|
'11 STORE $0\_s*' ..
|
||||||
|
'12 RETURN void\_s*',
|
||||||
|
g:instr1)
|
||||||
|
assert_match('<SNR>\d*_F2\_s*' ..
|
||||||
|
'var x: number\_s*' ..
|
||||||
|
'x = o.s_var\_s*' ..
|
||||||
|
'0 LOAD arg\[-1\]\_s*' ..
|
||||||
|
'1 OBJ_MEMBER 0 \[STATIC\]\_s*' ..
|
||||||
|
'2 STORE $0\_s*' ..
|
||||||
|
'x = o.o_var\_s*' ..
|
||||||
|
'3 LOAD arg\[-1\]\_s*' ..
|
||||||
|
'4 OBJ_MEMBER 0\_s*' ..
|
||||||
|
'5 STORE $0\_s*' ..
|
||||||
|
'x = o.s_var2\_s*' ..
|
||||||
|
'6 LOAD arg\[-1\]\_s*' ..
|
||||||
|
'7 OBJ_MEMBER 1 \[STATIC\]\_s*' ..
|
||||||
|
' 8 STORE $0\_s*' ..
|
||||||
|
'x = o.o_var2\_s*' ..
|
||||||
|
'9 LOAD arg\[-1\]\_s*' ..
|
||||||
|
'10 OBJ_MEMBER 1\_s*' ..
|
||||||
|
'11 STORE $0\_s*' ..
|
||||||
|
'12 RETURN void',
|
||||||
|
g:instr2)
|
||||||
|
|
||||||
|
unlet g:instr1
|
||||||
|
unlet g:instr2
|
||||||
|
enddef
|
||||||
|
|
||||||
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
||||||
|
@@ -699,6 +699,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1875,
|
||||||
/**/
|
/**/
|
||||||
1874,
|
1874,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user