Code polish

This commit is contained in:
2024-09-12 01:03:24 +02:00
parent f093fe4d1e
commit 4fbc86e4b6
2 changed files with 9 additions and 5 deletions

View File

@@ -1,10 +1,7 @@
---@diagnostic disable: missing-return
---@diagnostic disable: missing-return, lowercase-global
{{range .Fields -}}
---@field {{.Name}} {{.Type}} {{.Comment}}
{{end -}}
{{range .Constructors -}}
---@overload fun({{range $index, $param := .Params}}{{if $index}}, {{end}}{{$param.Name}}: {{$param.Type}}{{end}}): {{$.ClassName}}
{{end -}}
---@class {{.ClassName}}
{{.ClassName}} = {
{{$n := len .Methods -}}
@@ -23,6 +20,9 @@
{{end}}{{end}}
}
---@type {{$.ClassName}}
-- Define class globally so it's "available" to other files
---@type {{$.ClassName}}
{{range .Constructors -}}
---@overload fun({{range $index, $param := .Params}}{{if $index}}, {{end}}{{$param.Name}}: {{$param.Type}}{{end}}): {{$.ClassName}}
{{end -}}
{{$.ClassName}} = nil

View File

@@ -120,6 +120,8 @@ func ParseFile(filename string) (*Class, error) {
})
res.Constructors = append(res.Constructors, resConstructor)
// constructorDetails := codeblocks.Eq(1)
log.Printf("%#v", res)
return &res, nil
@@ -131,6 +133,8 @@ func MapType(t string) string {
return "any"
case "int":
return "number"
case "float":
return "number"
case "string":
return "string"
case "boolean":