From a8edf67a280155a33b57785866d41fca249b9909 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Sat, 30 Jul 2016 00:50:38 +0200 Subject: make nim bootstrap again for older versions --- compiler/condsyms.nim | 1 + lib/pure/collections/sequtils.nim | 4 +++- lib/pure/collections/tableimpl.nim | 4 ++-- lib/pure/collections/tables.nim | 4 ++-- lib/system.nim | 2 +- lib/system/inclrtl.nim | 5 +++++ 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/compiler/condsyms.nim b/compiler/condsyms.nim index 02f7e764d..bcd9592e6 100644 --- a/compiler/condsyms.nim +++ b/compiler/condsyms.nim @@ -98,3 +98,4 @@ proc initDefines*() = defineSymbol("nimtypedescfixed") defineSymbol("nimKnowsNimvm") defineSymbol("nimArrIdx") + defineSymbol("nimImmediateDeprecated") diff --git a/lib/pure/collections/sequtils.nim b/lib/pure/collections/sequtils.nim index ef8409443..e277ee9e8 100644 --- a/lib/pure/collections/sequtils.nim +++ b/lib/pure/collections/sequtils.nim @@ -20,6 +20,8 @@ ## **Note**: This interface will change as soon as the compiler supports ## closures and proper coroutines. +include "system/inclrtl" + when not defined(nimhygiene): {.pragma: dirty.} @@ -456,7 +458,7 @@ template anyIt*(seq1, pred: untyped): bool = break result -template toSeq*(iter: untyped): untyped = +template toSeq*(iter: untyped): untyped {.oldimmediate.} = ## Transforms any iterator into a sequence. ## ## Example: diff --git a/lib/pure/collections/tableimpl.nim b/lib/pure/collections/tableimpl.nim index f4a135e01..be3507137 100644 --- a/lib/pure/collections/tableimpl.nim +++ b/lib/pure/collections/tableimpl.nim @@ -79,7 +79,7 @@ template addImpl(enlarge) {.dirty.} = rawInsert(t, t.data, key, val, hc, j) inc(t.counter) -template maybeRehashPutImpl(enlarge) {.dirty.} = +template maybeRehashPutImpl(enlarge) {.oldimmediate, dirty.} = if mustRehash(t.dataLen, t.counter): enlarge(t) index = rawGetKnownHC(t, key, hc) @@ -87,7 +87,7 @@ template maybeRehashPutImpl(enlarge) {.dirty.} = rawInsert(t, t.data, key, val, hc, index) inc(t.counter) -template putImpl(enlarge) {.dirty.} = +template putImpl(enlarge) {.oldimmediate, dirty.} = var hc: Hash var index = rawGet(t, key, hc) if index >= 0: t.data[index].val = val diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim index 9e7e2e0e5..9308095aa 100644 --- a/lib/pure/collections/tables.nim +++ b/lib/pure/collections/tables.nim @@ -463,7 +463,7 @@ proc clear*[A, B](t: OrderedTable[A, B] | OrderedTableRef[A, B]) = t.first = -1 t.last = -1 -template forAllOrderedPairs(yieldStmt: untyped) {.dirty.} = +template forAllOrderedPairs(yieldStmt: untyped) {.oldimmediate, dirty.} = var h = t.first while h >= 0: var nxt = t.data[h].next @@ -649,7 +649,7 @@ proc len*[A, B](t: OrderedTableRef[A, B]): int {.inline.} = ## returns the number of keys in `t`. result = t.counter -template forAllOrderedPairs(yieldStmt: untyped) {.dirty.} = +template forAllOrderedPairs(yieldStmt: untyped) {.oldimmediate, dirty.} = var h = t.first while h >= 0: var nxt = t.data[h].next diff --git a/lib/system.nim b/lib/system.nim index 2b19b5633..0c7eaea95 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -1874,7 +1874,7 @@ iterator countdown*[T](a, b: T, step = 1): T {.inline.} = yield res dec(res, step) -template countupImpl(incr: untyped) {.dirty.} = +template countupImpl(incr: untyped) {.oldimmediate, dirty.} = when T is IntLikeForCount: var res = int(a) while res <= int(b): diff --git a/lib/system/inclrtl.nim b/lib/system/inclrtl.nim index 3caeefcbc..f9e6754ef 100644 --- a/lib/system/inclrtl.nim +++ b/lib/system/inclrtl.nim @@ -19,6 +19,11 @@ when not defined(nimNewShared): {.pragma: gcsafe.} +when not defined(nimImmediateDeprecated): + {.pragma: oldimmediate, immediate.} +else: + {.pragma: oldimmediate.} + when defined(createNimRtl): when defined(useNimRtl): {.error: "Cannot create and use nimrtl at the same time!".} -- cgit 1.4.1-2-gfad0