Hallucinate fixes to return types and comments
This commit is contained in:
21
class.tmpl
21
class.tmpl
@@ -11,25 +11,28 @@
|
||||
{{- range $param := $method.Params}}
|
||||
---@param {{.Name}} {{.Type}}{{if ne .Comment ""}} {{.Comment}}{{end}}
|
||||
{{- end}}
|
||||
{{- range $ret := $method.Returns}}
|
||||
---@return {{.Type}}{{if ne .Comment ""}} #{{.Comment}}{{end}}
|
||||
{{- if gt (len $method.Returns) 0}}
|
||||
{{- range $retIndex, $ret := $method.Returns}}
|
||||
{{- if eq $retIndex (sub (len $method.Returns) 1)}}
|
||||
---@return {{.Type}}{{if ne .Comment ""}} #{{truncateComment .Comment 80}}{{end}}
|
||||
{{- else}}
|
||||
---@return {{.Type}}{{if ne .Comment ""}} #{{truncateComment .Comment 80}}{{end}}
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
{{.Name}} = function(self{{if gt (len .Params) 0}}, {{range $index, $param := .Params}}{{if $index}}, {{end}}{{$param.Name}}{{end}}{{end}}) end,
|
||||
{{- else}}
|
||||
{{.Name}} = function(self{{if gt (len .Params) 0}}, {{range $index, $param := .Params}}{{if $index}}, {{end}}{{$param.Name}}{{end}}{{end}}) end,
|
||||
{{- end}}
|
||||
{{- if ne (plus1 $index) $n}}
|
||||
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
}
|
||||
|
||||
{{- if gt (len .Constructors) 0}}
|
||||
---@type {{$.ClassName}}
|
||||
{{- range .Constructors}}
|
||||
{{- range .Params}}
|
||||
{{- if ne .Comment ""}}
|
||||
---{{.Name}} ({{.Type}}) -> {{.Comment}}
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
---@overload fun({{range $index, $param := .Params}}{{if $index}}, {{end}}{{$param.Name}}: {{$param.Type}}{{end}}): {{$.ClassName}}{{- if ne .Comment ""}}
|
||||
---{{.Comment}}
|
||||
---@overload fun({{range $index, $param := .Params}}{{if $index}}, {{end}}{{$param.Name}}: {{$param.Type}}{{end}}): {{$.ClassName}}
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
{{.ClassName}} = nil
|
||||
|
Reference in New Issue
Block a user