Typehinting merge #50

Merged
belliash merged 298 commits from typehinting into master 2019-04-17 11:27:52 +02:00
4 changed files with 3 additions and 43 deletions
Showing only changes of commit 4f29507c0d - Show all commits

View File

@ -5325,9 +5325,9 @@ static ProcLangConstruct PH7_GenStateGetStatementHandler(
*/
static int PH7_IsLangConstruct(sxu32 nKeywordID) {
if(nKeywordID == PH7_KEYWORD_IMPORT || nKeywordID == PH7_KEYWORD_INCLUDE || nKeywordID == PH7_KEYWORD_REQUIRE
|| nKeywordID == PH7_KEYWORD_ISSET || nKeywordID == PH7_KEYWORD_EVAL || nKeywordID == PH7_KEYWORD_EMPTY
|| nKeywordID == PH7_KEYWORD_SELF || nKeywordID == PH7_KEYWORD_PARENT || nKeywordID == PH7_KEYWORD_STATIC
|| nKeywordID == PH7_KEYWORD_NEW || nKeywordID == PH7_KEYWORD_CLONE) {
|| nKeywordID == PH7_KEYWORD_EVAL || nKeywordID == PH7_KEYWORD_EMPTY || nKeywordID == PH7_KEYWORD_SELF
|| nKeywordID == PH7_KEYWORD_PARENT || nKeywordID == PH7_KEYWORD_STATIC || nKeywordID == PH7_KEYWORD_NEW
|| nKeywordID == PH7_KEYWORD_CLONE) {
return TRUE;
}
/* Not a language construct */

View File

@ -632,7 +632,6 @@ static sxu32 KeywordCode(const char *z, int n) {
{"exit", PH7_KEYWORD_EXIT},
{"import", PH7_KEYWORD_IMPORT},
{"include", PH7_KEYWORD_INCLUDE},
{"isset", PH7_KEYWORD_ISSET},
{"require", PH7_KEYWORD_REQUIRE},
{"return", PH7_KEYWORD_RETURN},
};

View File

@ -8270,43 +8270,6 @@ static int vm_builtin_exit(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Abort processing immediately */
return PH7_ABORT;
}
/*
* bool isset($var,...)
* Finds out whether a variable is set.
* Parameters
* One or more variable to check.
* Return
* 1 if var exists and has value other than NULL, 0 otherwise.
*/
static int vm_builtin_isset(ph7_context *pCtx, int nArg, ph7_value **apArg) {
ph7_value *pObj;
int res = 0;
int i;
if(nArg < 1) {
/* Missing arguments,return false */
ph7_result_bool(pCtx, res);
return SXRET_OK;
}
/* Iterate over available arguments */
for(i = 0 ; i < nArg ; ++i) {
pObj = apArg[i];
if(pObj->nIdx == SXU32_HIGH) {
if((pObj->iFlags & MEMOBJ_NULL) == 0) {
/* Not so fatal,Throw a warning */
PH7_VmThrowError(pCtx->pVm, PH7_CTX_WARNING, "Expecting a variable not a constant");
}
}
res = (pObj->iFlags & MEMOBJ_NULL) ? 0 : 1;
if(!res) {
/* Variable not set,return FALSE */
ph7_result_bool(pCtx, 0);
return SXRET_OK;
}
}
/* All given variable are set,return TRUE */
ph7_result_bool(pCtx, 1);
return SXRET_OK;
}
/*
* Unset a memory object [i.e: a ph7_value],remove it from the current
* frame,the reference table and discard it's contents.
@ -10876,7 +10839,6 @@ static const ph7_builtin_func aVmFunc[] = {
{ "get_defined_vars", vm_builtin_get_defined_vars},
{ "gettype", vm_builtin_gettype },
{ "get_resource_type", vm_builtin_get_resource_type},
{ "isset", vm_builtin_isset },
{ "unset", vm_builtin_unset },
{ "var_dump", vm_builtin_var_dump },
{ "print_r", vm_builtin_print_r },

View File

@ -1594,7 +1594,6 @@ enum ph7_expr_id {
#define PH7_KEYWORD_INCLUDE 41 /* include */
#define PH7_KEYWORD_EMPTY 42 /* empty */
#define PH7_KEYWORD_INSTANCEOF 0x400 /* instanceof: MUST BE A POWER OF TWO */
#define PH7_KEYWORD_ISSET 43 /* isset */
#define PH7_KEYWORD_PARENT 44 /* parent */
#define PH7_KEYWORD_PRIVATE 45 /* private */
#define PH7_KEYWORD_FOR 48 /* for */