Files
dolt/nomdl/codegen/js/package.tmpl
T
Erik Arvidsson c91b8146dc Go: Eagerly fixup types after the Package has been created (#1241)
This fixes the package refs in NewPackage and makes the serializer
know about these refs when a Package is encoded.
2016-04-13 18:09:22 -07:00

11 lines
415 B
Cheetah

{{if .HasTypes}}
const _pkg = new {{importJS "Package"}}([{{range $i, $t := .Types}}
{{toTypeValueJS $t true 2}},{{end}}
], [{{range $deps := .Dependencies}}
{{importJS "Ref"}}.parse('{{$deps}}'),{{end}}
]);
{{importJS "registerPackage"}}(_pkg);{{range $i, $t := .Types}}
const {{userType $t}}$type = {{importJS "makeType"}}(_pkg.ref, {{$i}});
const {{userType $t}}$typeDef = _pkg.types[{{$i}}];{{end}}
{{end}}