diff --git a/compiler/evalffi.nim b/compiler/evalffi.nim index 54be0ccb2..db78da714 100644 --- a/compiler/evalffi.nim +++ b/compiler/evalffi.nim @@ -151,7 +151,7 @@ proc getField(n: PNode; position: int): PSym = else: discard proc packObject(x: PNode, typ: PType, res: pointer) = - InternalAssert x.kind in {nkObjConstr, nkPar} + internalAssert x.kind in {nkObjConstr, nkPar} # compute the field's offsets: discard typ.getSize for i in countup(ord(x.kind == nkObjConstr), sonsLen(x) - 1): diff --git a/compiler/vm.nim b/compiler/vm.nim index 2a80106a5..5c8e533f1 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -426,8 +426,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg = let src = regs[rb].node if src.kind notin {nkEmpty..nkNilLit}: let n = src.sons[rc] - regs[ra].node = if n.kind == nkExprColonExpr: n[1] - else: n + regs[ra].node = n else: stackTrace(c, tos, pc, errIndexOutOfBounds) of opcWrObj: diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index b1a751723..0fc71189d 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -308,12 +308,20 @@ proc genAndOr(c: PCtx; n: PNode; opc: TOpcode; dest: var TDest) = c.gen(n.sons[2], dest) c.patch(L1) -proc nilLiteral(n: PNode): PNode = - result = n +proc canonConst(n: PNode): PNode = + if n.kind == nkExprColonExpr: + result = n.sons[1] + elif n.hasSubnodeWith(nkExprColonExpr): + result = n.copyNode + newSeq(result.sons, n.len) + for i in 0..