diff options
author | Zahary Karadjov <zahary@gmail.com> | 2013-08-19 01:29:47 +0300 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2013-08-19 01:29:47 +0300 |
commit | fc858927f037a3218859cf6be4e97f0976433805 (patch) | |
tree | ad6dc1ca2a9add6881947a0aa8e8ab687f67b8f8 /compiler | |
parent | f760bc243b957ec8ebb529b9eadea53fc93adca5 (diff) | |
download | Nim-fc858927f037a3218859cf6be4e97f0976433805.tar.gz |
Revert "Revert "fix tforwardgeneric""
This reverts commit e3f93241c3824e49b69c647bbd44726a79e8f8f8.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ast.nim | 4 | ||||
-rw-r--r-- | compiler/lambdalifting.nim | 3 | ||||
-rw-r--r-- | compiler/seminst.nim | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index 13df058e7..5f6b658cf 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -1359,9 +1359,9 @@ proc getStrOrChar*(a: PNode): string = proc isGenericRoutine*(s: PSym): bool = case s.kind of skProc, skTemplate, skMacro, skIterator, skMethod, skConverter: - result = s.ast != nil and s.ast[genericParamsPos].kind != nkEmpty + result = sfFromGeneric in s.flags else: nil - + proc isRoutine*(s: PSym): bool {.inline.} = result = s.kind in {skProc, skTemplate, skMacro, skIterator, skMethod, skConverter} diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim index 8d4946ab5..163ea4136 100644 --- a/compiler/lambdalifting.nim +++ b/compiler/lambdalifting.nim @@ -288,6 +288,9 @@ proc interestingVar(s: PSym): bool {.inline.} = proc semCaptureSym*(s, owner: PSym) = if interestingVar(s) and owner.id != s.owner.id and s.kind != skResult: if owner.typ != nil and not isGenericRoutine(owner): + # XXX: is this really safe? + # if we capture a var from another generic routine, + # it won't be consider captured. owner.typ.callConv = ccClosure #echo "semCaptureSym ", owner.name.s, owner.id, " ", s.name.s, s.id # since the analysis is not entirely correct, we don't set 'tfCapturesEnv' diff --git a/compiler/seminst.nim b/compiler/seminst.nim index 35ed00965..431635b9c 100644 --- a/compiler/seminst.nim +++ b/compiler/seminst.nim @@ -125,8 +125,6 @@ proc fixupInstantiatedSymbols(c: PContext, s: PSym) = openScope(c) var n = oldPrc.ast n.sons[bodyPos] = copyTree(s.getBody) - if n.sons[paramsPos].kind != nkEmpty: - addParams(c, oldPrc.typ.n, oldPrc.kind) instantiateBody(c, n, oldPrc) closeScope(c) popInfoContext() |