aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-02-03 13:32:27 +1000
committerDavid Walter Seikel2012-02-03 13:32:27 +1000
commit6a6eaf26345f7e12648aa25a9390e5d92c50a11b (patch)
tree189a37283a2b08d3c6b40b38b2497e523d9786c9 /LuaSL
parentLua locals. (diff)
downloadSledjHamr-6a6eaf26345f7e12648aa25a9390e5d92c50a11b.zip
SledjHamr-6a6eaf26345f7e12648aa25a9390e5d92c50a11b.tar.gz
SledjHamr-6a6eaf26345f7e12648aa25a9390e5d92c50a11b.tar.bz2
SledjHamr-6a6eaf26345f7e12648aa25a9390e5d92c50a11b.tar.xz
Take care of declerations without asignments.
Diffstat (limited to 'LuaSL')
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.h3
-rw-r--r--LuaSL/src/LuaSL_compile.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h
index 3e80f50..9f1aaee 100644
--- a/LuaSL/src/LuaSL_LSL_tree.h
+++ b/LuaSL/src/LuaSL_LSL_tree.h
@@ -149,7 +149,8 @@ typedef enum
149typedef enum 149typedef enum
150{ 150{
151 MF_NONE = 0, 151 MF_NONE = 0,
152 MF_LOCAL = 1 152 MF_LOCAL = 1,
153 MF_NOASSIGN = 2
153} miscFlags; 154} miscFlags;
154 155
155struct _allowedTypes 156struct _allowedTypes
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c
index 2ae8dca..c06afc4 100644
--- a/LuaSL/src/LuaSL_compile.c
+++ b/LuaSL/src/LuaSL_compile.c
@@ -1092,6 +1092,8 @@ LSL_Leaf *addVariable(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identi
1092 identifier->right = assignment; 1092 identifier->right = assignment;
1093 if (assignment) 1093 if (assignment)
1094 assignment->right = expr; 1094 assignment->right = expr;
1095 else
1096 identifier->flags |= MF_NOASSIGN;
1095 if (type) 1097 if (type)
1096 { 1098 {
1097 if (compiler->currentBlock) 1099 if (compiler->currentBlock)
@@ -2025,6 +2027,12 @@ static void outputIdentifierToken(FILE *file, outputMode mode, LSL_Leaf *content
2025 fprintf(file, ".%s", content->value.identifierValue->sub); 2027 fprintf(file, ".%s", content->value.identifierValue->sub);
2026 } 2028 }
2027 else 2029 else
2030 if ((LSL_VARIABLE == content->toKen->type) && (MF_NOASSIGN & content->flags))
2031 {
2032 outputText(file, &(content->value.identifierValue->name), !(LSL_NOIGNORE & content->toKen->flags));
2033 fprintf(file, " = nil");
2034 }
2035 else
2028 outputText(file, &(content->value.identifierValue->name), !(LSL_NOIGNORE & content->toKen->flags)); 2036 outputText(file, &(content->value.identifierValue->name), !(LSL_NOIGNORE & content->toKen->flags));
2029 } 2037 }
2030} 2038}