diff options
author | David Walter Seikel | 2012-02-04 20:06:29 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-02-04 20:06:29 +1000 |
commit | b75fb33cda872948cf91144feeb47450701efd05 (patch) | |
tree | d447cc26fa2d6f3e901c7074026f331c8d7b8b73 /LuaSL/src | |
parent | Apply LuaJIT hotfix1. (diff) | |
download | SledjHamr-b75fb33cda872948cf91144feeb47450701efd05.zip SledjHamr-b75fb33cda872948cf91144feeb47450701efd05.tar.gz SledjHamr-b75fb33cda872948cf91144feeb47450701efd05.tar.bz2 SledjHamr-b75fb33cda872948cf91144feeb47450701efd05.tar.xz |
Track those functions and variables that are LSL constants.
Diffstat (limited to 'LuaSL/src')
-rw-r--r-- | LuaSL/src/LuaSL_LSL_tree.h | 4 | ||||
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 15 |
2 files changed, 16 insertions, 3 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index 1092f26..6709236 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h | |||
@@ -156,7 +156,8 @@ typedef enum | |||
156 | MF_PREDEC = 16, | 156 | MF_PREDEC = 16, |
157 | MF_PREINC = 32, | 157 | MF_PREINC = 32, |
158 | MF_POSTDEC = 64, | 158 | MF_POSTDEC = 64, |
159 | MF_POSTINC = 128 | 159 | MF_POSTINC = 128, |
160 | MF_LSLCONST = 256 | ||
160 | } miscFlags; | 161 | } miscFlags; |
161 | 162 | ||
162 | struct _allowedTypes | 163 | struct _allowedTypes |
@@ -303,6 +304,7 @@ struct _LSL_Function | |||
303 | #endif | 304 | #endif |
304 | Eina_Inarray vars; // Eina Inarray has not been released yet (Eina 1.2). | 305 | Eina_Inarray vars; // Eina Inarray has not been released yet (Eina 1.2). |
305 | LSL_Block *block; | 306 | LSL_Block *block; |
307 | miscFlags flags; | ||
306 | }; | 308 | }; |
307 | 309 | ||
308 | struct _LSL_FunctionCall | 310 | struct _LSL_FunctionCall |
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 9d2456b..f997d62 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c | |||
@@ -261,8 +261,14 @@ static LSL_Leaf *findFunction(LuaSL_compiler *compiler, const char *name) | |||
261 | { | 261 | { |
262 | if (NULL == func) | 262 | if (NULL == func) |
263 | func = eina_hash_find(constants.functions, name); | 263 | func = eina_hash_find(constants.functions, name); |
264 | if (NULL == func) | 264 | if (NULL != func) |
265 | { | ||
266 | func->flags |= MF_LSLCONST; | ||
267 | func->value.functionValue->flags |= MF_LSLCONST; | ||
268 | } | ||
269 | else | ||
265 | func = eina_hash_find(compiler->script.functions, name); | 270 | func = eina_hash_find(compiler->script.functions, name); |
271 | |||
266 | } | 272 | } |
267 | 273 | ||
268 | return func; | 274 | return func; |
@@ -298,7 +304,12 @@ static LSL_Leaf *findVariable(LuaSL_compiler *compiler, const char *name) | |||
298 | 304 | ||
299 | if (NULL == var) | 305 | if (NULL == var) |
300 | var = eina_hash_find(constants.variables, name); | 306 | var = eina_hash_find(constants.variables, name); |
301 | if (NULL == var) | 307 | if (NULL != var) |
308 | { | ||
309 | var->flags |= MF_LSLCONST; | ||
310 | var->value.identifierValue->flags |= MF_LSLCONST; | ||
311 | } | ||
312 | else | ||
302 | var = eina_hash_find(compiler->script.variables, name); | 313 | var = eina_hash_find(compiler->script.variables, name); |
303 | } | 314 | } |
304 | 315 | ||