mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-04 02:44:44 +00:00
[refactoring] error instead of quit for basename (#11491)
(cherry picked from commit bda9fd149c)
This commit is contained in:
committed by
narimiran
parent
78c6f01b90
commit
ea4d72a379
@@ -1302,7 +1302,8 @@ proc basename*(a: NimNode): NimNode =
|
||||
of nnkIdent: return a
|
||||
of nnkPostfix, nnkPrefix: return a[1]
|
||||
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.}=
|
||||
case a.kind
|
||||
@@ -1311,7 +1312,8 @@ proc `basename=`*(a: NimNode; val: string) {.compileTime.}=
|
||||
of nnkPostfix, nnkPrefix:
|
||||
a[1] = ident(val)
|
||||
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.} =
|
||||
newNimNode(nnkPostfix).add(ident(op), node)
|
||||
|
||||
Reference in New Issue
Block a user