From 0f8082c935cb62d6e2acf5ee5d6619be39856b4c Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Tue, 19 Jun 2018 16:38:03 +0300 Subject: [PATCH] fix #8 --- chronicles.nim | 2 +- chronicles/scope_helpers.nim | 4 ++-- tests/lexical_scopes.nim | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/chronicles.nim b/chronicles.nim index 947e152..6a85098 100644 --- a/chronicles.nim +++ b/chronicles.nim @@ -44,7 +44,7 @@ macro logScopeIMPL(prevScopes: typed, for k, v in assignments(bestScope.scopeAssignments): finalBindings[k] = v - for k, v in assignments(newBindings, false): + for k, v in assignments(newBindings): finalBindings[k] = v for k, v in finalBindings: diff --git a/chronicles/scope_helpers.nim b/chronicles/scope_helpers.nim index bb8054f..7c6e475 100644 --- a/chronicles/scope_helpers.nim +++ b/chronicles/scope_helpers.nim @@ -9,7 +9,7 @@ proc id*(key: string, public = false): NimNode = result = newIdentNode(key) if public: result = postfix(result, "*") -iterator assignments*(n: NimNode, liftIdentifiers = true): (string, NimNode) = +iterator assignments*(n: NimNode): (string, NimNode) = # extract the assignment pairs from a block with assigments # or a call-site with keyword arguments. for child in n: @@ -18,7 +18,7 @@ iterator assignments*(n: NimNode, liftIdentifiers = true): (string, NimNode) = let value = child[1] yield (name, value) - elif child.kind == nnkIdent and liftIdentifiers: + elif child.kind == nnkIdent: yield ($child, child) else: diff --git a/tests/lexical_scopes.nim b/tests/lexical_scopes.nim index 93e0821..8ae8f43 100644 --- a/tests/lexical_scopes.nim +++ b/tests/lexical_scopes.nim @@ -11,8 +11,9 @@ logScope: logScope: c = 100 -proc main = +proc main(arg: int) = logScope: + arg c = 10 logScope: @@ -20,7 +21,7 @@ proc main = info("main started", a = 10, b = "inner-b", d = "some-d") -main() +main(50) info("exiting", msg = "bye bye")