From 672f0d32e322b79661b5d7959887adaa9e41ad98 Mon Sep 17 00:00:00 2001 From: Daniil Rozanov Date: Fri, 29 Mar 2024 04:37:56 +0300 Subject: feat: build from current variant --- lua/cmake-explorer/build_list.lua | 57 --------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 lua/cmake-explorer/build_list.lua (limited to 'lua/cmake-explorer/build_list.lua') diff --git a/lua/cmake-explorer/build_list.lua b/lua/cmake-explorer/build_list.lua deleted file mode 100644 index 7abaddc..0000000 --- a/lua/cmake-explorer/build_list.lua +++ /dev/null @@ -1,57 +0,0 @@ -local Build = require("cmake-explorer.build") - -local BuildFilter = {} - -BuildFilter.__call = function(self, build) - for k, v in pairs(self) do - if type(k) == "string" then - if v ~= build[k] then - return false - end - end - end - return true -end - -local BuildList = { - __newindex = function(t, k, v) - for _, value in ipairs(t) do - if value == v then - return - end - end - rawset(t, k, v) - end, -} - -function BuildList:new() - local obj = { - current = nil, - } - setmetatable(obj, BuildList) - return obj -end - -function BuildList:insert(o) - local build = Build:new(o) - table.insert(self, build) - self.current = build -end - -function BuildList:filter(pred) - pred = pred or {} - local i, n = 0, #self - if type(pred) == "table" then - setmetatable(pred, BuildFilter) - end - return function() - repeat - i = i + 1 - if pred(self[i]) then - return self[i] - end - until i ~= n - end -end - -return BuildList -- cgit v1.2.3