Skip to content

Commit 5cae290

Browse files
committed
Work around compiler bug: nim-lang/Nim#2630
Fixes #8
1 parent ffd0651 commit 5cae290

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/docopt.nim

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ method match(self: Required, left: seq[Pattern],
283283
collected: seq[Pattern] = @[]): MatchResult =
284284
result = (true, left, collected)
285285
for pattern in self.children:
286-
result = pattern.match(result.left, result.collected)
286+
let t = pattern.match(result.left, result.collected)
287+
result = t
287288
if not result.matched:
288289
return (false, left, collected)
289290

@@ -292,7 +293,8 @@ method match(self: Optional, left: seq[Pattern],
292293
collected: seq[Pattern] = @[]): MatchResult =
293294
result = (true, left, collected)
294295
for pattern in self.children:
295-
result = pattern.match(result.left, result.collected)
296+
let t = pattern.match(result.left, result.collected)
297+
result = t
296298
result.matched = true
297299

298300

@@ -304,7 +306,8 @@ method match(self: OneOrMore, left: seq[Pattern],
304306
var times = 0
305307
while result.matched:
306308
# could it be that something didn't match but changed l or c?
307-
result = self.children[0].match(result.left, result.collected)
309+
let t = self.children[0].match(result.left, result.collected)
310+
result = t
308311
if result.matched:
309312
times += 1
310313
if l2 == result.left:

0 commit comments

Comments
 (0)