summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@gmail.com>2017-02-06 20:42:01 +0100
committerDominik Picheta <dominikpicheta@gmail.com>2017-02-06 20:42:01 +0100
commit3c8c5d081e50058569f6257d16a21ec928637aa0 (patch)
tree21121e632480c37c1ea17cfbcbf6a621a0595f62
parente01c3561dc6ed08cd6c34a29d12c4c9951840f4b (diff)
downloadNim-3c8c5d081e50058569f6257d16a21ec928637aa0.tar.gz
Adds `except T as ident` handling in semtempl.
-rw-r--r--compiler/semtempl.nim8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim
index b63928807..c9a70e9bc 100644
--- a/compiler/semtempl.nim
+++ b/compiler/semtempl.nim
@@ -391,9 +391,15 @@ proc semTemplBody(c: var TemplCtx, n: PNode): PNode =
       var a = n.sons[i]
       checkMinSonsLen(a, 1)
       var L = sonsLen(a)
+      openScope(c)
       for j in countup(0, L-2):
-        a.sons[j] = semTemplBody(c, a.sons[j])
+        if a.sons[j].isInfixAs():
+          addLocalDecl(c, a.sons[j].sons[2], skLet)
+          a.sons[j].sons[1] = semTemplBody(c, a.sons[j][1])
+        else:
+          a.sons[j] = semTemplBody(c, a.sons[j])
       a.sons[L-1] = semTemplBodyScope(c, a.sons[L-1])
+      closeScope(c)
   of nkVarSection: semTemplSomeDecl(c, n, skVar)
   of nkLetSection: semTemplSomeDecl(c, n, skLet)
   of nkFormalParams: