1. Set a proper data type when compiling closure.
All checks were successful
The build was successful.
All checks were successful
The build was successful.
2. Temporarily allow to call a closure/function if its name is stored in a variable of callback or string type. Ultimately, only callback will be allowed.
This commit is contained in:
parent
2572b9321d
commit
d87ce3ad1d
|
@ -1013,6 +1013,7 @@ PH7_PRIVATE sxi32 PH7_CompileClosure(ph7_gen_state *pGen, sxi32 iCompileFlag) {
|
||||||
}
|
}
|
||||||
SyStringInitFromBuf(&sName, zName, nLen);
|
SyStringInitFromBuf(&sName, zName, nLen);
|
||||||
PH7_MemObjInitFromString(pGen->pVm, pObj, &sName);
|
PH7_MemObjInitFromString(pGen->pVm, pObj, &sName);
|
||||||
|
pObj->iFlags = MEMOBJ_CALL;
|
||||||
/* Compile the closure body */
|
/* Compile the closure body */
|
||||||
rc = PH7_GenStateCompileFunc(&(*pGen), &sName, 0, TRUE, &pAnonFunc);
|
rc = PH7_GenStateCompileFunc(&(*pGen), &sName, 0, TRUE, &pAnonFunc);
|
||||||
if(rc == SXERR_ABORT) {
|
if(rc == SXERR_ABORT) {
|
||||||
|
|
|
@ -4831,7 +4831,7 @@ static sxi32 VmByteCodeExec(
|
||||||
SyHashEntry *pEntry;
|
SyHashEntry *pEntry;
|
||||||
SyString sName;
|
SyString sName;
|
||||||
/* Extract function name */
|
/* Extract function name */
|
||||||
if((pTos->iFlags & MEMOBJ_STRING) == 0) {
|
if((pTos->iFlags & (MEMOBJ_CALL | MEMOBJ_STRING)) == 0) {
|
||||||
if(pTos->iFlags & MEMOBJ_HASHMAP) {
|
if(pTos->iFlags & MEMOBJ_HASHMAP) {
|
||||||
ph7_value sResult;
|
ph7_value sResult;
|
||||||
SySetReset(&aArg);
|
SySetReset(&aArg);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user