Skip to content

Commit 24cc4f8

Browse files
committed
format codebase
1 parent 98f0057 commit 24cc4f8

Some content is hidden

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

86 files changed

+109
-123
lines changed

.vscode/on_editor_save.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,4 @@ if not did_something then
196196
print("not sure how to run " .. path)
197197
print("running as normal lua")
198198
run_lua(path)
199-
end
199+
end

examples/benchmarks/locate_lua.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ for full_path in io.popen("locate .lua"):read("*all"):gmatch("(.-)\n") do
1818
end
1919
end
2020

21-
require("test.helpers.profiler").Stop()
21+
require("test.helpers.profiler").Stop()

examples/projects/gmod/build_glua_base.lua

+2-3
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,8 @@ for class_name, lib in spairs(wiki_json.CLASSES) do
430430
if class_name == "IVector" or class_name == "IAngle" then
431431
lib.MEMBERS.__add = binary_operator(original_name, original_name, original_name)
432432
lib.MEMBERS.__sub = binary_operator(original_name, original_name, original_name)
433-
lib.MEMBERS.__mul = binary_operator(original_name, original_name.."|number", original_name)
434-
lib.MEMBERS.__div = binary_operator(original_name, original_name.."|number", original_name)
433+
lib.MEMBERS.__mul = binary_operator(original_name, original_name .. "|number", original_name)
434+
lib.MEMBERS.__div = binary_operator(original_name, original_name .. "|number", original_name)
435435
end
436436

437437
if class_name == "IMatrix" then
@@ -512,7 +512,6 @@ for class_name, lib in spairs(wiki_json.CLASSES) do
512512
if class_name == "IPlayer" and key == "SetRenderAngles" then
513513

514514
else
515-
516515
indent()
517516
e("type ")
518517
e(class_name)

examples/projects/gmod/lua/teamrocket.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,4 @@ if SERVER then
178178
team_rocket_death(victim, attacker, victim:GetVelocity():GetNormalized())
179179
end
180180
end)
181-
end
181+
end

examples/projects/gmod/nattlua/glua.nlua

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ type NULL = INULL
1212

1313
analyzer function hook.Add(eventName: string, obj: any, callback: ref function=(...any)>(...any))
1414
local event_callback = env.typesystem.EventCallbacks:Get(eventName)
15-
if not event_callback then error("hook " .. tostring(eventName) .. " does not exist", 2) end
15+
16+
if not event_callback then
17+
error("hook " .. tostring(eventName) .. " does not exist", 2)
18+
end
19+
1620
callback:SetOutputSignature(event_callback:GetOutputSignature())
1721
callback:SetExplicitOutputSignature(true)
1822
callback:SetInputSignature(event_callback:GetInputSignature())

format.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,4 @@ if dictionary then
209209
end
210210
end
211211
end
212-
end
212+
end

language_server/editor_helper.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ function META:Recompile(path, lol, diagnostics)
249249

250250
if cfg then
251251
if entry_point then
252-
should_analyze = self.TempFiles[entry_point] and self:IsLoaded(entry_point) and
252+
should_analyze = self.TempFiles[entry_point] and
253+
self:IsLoaded(entry_point) and
253254
self:GetFileContent(entry_point):find("-" .. "-ANALYZE", nil, true)
254255
end
255256

language_server/lsp.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -586,4 +586,4 @@ function lsp.Call(params)
586586
if lsp.methods[params.method] then lsp.methods[params.method](params) end
587587
end
588588

589-
return lsp
589+
return lsp

language_server/main.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ while true do
4848

4949
write_message(res)
5050
end
51-
end
51+
end

nattlua/analyzer.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,4 @@ function META.New(config)
234234
return self
235235
end
236236

237-
return META
237+
return META

nattlua/analyzer/base/base_analyzer.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -417,4 +417,4 @@ return function(META)
417417
end
418418
end
419419
end
420-
end
420+
end

nattlua/analyzer/base/lexical_scope.lua

+1-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ function META:BuildParentCache()
5858
parent = parent.Parent
5959
end
6060

