From ae208dc380808ff1aef39929a0e897e881571d43 Mon Sep 17 00:00:00 2001 From: William Boman Date: Fri, 13 Oct 2023 21:14:29 +0200 Subject: refactor: standardize constructors and improve inheritance construction --- lua/mason-core/installer/context/spawn.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lua/mason-core/installer/context/spawn.lua') 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 -- cgit v1.2.3-70-g09d2