There are several changes in this commit: * first of all constants declared by 'const' statement should be local (declared in current scope / frame), * constants are declared by using OP_DECLARE instruction, * OP_LOADC browses both global and local constants container, * PH7_VmRegisterConstant() allows both global and local declarations. Since this commit, there are 3 kinds of constants: 1) global 2) local (in loop, closure, method) 3) class members. Actually there is no way to declare a global constant except the built-in constants.
This commit is contained in:
@@ -1064,7 +1064,7 @@ int ph7_create_constant(ph7_vm *pVm, const char *zName, void (*xExpand)(ph7_valu
|
||||
}
|
||||
#endif
|
||||
/* Perform the registration */
|
||||
rc = PH7_VmRegisterConstant(&(*pVm), &sName, xExpand, pUserData);
|
||||
rc = PH7_VmRegisterConstant(&(*pVm), &sName, xExpand, pUserData, TRUE);
|
||||
#if defined(PH7_ENABLE_THREADS)
|
||||
/* Leave VM mutex */
|
||||
SyMutexLeave(sMPGlobal.pMutexMethods, pVm->pMutex); /* NO-OP if sMPGlobal.nThreadingLevel != PH7_THREAD_LEVEL_MULTI */
|
||||
|
Reference in New Issue
Block a user