Import tables when necessary

This commit is contained in:
Emery Hemingway 2021-09-06 17:39:23 +02:00
parent d43f9ca926
commit de50a0a41d
1 changed files with 5 additions and 0 deletions

View File

@ -378,6 +378,11 @@ proc generateProcs(result: var seq[PNode]; name: string; sn: SchemaNode) =
proc collectRefImports(imports: PNode; sn: SchemaNode) =
case sn.kind
of snkLiteral:
if sn.value.isDictionary:
imports.add ident"std/tables"
of snkDictOf:
imports.add ident"std/tables"
of snkRef:
if sn.refPath.len > 1:
imports.add ident(sn.refPath[0].toLowerAscii)