Initial commit
This commit is contained in:
24
class.tmpl
Normal file
24
class.tmpl
Normal file
@@ -0,0 +1,24 @@
|
||||
---@diagnostic disable: missing-return
|
||||
{{range .Fields}}
|
||||
---@field {{.Name}} {{.Type}} {{.Comment}}
|
||||
{{end}}
|
||||
{{.ClassName}} = {
|
||||
{{$n := len .Methods}}
|
||||
{{$methods := len .Methods}}
|
||||
{{range $index, $method := .Methods}}
|
||||
---@param self {{$.ClassName}}
|
||||
{{range $param := $method.Params}}
|
||||
---@param {{.Name}} {{.Type}} {{.Comment}}
|
||||
{{end}}
|
||||
{{range $ret := $method.Returns}}
|
||||
---@return {{.Type}} {{if ne .Comment ""}}#{{.Comment}}{{end}}
|
||||
{{end}}
|
||||
{{.Name}} = function(self{{if gt (len .Params) 0}}, {{range $index, $param := .Params}}{{if $index}}, {{end}}{{$param.Name}}{{end}}{{end}}) end,
|
||||
{{if eq (plus1 $index) $n}}
|
||||
|
||||
{{end}}
|
||||
{{end}}
|
||||
}
|
||||
|
||||
---@type ({{$.ClassName}} | fun(): {{$.ClassName}})
|
||||
{{$.ClassName}} = nil
|
Reference in New Issue
Block a user