fixed issue with not printing array instances in symbol table

This commit is contained in:
Partho
2025-04-14 02:01:51 -04:00
parent 3fc7a6371a
commit 3baa95288a
3 changed files with 108 additions and 88 deletions

View File

@ -1128,6 +1128,17 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
st_fprint(file_ptr, getName(entry), currentScopeNum, parentScopeNum, arrayType, " Type of Array");
}
}
if (getAdInfoType(entry) == TYPE_ARRAY) {
char *arrayType = (char *)malloc(100);
sprintf(arrayType, " %d -> %s", getNumArrDim(entry),
getName(getArrType(entry)));
if (parentScopeNum == 0) {
st_fprint(file_ptr, getName(entry), currentScopeNum, -100, getType(entry), " Array Instance");
} else {
st_fprint(file_ptr, getName(entry), currentScopeNum, parentScopeNum, getType(entry), " Array Instance");
}
}
if (getAdInfoType(entry) == TYPE_RECORD_TYPE) {
char *recordAdInfo = (char *)malloc(100);
sprintf(recordAdInfo, " elements-%d size-%d bytes", getRecLength(entry), getRecTotal(entry));