Skip to content

Commit

Permalink
Add missing debug info for multidimensional strings
Browse files Browse the repository at this point in the history
new String:INVISIBLE[2][8];

Multidimensional arrays like this wouldn't get their debug info added to
the debug symbols table.
Bug: https://bugs.alliedmods.net/show_bug.cgi?id=6324

See Fyren's comment in the bug report.
This patch recursively checks the parent symbol of array dimensions
until it finds the top symbol and uses that to check for the compound
level.
This still allows for early exiting the loop when going out of scope.
  • Loading branch information
peace-maker authored and psychonic committed Apr 4, 2015
1 parent 9a26ae0 commit 491d24a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion sourcepawn/compiler/sc1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6474,7 +6474,20 @@ static int testsymbols(symbol *root,int level,int testlabs,int testconst)
int entry=FALSE;

symbol *sym=root->next;
while (sym!=NULL && sym->compound>=level) {
symbol *parent;
while (sym!=NULL) {
if (sym->compound < level) {
parent = sym->parent;
if (parent == NULL || (parent->ident != iARRAY && parent->ident != iREFARRAY))
break;
/* This is one dimension of a multidimensional array. Find the top symbol. */
while (parent->parent != NULL && (parent->parent->ident == iARRAY || parent->parent->ident == iREFARRAY)) {
parent = parent->parent;
}
/* Only the top symbol gets the compound level set. */
if (parent->compound < level)
break;
}
switch (sym->ident) {
case iLABEL:
if (testlabs) {
Expand Down

0 comments on commit 491d24a

Please sign in to comment.