diff options
author | Zahary Karadjov <zahary@gmail.com> | 2012-04-11 01:14:56 +0300 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2012-04-11 01:52:12 +0300 |
commit | 238202ccbc418dece73086f0d009b2b6fe3850ca (patch) | |
tree | aaa6c9a0cc6c6e3fcb9d42c6cb1eba94c6ca1544 /compiler | |
parent | c1ad05c4c582a6b51c47095b7ab946d5df10d72c (diff) | |
download | Nim-238202ccbc418dece73086f0d009b2b6fe3850ca.tar.gz |
re-enable rodfiles tests; fixes #91
Diffstat (limited to 'compiler')
-rwxr-xr-x | compiler/ccgstmts.nim | 3 | ||||
-rwxr-xr-x | compiler/semtypes.nim | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index e018a3ac9..5ad9d8b44 100755 --- a/compiler/ccgstmts.nim +++ b/compiler/ccgstmts.nim @@ -53,7 +53,8 @@ proc genSingleVar(p: BProc, a: PNode) = var targetProc = p var immediateAsgn = a.sons[2].kind != nkEmpty if sfGlobal in v.flags: - targetProc = p.module.preInitProc + if v.owner.kind != skModule: + targetProc = p.module.preInitProc assignGlobalVar(targetProc, v) genObjectInit(targetProc, cpsInit, v.typ, v.loc, true) else: diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index be5bd95d9..5626da6f9 100755 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -181,7 +181,12 @@ proc semTypeIdent(c: PContext, n: PNode): PSym = if result != nil: markUsed(n, result) if result.kind == skParam and result.typ.kind == tyTypeDesc: - return result.typ.sons[0].sym + # This is a typedesc param. is it already bound? + # it's not bound when it's also used as return type for example + if result.typ.sonsLen > 0: + return result.typ.sons[0].sym + else: + return result.typ.sym if result.kind != skType: GlobalError(n.info, errTypeExpected) if result.typ.kind != tyGenericParam: # XXX get rid of this hack! |