* Fix #5691 * Cleanup and thoughts * Use scope approach * Seperate defined/declared/declaredInScope magics * Fix declaredInScope * Update spec accordingly
This commit is contained in:
parent
d11933ad99
commit
fb58066b61
15 changed files with 180 additions and 85 deletions
|
|
@ -22,6 +22,7 @@ a[1]: 45
|
|||
x: some string
|
||||
([("key", "val"), ("keyB", "2")], [("val", "key"), ("2", "keyB")])
|
||||
([("key", "val"), ("keyB", "2")], [("val", "key"), ("2", "keyB")])
|
||||
0
|
||||
'''
|
||||
"""
|
||||
|
||||
|
|
@ -222,3 +223,17 @@ block getImplTransformed:
|
|||
doAssert "toExpand" notin code
|
||||
# template is expanded (but that would already be the case with
|
||||
# `a.getImpl.repr`, unlike the other transformations mentioned above
|
||||
|
||||
|
||||
# test macro resemming
|
||||
macro makeVar(): untyped =
|
||||
quote:
|
||||
var tensorY {.inject.}: int
|
||||
|
||||
macro noop(a: typed): untyped =
|
||||
a
|
||||
|
||||
noop:
|
||||
makeVar
|
||||
echo tensorY
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ macro checkType(ex: typed): untyped =
|
|||
echo ex.getTypeInst.repr, "; ", ex.typeKind, "; ", ex.getType.repr, "; ", ex.getTypeImpl.repr
|
||||
|
||||
macro checkProcType(fn: typed): untyped =
|
||||
if fn.kind == nnkProcDef:
|
||||
result = fn
|
||||
let fn_sym = if fn.kind == nnkProcDef: fn[0] else: fn
|
||||
echo fn_sym, "; ", fn_sym.typeKind, "; ", fn_sym.getType.repr, "; ", fn_sym.getTypeImpl.repr
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue