diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-05-08 16:32:53 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-05-08 16:32:53 -0300 |
commit | 11a70220670f25a9929439f0b27331f09f05235c (patch) | |
tree | c4a962b5a3e53ac6df8894fb3ad2248c4a1256cb /lcode.c | |
parent | 35a6ed283881f313152457f24cc6c677122d5058 (diff) | |
download | lua-11a70220670f25a9929439f0b27331f09f05235c.tar.gz lua-11a70220670f25a9929439f0b27331f09f05235c.tar.bz2 lua-11a70220670f25a9929439f0b27331f09f05235c.zip |
global variables are stored in a Lua table
Diffstat (limited to 'lcode.c')
-rw-r--r-- | lcode.c | 10 |
1 files changed, 1 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 1.27 2000/04/17 14:05:34 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 1.28 2000/04/19 13:41:37 roberto Exp roberto $ |
3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -16,7 +16,6 @@ | |||
16 | #include "lobject.h" | 16 | #include "lobject.h" |
17 | #include "lopcodes.h" | 17 | #include "lopcodes.h" |
18 | #include "lparser.h" | 18 | #include "lparser.h" |
19 | #include "lstring.h" | ||
20 | 19 | ||
21 | 20 | ||
22 | void luaK_error (LexState *ls, const char *msg) { | 21 | void luaK_error (LexState *ls, const char *msg) { |
@@ -148,11 +147,6 @@ void luaK_setcallreturns (FuncState *fs, int nresults) { | |||
148 | } | 147 | } |
149 | 148 | ||
150 | 149 | ||
151 | static void assertglobal (FuncState *fs, int index) { | ||
152 | luaS_assertglobal(fs->L, fs->f->kstr[index]); | ||
153 | } | ||
154 | |||
155 | |||
156 | static int discharge (FuncState *fs, expdesc *var) { | 150 | static int discharge (FuncState *fs, expdesc *var) { |
157 | switch (var->k) { | 151 | switch (var->k) { |
158 | case VLOCAL: | 152 | case VLOCAL: |
@@ -160,7 +154,6 @@ static int discharge (FuncState *fs, expdesc *var) { | |||
160 | break; | 154 | break; |
161 | case VGLOBAL: | 155 | case VGLOBAL: |
162 | luaK_code1(fs, OP_GETGLOBAL, var->u.index); | 156 | luaK_code1(fs, OP_GETGLOBAL, var->u.index); |
163 | assertglobal(fs, var->u.index); /* make sure that there is a global */ | ||
164 | break; | 157 | break; |
165 | case VINDEXED: | 158 | case VINDEXED: |
166 | luaK_code0(fs, OP_GETTABLE); | 159 | luaK_code0(fs, OP_GETTABLE); |
@@ -190,7 +183,6 @@ void luaK_storevar (LexState *ls, const expdesc *var) { | |||
190 | break; | 183 | break; |
191 | case VGLOBAL: | 184 | case VGLOBAL: |
192 | luaK_code1(fs, OP_SETGLOBAL, var->u.index); | 185 | luaK_code1(fs, OP_SETGLOBAL, var->u.index); |
193 | assertglobal(fs, var->u.index); /* make sure that there is a global */ | ||
194 | break; | 186 | break; |
195 | case VINDEXED: /* table is at top-3; pop 3 elements after operation */ | 187 | case VINDEXED: /* table is at top-3; pop 3 elements after operation */ |
196 | luaK_code2(fs, OP_SETTABLE, 3, 3); | 188 | luaK_code2(fs, OP_SETTABLE, 3, 3); |