mirror of
https://github.com/neovim/neovim.git
synced 2026-08-17 21:34:48 -05:00
fix(options): latent codegen bug
Problem:
Latent bug from 7f6c14ed54 (2015).
If an option default is "false" (`o.defaults.if_false = false`, e.g.
'fileignorecase'), codegen does not give it a `.def_val` on the platform
where its `#if` condition is undefined; it is zero-initialized.
This wasn't noticed until the parent commit, where zero value is
kObjectTypeNil, which `set_option_varp()` rejects.
Solution:
Check `if_false == nil` insteada of "falsey", so the `#else` branch gets
generated.
This commit is contained in:
@@ -290,7 +290,8 @@ local function dump_option(i, o, write)
|
||||
elseif o.defaults.condition then
|
||||
write(('#if defined(%s)'):format(o.defaults.condition))
|
||||
write(' .def_val=', get_defaults(o.defaults.if_true, o.full_name))
|
||||
if o.defaults.if_false then
|
||||
-- Check against nil: `if_false=false` is a valid default and must still emit the `#else`.
|
||||
if o.defaults.if_false ~= nil then
|
||||
write('#else')
|
||||
write(' .def_val=', get_defaults(o.defaults.if_false, o.full_name))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user