Skip to content

Commit 1e615ee

Browse files
committed
Improve type hinting for classes by:
- adding a type hint for new() and newClass() - adding simple ---@Class x: y type hints for base class variables
1 parent 3c3e79b commit 1e615ee

76 files changed

Lines changed: 88 additions & 5 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Classes/BuildListControl.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
local ipairs = ipairs
77
local s_format = string.format
88

9+
---@class BuildListControl: ListControl
910
local BuildListClass = newClass("BuildListControl", "ListControl", function(self, anchor, rect, listMode)
1011
self.ListControl(anchor, rect, 20, "VERTICAL", false, listMode.list)
1112
self.listMode = listMode

src/Classes/ButtonControl.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
-- Class: Button Control
44
-- Basic button control.
55
--
6+
---@class ButtonControl: Control, TooltipHost
67
local ButtonClass = newClass("ButtonControl", "Control", "TooltipHost", function(self, anchor, rect, label, onClick, onHover, forceTooltip)
78
self.Control(anchor, rect)
89
self.TooltipHost()

src/Classes/CalcBreakdownControl.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ local m_cos = math.cos
1313
local m_pi = math.pi
1414
local band = bit.band
1515

16+
---@class CalcBreakdownControl: Control, ControlHost
1617
local CalcBreakdownClass = newClass("CalcBreakdownControl", "Control", "ControlHost", function(self, calcsTab)
1718
self.Control()
1819
self.ControlHost()

src/Classes/CalcSectionControl.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
--
66
local t_insert = table.insert
77

8+
---@class CalcSectionControl: Control, ControlHost
89
local CalcSectionClass = newClass("CalcSectionControl", "Control", "ControlHost", function(self, calcsTab, width, id, group, colour, subSection, updateFunc)
910
self.Control(calcsTab, {0, 0, width, 0})
1011
self.ControlHost()

src/Classes/CalcsTab.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ local buffModeDropList = {
1616
{ label = "Effective DPS", buffMode = "EFFECTIVE" }
1717
}
1818

19+
---@class CalcsTab: UndoHandler, ControlHost, Control
1920
local CalcsTabClass = newClass("CalcsTab", "UndoHandler", "ControlHost", "Control", function(self, build)
2021
self.UndoHandler()
2122
self.ControlHost()

src/Classes/CheckBoxControl.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
-- Class: Check Box Control
44
-- Basic check box control.
55
--
6+
---@class CheckBoxControl: Control, TooltipHost
67
local CheckBoxClass = newClass("CheckBoxControl", "Control", "TooltipHost", function(self, anchor, rect, label, changeFunc, tooltipText, initialState)
78
rect[4] = rect[3] or 0
89
self.Control(anchor, rect)

src/Classes/CompareEntry.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ local s_format = string.format
99
local m_min = math.min
1010
local m_max = math.max
1111

12+
---@class CompareEntry: ControlHost
1213
local CompareEntryClass = newClass("CompareEntry", "ControlHost", function(self, xmlText, label)
1314
self.ControlHost()
1415

src/Classes/ComparePowerReportListControl.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
local t_insert = table.insert
88
local t_sort = table.sort
99

10+
---@class ComparePowerReportListControl: ListControl
1011
local ComparePowerReportListClass = newClass("ComparePowerReportListControl", "ListControl", function(self, anchor, rect)
1112
self.ListControl(anchor, rect, 18, "VERTICAL", false)
1213

src/Classes/CompareTab.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ local function matchFlags(reqFlags, notFlags, flags)
122122
return true
123123
end
124124

125+
---@class CompareTab: ControlHost, Control
125126
local CompareTabClass = newClass("CompareTab", "ControlHost", "Control", function(self, primaryBuild)
126127
self.ControlHost()
127128
self.Control()

src/Classes/ConfigSetListControl.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ local t_insert = table.insert
77
local t_remove = table.remove
88
local m_max = math.max
99

10+
---@class ConfigSetListControl: ListControl
1011
local ConfigSetListClass = newClass("ConfigSetListControl", "ListControl", function(self, anchor, rect, configTab)
1112
self.ListControl(anchor, rect, 16, "VERTICAL", true, configTab.configSetOrderList)
1213
self.configTab = configTab

0 commit comments

Comments
 (0)