Fix block scope for local declarations
Build / AerScript (push) Successful in 40s

This commit is contained in:
2026-10-25 19:22:50 +01:00
parent 3e3b795626
commit 8a2d7d8bd3
4 changed files with 277 additions and 52 deletions
+10
View File
@@ -1121,7 +1121,13 @@ struct ph7_class_instance {
* is stored in an instance of the following structure.
*/
typedef struct VmInstr VmInstr;
typedef struct VmScopeInfo VmScopeInfo;
typedef struct VmScope VmScope;
struct VmScopeInfo {
VmScopeInfo *pParent; /* Lexical parent in the same bytecode container */
};
struct VmInstr {
VmScopeInfo *pScope; /* Lexical scope at this instruction */
sxu8 iOp; /* Operation to preform */
sxi32 iP1; /* First operand */
sxu32 iP2; /* Second operand (Often the jump destination) */
@@ -1161,6 +1167,8 @@ struct ph7_exception {
*/
SySet sFinally; /* Compiled 'finally' instructions block (VmInstr) */
VmFrame *pFrame; /* Frame that trigger the exception */
VmScopeInfo *pScope; /* Enclosing lexical context at try entry */
void *pScopeExec; /* Execution owning that context */
};
/* Forward reference */
typedef struct ph7_case_expr ph7_case_expr;
@@ -1244,6 +1252,7 @@ struct ph7_vm {
SySet aSelf; /* 'self' stack used for static member access [i.e: self::MyConstant] */
sxi32 iExitStatus; /* Script exit status */
ph7_gen_state sCodeGen; /* Code generator module */
VmScope *pScope; /* Active lexical scopes (not call frames) */
ph7_vm *pNext, *pPrev; /* List of active VMs */
sxu32 nMagic; /* Sanity check against misuse */
};
@@ -1261,6 +1270,7 @@ struct VmFrame {
SyHash hVar; /* Variable hashtable for fast lookup */
SySet sArg; /* Function arguments container */
SySet sRef; /* Local reference table (VmSlot instance) */
SySet sConstDecl; /* Constants already declared during this invocation */
sxi32 iFlags; /* Frame configuration flags (See below) */
sxu32 iExceptionJump; /* Exception jump destination */
};