commit
6fa72c5d9d
2 changed files with 6 additions and 0 deletions
|
|
@ -914,6 +914,10 @@ proc evalTypeTrait*(trait, operand: PNode, context: PSym): PNode =
|
|||
result = newStrNode(nkStrLit, typ.typeToString(preferName))
|
||||
result.typ = newType(tyString, context)
|
||||
result.info = trait.info
|
||||
of "arity":
|
||||
result = newIntNode(nkIntLit, typ.n.len-1)
|
||||
result.typ = newType(tyInt, context)
|
||||
result.info = trait.info
|
||||
else:
|
||||
internalAssert false
|
||||
|
||||
|
|
|
|||
|
|
@ -13,3 +13,5 @@
|
|||
proc name*(t: typedesc): string {.magic: "TypeTrait".}
|
||||
## Returns the name of the given type
|
||||
|
||||
proc arity*(t: typedesc): int {.magic: "TypeTrait".}
|
||||
## Returns the arity of the given type
|
||||
Loading…
Add table
Add a link
Reference in a new issue