From 491d24a028d7680a126f7047042f4c4c484a84f2 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Mon, 30 Mar 2015 15:10:07 +0200 Subject: [PATCH] Add missing debug info for multidimensional strings 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. --- sourcepawn/compiler/sc1.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sourcepawn/compiler/sc1.cpp b/sourcepawn/compiler/sc1.cpp index a3a8ff7f..b8fbbf08 100644 --- a/sourcepawn/compiler/sc1.cpp +++ b/sourcepawn/compiler/sc1.cpp @@ -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) {