summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorhlaaftana <10591326+hlaaftana@users.noreply.github.com>2021-11-24 14:22:40 +0300
committerGitHub <noreply@github.com>2021-11-24 12:22:40 +0100
commitc7c6b13a325958c6b55cbec2eb812eb06074101b (patch)
treee90d098448eb1614e1e5d20c3ea32111d83c52b4 /compiler
parentff39f6e26062651a56d6ac4c24fe5a799c177c50 (diff)
downloadNim-c7c6b13a325958c6b55cbec2eb812eb06074101b.tar.gz
parseExpr/parseStmt accept filename, fixes #13540 (#19182)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/vm.nim9
-rw-r--r--compiler/vmgen.nim4
2 files changed, 6 insertions, 7 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim
index b64545081..d58a49f9e 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -1748,11 +1748,10 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
       elif instr.opcode == opcNHint:
         message(c.config, info, hintUser, a.strVal)
     of opcParseExprToAst:
-      decodeB(rkNode)
-      # c.debug[pc].line.int - countLines(regs[rb].strVal) ?
+      decodeBC(rkNode)
       var error: string
       let ast = parseString(regs[rb].node.strVal, c.cache, c.config,
-                            toFullPath(c.config, c.debug[pc]), c.debug[pc].line.int,
+                            regs[rc].node.strVal, 0,
                             proc (conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg: string) {.nosinks.} =
                               if error.len == 0 and msg <= errMax:
                                 error = formatMsg(conf, info, msg, arg))
@@ -1764,10 +1763,10 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
       else:
         regs[ra].node = ast[0]
     of opcParseStmtToAst:
-      decodeB(rkNode)
+      decodeBC(rkNode)
       var error: string
       let ast = parseString(regs[rb].node.strVal, c.cache, c.config,
-                            toFullPath(c.config, c.debug[pc]), c.debug[pc].line.int,
+                            regs[rc].node.strVal, 0,
                             proc (conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg: string) {.nosinks.} =
                               if error.len == 0 and msg <= errMax:
                                 error = formatMsg(conf, info, msg, arg))
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim
index bb095d3ee..9a823dff4 100644
--- a/compiler/vmgen.nim
+++ b/compiler/vmgen.nim
@@ -1225,9 +1225,9 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest; m: TMagic) =
     unused(c, n, dest)
     genBinaryStmtVar(c, n, opcAddSeqElem)
   of mParseExprToAst:
-    genUnaryABC(c, n, dest, opcParseExprToAst)
+    genBinaryABC(c, n, dest, opcParseExprToAst)
   of mParseStmtToAst:
-    genUnaryABC(c, n, dest, opcParseStmtToAst)
+    genBinaryABC(c, n, dest, opcParseStmtToAst)
   of mTypeTrait:
     let tmp = c.genx(n[1])
     if dest < 0: dest = c.getTemp(n.typ)