This commit is contained in:
Araq
2014-07-01 23:41:25 +02:00
parent b119dc2f3b
commit d02cc41596
2 changed files with 16 additions and 3 deletions

View File

@@ -714,11 +714,12 @@ proc genFieldCheck(p: BProc, e: PNode, obj: PRope, field: PSym) =
assert(it.sons[0].kind == nkSym)
let op = it.sons[0].sym
if op.magic == mNot: it = it.sons[1]
assert(it.sons[2].kind == nkSym)
let disc = it.sons[2].skipConv
assert(disc.kind == nkSym)
initLoc(test, locNone, it.typ, OnStack)
initLocExpr(p, it.sons[1], u)
initLoc(v, locExpr, it.sons[2].typ, OnUnknown)
v.r = ropef("$1.$2", [obj, it.sons[2].sym.loc.r])
initLoc(v, locExpr, disc.typ, OnUnknown)
v.r = ropef("$1.$2", [obj, disc.sym.loc.r])
genInExprAux(p, it, u, v, test)
let id = nodeTableTestOrSet(p.module.dataCache,
newStrNode(nkStrLit, field.name.s), gBackendId)

View File

@@ -20,3 +20,15 @@ type
var a = Bar(y: 100, x: 200) # works
var b = Bar(x: 100, y: 200) # used to fail
# bug 1275
type
Graphic = object of TObject
case kind: range[0..1]
of 0:
radius: float
of 1:
size: tuple[w, h: float]
var d = Graphic(kind: 1, size: (12.9, 6.9))