bugfix: regionized pointers in a generic context; renamed 'Future' to 'Promise'

This commit is contained in:
Araq 2014-05-25 15:19:46 +02:00
commit 030eac86c0
7 changed files with 137 additions and 108 deletions

View file

@ -1579,9 +1579,9 @@ proc semShallowCopy(c: PContext, n: PNode, flags: TExprFlags): PNode =
else:
result = semDirectOp(c, n, flags)
proc createFuture(c: PContext; t: PType; info: TLineInfo): PType =
proc createPromise(c: PContext; t: PType; info: TLineInfo): PType =
result = newType(tyGenericInvokation, c.module)
addSonSkipIntLit(result, magicsys.getCompilerProc("Future").typ)
addSonSkipIntLit(result, magicsys.getCompilerProc("Promise").typ)
addSonSkipIntLit(result, t)
result = instGenericContainer(c, info, result, allowMetaTypes = false)
@ -1619,9 +1619,9 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
of mSpawn:
result = setMs(n, s)
result.sons[1] = semExpr(c, n.sons[1])
# later passes may transform the type 'Future[T]' back into 'T'
# later passes may transform the type 'Promise[T]' back into 'T'
if not result[1].typ.isEmptyType:
result.typ = createFuture(c, result[1].typ, n.info)
result.typ = createPromise(c, result[1].typ, n.info)
else: result = semDirectOp(c, n, flags)
proc semWhen(c: PContext, n: PNode, semCheck = true): PNode =