bugfix #100 again

This commit is contained in:
Araq
2012-03-28 16:43:05 +02:00
parent a79acb58fc
commit 1af0601011
7 changed files with 12 additions and 14 deletions

View File

@@ -139,9 +139,9 @@ proc getStorageLoc(n: PNode): TStorageLoc =
case n.kind
of nkSym:
case n.sym.kind
of skParam, skForVar, skTemp:
of skParam, skTemp:
result = OnStack
of skVar, skResult, skLet:
of skVar, skForVar, skResult, skLet:
if sfGlobal in n.sym.flags: result = OnHeap
else: result = OnStack
of skConst:
@@ -1652,7 +1652,7 @@ proc expr(p: BProc, e: PNode, d: var TLoc) =
genComplexConst(p, sym, d)
of skEnumField:
putIntoDest(p, d, e.typ, toRope(sym.position))
of skVar, skResult, skLet:
of skVar, skForVar, skResult, skLet:
if sfGlobal in sym.flags: genVarPrototype(p.module, sym)
if sym.loc.r == nil or sym.loc.t == nil:
InternalError(e.info, "expr: var not init " & sym.name.s)
@@ -1664,7 +1664,7 @@ proc expr(p: BProc, e: PNode, d: var TLoc) =
putLocIntoDest(p, d, sym.loc)
else:
putLocIntoDest(p, d, sym.loc)
of skForVar, skTemp:
of skTemp:
if sym.loc.r == nil or sym.loc.t == nil:
InternalError(e.info, "expr: temp not init " & sym.name.s)
putLocIntoDest(p, d, sym.loc)

View File

@@ -23,7 +23,7 @@ proc genVarTuple(p: BProc, n: PNode) =
for i in countup(0, L-3):
var v = n.sons[i].sym
if sfCompileTime in v.flags: continue
if sfGlobal in v.flags and v.kind != skForVar:
if sfGlobal in v.flags:
assignGlobalVar(p, v)
genObjectInit(p, cpsInit, v.typ, v.loc, true)
else:
@@ -49,7 +49,7 @@ proc genSingleVar(p: BProc, a: PNode) =
var v = a.sons[0].sym
if sfCompileTime in v.flags: return
var immediateAsgn = a.sons[2].kind != nkEmpty
if sfGlobal in v.flags and v.kind != skForVar:
if sfGlobal in v.flags:
assignGlobalVar(p, v)
genObjectInit(p, cpsInit, v.typ, v.loc, true)
else:

View File

@@ -37,10 +37,10 @@ proc mangleName(s: PSym): PRope =
case s.kind
of skProc, skMethod, skConverter, skConst:
result = toRope("@")
of skVar, skResult, skLet:
of skVar, skForVar, skResult, skLet:
if sfGlobal in s.flags: result = toRope("@")
else: result = toRope("%")
of skForVar, skTemp, skParam, skType, skEnumField, skModule:
of skTemp, skParam, skType, skEnumField, skModule:
result = toRope("%")
else: InternalError(s.info, "mangleName")
app(result, toRope(mangle(s.name.s)))

View File

@@ -11,8 +11,7 @@
# included from transf.nim
const
declarativeDefs = {nkProcDef, nkMethodDef, nkIteratorDef,
nkConverterDef}
declarativeDefs = {nkProcDef, nkMethodDef, nkIteratorDef, nkConverterDef}
procDefs = nkLambdaKinds + declarativeDefs
proc indirectAccess(a, b: PSym, info: TLineInfo): PNode =

View File

@@ -107,14 +107,14 @@ proc analyseSym(c: PProcCtx, n: PNode): TThreadOwner =
result = c.mapping[v.id]
if result != toUndefined: return
case v.kind
of skVar, skLet, skResult:
of skVar, skForVar, skLet, skResult:
result = toNil
if sfGlobal in v.flags:
if sfThread in v.flags:
result = toMine
elif containsGarbageCollectedRef(v.typ):
result = toTheirs
of skTemp, skForVar: result = toNil
of skTemp: result = toNil
of skConst: result = toMine
of skParam:
result = c.mapping[v.id]

View File

@@ -103,4 +103,3 @@ proc c_getenv(env: CString): CString {.importc: "getenv", noDecl.}
proc c_putenv(env: CString): cint {.importc: "putenv", noDecl.}
{.pop}

View File

@@ -1,7 +1,7 @@
version 0.9.0
=============
- fix bug #100 so that unittests work again
- make GC realtime capable: GC_step(ms: int)
- ``=`` should be overloadable; requires specialization for ``=``
- fix remaining generics bugs
- fix remaining closure bugs: