summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-11-15 16:18:28 +0100
committerAraq <rumpf_a@web.de>2018-11-15 16:18:28 +0100
commit3fe8b4f69d3bf651e3b3dc0895e6767ce475007c (patch)
tree26364a0cd7028b01fa1c986000a1bb218a26ea2d
parentdd3e1cbc9bb1bf346a640451121dc52d4e8b98f3 (diff)
downloadNim-3fe8b4f69d3bf651e3b3dc0895e6767ce475007c.tar.gz
fixes #9692
-rw-r--r--compiler/semasgn.nim9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/semasgn.nim b/compiler/semasgn.nim
index 62e01ba7b..3947e4f6c 100644
--- a/compiler/semasgn.nim
+++ b/compiler/semasgn.nim
@@ -81,8 +81,8 @@ proc genAddr(c: PContext; x: PNode): PNode =
     addSon(result, x)
 
 proc newAsgnCall(c: PContext; op: PSym; x, y: PNode): PNode =
-  if sfError in op.flags:
-    localError(c.config, x.info, "usage of '$1' is a user-defined error" % op.name.s)
+  #if sfError in op.flags:
+  #  localError(c.config, x.info, "usage of '$1' is a user-defined error" % op.name.s)
   result = newNodeI(nkCall, x.info)
   result.add newSymNode(op)
   result.add genAddr(c, x)
@@ -121,7 +121,10 @@ proc considerAsgnOrSink(c: var TLiftCtx; t: PType; body, x, y: PNode;
       op = field
       if op == nil:
         op = liftBody(c.c, t, c.kind, c.info)
-    markUsed(c.c.config, c.info, op, c.c.graph.usageSym)
+    if sfError in op.flags:
+      incl c.fn.flags, sfError
+    else:
+      markUsed(c.c.config, c.info, op, c.c.graph.usageSym)
     onUse(c.info, op)
     body.add newAsgnCall(c.c, op, x, y)
     result = true