diff options
author | Araq <rumpf_a@web.de> | 2012-11-22 01:36:57 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-11-22 01:36:57 +0100 |
commit | 338683a1980e32fb31d8a09e0308e422b883e686 (patch) | |
tree | 7bd5b6de0764768575be18b1c1c46a12287c51df /compiler | |
parent | 85c53d525b0f3afdd866e7ccaad3e084ad49fa45 (diff) | |
download | Nim-338683a1980e32fb31d8a09e0308e422b883e686.tar.gz |
bugfixes for thread analysis
Diffstat (limited to 'compiler')
-rwxr-xr-x | compiler/semthreads.nim | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/semthreads.nim b/compiler/semthreads.nim index 6c0259ef1..75621be79 100755 --- a/compiler/semthreads.nim +++ b/compiler/semthreads.nim @@ -184,8 +184,9 @@ proc analyseCall(c: PProcCtx, n: PNode): TThreadOwner = call.args[i-1] = analyse(c, n[i]) if not computed.hasKey(call): computed[call] = toUndefined # we are computing it - for i in 1..n.len-1: - var formal = skipTypes(prc.typ, abstractInst).n.sons[i].sym + let prctyp = skipTypes(prc.typ, abstractInst).n + for i in 1.. prctyp.len-1: + var formal = prctyp.sons[i].sym newCtx.mapping[formal.id] = call.args[i-1] pushInfoContext(n.info) result = analyse(newCtx, prc.getBody) @@ -226,7 +227,8 @@ proc analyseVarSection(c: PProcCtx, n: PNode): TThreadOwner = var a = n.sons[i] if a.kind == nkCommentStmt: continue if a.kind == nkIdentDefs: - assert(a.sons[0].kind == nkSym) + #assert(a.sons[0].kind == nkSym); also valid for after + # closure transformation: analyseSingleVar(c, a) else: analyseVarTuple(c, a) @@ -359,9 +361,11 @@ proc analyse(c: PProcCtx, n: PNode): TThreadOwner = of nkReturnStmt, nkDiscardStmt: if n.sons[0].kind != nkEmpty: result = analyse(c, n.sons[0]) else: result = toVoid + of nkLambdaKinds, nkClosure: + result = toMine of nkAsmStmt, nkPragma, nkIteratorDef, nkProcDef, nkMethodDef, - nkConverterDef, nkMacroDef, nkTemplateDef, nkLambdaKinds, nkClosure, - nkGotoState, nkState: + nkConverterDef, nkMacroDef, nkTemplateDef, + nkGotoState, nkState, nkBreakState, nkType: result = toVoid of nkExprColonExpr: result = analyse(c, n.sons[1]) |