diff options
author | David Walter Seikel | 2012-01-23 18:30:21 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-23 18:30:21 +1000 |
commit | 45214c885b16a1d14ad8c468158e41a7be4a8050 (patch) | |
tree | 0208438b1a32191eae64769dd1dc033ed9d5da56 /LuaSL/src/LuaSL_compile.c | |
parent | That was just for debugging. Still chasing that bug. (diff) | |
download | SledjHamr-45214c885b16a1d14ad8c468158e41a7be4a8050.zip SledjHamr-45214c885b16a1d14ad8c468158e41a7be4a8050.tar.gz SledjHamr-45214c885b16a1d14ad8c468158e41a7be4a8050.tar.bz2 SledjHamr-45214c885b16a1d14ad8c468158e41a7be4a8050.tar.xz |
Fix variable reference being replaced by it's definition.
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 42b0798..f84b1e1 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c | |||
@@ -295,14 +295,23 @@ static LSL_Leaf *findVariable(LuaSL_compiler *compiler, const char *name) | |||
295 | LSL_Leaf *checkVariable(LuaSL_compiler *compiler, LSL_Leaf *identifier) | 295 | LSL_Leaf *checkVariable(LuaSL_compiler *compiler, LSL_Leaf *identifier) |
296 | { | 296 | { |
297 | gameGlobals *game = compiler->game; | 297 | gameGlobals *game = compiler->game; |
298 | LSL_Leaf *var = findVariable(compiler, identifier->value.stringValue); | ||
299 | 298 | ||
300 | if (NULL == var) | 299 | if (identifier) |
301 | PE("NOT found %s @ line %d, column %d!", identifier->value.stringValue, identifier->line, identifier->column); | 300 | { |
302 | else if (LUASL_DEBUG) | 301 | LSL_Leaf *var = findVariable(compiler, identifier->value.stringValue); |
303 | PI("Found %s!", identifier->value.stringValue); | ||
304 | 302 | ||
305 | return var; | 303 | if (var) |
304 | { | ||
305 | if (LUASL_DEBUG) | ||
306 | PI("Found %s!", identifier->value.stringValue); | ||
307 | identifier->value.identifierValue = var->value.identifierValue; | ||
308 | identifier->basicType = var->basicType; | ||
309 | } | ||
310 | else | ||
311 | PE("NOT found %s @ line %d, column %d!", identifier->value.stringValue, identifier->line, identifier->column); | ||
312 | } | ||
313 | |||
314 | return identifier; | ||
306 | } | 315 | } |
307 | 316 | ||
308 | LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right) | 317 | LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right) |