From 23fc93fc2d0e409fba92ddbb02772d4ba5bb9c0f Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Fri, 6 Dec 2019 15:38:53 -0600 Subject: [PATCH] VM: allow ptr setting ptr fields (#12825) --- compiler/vm.nim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/vm.nim b/compiler/vm.nim index e163243554..4403a385d7 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -231,7 +231,11 @@ proc fastAsgnComplex(x: var TFullReg, y: TFullReg) = proc writeField(n: var PNode, x: TFullReg) = case x.kind of rkNone: discard - of rkInt: n.intVal = x.intVal + of rkInt: + if n.kind == nkNilLit: + n[].reset + n.kind = nkIntLit # ideally, `nkPtrLit` + n.intVal = x.intVal of rkFloat: n.floatVal = x.floatVal of rkNode: n = copyValue(x.node) of rkRegisterAddr: writeField(n, x.regAddr[])