preserves_schema_nim: emit Perserve type for And composites
This commit is contained in:
parent
66a653a775
commit
70655a959b
|
@ -1,6 +1,6 @@
|
|||
# Package
|
||||
|
||||
version = "20221213"
|
||||
version = "20230228"
|
||||
author = "Emery Hemingway"
|
||||
description = "data model and serialization format"
|
||||
license = "Unlicense"
|
||||
|
|
|
@ -493,7 +493,10 @@ proc typeDef(loc: Location; name: string; def: Definition; ty: PNode): PNode =
|
|||
embeddingParams(loc.schema, isEmbedded(loc, def)),
|
||||
ty)
|
||||
of DefinitionKind.and:
|
||||
raiseAssert "And variants not suported"
|
||||
nn(nkTypeDef,
|
||||
name.ident.toExport,
|
||||
embeddingParams(loc.schema, isEmbedded(loc, def)),
|
||||
preserveIdent(loc.schema))
|
||||
of DefinitionKind.Pattern:
|
||||
typeDef(loc, name, def.pattern, ty)
|
||||
|
||||
|
@ -675,7 +678,8 @@ proc nimTypeOf(loc: Location; known: var TypeTable; def: Definition; name: strin
|
|||
case def.orKind
|
||||
of DefinitionKind.or:
|
||||
nimTypeOf(loc, known, def.or, name)
|
||||
of DefinitionKind.and: raiseAssert """"And" definitions are unsupported"""
|
||||
of DefinitionKind.and:
|
||||
TypeSpec(node: preserveIdent(loc.schema))
|
||||
of DefinitionKind.Pattern:
|
||||
nimTypeOf(loc, known, def.pattern, name)
|
||||
|
||||
|
|
Loading…
Reference in New Issue