aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.h7
-rw-r--r--LuaSL/src/LuaSL_compile.c6
2 files changed, 13 insertions, 0 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h
index 6273d60..3e80f50 100644
--- a/LuaSL/src/LuaSL_LSL_tree.h
+++ b/LuaSL/src/LuaSL_LSL_tree.h
@@ -146,6 +146,12 @@ typedef enum
146 ST_MODULO = 8192 // % %= 146 ST_MODULO = 8192 // % %=
147} opSubType; 147} opSubType;
148 148
149typedef enum
150{
151 MF_NONE = 0,
152 MF_LOCAL = 1
153} miscFlags;
154
149struct _allowedTypes 155struct _allowedTypes
150{ 156{
151 opType result; 157 opType result;
@@ -181,6 +187,7 @@ struct _LSL_Leaf
181#endif 187#endif
182 int line, column, len; 188 int line, column, len;
183 opType basicType; 189 opType basicType;
190 miscFlags flags;
184 union 191 union
185 { 192 {
186 float floatValue; 193 float floatValue;
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c
index 7457f0c..2ae8dca 100644
--- a/LuaSL/src/LuaSL_compile.c
+++ b/LuaSL/src/LuaSL_compile.c
@@ -1094,6 +1094,8 @@ LSL_Leaf *addVariable(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identi
1094 assignment->right = expr; 1094 assignment->right = expr;
1095 if (type) 1095 if (type)
1096 { 1096 {
1097 if (compiler->currentBlock)
1098 type->flags |= MF_LOCAL;
1097 identifier->basicType = type->basicType; 1099 identifier->basicType = type->basicType;
1098 result->value.basicType = type->basicType; 1100 result->value.basicType = type->basicType;
1099 result->value.toKen = type->toKen; // This is the LSL_TYPE_* toKen instead of the LSL_* toKen. Not sure if that's a problem. 1101 result->value.toKen = type->toKen; // This is the LSL_TYPE_* toKen instead of the LSL_* toKen. Not sure if that's a problem.
@@ -1523,7 +1525,11 @@ static void outputLeaf(FILE *file, outputMode mode, LSL_Leaf *leaf)
1523 if (OM_LUA == mode) 1525 if (OM_LUA == mode)
1524 { 1526 {
1525 if (LSL_TYPE & leaf->toKen->flags) 1527 if (LSL_TYPE & leaf->toKen->flags)
1528 {
1529 if (MF_LOCAL & leaf->flags)
1530 fprintf(file, " local ");
1526 fprintf(file, " --[[%s]] ", leaf->toKen->toKen); 1531 fprintf(file, " --[[%s]] ", leaf->toKen->toKen);
1532 }
1527 else if (LSL_CONCATENATE == leaf->toKen->type) 1533 else if (LSL_CONCATENATE == leaf->toKen->type)
1528 fprintf(file, " .. "); 1534 fprintf(file, " .. ");
1529 else 1535 else