diff options
Diffstat (limited to 'compiler/semtempl.nim')
-rw-r--r-- | compiler/semtempl.nim | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim index 642fcb527..fc1af7246 100644 --- a/compiler/semtempl.nim +++ b/compiler/semtempl.nim @@ -632,6 +632,11 @@ proc semPatternBody(c: var TemplCtx, n: PNode): PNode = localError(n.info, errInvalidExpression) result = n + proc stupidStmtListExpr(n: PNode): bool = + for i in 0 .. n.len-2: + if n[i].kind notin {nkEmpty, nkCommentStmt}: return false + result = true + result = n case n.kind of nkIdent: @@ -657,6 +662,12 @@ proc semPatternBody(c: var TemplCtx, n: PNode): PNode = localError(n.info, errInvalidExpression) else: localError(n.info, errInvalidExpression) + of nkStmtList, nkStmtListExpr: + if stupidStmtListExpr(n): + result = semPatternBody(c, n.lastSon) + else: + for i in countup(0, sonsLen(n) - 1): + result.sons[i] = semPatternBody(c, n.sons[i]) of nkCallKinds: let s = qualifiedLookUp(c.c, n.sons[0], {}) if s != nil: |