aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV1K1NGbg <victor@ilchev.com>2024-07-26 00:06:39 +0300
committerV1K1NGbg <victor@ilchev.com>2024-08-05 20:49:17 +0300
commit2fa95314cc273c2cfc941e97bf8a183e048bccf6 (patch)
treea402a53b5dda8bd5f3baf484e6a6ff90e56b4ea1
parent1f01bc98f91546a03b777202ce0f52f827dbd321 (diff)
downloadluarocks-2fa95314cc273c2cfc941e97bf8a183e048bccf6.tar.gz
luarocks-2fa95314cc273c2cfc941e97bf8a183e048bccf6.tar.bz2
luarocks-2fa95314cc273c2cfc941e97bf8a183e048bccf6.zip
removed some comments
-rw-r--r--src/luarocks/persist.tl2
-rw-r--r--src/luarocks/util.tl24
2 files changed, 13 insertions, 13 deletions
diff --git a/src/luarocks/persist.tl b/src/luarocks/persist.tl
index 95fc39d9..46a1bbad 100644
--- a/src/luarocks/persist.tl
+++ b/src/luarocks/persist.tl
@@ -174,7 +174,7 @@ end
174-- @param tbl table: the table containing the data to be written 174-- @param tbl table: the table containing the data to be written
175-- @param field_order table: an optional array indicating the order of top-level fields. 175-- @param field_order table: an optional array indicating the order of top-level fields.
176-- @return persisted data as string; or nil and an error message 176-- @return persisted data as string; or nil and an error message
177function persist.save_from_table_to_string(tbl: {number | string: number | string}, field_order: util.SortBy<number | string>): string, string --? optional 177function persist.save_from_table_to_string(tbl: {number | string: number | string}, field_order: util.SortBy<number | string>): string, string
178 local out: Writer = {buffer = {}} --! 178 local out: Writer = {buffer = {}} --!
179 function out:write(data: string) table.insert(self.buffer, data) end 179 function out:write(data: string) table.insert(self.buffer, data) end
180 local ok, err = write_table_as_assignments(out, tbl, field_order) 180 local ok, err = write_table_as_assignments(out, tbl, field_order)
diff --git a/src/luarocks/util.tl b/src/luarocks/util.tl
index c1282eb1..505584a0 100644
--- a/src/luarocks/util.tl
+++ b/src/luarocks/util.tl
@@ -53,7 +53,7 @@ local type Rockspec = cfg.Rockspec
53local type Parser = util.Parser 53local type Parser = util.Parser
54 54
55 55
56local scheduled_functions: {Fn} = {} --? infered from line 48-51 56local scheduled_functions: {Fn} = {}
57 57
58--- Schedule a function to be executed upon program termination. 58--- Schedule a function to be executed upon program termination.
59-- This is useful for actions such as deleting temporary directories 59-- This is useful for actions such as deleting temporary directories
@@ -73,7 +73,7 @@ end
73-- @param item table: The token representing the scheduled function that was 73-- @param item table: The token representing the scheduled function that was
74-- returned from the schedule_function call. 74-- returned from the schedule_function call.
75function util.remove_scheduled_function(item: Fn) 75function util.remove_scheduled_function(item: Fn)
76 for k, v in ipairs(scheduled_functions) do --? ipairs 76 for k, v in ipairs(scheduled_functions) do
77 if v == item then 77 if v == item then
78 table.remove(scheduled_functions, k) 78 table.remove(scheduled_functions, k)
79 return 79 return
@@ -150,7 +150,7 @@ function util.variable_substitutions(tbl: {string: any}, vars: {string: string})
150 local updated: {string: string} = {} 150 local updated: {string: string} = {}
151 for k, v in pairs(tbl) do 151 for k, v in pairs(tbl) do
152 if v is string then 152 if v is string then
153 updated[k] = string.gsub(v, var_format_pattern, vars) --! table 100% (there is an assert in src/luarocks/util.lua) 153 updated[k] = string.gsub(v, var_format_pattern, vars)
154 if warn_failed_matches(updated[k]) then 154 if warn_failed_matches(updated[k]) then
155 updated[k] = updated[k]:gsub(var_format_pattern, "") 155 updated[k] = updated[k]:gsub(var_format_pattern, "")
156 end 156 end
@@ -285,7 +285,7 @@ end
285-- @param unnamed_paths table: An array of rockspec paths that don't contain rock 285-- @param unnamed_paths table: An array of rockspec paths that don't contain rock
286-- name and version in regular format. 286-- name and version in regular format.
287-- @param subdir string: path to subdirectory. 287-- @param subdir string: path to subdirectory.
288local function collect_rockspecs(versions: {string: string}, paths: {string: string}, unnamed_paths: {string}, subdir: string) --! fs stuff 288local function collect_rockspecs(versions: {string: string}, paths: {string: string}, unnamed_paths: {string}, subdir: string)
289 local fs = require("luarocks.fs") 289 local fs = require("luarocks.fs")
290 local dir = require("luarocks.dir") 290 local dir = require("luarocks.dir")
291 local path = require("luarocks.path") 291 local path = require("luarocks.path")
@@ -343,7 +343,7 @@ function util.get_default_rockspec(): string, string
343 343
344 if rock then 344 if rock then
345 -- If there are rockspecs for multiple rocks it's ambiguous. 345 -- If there are rockspecs for multiple rocks it's ambiguous.
346 if next(versions, rock) ~= nil then --! why expect boolean 346 if next(versions, rock) ~= nil then
347 return nil, "Please specify which rockspec file to use." 347 return nil, "Please specify which rockspec file to use."
348 else 348 else
349 return paths[rock] 349 return paths[rock]
@@ -373,7 +373,7 @@ function util.split_namespace(ns_name: string): string, string
373end 373end
374 374
375--- Argparse action callback for namespaced rock arguments. 375--- Argparse action callback for namespaced rock arguments.
376function util.namespaced_name_action(args: {any: any}, target: string, ns_name: string) --? Fn.args 376function util.namespaced_name_action(args: {any: any}, target: string, ns_name: string)
377 377
378 if not ns_name then 378 if not ns_name then
379 return 379 return
@@ -406,7 +406,7 @@ end
406-- before the platform has been determined and luarocks.fs has been 406-- before the platform has been determined and luarocks.fs has been
407-- initialized. 407-- initialized.
408function util.exists(file: string): boolean 408function util.exists(file: string): boolean
409 local fd, _, code = io.open(file, "r") --! both tl.tl and the lua docs say that the method gives 2 returns: (FILE and string) 409 local fd, _, code = io.open(file, "r")
410 if code == 13 then 410 if code == 13 then
411 -- code 13 means "Permission denied" on both Unix and Windows 411 -- code 13 means "Permission denied" on both Unix and Windows
412 -- io.open on folders always fails with code 13 on Windows 412 -- io.open on folders always fails with code 13 on Windows
@@ -430,7 +430,7 @@ function util.lua_is_wrapper(interp: string): boolean, string
430 if not data then 430 if not data then
431 return nil, err 431 return nil, err
432 end 432 end
433 return not not data:match("LUAROCKS_SYSCONFDIR") --! not not ->? string to true? 433 return not not data:match("LUAROCKS_SYSCONFDIR")
434end 434end
435 435
436do 436do
@@ -455,7 +455,7 @@ do
455 return lv 455 return lv
456 end 456 end
457 457
458 function util.get_luajit_version(): string --? cfg.cache.luajit_version no context 458 function util.get_luajit_version(): string
459 if cfg.cache.luajit_version_checked then 459 if cfg.cache.luajit_version_checked then
460 return cfg.cache.luajit_version 460 return cfg.cache.luajit_version
461 end 461 end
@@ -465,7 +465,7 @@ do
465 return nil 465 return nil
466 end 466 end
467 467
468 local ljv: string --? above a string? 468 local ljv: string
469 if cfg.lua_version == "5.1" then 469 if cfg.lua_version == "5.1" then
470 -- Ignores extra version info for custom builds, e.g. "LuaJIT 2.1.0-beta3 some-other-version-info" 470 -- Ignores extra version info for custom builds, e.g. "LuaJIT 2.1.0-beta3 some-other-version-info"
471 ljv = util.popen_read(Q(cfg.variables.LUA) .. ' -e "io.write(tostring(jit and jit.version:gsub([[^%S+ (%S+).*]], [[%1]])))"') 471 ljv = util.popen_read(Q(cfg.variables.LUA) .. ' -e "io.write(tostring(jit and jit.version:gsub([[^%S+ (%S+).*]], [[%1]])))"')
@@ -540,7 +540,7 @@ do
540 return nil, bindir 540 return nil, bindir
541 end 541 end
542 542
543 return { --? {string: string} 543 return {
544 lua_version = luaver, 544 lua_version = luaver,
545 lua = lua, 545 lua = lua,
546 lua_dir = prefix, 546 lua_dir = prefix,
@@ -623,7 +623,7 @@ function util.get_rocks_provided(rockspec: Rockspec): {string: string}
623 end 623 end
624 624
625 if not rockspec then 625 if not rockspec then
626 cfg.cache.rocks_provided = rocks_provided --! 626 cfg.cache.rocks_provided = rocks_provided
627 end 627 end
628 628
629 return rocks_provided 629 return rocks_provided