diff options
author | LemonBoy <thatlemon@gmail.com> | 2018-09-17 18:52:40 +0200 |
---|---|---|
committer | LemonBoy <thatlemon@gmail.com> | 2018-09-17 18:52:40 +0200 |
commit | 027cc5013eedce70d5f925e18037e9d1786ebd15 (patch) | |
tree | a86ceaa4944becf2e194eaf26a3266d13226c727 /compiler/vm.nim | |
parent | 6dc6ea41468dc99c8826b03b512af8f9a46e660d (diff) | |
download | Nim-027cc5013eedce70d5f925e18037e9d1786ebd15.tar.gz |
Fix error during field access in VM
Tuple constructors can't have nkExprColonExpr but may contain NimNodes of that kind. Fixes #4952
Diffstat (limited to 'compiler/vm.nim')
-rw-r--r-- | compiler/vm.nim | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim index e38642de8..faff81697 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -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) |