diff options
author | flywind <43030857+xflywind@users.noreply.github.com> | 2020-11-02 21:16:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-02 14:16:33 +0100 |
commit | eb429988cd15555f2af35389d52256b06e00e900 (patch) | |
tree | c627c3407d043ab42b2027df3161dff3cfaec038 /lib | |
parent | 6fa82a5b3afbe644eef3fb41647a341d8e9b21c4 (diff) | |
download | Nim-eb429988cd15555f2af35389d52256b06e00e900.tar.gz |
fixes #15594 (#15819)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/sugar.nim | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/pure/sugar.nim b/lib/pure/sugar.nim index 92e9f662a..dd44c731d 100644 --- a/lib/pure/sugar.nim +++ b/lib/pure/sugar.nim @@ -207,6 +207,8 @@ macro capture*(locals: varargs[typed], body: untyped): untyped {.since: (1, 1).} let locals = if locals.len == 1 and locals[0].kind == nnkBracket: locals[0] else: locals for arg in locals: + if arg.strVal == "result": + error("The variable name cannot be `result`!", arg) params.add(newIdentDefs(ident(arg.strVal), freshIdentNodes getTypeInst arg)) result = newNimNode(nnkCall) result.add(newProc(newEmptyNode(), params, body, nnkProcDef)) |