Add isInstanceOf for generic procs to the macros module (#9730)

This commit is contained in:
cooldome 2018-11-21 20:30:03 +00:00 • committed by Andreas Rumpf
commit 086676782a
8 changed files with 46 additions and 3 deletions

View file

@ -274,6 +274,12 @@ when defined(nimHasSymOwnerInMacro):
## result is also mnde of kind nnkSym if owner exists otherwise
## nnkNilLit is returned
when defined(nimHasInstantiationOfInMacro):
proc isInstantiationOf*(instanceProcSym, genProcSym: NimNode): bool {.magic: "SymIsInstantiationOf", noSideEffect.}
## check if proc symbol is instance of the generic proc symbol
## useful to check proc symbols against generic symbols
## returned by `bindSym`
proc getType*(n: NimNode): NimNode {.magic: "NGetType", noSideEffect.}
## with 'getType' you can access the node's `type`:idx:. A Nim type is
## mapped to a Nim AST too, so it's slightly confusing but it means the same