From 23900f2aed6f19d3fc837b42eb4c940488ba80ae Mon Sep 17 00:00:00 2001 From: belliash Date: Sat, 4 May 2019 18:53:11 +0200 Subject: [PATCH] Remove unused compiler function - PH7_CompileLangConstruct(). In AerScript, there are no such language constructs, that have syntax similiar to functions. If so, it is just a builtin function. --- engine/compiler.c | 37 ------------------------------------- include/compiler.h | 1 - include/ph7int.h | 1 - 3 files changed, 39 deletions(-) diff --git a/engine/compiler.c b/engine/compiler.c index 94d83ad..5801e80 100644 --- a/engine/compiler.c +++ b/engine/compiler.c @@ -1025,43 +1025,6 @@ PH7_PRIVATE sxi32 PH7_CompileDefine(ph7_gen_state *pGen, sxi32 iFlags) { } return SXRET_OK; } -/* - * Compile a function [i.e: die(),exit(),include(),...] which is a langauge - * construct. - */ -PH7_PRIVATE sxi32 PH7_CompileLangConstruct(ph7_gen_state *pGen, sxi32 iCompileFlag) { - SyString *pName; - sxu32 nKeyID; - sxi32 rc; - /* Name of the language construct [i.e: echo,die...]*/ - pName = &pGen->pIn->sData; - nKeyID = (sxu32)SX_PTR_TO_INT(pGen->pIn->pUserData); - pGen->pIn++; /* Jump the language construct keyword */ - sxi32 nArg = 0; - sxu32 nIdx = 0; - rc = PH7_CompileExpr(&(*pGen), EXPR_FLAG_RDONLY_LOAD/* Do not create variable if non-existent */, 0); - if(rc == SXERR_ABORT) { - return SXERR_ABORT; - } else if(rc != SXERR_EMPTY) { - nArg = 1; - } - if(SXRET_OK != PH7_GenStateFindLiteral(&(*pGen), pName, &nIdx)) { - ph7_value *pObj; - /* Emit the call instruction */ - pObj = PH7_ReserveConstObj(pGen->pVm, &nIdx); - if(pObj == 0) { - PH7_GenCompileError(&(*pGen), E_ERROR, 1, "PH7 engine is running out-of-memory"); - } - PH7_MemObjInitFromString(pGen->pVm, pObj, pName); - /* Install in the literal table */ - PH7_GenStateInstallLiteral(&(*pGen), pObj, nIdx); - } - /* Emit the call instruction */ - PH7_VmEmitInstr(pGen->pVm, 0, PH7_OP_LOADC, 0, nIdx, 0, 0); - PH7_VmEmitInstr(pGen->pVm, 0, PH7_OP_CALL, nArg, 0, 0, 0); - /* Node successfully compiled */ - return SXRET_OK; -} /* * Compile a node holding a variable declaration. * Variables in Aer are represented by a dollar sign followed by the name of the variable. diff --git a/include/compiler.h b/include/compiler.h index f633a99..ad3ada3 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -117,7 +117,6 @@ static sxi32 PH7_GenStateListNodeValidator(ph7_gen_state *pGen, ph7_expr_node *p static sxi32 PH7_GenStateCompileFunc(ph7_gen_state *pGen, SyString *pName, sxi32 iFlags, int bHandleClosure, ph7_vm_func **ppFunc); static sxi32 GenStateDefineNodeValidator(ph7_gen_state *pGen, ph7_expr_node *pRoot); PH7_PRIVATE sxi32 PH7_CompileDefine(ph7_gen_state *pGen, sxi32 iFlags); -PH7_PRIVATE sxi32 PH7_CompileLangConstruct(ph7_gen_state *pGen, sxi32 iCompileFlag); PH7_PRIVATE sxi32 PH7_CompileVariable(ph7_gen_state *pGen, sxi32 iCompileFlag); static sxi32 PH7_GenStateLoadLiteral(ph7_gen_state *pGen); static sxi32 PH7_GenStateResolveNamespaceLiteral(ph7_gen_state *pGen); diff --git a/include/ph7int.h b/include/ph7int.h index c7a3eca..3e2fcc7 100644 --- a/include/ph7int.h +++ b/include/ph7int.h @@ -1708,7 +1708,6 @@ PH7_PRIVATE const ph7_expr_op *PH7_ExprExtractOperator(SyString *pStr, SyToken * PH7_PRIVATE sxi32 PH7_ExprFreeTree(ph7_gen_state *pGen, SySet *pNodeSet); /* compile.c function prototypes */ PH7_PRIVATE ProcNodeConstruct PH7_GetNodeHandler(sxu32 nNodeType); -PH7_PRIVATE sxi32 PH7_CompileLangConstruct(ph7_gen_state *pGen, sxi32 iCompileFlag); PH7_PRIVATE sxi32 PH7_CompileVariable(ph7_gen_state *pGen, sxi32 iCompileFlag); PH7_PRIVATE sxi32 PH7_CompileLiteral(ph7_gen_state *pGen, sxi32 iCompileFlag); PH7_PRIVATE sxi32 PH7_CompileSimpleString(ph7_gen_state *pGen, sxi32 iCompileFlag);