style(syntax): only use `[]` index where necessary

It interferes with sumenko_lua.
This commit is contained in:
Iron-E 2021-08-22 15:22:58 -04:00
parent cac088df10
commit 94eda96eb8
No known key found for this signature in database
GPG Key ID: 19B71B7B7B021D22
1 changed files with 7 additions and 7 deletions

View File

@ -93,7 +93,7 @@ local function tohex(rgb) return string.format('#%06x', rgb) end
local function use_background_with(attributes) local function use_background_with(attributes)
return setmetatable( return setmetatable(
attributes[go.background], attributes[go.background],
{['__index'] = attributes} {__index = attributes}
) )
end end
@ -116,10 +116,10 @@ function highlite.group(group_name)
return return
{ {
['fg'] = group_definition.foreground and tohex(group_definition.foreground) or _NONE, fg = group_definition.foreground and tohex(group_definition.foreground) or _NONE,
['bg'] = group_definition.background and tohex(group_definition.background) or _NONE, bg = group_definition.background and tohex(group_definition.background) or _NONE,
['blend'] = group_definition.blend, blend = group_definition.blend,
['style'] = style or _NONE style = style or _NONE
} }
end end
@ -166,7 +166,7 @@ function highlite:highlight_terminal(terminal_colors)
end end
end end
return setmetatable(highlite, {['__call'] = function(self, normal, highlights, terminal_colors) return setmetatable(highlite, {__call = function(self, normal, highlights, terminal_colors)
-- function to resolve function highlight groups being defined by function calls. -- function to resolve function highlight groups being defined by function calls.
local function resolve(tbl, key, resolve_links) local function resolve(tbl, key, resolve_links)
local value = tbl[key] local value = tbl[key]
@ -174,7 +174,7 @@ return setmetatable(highlite, {['__call'] = function(self, normal, highlights, t
if value_type == 'function' then -- call and cache the result; next time, if it isn't a function this step will be skipped if value_type == 'function' then -- call and cache the result; next time, if it isn't a function this step will be skipped
tbl[key] = value(setmetatable({}, tbl[key] = value(setmetatable({},
{ {
['__index'] = function(_, inner_key) return resolve(tbl, inner_key, true) end __index = function(_, inner_key) return resolve(tbl, inner_key, true) end
})) }))
elseif resolve_links and value_type == _TYPE_STRING and not string.find(value, '^#') then elseif resolve_links and value_type == _TYPE_STRING and not string.find(value, '^#') then
return resolve(tbl, value, resolve_links) return resolve(tbl, value, resolve_links)