summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ast.nim2
-rw-r--r--compiler/vm.nim8
-rw-r--r--compiler/vmdef.nim1
-rw-r--r--compiler/vmgen.nim1
4 files changed, 11 insertions, 1 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim
index 3a4158204..a0a5d204a 100644
--- a/compiler/ast.nim
+++ b/compiler/ast.nim
@@ -602,7 +602,7 @@ type
     mNSetFloatVal, mNSetSymbol, mNSetIdent, mNSetType, mNSetStrVal, mNLineInfo,
     mNNewNimNode, mNCopyNimNode, mNCopyNimTree, mStrToIdent, mIdentToStr,
     mNBindSym, mLocals, mNCallSite,
-    mEqIdent, mEqNimrodNode, mSameNodeType,
+    mEqIdent, mEqNimrodNode, mSameNodeType, mGetImpl,
     mNHint, mNWarning, mNError,
     mInstantiationInfo, mGetTypeInfo, mNGenSym
 
diff --git a/compiler/vm.nim b/compiler/vm.nim
index b15c55565..b7b09f4a3 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -781,6 +781,14 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
         regs[ra].node.add(copyTree(regs[rb].regToNode))
       else:
         stackTrace(c, tos, pc, errNilAccess)
+    of opcGetImpl:
+      decodeB(rkNode)
+      let a = regs[rb].node
+      if a.kind == nkSym:
+        regs[ra].node = if a.sym.ast.isNil: newNode(nkNilLit)
+                        else: copyTree(a.sym.ast)
+      else:
+        stackTrace(c, tos, pc, errFieldXNotFound, "symbol")
     of opcEcho:
       let rb = instr.regB
       if rb == 1:
diff --git a/compiler/vmdef.nim b/compiler/vmdef.nim
index 6900b17c2..337e4ec8f 100644
--- a/compiler/vmdef.nim
+++ b/compiler/vmdef.nim
@@ -102,6 +102,7 @@ type
     opcEqIdent,
     opcStrToIdent,
     opcIdentToStr,
+    opcGetImpl,
 
     opcEcho,
     opcIndCall, # dest = call regStart, n; where regStart = fn, arg1, ...
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim
index 919c38e08..237a44e18 100644
--- a/compiler/vmgen.nim
+++ b/compiler/vmgen.nim
@@ -948,6 +948,7 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest; m: TMagic) =
   of mSlurp: genUnaryABC(c, n, dest, opcSlurp)
   of mStaticExec: genBinaryABCD(c, n, dest, opcGorge)
   of mNLen: genUnaryABI(c, n, dest, opcLenSeq)
+  of mGetImpl: genUnaryABC(c, n, dest, opcGetImpl)
   of mNChild: genBinaryABC(c, n, dest, opcNChild)
   of mNSetChild, mNDel:
     unused(n, dest)