[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Get rid of "local abc abc = function(...)" idiom (9ad93d2)
Marcel Fabian Krüger
tex at 2krueger.de
Thu Feb 13 11:13:09 CET 2020
Repository : https://github.com/latex3/luaotfload
On branch : dev
Link : https://github.com/latex3/luaotfload/commit/9ad93d271a79d163001ff044ff3cec7235e50e56
>---------------------------------------------------------------
commit 9ad93d271a79d163001ff044ff3cec7235e50e56
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date: Thu Feb 13 11:13:09 2020 +0100
Get rid of "local abc abc = function(...)" idiom
The conversion is done automatically by
comby -custom-matcher ~/comby/lua.json 'local :[[name]] :[[name]] = function (:[args]):[body]end' 'local function :[[name]] (:[args]):[body]end' src/*.lua -i
>---------------------------------------------------------------
9ad93d271a79d163001ff044ff3cec7235e50e56
src/luaotfload-colors.lua | 6 ++----
src/luaotfload-configuration.lua | 3 +--
src/luaotfload-database.lua | 14 +++++---------
src/luaotfload-parsers.lua | 3 +--
src/luaotfload-tool.lua | 12 +++++-------
5 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/src/luaotfload-colors.lua b/src/luaotfload-colors.lua
index c533108..02d30e9 100644
--- a/src/luaotfload-colors.lua
+++ b/src/luaotfload-colors.lua
@@ -175,8 +175,7 @@ local color_callback
local color_attr = luatexbase.new_attribute("luaotfload_color_attribute")
-- (node * node * string * bool * (bool | nil)) -> (node * node * (string | nil))
-local color_whatsit
-color_whatsit = function (head, curr, color, push, tail)
+local function color_whatsit (head, curr, color, push, tail)
local pushdata = hex_to_rgba(color)
local colornode = newnode(whatsit_t, colorstack_t)
setfield(colornode, "stack", 0)
@@ -220,8 +219,7 @@ values during the node list traversal.
--doc]]--
--- (node * (string | nil)) -> (node * (string | nil))
-local node_colorize
-node_colorize = function (head, toplevel, current_color)
+local function node_colorize (head, toplevel, current_color)
local n = head
while n do
local n_id = getid(n)
diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua
index e4a15bd..2e73396 100644
--- a/src/luaotfload-configuration.lua
+++ b/src/luaotfload-configuration.lua
@@ -887,8 +887,7 @@ local process_options = function (opts)
return new
end
-local apply
-apply = function (old, new)
+local function apply (old, new)
if not new then
if not old then
return false
diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua
index c401ef9..9a84ab1 100644
--- a/src/luaotfload-database.lua
+++ b/src/luaotfload-database.lua
@@ -310,8 +310,7 @@ local sanitize_fontnames = function (rawnames)
return result
end
-local find_files_indeed
-find_files_indeed = function (acc, dirs, filter)
+local function find_files_indeed (acc, dirs, filter)
if not next (dirs) then --- done
return acc
end
@@ -632,8 +631,7 @@ getmetadata = function ()
end
--- unit -> unit
-local load_lookups
-load_lookups = function ( )
+local function load_lookups ( )
local foundname, data = load_lua_file(config.luaotfload.paths.lookup_path_lua)
if data then
logreport ("log", 0, "cache", "Lookup cache loaded from %s.", foundname)
@@ -867,8 +865,7 @@ local hash_request = function (specification)
end
--- 'a -> 'a -> table -> (string * int|boolean * boolean)
-local lookup_font_name_cached
-lookup_font_name_cached = function (specification)
+local function lookup_font_name_cached (specification)
if not lookup_cache then load_lookups () end
local request = hash_request(specification)
logreport ("both", 4, "cache", "Looking for %q in cache ...",
@@ -2175,8 +2172,7 @@ local locate_matching_pfb = function (afmfile, dir)
return kpsefind_file (pfbname, "type1 fonts")
end
-local process_dir_tree
-process_dir_tree = function (acc, dirs, done)
+local function process_dir_tree (acc, dirs, done)
if not next (dirs) then --- done
return acc
end
@@ -3644,7 +3640,7 @@ end
--- string -> string list -> int -> string list -> string list -> string list ->
--- (string list * string list * string list * string list)
-local collect_cache collect_cache = function (path, all, n, luanames,
+local function collect_cache (path, all, n, luanames,
lucnames, rest)
if not all then
local all = find_files (path)
diff --git a/src/luaotfload-parsers.lua b/src/luaotfload-parsers.lua
index 11f8693..fbcd6e3 100644
--- a/src/luaotfload-parsers.lua
+++ b/src/luaotfload-parsers.lua
@@ -248,8 +248,7 @@ end
--- -> string list -> string list -> string list
--- -> (string -> fun option -> string list)
--- -> tab * tab * tab
-local read_fonts_conf_indeed
-read_fonts_conf_indeed = function (depth,
+local function read_fonts_conf_indeed (depth,
start,
home,
xdg_config_home,
diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua
index 4edeb9c..643a05f 100644
--- a/src/luaotfload-tool.lua
+++ b/src/luaotfload-tool.lua
@@ -447,7 +447,7 @@ local baseindent = " "
--doc]]--
-local show_info_table show_info_table = function (t, depth)
+local function show_info_table (t, depth)
depth = depth or 0
local indent = stringrep (baseindent, depth)
local keys = tablesortedkeys (t)
@@ -671,8 +671,7 @@ local show_full_info = function (path, subfont)
display_features(rawinfo.resources.features)
end
-local subfont_by_name
-subfont_by_name = function (lst, askedname, n)
+local function subfont_by_name (lst, askedname, n)
for n = 1, #lst do
local font = lst[n]
if fonts.names.sanitize_fontname (font.fullname) == askedname then
@@ -1239,7 +1238,7 @@ end
---
--- --list=<criterion> --fields=<f1>,<f2>,<f3>,...<fn>
-local get_fields get_fields = function (entry, fields, acc, n)
+local function get_fields (entry, fields, acc, n)
if not acc then
return get_fields (entry, fields, { }, 1)
end
@@ -1268,7 +1267,7 @@ end
local separator = "\t" --- could be “,” for csv
-local format_fields format_fields = function (fields, acc, n)
+local function format_fields (fields, acc, n)
if not acc then
return format_fields(fields, { }, 1)
end
@@ -1285,8 +1284,7 @@ local format_fields format_fields = function (fields, acc, n)
return tableconcat(acc, separator)
end
-local set_primary_field
-set_primary_field = function (fields, addme, acc, n)
+local function set_primary_field (fields, addme, acc, n)
if not acc then
return set_primary_field(fields, addme, { addme }, 1)
end
More information about the latex3-commits
mailing list.