diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-10-29 14:26:48 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-10-29 14:26:48 -0300 |
commit | a006514ea138a29b6031058d9002b48a572b5dd6 (patch) | |
tree | b289a8af0c0497f2555784a0cf666659ceab0236 /lparser.h | |
parent | 6e9b719694bffb8de711f182d405ec37d32ae0b1 (diff) | |
download | lua-a006514ea138a29b6031058d9002b48a572b5dd6.tar.gz lua-a006514ea138a29b6031058d9002b48a572b5dd6.tar.bz2 lua-a006514ea138a29b6031058d9002b48a572b5dd6.zip |
Big revamp in the implmentation of labels/gotos
Added restriction that, when a label is created, there cannot be
another label with the same name visible. That allows backward goto's
to be resolved when they are read. Backward goto's get a close if
they jump out of the scope of some variable; labels get a close only
if previous goto to it jumps out of the scope of some upvalue.
Diffstat (limited to 'lparser.h')
-rw-r--r-- | lparser.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -88,6 +88,7 @@ typedef struct Labeldesc { | |||
88 | int pc; /* position in code */ | 88 | int pc; /* position in code */ |
89 | int line; /* line where it appeared */ | 89 | int line; /* line where it appeared */ |
90 | lu_byte nactvar; /* local level where it appears in current block */ | 90 | lu_byte nactvar; /* local level where it appears in current block */ |
91 | lu_byte close; /* goto that escapes upvalues */ | ||
91 | } Labeldesc; | 92 | } Labeldesc; |
92 | 93 | ||
93 | 94 | ||
@@ -128,6 +129,7 @@ typedef struct FuncState { | |||
128 | int np; /* number of elements in 'p' */ | 129 | int np; /* number of elements in 'p' */ |
129 | int nabslineinfo; /* number of elements in 'abslineinfo' */ | 130 | int nabslineinfo; /* number of elements in 'abslineinfo' */ |
130 | int firstlocal; /* index of first local var (in Dyndata array) */ | 131 | int firstlocal; /* index of first local var (in Dyndata array) */ |
132 | int firstlabel; /* index of first label (in 'dyd->label->arr') */ | ||
131 | short nlocvars; /* number of elements in 'f->locvars' */ | 133 | short nlocvars; /* number of elements in 'f->locvars' */ |
132 | lu_byte nactvar; /* number of active local variables */ | 134 | lu_byte nactvar; /* number of active local variables */ |
133 | lu_byte nups; /* number of upvalues */ | 135 | lu_byte nups; /* number of upvalues */ |