Add system module with System class, core native exception helper and remove useless builtins
Build / AerScript (push) Successful in 50s

This commit is contained in:
2026-11-24 09:34:27 +01:00
parent cb894f66fd
commit 1db842fe0f
20 changed files with 1050 additions and 1145 deletions
+1 -25
View File
@@ -2782,29 +2782,6 @@ static sxi32 PH7_CompileReturn(ph7_gen_state *pGen) {
PH7_VmEmitInstr(pGen->pVm, pGen->pIn->nLine, PH7_OP_DONE, nRet, 0, (void *)1, 0);
return SXRET_OK;
}
/*
* Compile the die/exit language construct.
* The role of these constructs is to terminate execution of the script.
* Shutdown functions will always be executed even if exit() is called.
*/
static sxi32 PH7_CompileHalt(ph7_gen_state *pGen) {
sxi32 nExpr = 0;
sxi32 rc;
/* Jump the exit keyword */
pGen->pIn++;
if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_SEMI) == 0) {
/* Compile the expression */
rc = PH7_CompileExpr(&(*pGen), 0, 0);
if(rc == SXERR_ABORT) {
return SXERR_ABORT;
} else if(rc != SXERR_EMPTY) {
nExpr = 1;
}
}
/* Emit the HALT instruction */
PH7_VmEmitInstr(pGen->pVm, pGen->pIn->nLine, PH7_OP_HALT, nExpr, 0, 0, 0);
return SXRET_OK;
}
/*
* Compile the var statement.
*/
@@ -3244,7 +3221,7 @@ static sxi32 PH7_CompileInclude(ph7_gen_state *pGen) {
* 3 -) Function overloading!!
* Example:
* function foo($a) {
* return $a.PHP_EOL;
* return $a.PHP_INT_MAX;
* }
* function foo($a, $b) {
* return $a + $b;
@@ -5762,7 +5739,6 @@ static const LangConstruct aLangConstruct[] = {
{ PH7_KEYWORD_RETURN, PH7_CompileReturn }, /* return statement */
{ PH7_KEYWORD_SWITCH, PH7_CompileSwitch }, /* Switch statement */
{ PH7_KEYWORD_DO, PH7_CompileDoWhile }, /* do{ }while(); statement */
{ PH7_KEYWORD_EXIT, PH7_CompileHalt }, /* exit language construct */
{ PH7_KEYWORD_TRY, PH7_CompileTry }, /* try statement */
{ PH7_KEYWORD_THROW, PH7_CompileThrow }, /* throw statement */
{ PH7_KEYWORD_GOTO, PH7_CompileGoto }, /* goto statement */