61-
6261
self.ParentList = list
6362
self.ParentMap = map
6463
self.Root = parent
@@ -91,7 +90,6 @@ function META:GetRoot()
9190
return self.Root
9291
end
9392

94-
9593
function META:GetDependencies()
9694
local out = {}
9795

@@ -422,4 +420,4 @@ function META.New(parent, upvalue_position, obj)
422420
return scope
423421
end
424422

425-
return META
423+
return META

nattlua/analyzer/base/scopes.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,4 @@ return function(META)
197197
end
198198
end
199199
end
200-
end
200+
end

nattlua/analyzer/cast.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ local function cast_lua_types_to_types(tps)
5252
return tbl
5353
end
5454

55-
return cast_lua_types_to_types
55+
return cast_lua_types_to_types

nattlua/analyzer/context.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ for i, v in ipairs(META.OnInitialize) do
2121
v(self)
2222
end
2323

24-
return self
24+
return self

nattlua/analyzer/control_flow.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -398,4 +398,4 @@ return function(META)
398398
function META:PopConditionalScope()
399399
self:PopScope()
400400
end
401-
end
401+
end

nattlua/analyzer/expressions/function.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,4 @@ return {
189189

190190
return obj
191191
end,
192-
}
192+
}

nattlua/analyzer/expressions/postfix_call.lua

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ return {
3333

3434
local types = {self_arg}
3535
self:AnalyzeExpressions(node.expressions, types)
36-
3736
local arguments
3837

3938
if self:IsTypesystem() then

nattlua/analyzer/expressions/table.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,4 @@ return {
158158
self:PopCurrentType("table")
159159
return tbl
160160
end,
161-
}
161+
}

nattlua/analyzer/mutation_solver.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,4 +220,4 @@ local function mutation_solver(mutations, scope, obj)
220220
return union
221221
end
222222

223-
return mutation_solver
223+
return mutation_solver

nattlua/analyzer/operators/call.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,4 @@ return {
260260
return base_call(obj, self, input, call_node)
261261
end
262262
end,
263-
}
263+
}

nattlua/analyzer/operators/function_call_analyzer.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,4 @@ return function(analyzer, obj, input)
163163
end
164164

165165
return ret
166-
end
166+
end

nattlua/analyzer/operators/function_call_body.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -574,4 +574,4 @@ return function(self, obj, input)
574574
end
575575

576576
return contract
577-
end
577+
end

nattlua/analyzer/operators/index.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,4 @@ return {
165165
return obj:Get(key)
166166
end
167167
end,
168-
}
168+
}

nattlua/analyzer/statements/assignment.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,4 +232,4 @@ return {
232232
end
233233
end
234234
end,
235-
}
235+
}

nattlua/analyzer/statements/generic_for.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,4 @@ return {
118118
self:PopUncertainLoop()
119119
end
120120
end,
121-
}
121+
}

nattlua/c_declarations/analyzer.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,4 @@ function META.New()
264264
return self
265265
end
266266

267-
return META
267+
return META

nattlua/c_declarations/ast_walker.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,4 @@ local function walk_cdeclarations(node, callback)
165165
end
166166
end
167167

168-
return walk_cdeclarations
168+
return walk_cdeclarations

