summary refs log tree commit diff stats
path: root/compiler/semexprs.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-06-30 12:50:24 +0200
committerAraq <rumpf_a@web.de>2015-06-30 12:50:24 +0200
commit28de800d6148065fd3e6344f7255e793298be399 (patch)
tree8aec27c13cd99be3c9e3d3abef45e1d183db996b /compiler/semexprs.nim
parent4cfe216a776ffef61380c1c5f2d61aff7315c122 (diff)
parent3312d49a489e50e5c5f2275f7c0e400208eb8a5d (diff)
downloadNim-28de800d6148065fd3e6344f7255e793298be399.tar.gz
Merge branch 'more_concurrency' into devel
Conflicts:
	doc/tut1.txt
	lib/core/locks.nim
	lib/pure/collections/tables.nim
	lib/pure/selectors.nim
Diffstat (limited to 'compiler/semexprs.nim')
-rw-r--r--compiler/semexprs.nim16
1 files changed, 10 insertions, 6 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 45f6f04f9..a56df9502 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -1727,13 +1727,17 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
     dec c.inParallelStmt
   of mSpawn:
     result = setMs(n, s)
-    result.sons[1] = semExpr(c, n.sons[1])
-    if not result[1].typ.isEmptyType:
-      if spawnResult(result[1].typ, c.inParallelStmt > 0) == srFlowVar:
-        result.typ = createFlowVar(c, result[1].typ, n.info)
+    for i in 1 .. <n.len:
+      result.sons[i] = semExpr(c, n.sons[i])
+    let typ = result[^1].typ
+    if not typ.isEmptyType:
+      if spawnResult(typ, c.inParallelStmt > 0) == srFlowVar:
+        result.typ = createFlowVar(c, typ, n.info)
       else:
-        result.typ = result[1].typ
-      result.add instantiateCreateFlowVarCall(c, result[1].typ, n.info).newSymNode
+        result.typ = typ
+      result.add instantiateCreateFlowVarCall(c, typ, n.info).newSymNode
+    else:
+      result.add emptyNode
   of mProcCall:
     result = setMs(n, s)
     result.sons[1] = semExpr(c, n.sons[1])