Do not count compilation errors.
The build was successful.
Details
The build was successful.
Details
Interpreter will abort script execution on first error found.
This commit is contained in:
parent
48a38dc1af
commit
c443a38fec
|
@ -695,15 +695,14 @@ static sxi32 ProcessSourceFile(
|
|||
}
|
||||
/* Compile the script */
|
||||
PH7_CompileAerScript(pVm, &(*pScript), PH7_AERSCRIPT_CODE);
|
||||
if(pVm->sCodeGen.nErr > 0 || pVm == 0) {
|
||||
sxu32 nErr = pVm->sCodeGen.nErr;
|
||||
/* Compilation error or null ppVm pointer,release this VM */
|
||||
if(pVm == 0) {
|
||||
/* Null ppVm pointer,release this VM */
|
||||
SyMemBackendRelease(&pVm->sAllocator);
|
||||
SyMemBackendPoolFree(&pEngine->sAllocator, pVm);
|
||||
if(ppVm) {
|
||||
*ppVm = 0;
|
||||
}
|
||||
return nErr > 0 ? PH7_COMPILE_ERR : PH7_OK;
|
||||
return PH7_OK;
|
||||
}
|
||||
/* Prepare the virtual machine for bytecode execution */
|
||||
rc = PH7_VmMakeReady(pVm);
|
||||
|
|
|
@ -4953,7 +4953,6 @@ PH7_PRIVATE sxi32 PH7_ResetCodeGenerator(
|
|||
pGen->pCurrent = &pGen->sGlobal;
|
||||
pGen->pRawIn = pGen->pRawEnd = 0;
|
||||
pGen->pIn = pGen->pEnd = 0;
|
||||
pGen->nErr = 0;
|
||||
return SXRET_OK;
|
||||
}
|
||||
/*
|
||||
|
@ -4972,22 +4971,6 @@ PH7_PRIVATE sxi32 PH7_GenCompileError(ph7_gen_state *pGen, sxi32 nErrType, sxu32
|
|||
SyBlobReset(pWorker);
|
||||
/* Peek the processed file path if available */
|
||||
pFile = (SyString *)SySetPeek(&pGen->pVm->aFiles);
|
||||
if(nErrType == E_ERROR) {
|
||||
/* Increment the error counter */
|
||||
pGen->nErr++;
|
||||
if(pGen->nErr > 15) {
|
||||
/* Error count limit reached */
|
||||
if(pGen->xErr) {
|
||||
SyBlobFormat(pWorker, "%u Error count limit reached,PH7 is aborting compilation\n", nLine);
|
||||
if(SyBlobLength(pWorker) > 0) {
|
||||
/* Consume the generated error message */
|
||||
pGen->xErr(SyBlobData(pWorker), SyBlobLength(pWorker), pGen->pErrData);
|
||||
}
|
||||
}
|
||||
/* Abort immediately */
|
||||
return SXERR_ABORT;
|
||||
}
|
||||
}
|
||||
if(pGen->xErr == 0) {
|
||||
/* No available error consumer,return immediately */
|
||||
return SXRET_OK;
|
||||
|
|
51
engine/vm.c
51
engine/vm.c
|
@ -9479,41 +9479,34 @@ static sxi32 VmEvalChunk(
|
|||
}
|
||||
/* Compile the chunk */
|
||||
PH7_CompileAerScript(pVm, pChunk, iFlags);
|
||||
if(pVm->sCodeGen.nErr > 0) {
|
||||
/* Compilation error,return false */
|
||||
if(pCtx) {
|
||||
ph7_result_bool(pCtx, 0);
|
||||
}
|
||||
} else {
|
||||
ph7_value sResult; /* Return value */
|
||||
SyHashEntry *pEntry;
|
||||
/* Initialize and install static and constants class attributes */
|
||||
SyHashResetLoopCursor(&pVm->hClass);
|
||||
while((pEntry = SyHashGetNextEntry(&pVm->hClass)) != 0) {
|
||||
if(VmMountUserClass(&(*pVm), (ph7_class *)pEntry->pUserData) != SXRET_OK) {
|
||||
if(pCtx) {
|
||||
ph7_result_bool(pCtx, 0);
|
||||
}
|
||||
goto Cleanup;
|
||||
}
|
||||
}
|
||||
if(SXRET_OK != PH7_VmEmitInstr(pVm, 0, PH7_OP_DONE, 0, 0, 0, 0)) {
|
||||
/* Out of memory */
|
||||
ph7_value sResult; /* Return value */
|
||||
SyHashEntry *pEntry;
|
||||
/* Initialize and install static and constants class attributes */
|
||||
SyHashResetLoopCursor(&pVm->hClass);
|
||||
while((pEntry = SyHashGetNextEntry(&pVm->hClass)) != 0) {
|
||||
if(VmMountUserClass(&(*pVm), (ph7_class *)pEntry->pUserData) != SXRET_OK) {
|
||||
if(pCtx) {
|
||||
ph7_result_bool(pCtx, 0);
|
||||
}
|
||||
goto Cleanup;
|
||||
}
|
||||
/* Assume a boolean true return value */
|
||||
PH7_MemObjInitFromBool(pVm, &sResult, 1);
|
||||
/* Execute the compiled chunk */
|
||||
VmLocalExec(pVm, &aByteCode, &sResult);
|
||||
if(pCtx) {
|
||||
/* Set the execution result */
|
||||
ph7_result_value(pCtx, &sResult);
|
||||
}
|
||||
PH7_MemObjRelease(&sResult);
|
||||
}
|
||||
if(SXRET_OK != PH7_VmEmitInstr(pVm, 0, PH7_OP_DONE, 0, 0, 0, 0)) {
|
||||
/* Out of memory */
|
||||
if(pCtx) {
|
||||
ph7_result_bool(pCtx, 0);
|
||||
}
|
||||
goto Cleanup;
|
||||
}
|
||||
/* Assume a boolean true return value */
|
||||
PH7_MemObjInitFromBool(pVm, &sResult, 1);
|
||||
/* Execute the compiled chunk */
|
||||
VmLocalExec(pVm, &aByteCode, &sResult);
|
||||
if(pCtx) {
|
||||
/* Set the execution result */
|
||||
ph7_result_value(pCtx, &sResult);
|
||||
}
|
||||
PH7_MemObjRelease(&sResult);
|
||||
Cleanup:
|
||||
/* Cleanup the mess left behind */
|
||||
pVm->pByteContainer = pByteCode;
|
||||
|
|
|
@ -904,7 +904,6 @@ struct ph7_gen_state {
|
|||
SyBlob sErrBuf; /* Error buffer */
|
||||
SyToken *pIn; /* Current processed token */
|
||||
SyToken *pEnd; /* Last token in the stream */
|
||||
sxu32 nErr; /* Total number of compilation error */
|
||||
SyToken *pRawIn; /* Current processed raw token */
|
||||
SyToken *pRawEnd; /* Last raw token in the stream */
|
||||
SySet *pTokenSet; /* Token containers */
|
||||
|
|
Loading…
Reference in New Issue