Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: George Lemon <georgelemon@protonmail.com>
  • Loading branch information
georgelemon committed Jun 6, 2024
1 parent 4686a7e commit 14a0011
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/voodoo/extendables.nim
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ macro extendable*(x: untyped) =
## Mark your object or enum with `extendable` pragma
## for making it extendable from other modules at compile-time.
expectKind(x, nnkTypeDef)
let objName = x[0][0]
let objName =
if x[0][0].kind == nnkPostfix:
x[0][0][1]
else:
x[0][0]
if x[2].kind == nnkObjectTy:
for objNode in x[2][2]:
case objNode.kind
Expand All @@ -94,9 +98,8 @@ macro extendable*(x: untyped) =
insert(x[2][2][1], x[2][2][1].len - 1, br)
else: discard
elif x[2].kind == nnkEnumTy:
let enumName = x[0][0].strVal
if ExtendableEnums.hasKey(enumName):
for enumField in ExtendableEnums[enumName]:
if ExtendableEnums.hasKey(objName.strVal):
for enumField in ExtendableEnums[objName.strVal]:
add x[2], enumField
x

Expand Down

0 comments on commit 14a0011

Please sign in to comment.