Merge pull request 'Fix new compiler error from Teal 0.15.0 upgrade' (#75) from feat/fixes-teal-0.15.0 into master
Reviewed-on: #75
This commit is contained in:
commit
5cd9a539a5
|
@ -18,7 +18,7 @@ local record Function_Info
|
||||||
parameters: List<Variable_Info.Variable_Info>
|
parameters: List<Variable_Info.Variable_Info>
|
||||||
return_types: List<Type_Info.Type_Info>
|
return_types: List<Type_Info.Type_Info>
|
||||||
|
|
||||||
append_parameter: function(self: Function_Info, name: string, type: string)
|
append_parameter: function(self: Function_Info, name: string, types: List<Type_Info.Type_Info>)
|
||||||
append_return_type: function(self: Function_Info, return_type: string)
|
append_return_type: function(self: Function_Info, return_type: string)
|
||||||
|
|
||||||
fixup: function(Function_Info)
|
fixup: function(Function_Info)
|
||||||
|
|
|
@ -16,11 +16,9 @@ end
|
||||||
|
|
||||||
local __Variable_Info: metatable<Variable_Info> = {
|
local __Variable_Info: metatable<Variable_Info> = {
|
||||||
__call = function(_self: Variable_Info, name: string | nil, types: List<Type_Info.Type_Info> | nil): Variable_Info
|
__call = function(_self: Variable_Info, name: string | nil, types: List<Type_Info.Type_Info> | nil): Variable_Info
|
||||||
name = name or ""
|
|
||||||
types = types or List()
|
|
||||||
return {
|
return {
|
||||||
name = name,
|
name = name or "",
|
||||||
types = types,
|
types = types or List(),
|
||||||
|
|
||||||
fixup = function(self: Variable_Info)
|
fixup = function(self: Variable_Info)
|
||||||
for t in self.types:iter() do
|
for t in self.types:iter() do
|
||||||
|
|
|
@ -30,7 +30,7 @@ end
|
||||||
function snippets.render_requires(requires: Map<string, string>): string
|
function snippets.render_requires(requires: Map<string, string>): string
|
||||||
local tmpl = [[local $(name) = require "$(path)"]]
|
local tmpl = [[local $(name) = require "$(path)"]]
|
||||||
|
|
||||||
local require_statements <const> = List()
|
local require_statements <const>: List<string> = List()
|
||||||
for name, path in requires:iter() do
|
for name, path in requires:iter() do
|
||||||
local tmpl_args = {
|
local tmpl_args = {
|
||||||
name = name,
|
name = name,
|
||||||
|
|
|
@ -58,12 +58,12 @@ function utils.do_or_fail<T>(func: function<T>(...: any): (T | nil, string), ...
|
||||||
|
|
||||||
local ok, res, err = pcall(func, ...)
|
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 }))
|
log:error(logger.message_with_metadata("do_or_fail failed!", { error = err }))
|
||||||
error(err)
|
error(err)
|
||||||
end
|
end
|
||||||
|
|
||||||
return res
|
return res as T -- promote to T since pcall succeeded at this point
|
||||||
end
|
end
|
||||||
|
|
||||||
return utils
|
return utils
|
||||||
|
|
Loading…
Reference in New Issue