From 6d2706959054e778aaaf634b70a531d0fb9395f6 Mon Sep 17 00:00:00 2001 From: belliash Date: Mon, 27 Aug 2018 18:04:45 +0200 Subject: [PATCH] Add new file for every chunk. Every chunk should has its own file associated, even if it is [MEMORY]. Otherwise, some false information can be provided by interpreter to developer. --- engine/api.c | 2 ++ engine/vm.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/engine/api.c b/engine/api.c index d8015ab..9c1db66 100644 --- a/engine/api.c +++ b/engine/api.c @@ -696,6 +696,8 @@ static sxi32 ProcessSourceFile( ph7_vm_config(pVm, PH7_VM_CONFIG_IMPORT_PATH, pFileDir); /* Push processed file path */ PH7_VmPushFilePath(pVm, pFilePath, -1, TRUE, 0); + } else { + PH7_VmPushFilePath(pVm, "[MEMORY]", -1, TRUE, 0); } /* Compile the script */ PH7_CompileAerScript(pVm, &(*pScript), PH7_AERSCRIPT_CODE); diff --git a/engine/vm.c b/engine/vm.c index 999dffb..9dae7b6 100644 --- a/engine/vm.c +++ b/engine/vm.c @@ -10226,6 +10226,10 @@ static sxi32 VmEvalChunk( /* Swap bytecode container */ pByteCode = pVm->pByteContainer; pVm->pByteContainer = &aByteCode; + /* Push memory as a processed file path */ + if((iFlags & PH7_AERSCRIPT_CODE) == 0) { + PH7_VmPushFilePath(pVm, "[MEMORY]", -1, TRUE, 0); + } /* Compile the chunk */ PH7_CompileAerScript(pVm, pChunk, iFlags); if(pVm->sCodeGen.nErr > 0) {