Fix symbol printing in schemas

This commit is contained in:
Emery Hemingway 2021-09-07 10:17:18 +02:00
parent df53ff0d41
commit a7acd971d2
2 changed files with 8 additions and 2 deletions

View File

@ -461,7 +461,7 @@ proc generateNimFile*(scm: Schema; path: string) =
nn(nkPragma,
nn(nkExprColonExpr,
ident"record",
PNode(kind: nkStrLit, strVal: $def.nodes[0])))),
PNode(kind: nkStrLit, strVal: $def.nodes[0].value.symbol)))),
newEmpty(),
t)
else:

View File

@ -137,7 +137,13 @@ proc `$`*(n: SchemaNode): string =
result.add " ...:...}"
of snkRecord:
result.add '<'
result.add join(n.nodes, " ")
if n.nodes[0].kind == snkLiteral and n.nodes[0].value.kind == pkSymbol:
result.add n.nodes[0].value.symbol
for i in 1..n.nodes.high:
result.add ' '
result.add $n.nodes[i]
else:
result.add join(n.nodes, " ")
result.add '>'
of snkTuple:
result.add '['