mirror of
https://github.com/vim/vim.git
synced 2025-10-04 05:25:06 -04:00
patch 9.0.1662: crash when using a class member twice
Problem: Crash when using a class member twice. (Christian J. Robinson) Solution: Make a copy of the value.
This commit is contained in:
@@ -838,6 +838,23 @@ def Test_class_member()
|
||||
END
|
||||
v9.CheckScriptSuccess(lines)
|
||||
|
||||
# using static class member twice
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
|
||||
class HTML
|
||||
static author: string = 'John Doe'
|
||||
|
||||
static def MacroSubstitute(s: string): string
|
||||
return substitute(s, '{{author}}', author, 'gi')
|
||||
enddef
|
||||
endclass
|
||||
|
||||
assert_equal('some text', HTML.MacroSubstitute('some text'))
|
||||
assert_equal('some text', HTML.MacroSubstitute('some text'))
|
||||
END
|
||||
v9.CheckScriptSuccess(lines)
|
||||
|
||||
# access private member in lambda
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
|
Reference in New Issue
Block a user