mirror of
https://github.com/lua/lua
synced 2026-09-29 04:35:58 +03:00
first implementation of unrestricted static scoping
This commit is contained in:
parent
4d0935ec0f
commit
abdbe883a8
18 changed files with 412 additions and 187 deletions
11
lcode.c
11
lcode.c
|
|
@ -273,6 +273,11 @@ void luaK_dischargevars (FuncState *fs, expdesc *e) {
|
|||
e->k = VNONRELOC;
|
||||
break;
|
||||
}
|
||||
case VUPVAL: {
|
||||
e->u.i.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.i.info, 0);
|
||||
e->k = VRELOCABLE;
|
||||
break;
|
||||
}
|
||||
case VGLOBAL: {
|
||||
e->u.i.info = luaK_codeABc(fs, OP_GETGLOBAL, 0, e->u.i.info);
|
||||
e->k = VRELOCABLE;
|
||||
|
|
@ -437,6 +442,12 @@ void luaK_storevar (FuncState *fs, expdesc *var, expdesc *exp) {
|
|||
luaK_exp2reg(fs, exp, var->u.i.info);
|
||||
break;
|
||||
}
|
||||
case VUPVAL: {
|
||||
int e = luaK_exp2anyreg(fs, exp);
|
||||
freereg(fs, e);
|
||||
luaK_codeABC(fs, OP_SETUPVAL, e, var->u.i.info, 0);
|
||||
break;
|
||||
}
|
||||
case VGLOBAL: {
|
||||
int e = luaK_exp2anyreg(fs, exp);
|
||||
freereg(fs, e);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue