diff options
-rw-r--r-- | lib/core/macros.nim | 12 | ||||
-rw-r--r-- | lib/pure/unicode.nim | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 4296cb0ae..19452b4a8 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -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() diff --git a/lib/pure/unicode.nim b/lib/pure/unicode.nim index 0cbe8de7a..6ba966816 100644 --- a/lib/pure/unicode.nim +++ b/lib/pure/unicode.nim @@ -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] |