Checks for read-only globals

This commit is contained in:
Roberto Ierusalimschy
2025-05-06 15:54:05 -03:00
parent be81209063
commit 4365a45d68
4 changed files with 33 additions and 9 deletions

View File

@@ -77,11 +77,12 @@ typedef struct expdesc {
int info; /* for generic use */
struct { /* for indexed variables */
short idx; /* index (R or "long" K) */
short vidx; /* index in 'actvar.arr' or -1 if not a declared global */
lu_byte t; /* table (register or upvalue) */
} ind;
struct { /* for local variables */
lu_byte ridx; /* register holding the variable */
unsigned short vidx; /* compiler index (in 'actvar.arr') */
short vidx; /* index in 'actvar.arr' */
} var;
} u;
int t; /* patch list of 'exit when true' */
@@ -101,7 +102,7 @@ typedef struct expdesc {
#define varinreg(v) ((v)->vd.kind <= RDKTOCLOSE)
/* description of an active local variable */
/* description of an active variable */
typedef union Vardesc {
struct {
TValuefields; /* constant value (if it is a compile-time constant) */