bugfix #100 again
This commit is contained in:
parent
a79acb58fc
commit
1af0601011
7 changed files with 12 additions and 14 deletions
|
|
@ -139,9 +139,9 @@ proc getStorageLoc(n: PNode): TStorageLoc =
|
||||||
case n.kind
|
case n.kind
|
||||||
of nkSym:
|
of nkSym:
|
||||||
case n.sym.kind
|
case n.sym.kind
|
||||||
of skParam, skForVar, skTemp:
|
of skParam, skTemp:
|
||||||
result = OnStack
|
result = OnStack
|
||||||
of skVar, skResult, skLet:
|
of skVar, skForVar, skResult, skLet:
|
||||||
if sfGlobal in n.sym.flags: result = OnHeap
|
if sfGlobal in n.sym.flags: result = OnHeap
|
||||||
else: result = OnStack
|
else: result = OnStack
|
||||||
of skConst:
|
of skConst:
|
||||||
|
|
@ -1652,7 +1652,7 @@ proc expr(p: BProc, e: PNode, d: var TLoc) =
|
||||||
genComplexConst(p, sym, d)
|
genComplexConst(p, sym, d)
|
||||||
of skEnumField:
|
of skEnumField:
|
||||||
putIntoDest(p, d, e.typ, toRope(sym.position))
|
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 sfGlobal in sym.flags: genVarPrototype(p.module, sym)
|
||||||
if sym.loc.r == nil or sym.loc.t == nil:
|
if sym.loc.r == nil or sym.loc.t == nil:
|
||||||
InternalError(e.info, "expr: var not init " & sym.name.s)
|
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)
|
putLocIntoDest(p, d, sym.loc)
|
||||||
else:
|
else:
|
||||||
putLocIntoDest(p, d, sym.loc)
|
putLocIntoDest(p, d, sym.loc)
|
||||||
of skForVar, skTemp:
|
of skTemp:
|
||||||
if sym.loc.r == nil or sym.loc.t == nil:
|
if sym.loc.r == nil or sym.loc.t == nil:
|
||||||
InternalError(e.info, "expr: temp not init " & sym.name.s)
|
InternalError(e.info, "expr: temp not init " & sym.name.s)
|
||||||
putLocIntoDest(p, d, sym.loc)
|
putLocIntoDest(p, d, sym.loc)
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ proc genVarTuple(p: BProc, n: PNode) =
|
||||||
for i in countup(0, L-3):
|
for i in countup(0, L-3):
|
||||||
var v = n.sons[i].sym
|
var v = n.sons[i].sym
|
||||||
if sfCompileTime in v.flags: continue
|
if sfCompileTime in v.flags: continue
|
||||||
if sfGlobal in v.flags and v.kind != skForVar:
|
if sfGlobal in v.flags:
|
||||||
assignGlobalVar(p, v)
|
assignGlobalVar(p, v)
|
||||||
genObjectInit(p, cpsInit, v.typ, v.loc, true)
|
genObjectInit(p, cpsInit, v.typ, v.loc, true)
|
||||||
else:
|
else:
|
||||||
|
|
@ -49,7 +49,7 @@ proc genSingleVar(p: BProc, a: PNode) =
|
||||||
var v = a.sons[0].sym
|
var v = a.sons[0].sym
|
||||||
if sfCompileTime in v.flags: return
|
if sfCompileTime in v.flags: return
|
||||||
var immediateAsgn = a.sons[2].kind != nkEmpty
|
var immediateAsgn = a.sons[2].kind != nkEmpty
|
||||||
if sfGlobal in v.flags and v.kind != skForVar:
|
if sfGlobal in v.flags:
|
||||||
assignGlobalVar(p, v)
|
assignGlobalVar(p, v)
|
||||||
genObjectInit(p, cpsInit, v.typ, v.loc, true)
|
genObjectInit(p, cpsInit, v.typ, v.loc, true)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,10 @@ proc mangleName(s: PSym): PRope =
|
||||||
case s.kind
|
case s.kind
|
||||||
of skProc, skMethod, skConverter, skConst:
|
of skProc, skMethod, skConverter, skConst:
|
||||||
result = toRope("@")
|
result = toRope("@")
|
||||||
of skVar, skResult, skLet:
|
of skVar, skForVar, skResult, skLet:
|
||||||
if sfGlobal in s.flags: result = toRope("@")
|
if sfGlobal in s.flags: result = toRope("@")
|
||||||
else: result = toRope("%")
|
else: result = toRope("%")
|
||||||
of skForVar, skTemp, skParam, skType, skEnumField, skModule:
|
of skTemp, skParam, skType, skEnumField, skModule:
|
||||||
result = toRope("%")
|
result = toRope("%")
|
||||||
else: InternalError(s.info, "mangleName")
|
else: InternalError(s.info, "mangleName")
|
||||||
app(result, toRope(mangle(s.name.s)))
|
app(result, toRope(mangle(s.name.s)))
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,7 @@
|
||||||
# included from transf.nim
|
# included from transf.nim
|
||||||
|
|
||||||
const
|
const
|
||||||
declarativeDefs = {nkProcDef, nkMethodDef, nkIteratorDef,
|
declarativeDefs = {nkProcDef, nkMethodDef, nkIteratorDef, nkConverterDef}
|
||||||
nkConverterDef}
|
|
||||||
procDefs = nkLambdaKinds + declarativeDefs
|
procDefs = nkLambdaKinds + declarativeDefs
|
||||||
|
|
||||||
proc indirectAccess(a, b: PSym, info: TLineInfo): PNode =
|
proc indirectAccess(a, b: PSym, info: TLineInfo): PNode =
|
||||||
|
|
|
||||||
|
|
@ -107,14 +107,14 @@ proc analyseSym(c: PProcCtx, n: PNode): TThreadOwner =
|
||||||
result = c.mapping[v.id]
|
result = c.mapping[v.id]
|
||||||
if result != toUndefined: return
|
if result != toUndefined: return
|
||||||
case v.kind
|
case v.kind
|
||||||
of skVar, skLet, skResult:
|
of skVar, skForVar, skLet, skResult:
|
||||||
result = toNil
|
result = toNil
|
||||||
if sfGlobal in v.flags:
|
if sfGlobal in v.flags:
|
||||||
if sfThread in v.flags:
|
if sfThread in v.flags:
|
||||||
result = toMine
|
result = toMine
|
||||||
elif containsGarbageCollectedRef(v.typ):
|
elif containsGarbageCollectedRef(v.typ):
|
||||||
result = toTheirs
|
result = toTheirs
|
||||||
of skTemp, skForVar: result = toNil
|
of skTemp: result = toNil
|
||||||
of skConst: result = toMine
|
of skConst: result = toMine
|
||||||
of skParam:
|
of skParam:
|
||||||
result = c.mapping[v.id]
|
result = c.mapping[v.id]
|
||||||
|
|
|
||||||
|
|
@ -103,4 +103,3 @@ proc c_getenv(env: CString): CString {.importc: "getenv", noDecl.}
|
||||||
proc c_putenv(env: CString): cint {.importc: "putenv", noDecl.}
|
proc c_putenv(env: CString): cint {.importc: "putenv", noDecl.}
|
||||||
|
|
||||||
{.pop}
|
{.pop}
|
||||||
|
|
||||||
|
|
|
||||||
2
todo.txt
2
todo.txt
|
|
@ -1,7 +1,7 @@
|
||||||
version 0.9.0
|
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 ``=``
|
- ``=`` should be overloadable; requires specialization for ``=``
|
||||||
- fix remaining generics bugs
|
- fix remaining generics bugs
|
||||||
- fix remaining closure bugs:
|
- fix remaining closure bugs:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue