preserves_schema_nim: collect imports of simple compounds

This commit is contained in:
Emery Hemingway 2024-02-08 14:21:11 +00:00
parent 9134fecb36
commit 2825bceecf
2 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,6 @@
# Package
version = "20240206"
version = "20240208"
author = "Emery Hemingway"
description = "data model and serialization format"
license = "Unlicense"

View File

@ -930,10 +930,15 @@ proc collectRefImports(imports: var StringSet; loc: Location; pat: Pattern)
proc collectRefImports(imports: var StringSet; loc: Location; sp: SimplePattern) =
case sp.orKind
of SimplePatternKind.seqof:
collectRefImports(imports, loc, sp.seqof.pattern)
of SimplePatternKind.setof:
incl(imports, "std/sets")
collectRefImports(imports, loc, sp.setof.pattern)
of SimplePatternKind.dictof:
incl(imports, "std/tables")
collectRefImports(imports, loc, sp.dictof.key)
collectRefImports(imports, loc, sp.dictof.value)
of SimplePatternKind.Ref:
if sp.ref.module != @[] and sp.ref.module != loc.schemaPath:
incl(imports, string sp.ref.module[0])