diff options
Diffstat (limited to 'lua/mason-core/installer/context')
| -rw-r--r-- | lua/mason-core/installer/context/cwd.lua | 14 | ||||
| -rw-r--r-- | lua/mason-core/installer/context/fs.lua | 8 | ||||
| -rw-r--r-- | lua/mason-core/installer/context/init.lua | 10 | ||||
| -rw-r--r-- | lua/mason-core/installer/context/spawn.lua | 10 |
4 files changed, 27 insertions, 15 deletions
diff --git a/lua/mason-core/installer/context/cwd.lua b/lua/mason-core/installer/context/cwd.lua index cb2e70ec..2b74bf55 100644 --- a/lua/mason-core/installer/context/cwd.lua +++ b/lua/mason-core/installer/context/cwd.lua @@ -11,13 +11,15 @@ InstallContextCwd.__index = InstallContextCwd ---@param handle InstallHandle ---@param location InstallLocation -function InstallContextCwd.new(handle, location) +function InstallContextCwd:new(handle, location) assert(location, "location not provided") - return setmetatable({ - location = location, - handle = handle, - cwd = nil, - }, InstallContextCwd) + ---@type InstallContextCwd + local instance = {} + setmetatable(instance, self) + instance.location = location + instance.handle = handle + instance.cwd = nil + return instance end function InstallContextCwd:initialize() diff --git a/lua/mason-core/installer/context/fs.lua b/lua/mason-core/installer/context/fs.lua index 5c51fb56..93379017 100644 --- a/lua/mason-core/installer/context/fs.lua +++ b/lua/mason-core/installer/context/fs.lua @@ -8,8 +8,12 @@ local InstallContextFs = {} InstallContextFs.__index = InstallContextFs ---@param cwd InstallContextCwd -function InstallContextFs.new(cwd) - return setmetatable({ cwd = cwd }, InstallContextFs) +function InstallContextFs:new(cwd) + ---@type InstallContextFs + local instance = {} + setmetatable(instance, InstallContextFs) + instance.cwd = cwd + return instance end ---@async diff --git a/lua/mason-core/installer/context/init.lua b/lua/mason-core/installer/context/init.lua index f2cedb42..425bf39c 100644 --- a/lua/mason-core/installer/context/init.lua +++ b/lua/mason-core/installer/context/init.lua @@ -26,10 +26,10 @@ InstallContext.__index = InstallContext ---@param handle InstallHandle ---@param location InstallLocation ---@param opts PackageInstallOpts -function InstallContext.new(handle, location, opts) - local cwd = InstallContextCwd.new(handle, location) - local spawn = InstallContextSpawn.new(handle, cwd, false) - local fs = InstallContextFs.new(cwd) +function InstallContext:new(handle, location, opts) + local cwd = InstallContextCwd:new(handle, location) + local spawn = InstallContextSpawn:new(handle, cwd, false) + local fs = InstallContextFs:new(cwd) return setmetatable({ cwd = cwd, spawn = spawn, @@ -37,7 +37,7 @@ function InstallContext.new(handle, location, opts) location = location, package = handle.package, -- for convenience fs = fs, - receipt = receipt.InstallReceiptBuilder.new(), + receipt = receipt.InstallReceiptBuilder:new(), stdio_sink = handle.stdio.sink, links = { bin = {}, diff --git a/lua/mason-core/installer/context/spawn.lua b/lua/mason-core/installer/context/spawn.lua index 0a73ff3a..f2ce8df2 100644 --- a/lua/mason-core/installer/context/spawn.lua +++ b/lua/mason-core/installer/context/spawn.lua @@ -10,8 +10,14 @@ local InstallContextSpawn = {} ---@param handle InstallHandle ---@param cwd InstallContextCwd ---@param strict_mode boolean -function InstallContextSpawn.new(handle, cwd, strict_mode) - return setmetatable({ cwd = cwd, handle = handle, strict_mode = strict_mode }, InstallContextSpawn) +function InstallContextSpawn:new(handle, cwd, strict_mode) + ---@type InstallContextSpawn + local instance = {} + setmetatable(instance, self) + instance.cwd = cwd + instance.handle = handle + instance.strict_mode = strict_mode + return instance end ---@param cmd string |
