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.nim7
2 files changed, 6 insertions, 3 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim
index 02f5ae67e..8286e3bb7 100644
--- a/compiler/ast.nim
+++ b/compiler/ast.nim
@@ -1661,7 +1661,7 @@ proc isException*(t: PType): bool =
   # check if `y` is object type and it inherits from Exception
   assert(t != nil)
 
-  if t.kind != tyObject: 
+  if t.kind != tyObject:
     return false
 
   var base = t
diff --git a/compiler/vm.nim b/compiler/vm.nim
index 5c9a982ab..0a706b0fc 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -1467,7 +1467,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
           "request to create a NimNode of invalid kind")
       let cc = regs[rc].node
 
-      regs[ra].node = newNodeI(TNodeKind(int(k)),
+      let x = newNodeI(TNodeKind(int(k)),
         if cc.kind != nkNilLit:
           cc.info
         elif c.comesFromHeuristic.line > -1:
@@ -1476,7 +1476,10 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
           c.callsite[1].info
         else:
           c.debug[pc])
-      regs[ra].node.flags.incl nfIsRef
+      x.flags.incl nfIsRef
+      # prevent crashes in the compiler resulting from wrong macros:
+      if x.kind == nkIdent: x.ident = getIdent""
+      regs[ra].node = x
     of opcNCopyNimNode:
       decodeB(rkNode)
       regs[ra].node = copyNode(regs[rb].node)