From b14cc1e3b2d8462018e1d2a8e92dfcb42398713e Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Mon, 30 Oct 2017 14:45:57 +0100 Subject: fixes #6631 --- lib/pure/collections/sharedstrings.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/pure/collections/sharedstrings.nim') diff --git a/lib/pure/collections/sharedstrings.nim b/lib/pure/collections/sharedstrings.nim index a9e194fb4..83edf8d94 100644 --- a/lib/pure/collections/sharedstrings.nim +++ b/lib/pure/collections/sharedstrings.nim @@ -55,7 +55,7 @@ proc `[]=`*(s: var SharedString; i: Natural; value: char) = if i < s.len: s.buffer.data[i+s.first] = value else: raise newException(IndexError, "index out of bounds") -proc `[]`*(s: SharedString; ab: Slice[int]): SharedString = +proc `[]`*(s: SharedString; ab: HSlice[int, int]): SharedString = #incRef(src.buffer) if ab.a < s.len: result.buffer = s.buffer -- cgit 1.4.1-2-gfad0 From 0ab373115c75e75618d3e8935445cee3e0298b60 Mon Sep 17 00:00:00 2001 From: "Lynn C. Rees" Date: Wed, 15 Nov 2017 09:34:48 -0700 Subject: Trim remaining expr/stmt from stdlib (#6742) --- lib/core/macros.nim | 2 +- lib/deprecated/pure/rawsockets.nim | 4 ++-- lib/pure/collections/sharedstrings.nim | 4 ++-- lib/pure/osproc.nim | 2 +- lib/pure/typetraits.nim | 2 +- lib/system.nim | 10 +++++----- lib/system/endb.nim | 2 +- lib/system/gc2.nim | 2 +- lib/system/sysspawn.nim | 4 ++-- 9 files changed, 16 insertions(+), 16 deletions(-) (limited to 'lib/pure/collections/sharedstrings.nim') diff --git a/lib/core/macros.nim b/lib/core/macros.nim index fc5b5bfb7..5d0cb0c0d 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -400,7 +400,7 @@ proc quote*(bl: typed, op = "``"): NimNode {.magic: "QuoteAst", noSideEffect.} ## ## .. code-block:: nim ## - ## macro check(ex: expr): stmt = + ## macro check(ex: untyped): typed = ## # this is a simplified version of the check macro from the ## # unittest module. ## diff --git a/lib/deprecated/pure/rawsockets.nim b/lib/deprecated/pure/rawsockets.nim index ee77b232e..876334f9e 100644 --- a/lib/deprecated/pure/rawsockets.nim +++ b/lib/deprecated/pure/rawsockets.nim @@ -3,12 +3,12 @@ export nativesockets {.warning: "rawsockets module is deprecated, use nativesockets instead".} -template newRawSocket*(domain, sockType, protocol: cint): expr = +template newRawSocket*(domain, sockType, protocol: cint): untyped = {.warning: "newRawSocket is deprecated, use newNativeSocket instead".} newNativeSocket(domain, sockType, protocol) template newRawSocket*(domain: Domain = AF_INET, sockType: SockType = SOCK_STREAM, - protocol: Protocol = IPPROTO_TCP): expr = + protocol: Protocol = IPPROTO_TCP): untyped = {.warning: "newRawSocket is deprecated, use newNativeSocket instead".} newNativeSocket(domain, sockType, protocol) diff --git a/lib/pure/collections/sharedstrings.nim b/lib/pure/collections/sharedstrings.nim index 83edf8d94..7e9de4b73 100644 --- a/lib/pure/collections/sharedstrings.nim +++ b/lib/pure/collections/sharedstrings.nim @@ -87,10 +87,10 @@ proc newSharedString*(s: string): SharedString = result.len = len when declared(atomicLoadN): - template load(x): expr = atomicLoadN(addr x, ATOMIC_SEQ_CST) + template load(x): untyped = atomicLoadN(addr x, ATOMIC_SEQ_CST) else: # XXX Fixme - template load(x): expr = x + template load(x): untyped = x proc add*(s: var SharedString; t: cstring; len: Natural) = if len == 0: return diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim index d768a7de9..dc25ea4c3 100644 --- a/lib/pure/osproc.nim +++ b/lib/pure/osproc.nim @@ -841,7 +841,7 @@ elif not defined(useNimRtl): var attr: Tposix_spawnattr var fops: Tposix_spawn_file_actions - template chck(e: expr) = + template chck(e: untyped) = if e != 0'i32: raiseOSError(osLastError()) chck posix_spawn_file_actions_init(fops) diff --git a/lib/pure/typetraits.nim b/lib/pure/typetraits.nim index 3b6f7de1a..2047abda4 100644 --- a/lib/pure/typetraits.nim +++ b/lib/pure/typetraits.nim @@ -21,7 +21,7 @@ proc name*(t: typedesc): string {.magic: "TypeTrait".} ## ## proc `$`*(T: typedesc): string = name(T) ## - ## template test(x): stmt = + ## template test(x): typed = ## echo "type: ", type(x), ", value: ", x ## ## test 42 diff --git a/lib/system.nim b/lib/system.nim index 687a68119..51ffeb042 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2763,9 +2763,9 @@ when defined(nimvarargstyped): ## pretends to be free of side effects, so that it can be used for debugging ## routines marked as `noSideEffect `_. else: - proc echo*(x: varargs[expr, `$`]) {.magic: "Echo", tags: [WriteIOEffect], + proc echo*(x: varargs[untyped, `$`]) {.magic: "Echo", tags: [WriteIOEffect], benign, sideEffect.} - proc debugEcho*(x: varargs[expr, `$`]) {.magic: "Echo", noSideEffect, + proc debugEcho*(x: varargs[untyped, `$`]) {.magic: "Echo", noSideEffect, tags: [], raises: [].} template newException*(exceptn: typedesc, message: string; @@ -3706,7 +3706,7 @@ proc instantiationInfo*(index = -1, fullPaths = false): tuple[ ## .. code-block:: nim ## import strutils ## - ## template testException(exception, code: expr): stmt = + ## template testException(exception, code: untyped): typed = ## try: ## let pos = instantiationInfo() ## discard(code) @@ -3844,11 +3844,11 @@ type {.deprecated: [PNimrodNode: NimNode].} when false: - template eval*(blk: stmt): stmt = + template eval*(blk: typed): typed = ## executes a block of code at compile time just as if it was a macro ## optionally, the block can return an AST tree that will replace the ## eval expression - macro payload: stmt {.gensym.} = blk + macro payload: typed {.gensym.} = blk payload() when hasAlloc: diff --git a/lib/system/endb.nim b/lib/system/endb.nim index 35d8f25c4..d51ae29df 100644 --- a/lib/system/endb.nim +++ b/lib/system/endb.nim @@ -370,7 +370,7 @@ proc commandPrompt() = if dbgUser.len == 0: dbgUser.len = oldLen # now look what we have to do: var i = scanWord(addr dbgUser.data, dbgTemp, 0) - template `?`(x: expr): expr = dbgTemp == cstring(x) + template `?`(x: untyped): untyped = dbgTemp == cstring(x) if ?"s" or ?"step": dbgState = dbStepInto again = false diff --git a/lib/system/gc2.nim b/lib/system/gc2.nim index 70bed8740..4ecf3b226 100644 --- a/lib/system/gc2.nim +++ b/lib/system/gc2.nim @@ -173,7 +173,7 @@ proc internRefcount(p: pointer): int {.exportc: "getRefcount".} = when BitsPerPage mod (sizeof(int)*8) != 0: {.error: "(BitsPerPage mod BitsPerUnit) should be zero!".} -template color(c): expr = c.refCount and colorMask +template color(c): untyped = c.refCount and colorMask template setColor(c, col) = c.refcount = c.refcount and not colorMask or col diff --git a/lib/system/sysspawn.nim b/lib/system/sysspawn.nim index a0d10c446..dc2d13578 100644 --- a/lib/system/sysspawn.nim +++ b/lib/system/sysspawn.nim @@ -153,12 +153,12 @@ proc preferSpawn*(): bool = ## it is not necessary to call this directly; use 'spawnX' instead. result = gSomeReady.event -proc spawn*(call: stmt) {.magic: "Spawn".} +proc spawn*(call: typed) {.magic: "Spawn".} ## always spawns a new task, so that the 'call' is never executed on ## the calling thread. 'call' has to be proc call 'p(...)' where 'p' ## is gcsafe and has 'void' as the return type. -template spawnX*(call: stmt) = +template spawnX*(call: typed) = ## spawns a new task if a CPU core is ready, otherwise executes the ## call in the calling thread. Usually it is advised to ## use 'spawn' in order to not block the producer for an unknown -- cgit 1.4.1-2-gfad0