update stdlib to not use deprecated symbols

This commit is contained in:
Andreas Rumpf
2016-08-25 17:21:48 +02:00
parent 10f445da89
commit 54cc702351
2 changed files with 9 additions and 9 deletions

View File

@@ -333,7 +333,7 @@ proc parseStmt*(s: string): NimNode {.noSideEffect, compileTime.} =
let x = internalErrorFlag()
if x.len > 0: raise newException(ValueError, x)
proc getAst*(macroOrTemplate: expr): NimNode {.magic: "ExpandToAst", noSideEffect.}
proc getAst*(macroOrTemplate: untyped): NimNode {.magic: "ExpandToAst", noSideEffect.}
## Obtains the AST nodes returned from a macro or template invocation.
## Example:
##
@@ -342,7 +342,7 @@ proc getAst*(macroOrTemplate: expr): NimNode {.magic: "ExpandToAst", noSideEffec
## macro FooMacro() =
## var ast = getAst(BarTemplate())
proc quote*(bl: stmt, op = "``"): NimNode {.magic: "QuoteAst", noSideEffect.}
proc quote*(bl: typed, op = "``"): NimNode {.magic: "QuoteAst", noSideEffect.}
## Quasi-quoting operator.
## Accepts an expression or a block and returns the AST that represents it.
## Within the quoted AST, you are able to interpolate NimNode expressions
@@ -663,7 +663,7 @@ proc copyChildrenTo*(src, dest: NimNode) {.compileTime.}=
for i in 0 .. < src.len:
dest.add src[i].copyNimTree
template expectRoutine(node: NimNode): stmt =
template expectRoutine(node: NimNode) =
expectKind(node, RoutineNodes)
proc name*(someProc: NimNode): NimNode {.compileTime.} =
@@ -870,7 +870,7 @@ proc hasArgOfName* (params: NimNode; name: string): bool {.compiletime.}=
## Search nnkFormalParams for an argument.
assert params.kind == nnkFormalParams
for i in 1 .. <params.len:
template node: expr = params[i]
template node: untyped = params[i]
if name.eqIdent( $ node[0]):
return true
@@ -891,7 +891,7 @@ proc boolVal*(n: NimNode): bool {.compileTime, noSideEffect.} =
else: n == bindSym"true" # hacky solution for now
when not defined(booting):
template emit*(e: static[string]): stmt {.deprecated.} =
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:
@@ -900,6 +900,6 @@ when not defined(booting):
## emit("echo " & '"' & "hello world".toUpper & '"')
##
## Deprecated since version 0.15 since it's so rarely useful.
macro payload: stmt {.gensym.} =
macro payload: untyped {.gensym.} =
result = parseStmt(e)
payload()

View File

@@ -24,7 +24,7 @@ proc `<=%`*(a, b: Rune): bool = return int(a) <=% int(b)
proc `<%`*(a, b: Rune): bool = return int(a) <% int(b)
proc `==`*(a, b: Rune): bool = return int(a) == int(b)
template ones(n: expr): expr = ((1 shl n)-1)
template ones(n: untyped): untyped = ((1 shl n)-1)
proc runeLen*(s: string): int {.rtl, extern: "nuc$1".} =
## Returns the number of Unicode characters of the string ``s``
@@ -49,7 +49,7 @@ proc runeLenAt*(s: string, i: Natural): int =
elif ord(s[i]) shr 1 == 0b1111110: result = 6
else: result = 1
template fastRuneAt*(s: string, i: int, result: expr, doInc = true) =
template fastRuneAt*(s: string, i: int, result: untyped, doInc = true) =
## Returns the Unicode character ``s[i]`` in ``result``. If ``doInc == true``
## ``i`` is incremented by the number of bytes that have been processed.
bind ones
@@ -1628,7 +1628,7 @@ proc reversed*(s: string): string =
blockPos = 0
r: Rune
template reverseUntil(pos): stmt =
template reverseUntil(pos) =
var j = pos - 1
while j > blockPos:
result[newPos] = s[j]