Browse Source

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.
release/v0.1
Rafal Kupiec 1 year ago
parent
commit
23900f2aed
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
3 changed files with 0 additions and 39 deletions
  1. +0
    -37
      engine/compiler.c
  2. +0
    -1
      include/compiler.h
  3. +0
    -1
      include/ph7int.h

+ 0
- 37
engine/compiler.c View File

@ -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.

+ 0
- 1
include/compiler.h View File

@ -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);

+ 0
- 1
include/ph7int.h View File

@ -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);

Loading…
Cancel
Save