Rename 'instanceof' to 'is'.
All checks were successful
The build was successful.

This commit is contained in:
Rafal Kupiec 2019-06-06 11:53:17 +02:00
parent 24c75975e3
commit d0995a4239
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
4 changed files with 10 additions and 10 deletions

View File

@ -74,7 +74,7 @@ static sxi32 TokenizeAerScript(SyStream *pStream, SyToken *pToken, void *pUserDa
nKeyword = KeywordCode(pStr->zString, (int)pStr->nByte);
if(nKeyword != PH7_TK_ID) {
if(nKeyword &
(PH7_KEYWORD_NEW | PH7_KEYWORD_CLONE | PH7_KEYWORD_INSTANCEOF)) {
(PH7_KEYWORD_NEW | PH7_KEYWORD_CLONE | PH7_KEYWORD_IS)) {
/* Alpha stream operators [i.e: new,clone,instanceof],save the operator instance for later processing */
pToken->pUserData = (void *)PH7_ExprExtractOperator(pStr, 0);
/* Mark as an operator */
@ -528,7 +528,6 @@ static sxu32 KeywordCode(const char *z, int n) {
{"final", PH7_KEYWORD_FINAL},
{"finally", PH7_KEYWORD_FINALLY},
{"implements", PH7_KEYWORD_IMPLEMENTS},
{"instanceof", PH7_KEYWORD_INSTANCEOF},
{"interface", PH7_KEYWORD_INTERFACE},
{"namespace", PH7_KEYWORD_NAMESPACE},
{"new", PH7_KEYWORD_NEW},
@ -573,6 +572,7 @@ static sxu32 KeywordCode(const char *z, int n) {
{"exit", PH7_KEYWORD_EXIT},
{"import", PH7_KEYWORD_IMPORT},
{"include", PH7_KEYWORD_INCLUDE},
{"is", PH7_KEYWORD_IS},
{"require", PH7_KEYWORD_REQUIRE},
{"return", PH7_KEYWORD_RETURN},
};

View File

@ -53,7 +53,7 @@ static const ph7_expr_op aOpTable[] = {
{ {"(void)", sizeof("(void)") - 1 }, EXPR_OP_TYPECAST, 4, EXPR_OP_ASSOC_RIGHT, PH7_OP_CVT_VOID },
/* Binary operators */
/* Precedence 7,left-associative */
{ {"instanceof", sizeof("instanceof") - 1}, EXPR_OP_INSTOF, 7, EXPR_OP_NON_ASSOC, PH7_OP_IS_A},
{ {"instanceof", sizeof("instanceof") - 1}, EXPR_OP_IS, 7, EXPR_OP_NON_ASSOC, PH7_OP_IS},
{ {"*", sizeof(char)}, EXPR_OP_MUL, 7, EXPR_OP_ASSOC_LEFT, PH7_OP_MUL},
{ {"/", sizeof(char)}, EXPR_OP_DIV, 7, EXPR_OP_ASSOC_LEFT, PH7_OP_DIV},
{ {"%", sizeof(char)}, EXPR_OP_MOD, 7, EXPR_OP_ASSOC_LEFT, PH7_OP_MOD},

View File

@ -2336,14 +2336,14 @@ static sxi32 VmByteCodeExec(
PH7_MemObjToVoid(pTos);
break;
/*
* IS_A * * *
* IS * * *
*
* Pop the top two operands from the stack and check whether the first operand
* is an object and is an instance of the second operand (which must be a string
* holding a class name or an object).
* Push TRUE on success. FALSE otherwise.
*/
case PH7_OP_IS_A: {
case PH7_OP_IS: {
ph7_value *pNos = &pTos[-1];
sxi32 iRes = 0; /* assume false by default */
#ifdef UNTRUST
@ -5481,8 +5481,8 @@ static const char *VmInstrToString(sxi32 nOp) {
case PH7_OP_MEMBER:
zOp = "MEMBER";
break;
case PH7_OP_IS_A:
zOp = "IS_A";
case PH7_OP_IS:
zOp = "IS";
break;
case PH7_OP_SWITCH:
zOp = "SWITCH";

View File

@ -1465,7 +1465,7 @@ enum ph7_vm_op {
PH7_OP_INTERFACE_INIT,/* Interface init */
PH7_OP_FOREACH_INIT, /* For each init */
PH7_OP_FOREACH_STEP, /* For each step */
PH7_OP_IS_A, /* Instanceof */
PH7_OP_IS, /* Is */
PH7_OP_LOAD_EXCEPTION,/* Load an exception */
PH7_OP_POP_EXCEPTION, /* POP an exception */
PH7_OP_THROW, /* Throw exception */
@ -1488,7 +1488,7 @@ enum ph7_expr_id {
EXPR_OP_UMINUS, /* Unary minus */
EXPR_OP_UPLUS, /* Unary plus */
EXPR_OP_TYPECAST, /* Type cast [i.e: (int),(float),(string)...] */
EXPR_OP_INSTOF, /* instanceof */
EXPR_OP_IS, /* is */
EXPR_OP_LOGNOT, /* logical not ! */
EXPR_OP_MUL, /* Multiplication */
EXPR_OP_DIV, /* division */
@ -1590,7 +1590,7 @@ enum ph7_expr_id {
#define PH7_KEYWORD_FINALLY 36 /* finally */
#define PH7_KEYWORD_IMPLEMENTS 39 /* implements */
#define PH7_KEYWORD_INCLUDE 41 /* include */
#define PH7_KEYWORD_INSTANCEOF 0x400 /* instanceof: MUST BE A POWER OF TWO */
#define PH7_KEYWORD_IS 0x400 /* is: MUST BE A POWER OF TWO */
#define PH7_KEYWORD_PRIVATE 45 /* private */
#define PH7_KEYWORD_FOR 48 /* for */
#define PH7_KEYWORD_FOREACH 49 /* foreach */