mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-04 20:17:42 +00:00
@@ -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
|
||||
Reference in New Issue
Block a user