0
0
mirror of https://github.com/vim/vim.git synced 2025-10-04 05:25:06 -04:00

patch 9.0.1317: crash when using an unset object variable

Problem:    Crash when using an unset object variable.
Solution:   Give an error instead. (closes #12005)
This commit is contained in:
Bram Moolenaar
2023-02-17 21:08:50 +00:00
parent eea0a00811
commit 552bdca781
4 changed files with 34 additions and 7 deletions

View File

@@ -182,6 +182,21 @@ def Test_class_interface_wrong_end()
v9.CheckScriptFailure(lines, 'E476: Invalid command: endclass, expected endinterface')
enddef
def Test_object_not_set()
var lines =<< trim END
vim9script
class State
this.value = 'xyz'
endclass
var state: State
var db = {'xyz': 789}
echo db[state.value]
END
v9.CheckScriptFailure(lines, 'E1360:')
enddef
def Test_class_member_initializer()
var lines =<< trim END
vim9script