From b3055d8735ca012b77121c16bcf62e3f311084e8 Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 13 Dec 2017 13:36:10 +0100 Subject: [PATCH] attempt to get the stack trace logic right --- lib/pure/asyncfutures.nim | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/pure/asyncfutures.nim b/lib/pure/asyncfutures.nim index 5675f5399..ea7a798fc 100644 --- a/lib/pure/asyncfutures.nim +++ b/lib/pure/asyncfutures.nim @@ -217,16 +217,6 @@ proc `callback=`*[T](future: Future[T], ## If future has already completed then ``cb`` will be called immediately. future.callback = proc () = cb(future) -proc diff[T](a, b: seq[T]; firstB, lastB: int): int = - ## Iterates through both sequences until the items do not match, - ## returns the remainder of `b[firstB..lastB]` after the last item that does not match - ## together with the index of the last match. - result = firstB - for i in 0.. 0 and e > i+1: + if result[last] != entries[e]: + newBlock = false + break + dec e + dec last + + if newBlock: + for j in i+1 ..< reRaiseEnd: result.add entries[j] + i = reRaiseEnd+1 continue