summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2017-06-05 05:20:13 +0300
committerAndreas Rumpf <rumpf_a@web.de>2017-06-20 11:29:42 +0200
commitcd0256136839261b1c1b86c826d74cdbca5ddb67 (patch)
tree1a2043345025c2d849c680ace2707473b82bf04a /compiler/semstmts.nim
parent30ccadfe4c7674cd8e58f6a8fe75055c4518dac3 (diff)
downloadNim-cd0256136839261b1c1b86c826d74cdbca5ddb67.tar.gz
introduce a pre-processing pass for the concept bodies
fixes #4982
fixes #3805

close #3414
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r--compiler/semstmts.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 7ea7763c3..b00e9a9c0 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -144,7 +144,7 @@ proc fixNilType(n: PNode) =
   n.typ = nil
 
 proc discardCheck(c: PContext, result: PNode) =
-  if c.inTypeClass > 0: return
+  if c.matchedConcept != nil: return
   if result.typ != nil and result.typ.kind notin {tyStmt, tyVoid}:
     if result.kind == nkNilLit:
       result.typ = nil
@@ -1761,7 +1761,7 @@ proc semStmtList(c: PContext, n: PNode, flags: TExprFlags): PNode =
     else:
       var expr = semExpr(c, n.sons[i], flags)
       n.sons[i] = expr
-      if c.inTypeClass > 0 and expr.typ != nil:
+      if c.matchedConcept != nil and expr.typ != nil:
         case expr.typ.kind
         of tyBool:
           if expr.kind == nkInfix and
@@ -1800,7 +1800,7 @@ proc semStmtList(c: PContext, n: PNode, flags: TExprFlags): PNode =
 
   if result.len == 1 and
      # concept bodies should be preserved as a stmt list:
-     c.inTypeClass == 0 and
+     c.matchedConcept == nil and
      # also, don't make life complicated for macros.
      # they will always expect a proper stmtlist:
      nfBlockArg notin n.flags and