Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
Signed-off-by: George Lemon <[email protected]>
  • Loading branch information
georgelemon committed Jun 6, 2024
1 parent cfe013b commit f33ff97
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/voodoo/extendables.nim → src/voodoo/extensibles.nim
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ template extendCase*(fieldNode: untyped, branchesNode: untyped) =
Extendables[$objName & "_" & $fieldName] = stmtBranches
extendCaseMacro(fieldNode, branchesNode)

template extendableCase* {.pragma.}
template extensibleCase* {.pragma.}

macro extendable*(x: untyped) =
## Mark your object or enum with `extendable` pragma
## for making it extendable from other modules at compile-time.
macro extensible*(x: untyped) =
## Mark your object or enum with `extensible` pragma
## for making it extensible from other modules
expectKind(x, nnkTypeDef)
let objName =
if x[0][0].kind == nnkPostfix:
Expand All @@ -82,18 +82,18 @@ macro extendable*(x: untyped) =
for objNode in x[2][2]:
case objNode.kind
of nnkRecCase:
var isExtendable: bool
var isExtensible: bool
if objNode[0][0].kind == nnkPragmaExpr:
for somePragma in objNode[0][0][^1]:
if somePragma.eqIdent"extendableCase":
isExtendable = true
if somePragma.eqIdent"extensibleCase":
isExtensible = true
break
let fieldName =
if objNode[0][0][0].kind == nnkAccQuoted:
objNode[0][0][0]
else:
objNode[0][0]
if isExtendable:
if isExtensible:
let key = $objName & "_" & $fieldName
if Extendables.hasKey(key):
for br in Extendables[key]:
Expand Down

0 comments on commit f33ff97

Please sign in to comment.