nattlua/c_declarations/main.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,4 +223,4 @@ function cparser.load(lib--[[#: string]])
223223
return variables
224224
end
225225

226-
return cparser
226+
return cparser

nattlua/cli.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ function _G.RUN_CLI(cmd, ...)
6060
local func = assert(default[cmd], "Unknown command " .. cmd)
6161
io.write("running ", cmd, " with arguments ", table.concat(args, " "), "\n")
6262
func(unpack(args))
63-
end
63+
end

nattlua/compiler.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,4 +317,4 @@ function META.LoadFile(path, config)
317317
return loadstring(code, obj.config.file_name)
318318
end
319319

320-
return META
320+
return META

nattlua/definitions/lua/globals.nlua

+1-1
Original file line numberDiff line numberDiff line change
@@ -591,4 +591,4 @@ end
591591

592592
function _G.LSX(func: Function, props: Table, children: List<|Table | string | number|>)
593593
return {func = func, props = props, children = children}
594-
end
594+
end

nattlua/definitions/lua/luajit.nlua

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,4 @@ function FFIType<|str: string|>
256256
return number
257257
end
258258

259-
type ffi.string = function=(FFIPointer<|number|> | string, number | nil)>(string)
259+
type ffi.string = function=(FFIPointer<|number|> | string, number | nil)>(string)

nattlua/definitions/lua/string.nlua

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,4 +261,4 @@ analyzer function ^string.gsub(
261261
end
262262

263263
return types.String(), types.Number()
264-
end
264+
end

nattlua/definitions/lua/table.nlua

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,4 @@ function table.spread(tbl: nil | List<|any|>)
176176
if not tbl then return nil end
177177

178178
return table.unpack(tbl)
179-
end
179+
end

nattlua/definitions/lua/utf8.nlua

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ type utf8.len = ReturnIfNonLiteral<|
1616
analyzer function(str: string): number
1717
return require("nattlua.other.utf8").length(str:GetData())
1818
end
19-
|>
19+
|>

nattlua/lexer.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ local formating = require("nattlua.other.formating")
1717

1818
function META:ReadSpace()--[[#: TokenReturnType]]
1919
if not characters.IsSpace(self:PeekByte()) then return false end
20-
20+
2121
while not self:TheEnd() do
2222
self:Advance(1)
2323

@@ -437,6 +437,7 @@ do
437437
end
438438

439439
local symbols = runtime_syntax:GetSymbols()
440+
440441
function META:ReadSymbol()--[[#: TokenReturnType]]
441442
if self:ReadFirstFromArray(symbols) then return "symbol" end
442443

nattlua/other/context_mixin.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ return function(META--[[#: ref any]])
5353
self.context_ref[key] = (self.context_ref[key] or 0) - 1
5454
end
5555
end
56-
end
56+
end

nattlua/other/formating.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,4 +371,4 @@ function formating.TableToColumns(
371371
return out
372372
end
373373

374-
return formating
374+
return formating

nattlua/other/fs.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -875,4 +875,4 @@ int feof(void *stream);
875875
return fs
876876
end
877877

878-
return fs
878+
return fs

nattlua/other/jit_options.lua

+1-4
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,8 @@ return function()
3434
-- this should be 32 or 64 or something, but setting it to the same as maxmcode seems to work much better
3535
params.sizemcode = params.maxmcode
3636
else
37-
3837
params.maxmcode = 128000
3938
params.sizemcode = params.maxmcode
40-
41-
4239
params.maxrecord = 100
4340
params.maxirconst = 500
4441
params.maxside = 5000
@@ -76,4 +73,4 @@ return function()
7673

7774
jit.opt.start(unpack(args))
7875
jit.flush()
79-
end
76+
end

nattlua/other/path.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,4 @@ function path.ResolveRequire(str)
135135
return nil
136136
end
137137

138-
return path
138+
return path

nattlua/other/sort.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,4 @@ return function(t, comp)
110110
if comp then assert(type(comp) == "function") end
111111

112112
auxsort(t, 1, #t, comp or default_comp)
113-
end
113+
end

nattlua/other/string.lua

+4-9
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,15 @@ function stringx.split(self--[[#: string]], separator--[[#: string]])
2323
end
2424

2525
function stringx.replace(self--[[#: string]], old--[[#: string]], new--[[#: string]])
26-
if old == "" then
27-
return self
28-
end
26+
if old == "" then return self end
2927

30-
local parts = stringx.split(self, old)
28+
local parts = stringx.split(self, old)
3129

32-
if #parts == 1 then
33-
return self
34-
end
30+
if #parts == 1 then return self end
3531

36-
return table.concat(parts, new)
32+
return table.concat(parts, new)
3733
end
3834

39-
4035
function stringx.trim(self--[[#: string]])
4136
local char = "%s*"
4237
local _, start = self:find(char, 0)

nattlua/other/utf8.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,4 @@ function utf8.to_list(str)
235235
return tbl
236236
end
237237

238-
return utf8
238+
return utf8

nattlua/parser.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,4 +393,4 @@ function META:ParseStatement()
393393
return node
394394
end
395395

396-
return META
396+
return META

0 commit comments

Comments
 (0)