mirror of
https://github.com/neovim/neovim.git
synced 2026-08-02 04:51:38 +08:00
fix(options): latent codegen bug
Problem: Latent bug from 7f6c14ed54a46e822b80134d39a89f97523a2706 (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:
parent
cb7c019167
commit
1a755e4890
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user