tcnstseq works again

This commit is contained in:
Araq 2013-11-07 00:25:54 +01:00
commit 4cda0861f5
5 changed files with 11 additions and 3 deletions

View file

@ -207,6 +207,8 @@ proc newCall(a, b: PSym): PNode =
proc addHiddenParam(routine: PSym, param: PSym) =
var params = routine.ast.sons[paramsPos]
# -1 is correct here as param.position is 0 based but we have at position 0
# some nkEffect node:
param.position = params.len-1
addSon(params, newSymNode(param))
incl(routine.typ.flags, tfCapturesEnv)

View file

@ -187,6 +187,11 @@ proc semConstExpr(c: PContext, n: PNode): PNode =
LocalError(e.info, errConstExprExpected)
# error correction:
result = e
else:
# recompute the types as 'eval' isn't guaranteed to construct types nor
# that the types are sound:
result = semExprWithType(c, result)
result = fitNode(c, e.typ, result)
include hlo, seminst, semcall

View file

@ -421,7 +421,9 @@ proc semConst(c: PContext, n: PNode): PNode =
def = fitRemoveHiddenConv(c, typ, def)
else:
typ = def.typ
if typ == nil: continue
if typ == nil:
LocalError(a.sons[2].info, errConstExprExpected)
continue
if not typeAllowed(typ, skConst):
LocalError(a.info, errXisNoType, typeToString(typ))
continue

View file

@ -959,7 +959,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): PNode =
proc fixType(result, n: PNode) {.inline.} =
# XXX do it deeply for complex values
if result.typ.isNil: result.typ = n.typ
#if result.typ.isNil: result.typ = n.typ
proc execute(c: PCtx, start: int): PNode =
var tos = PStackFrame(prc: nil, comesFrom: 0, next: nil)

View file

@ -2,7 +2,6 @@ version 0.9.4
=============
- new VM:
- tcntseq fails
- implement overflow checking
- implement the FFI