Clean up macros (#14959)
This commit is contained in:
parent
2b0e336c97
commit
9465b5db44
8 changed files with 6 additions and 43 deletions
|
|
@ -140,10 +140,6 @@ const
|
|||
|
||||
{.push warnings: off.}
|
||||
|
||||
proc `!`*(s: string): NimIdent {.magic: "StrToIdent", noSideEffect, deprecated:
|
||||
"Deprecated since version 0.18.0: Use 'ident' or 'newIdentNode' instead.".}
|
||||
## Constructs an identifier from the string `s`.
|
||||
|
||||
proc toNimIdent*(s: string): NimIdent {.magic: "StrToIdent", noSideEffect, deprecated:
|
||||
"Deprecated since version 0.18.0: Use 'ident' or 'newIdentNode' instead.".}
|
||||
## Constructs an identifier from the string `s`.
|
||||
|
|
@ -393,13 +389,6 @@ proc `ident=`*(n: NimNode, val: NimIdent) {.magic: "NSetIdent", noSideEffect, de
|
|||
|
||||
{.pop.}
|
||||
|
||||
#proc `typ=`*(n: NimNode, typ: typedesc) {.magic: "NSetType".}
|
||||
# this is not sound! Unfortunately forbidding 'typ=' is not enough, as you
|
||||
# can easily do:
|
||||
# let bracket = semCheck([1, 2])
|
||||
# let fake = semCheck(2.0)
|
||||
# bracket[0] = fake # constructs a mixed array with ints and floats!
|
||||
|
||||
proc `strVal=`*(n: NimNode, val: string) {.magic: "NSetStrVal", noSideEffect.}
|
||||
## Sets the string value of a string literal or comment.
|
||||
## Setting `strVal` is disallowed for `nnkIdent` and `nnkSym` nodes; a new node
|
||||
|
|
@ -830,14 +819,6 @@ proc nestList*(op: NimNode; pack: NimNode; init: NimNode): NimNode {.compileTime
|
|||
for i in countdown(pack.len - 1, 0):
|
||||
result = newCall(op, pack[i], result)
|
||||
|
||||
{.push warnings: off.}
|
||||
|
||||
proc nestList*(theProc: NimIdent, x: NimNode): NimNode {.compileTime, deprecated:
|
||||
"Deprecated since v0.18.1; use one of 'nestList(NimNode, ...)' instead.".} =
|
||||
nestList(newIdentNode(theProc), x)
|
||||
|
||||
{.pop.}
|
||||
|
||||
proc treeTraverse(n: NimNode; res: var string; level = 0; isLisp = false, indented = false) {.benign.} =
|
||||
if level > 0:
|
||||
if indented:
|
||||
|
|
@ -1628,21 +1609,6 @@ macro getCustomPragmaVal*(n: typed, cp: typed{nkSym}): untyped =
|
|||
if result.kind == nnkEmpty:
|
||||
error(n.repr & " doesn't have a pragma named " & cp.repr()) # returning an empty node results in most cases in a cryptic error,
|
||||
|
||||
|
||||
when not defined(booting):
|
||||
template emit*(e: static[string]): untyped {.deprecated.} =
|
||||
## Accepts a single string argument and treats it as nim code
|
||||
## that should be inserted verbatim in the program
|
||||
## Example:
|
||||
##
|
||||
## .. code-block:: nim
|
||||
## emit("echo " & '"' & "hello world".toUpper & '"')
|
||||
##
|
||||
## Deprecated since version 0.15 since it's so rarely useful.
|
||||
macro payload: untyped {.gensym.} =
|
||||
result = parseStmt(e)
|
||||
payload()
|
||||
|
||||
macro unpackVarargs*(callee: untyped; args: varargs[untyped]): untyped =
|
||||
result = newCall(callee)
|
||||
for i in 0 ..< args.len:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue