Fix error during field access in VM
Tuple constructors can't have nkExprColonExpr but may contain NimNodes of that kind. Fixes #4952
This commit is contained in:
parent
6dc6ea4146
commit
027cc5013e
2 changed files with 24 additions and 3 deletions
|
|
@ -557,11 +557,15 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
|||
# a = b.c
|
||||
decodeBC(rkNode)
|
||||
let src = regs[rb].node
|
||||
if src.kind notin {nkEmpty..nkNilLit}:
|
||||
let n = src.sons[rc + ord(src.kind == nkObjConstr)].skipColon
|
||||
case src.kind
|
||||
of nkEmpty..nkNilLit:
|
||||
stackTrace(c, tos, pc, errNilAccess)
|
||||
of nkObjConstr:
|
||||
let n = src.sons[rc + 1].skipColon
|
||||
regs[ra].node = n
|
||||
else:
|
||||
stackTrace(c, tos, pc, errNilAccess)
|
||||
let n = src.sons[rc]
|
||||
regs[ra].node = n
|
||||
of opcWrObj:
|
||||
# a.b = c
|
||||
decodeBC(rkNode)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue