From ab322ff2b477460e6b4cac2c47037ecbc013cac8 Mon Sep 17 00:00:00 2001 From: zerbina <100542850+zerbina@users.noreply.github.com> Date: Fri, 8 Apr 2022 19:43:46 +0100 Subject: [PATCH] Remove `mNSetType` magic and associated VM opcode They're dead code, originally used for implementing `macros.typ=`, which was removed in commit #9465b5db443b98d7ac2c1683e986716fb9a9290f --- compiler/ast/ast_types.nim | 2 +- compiler/vm/vm.nim | 12 ------------ compiler/vm/vm_enums.nim | 2 +- compiler/vm/vmgen.nim | 3 --- 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/compiler/ast/ast_types.nim b/compiler/ast/ast_types.nim index 451f886b21f..ba7dd0ffcec 100644 --- a/compiler/ast/ast_types.nim +++ b/compiler/ast/ast_types.nim @@ -720,7 +720,7 @@ type mNctPut, mNctLen, mNctGet, mNctHasNext, mNctNext, mNIntVal, mNFloatVal, mNSymbol, mNIdent, mNGetType, mNStrVal, mNSetIntVal, - mNSetFloatVal, mNSetSymbol, mNSetIdent, mNSetType, mNSetStrVal, mNLineInfo, + mNSetFloatVal, mNSetSymbol, mNSetIdent, mNSetStrVal, mNLineInfo, mNNewNimNode, mNCopyNimNode, mNCopyNimTree, mStrToIdent, mNSigHash, mNSizeOf, mNBindSym, mNCallSite, mEqIdent, mEqNimrodNode, mSameNodeType, mGetImpl, mNGenSym, diff --git a/compiler/vm/vm.nim b/compiler/vm/vm.nim index 290e34fc004..de1aa590916 100644 --- a/compiler/vm/vm.nim +++ b/compiler/vm/vm.nim @@ -2168,18 +2168,6 @@ proc rawExecute(c: var TCtx, pc: var int, tos: var StackFrameIndex): TFullReg = dest.ident = regs[rb].node.ident else: raiseVmError(reportStr(rsemVmFieldNotFound, "ident")) - of opcNSetType: - decodeB(rkNode) - let b = regs[rb].node - internalAssert( - c.config, - b.kind == nkSym and b.sym.kind == skType, - "Canot set type to a non-skType symbol") - - internalAssert( - c.config, regs[ra].node != nil, "Target node must not be nil") - - regs[ra].node.typ = b.sym.typ of opcNSetStrVal: decodeB(rkNode) var dest = regs[ra].node diff --git a/compiler/vm/vm_enums.nim b/compiler/vm/vm_enums.nim index a2e0dd92d1d..7d96aa09309 100644 --- a/compiler/vm/vm_enums.nim +++ b/compiler/vm/vm_enums.nim @@ -84,7 +84,7 @@ type opcNGetSize, opcNSetIntVal, - opcNSetFloatVal, opcNSetSymbol, opcNSetIdent, opcNSetType, opcNSetStrVal, + opcNSetFloatVal, opcNSetSymbol, opcNSetIdent, opcNSetStrVal, opcNNewNimNode, opcNCopyNimNode, opcNCopyNimTree, opcNDel, opcGenSym, opcNccValue, opcNccInc, opcNcsAdd, opcNcsIncl, opcNcsLen, opcNcsAt, diff --git a/compiler/vm/vmgen.nim b/compiler/vm/vmgen.nim index 57ae99dcebf..3bad60467d5 100644 --- a/compiler/vm/vmgen.nim +++ b/compiler/vm/vmgen.nim @@ -1359,9 +1359,6 @@ proc genMagic(c: var TCtx; n: PNode; dest: var TDest; m: TMagic) = of mNSetIdent: unused(c, n, dest) genBinaryStmt(c, n, opcNSetIdent) - of mNSetType: - unused(c, n, dest) - genBinaryStmt(c, n, opcNSetType) of mNSetStrVal: unused(c, n, dest) genBinaryStmt(c, n, opcNSetStrVal)