From b75fb33cda872948cf91144feeb47450701efd05 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sat, 4 Feb 2012 20:06:29 +1000 Subject: Track those functions and variables that are LSL constants. --- LuaSL/src/LuaSL_LSL_tree.h | 4 +++- LuaSL/src/LuaSL_compile.c | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'LuaSL') 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 MF_PREDEC = 16, MF_PREINC = 32, MF_POSTDEC = 64, - MF_POSTINC = 128 + MF_POSTINC = 128, + MF_LSLCONST = 256 } miscFlags; struct _allowedTypes @@ -303,6 +304,7 @@ struct _LSL_Function #endif Eina_Inarray vars; // Eina Inarray has not been released yet (Eina 1.2). LSL_Block *block; + miscFlags flags; }; 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) { if (NULL == func) func = eina_hash_find(constants.functions, name); - if (NULL == func) + if (NULL != func) + { + func->flags |= MF_LSLCONST; + func->value.functionValue->flags |= MF_LSLCONST; + } + else func = eina_hash_find(compiler->script.functions, name); + } return func; @@ -298,7 +304,12 @@ static LSL_Leaf *findVariable(LuaSL_compiler *compiler, const char *name) if (NULL == var) var = eina_hash_find(constants.variables, name); - if (NULL == var) + if (NULL != var) + { + var->flags |= MF_LSLCONST; + var->value.identifierValue->flags |= MF_LSLCONST; + } + else var = eina_hash_find(compiler->script.variables, name); } -- cgit v1.1