diff --git a/src/awesomewm.d.tl/entity/Function_Info.tl b/src/awesomewm.d.tl/entity/Function_Info.tl index d3e3478..534da92 100644 --- a/src/awesomewm.d.tl/entity/Function_Info.tl +++ b/src/awesomewm.d.tl/entity/Function_Info.tl @@ -18,7 +18,7 @@ local record Function_Info parameters: List return_types: List - append_parameter: function(self: Function_Info, name: string, type: string) + append_parameter: function(self: Function_Info, name: string, types: List) append_return_type: function(self: Function_Info, return_type: string) fixup: function(Function_Info) diff --git a/src/awesomewm.d.tl/entity/Variable_Info.tl b/src/awesomewm.d.tl/entity/Variable_Info.tl index 03f169e..c0c5fea 100644 --- a/src/awesomewm.d.tl/entity/Variable_Info.tl +++ b/src/awesomewm.d.tl/entity/Variable_Info.tl @@ -16,11 +16,9 @@ end local __Variable_Info: metatable = { __call = function(_self: Variable_Info, name: string | nil, types: List | nil): Variable_Info - name = name or "" - types = types or List() return { - name = name, - types = types, + name = name or "", + types = types or List(), fixup = function(self: Variable_Info) for t in self.types:iter() do diff --git a/src/awesomewm.d.tl/generator/snippets.tl b/src/awesomewm.d.tl/generator/snippets.tl index 7d3209b..5060836 100644 --- a/src/awesomewm.d.tl/generator/snippets.tl +++ b/src/awesomewm.d.tl/generator/snippets.tl @@ -30,7 +30,7 @@ end function snippets.render_requires(requires: Map): string local tmpl = [[local $(name) = require "$(path)"]] - local require_statements = List() + local require_statements : List = List() for name, path in requires:iter() do local tmpl_args = { name = name, diff --git a/src/awesomewm.d.tl/utils.tl b/src/awesomewm.d.tl/utils.tl index a0453a5..828070e 100644 --- a/src/awesomewm.d.tl/utils.tl +++ b/src/awesomewm.d.tl/utils.tl @@ -58,12 +58,12 @@ function utils.do_or_fail(func: function(...: any): (T | nil, string), ... local ok, res, err = pcall(func, ...) - if not (ok and res) then + if not ok then log:error(logger.message_with_metadata("do_or_fail failed!", { error = err })) error(err) end - return res + return res as T -- promote to T since pcall succeeded at this point end return utils