Skip to content

Commit 8baf71c

Browse files
committed
Explicitly return self from constructors to preserve type information
1 parent 7fc5c60 commit 8baf71c

77 files changed

Lines changed: 81 additions & 3 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
@@ -47,6 +47,7 @@ function BuildListClass:BuildListControl(anchor, rect, listMode)
4747
self.controls.path.width = function()
4848
return self.width()
4949
end
50+
return self
5051
end
5152

5253
function BuildListClass:SelByFileName(selFileName)

src/Classes/ButtonControl.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function ButtonClass:ButtonControl(anchor, rect, label, onClick, onHover, forceT
1313
self.onClick = onClick
1414
self.onHover = onHover
1515
self.forceTooltip = forceTooltip
16+
return self
1617
end
1718

1819
function ButtonClass:Click()

src/Classes/CalcBreakdownControl.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ function CalcBreakdownClass:CalcBreakdownControl(calcsTab)
2727
self.rangeGuide:Load("Assets/range_guide.png")
2828
self.uiOverlay = NewImageHandle()
2929
self.uiOverlay:Load("Assets/game_ui_small.png")
30-
self.controls.scrollBar = new("ScrollBarControl"):ScrollBarControl({"RIGHT",self,"RIGHT"}, {-2, 0, 18, 0}, 80, "VERTICAL", true)
30+
self.controls.scrollBar = new("ScrollBarControl"):ScrollBarControl({ "RIGHT", self, "RIGHT" }, { -2, 0, 18, 0 }, 80,
31+
"VERTICAL", true)
32+
return self
3133
end
3234

3335
function CalcBreakdownClass:IsMouseOver()

src/Classes/CalcSectionControl.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ function CalcSectionClass:CalcSectionControl(calcsTab, width, id, group, colour,
5555
self.shown = function()
5656
return self.enabled
5757
end
58+
return self
5859
end
5960

6061
function CalcSectionClass:IsMouseOver()

src/Classes/CalcsTab.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ Effective DPS: Curses and enemy properties (such as resistances and status condi
155155

156156
self.controls.scrollBar = new("ScrollBarControl"):ScrollBarControl({"TOPRIGHT",self,"TOPRIGHT"}, {0, 0, 18, 0}, 50, "VERTICAL", true)
157157
self.powerBuilderInitialized = nil
158+
return self
158159
end
159160

160161
function CalcsTabClass:Load(xml, dbFileName)

src/Classes/CheckBoxControl.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function CheckBoxClass:CheckBoxControl(anchor, rect, label, changeFunc, tooltipT
1414
self.labelWidth = DrawStringWidth(self.width - 4, "VAR", label or "") + 5
1515
self.changeFunc = changeFunc
1616
self.state = initialState
17+
return self
1718
end
1819

1920
function CheckBoxClass:IsMouseOver()

src/Classes/CompareEntry.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ function CompareEntryClass:CompareEntry(xmlText, label)
5454
if xmlText then
5555
self:LoadFromXML(xmlText)
5656
end
57+
return self
5758
end
5859

5960
function CompareEntryClass:LoadFromXML(xmlText)

src/Classes/ComparePowerReportListControl.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function ComparePowerReportListClass:ComparePowerReportListControl(anchor, rect)
2525
self.colLabels = true
2626
self.showRowSeparators = true
2727
self.statusText = "Select a metric above to generate the power report."
28+
return self
2829
end
2930

3031
function ComparePowerReportListClass:SetReport(stat, report)

src/Classes/ConfigSetListControl.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ function ConfigSetListClass:ConfigSetListControl(anchor, rect, configTab)
4141
self.controls.new = new("ButtonControl"):ButtonControl({"RIGHT",self.controls.rename,"LEFT"}, {-4, 0, 60, 18}, "New", function()
4242
self:RenameSet(configTab:NewConfigSet(), true)
4343
end)
44+
return self
4445
end
4546

4647
function ConfigSetListClass:RenameSet(configSet, addOnName)

src/Classes/ConfigTab.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ function ConfigTabClass:ConfigTab(build)
612612
end
613613
end
614614
self.controls.scrollBar = new("ScrollBarControl"):ScrollBarControl({"TOPRIGHT",self,"TOPRIGHT"}, {0, 0, 18, 0}, 50, "VERTICAL", true)
615+
return self
615616
end
616617

617618
function ConfigTabClass:Load(xml, fileName)

0 commit comments

Comments
 (0)