diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-04-22 18:24:59 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-04-22 18:25:09 -0400 |
commit | 13e11b2fafe60cad7d04d80c602adc12d6080036 (patch) | |
tree | a36a93bc780b9b9e0eec30a486d8a4a9a6ddbd24 /dimension/parse.c | |
parent | 4e3c3918450d004bc00de4ad58eb7b707156f9aa (diff) | |
download | dimension-13e11b2fafe60cad7d04d80c602adc12d6080036.tar.xz |
Handle symbol aliases in dmnsn_find_symbol() directly.
Fixes infinite loops when macro arguments have the same name as existing
symbols.
Diffstat (limited to 'dimension/parse.c')
-rw-r--r-- | dimension/parse.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/dimension/parse.c b/dimension/parse.c index 74075a7..6651d41 100644 --- a/dimension/parse.c +++ b/dimension/parse.c @@ -131,8 +131,13 @@ dmnsn_find_symbol(dmnsn_symbol_table *symtable, const char *id) DMNSN_ARRAY_FOREACH_REVERSE (dmnsn_dictionary **, dict, symtable) { symbol = dmnsn_dictionary_at(*dict, id); - if (symbol) - break; + if (symbol) { + if (symbol->type == DMNSN_AST_IDENTIFIER) { + id = symbol->ptr; + } else { + break; + } + } } return symbol; |