[refactoring] error instead of quit for basename (#11491)
This commit is contained in:
parent
06ef56ba72
commit
bda9fd149c
1 changed files with 4 additions and 2 deletions
|
|
@ -1302,7 +1302,8 @@ proc basename*(a: NimNode): NimNode =
|
||||||
of nnkIdent: return a
|
of nnkIdent: return a
|
||||||
of nnkPostfix, nnkPrefix: return a[1]
|
of nnkPostfix, nnkPrefix: return a[1]
|
||||||
else:
|
else:
|
||||||
quit "Do not know how to get basename of (" & treeRepr(a) & ")\n" & repr(a)
|
error("Do not know how to get basename of (" & treeRepr(a) & ")\n" &
|
||||||
|
repr(a), a)
|
||||||
|
|
||||||
proc `basename=`*(a: NimNode; val: string) {.compileTime.}=
|
proc `basename=`*(a: NimNode; val: string) {.compileTime.}=
|
||||||
case a.kind
|
case a.kind
|
||||||
|
|
@ -1311,7 +1312,8 @@ proc `basename=`*(a: NimNode; val: string) {.compileTime.}=
|
||||||
of nnkPostfix, nnkPrefix:
|
of nnkPostfix, nnkPrefix:
|
||||||
a[1] = ident(val)
|
a[1] = ident(val)
|
||||||
else:
|
else:
|
||||||
quit "Do not know how to get basename of (" & treeRepr(a) & ")\n" & repr(a)
|
error("Do not know how to get basename of (" & treeRepr(a) & ")\n" &
|
||||||
|
repr(a), a)
|
||||||
|
|
||||||
proc postfix*(node: NimNode; op: string): NimNode {.compileTime.} =
|
proc postfix*(node: NimNode; op: string): NimNode {.compileTime.} =
|
||||||
newNimNode(nnkPostfix).add(ident(op), node)
|
newNimNode(nnkPostfix).add(ident(op), node)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue