parent
6e74fecb42
commit
0be17f5d9c
1 changed files with 12 additions and 2 deletions
|
|
@ -29,7 +29,7 @@ implements the required case distinction.
|
||||||
|
|
||||||
|
|
||||||
import
|
import
|
||||||
ast, trees, magicsys, options,
|
ast, astalgo, trees, magicsys, options,
|
||||||
nversion, msgs, idents, types,
|
nversion, msgs, idents, types,
|
||||||
ropes, passes, ccgutils, wordrecg, renderer,
|
ropes, passes, ccgutils, wordrecg, renderer,
|
||||||
cgmeth, lowerings, sighashes, modulegraphs, lineinfos, rodutils,
|
cgmeth, lowerings, sighashes, modulegraphs, lineinfos, rodutils,
|
||||||
|
|
@ -2234,6 +2234,16 @@ proc genTupleConstr(p: PProc, n: PNode, r: var TCompRes) =
|
||||||
r.res.addf("Field$#: $#", [i.rope, a.res])
|
r.res.addf("Field$#: $#", [i.rope, a.res])
|
||||||
r.res.add("}")
|
r.res.add("}")
|
||||||
|
|
||||||
|
proc lookupFieldAgain(ty: PType; field: PSym): PSym =
|
||||||
|
var ty = ty
|
||||||
|
while ty != nil:
|
||||||
|
ty = ty.skipTypes(skipPtrs)
|
||||||
|
assert(ty.kind in {tyTuple, tyObject})
|
||||||
|
result = lookupInRecord(ty.n, field.name)
|
||||||
|
if result != nil: break
|
||||||
|
ty = ty[0]
|
||||||
|
if result == nil: result = field
|
||||||
|
|
||||||
proc genObjConstr(p: PProc, n: PNode, r: var TCompRes) =
|
proc genObjConstr(p: PProc, n: PNode, r: var TCompRes) =
|
||||||
var a: TCompRes
|
var a: TCompRes
|
||||||
r.kind = resExpr
|
r.kind = resExpr
|
||||||
|
|
@ -2247,7 +2257,7 @@ proc genObjConstr(p: PProc, n: PNode, r: var TCompRes) =
|
||||||
gen(p, val, a)
|
gen(p, val, a)
|
||||||
var f = it[0].sym
|
var f = it[0].sym
|
||||||
if f.loc.r == nil: f.loc.r = mangleName(p.module, f)
|
if f.loc.r == nil: f.loc.r = mangleName(p.module, f)
|
||||||
fieldIDs.incl(f.id)
|
fieldIDs.incl(lookupFieldAgain(n.typ, f).id)
|
||||||
|
|
||||||
let typ = val.typ.skipTypes(abstractInst)
|
let typ = val.typ.skipTypes(abstractInst)
|
||||||
if a.typ == etyBaseIndex:
|
if a.typ == etyBaseIndex:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue