fixed several small issues
This commit is contained in:
@ -92,9 +92,10 @@ int getNumArrDim(TableNode *definition) {
|
||||
"function. Invalid.");
|
||||
return -1;
|
||||
}
|
||||
if (strcmp(getType(definition), "array") != 0) {
|
||||
printdebug("not checking the dim of an array -- invalid op");
|
||||
return 0;
|
||||
if(getAdInfoType(definition) != TYPE_ARRAY_TYPE){
|
||||
printdebug(
|
||||
"passed an invalid node to getNumArrDim. Seeing tag %d in getNumArrDim. Invalid.",getAdInfoType(definition));
|
||||
return -1;
|
||||
}
|
||||
return definition->additionalinfo->ArrayAdInfo->numofdimensions;
|
||||
}
|
||||
@ -113,8 +114,9 @@ TableNode *getArrType(TableNode *definition) {
|
||||
"function. Invalid.");
|
||||
return undefined;
|
||||
}
|
||||
if (strcmp(getType(definition), "array") != 0) {
|
||||
printdebug("not checking the type of an array -- invalid op");
|
||||
if(getAdInfoType(definition) != TYPE_ARRAY_TYPE){
|
||||
printdebug(
|
||||
"passed an invalid node to getArrType. Seeing tag %d. Invalid.",getAdInfoType(definition));
|
||||
return undefined;
|
||||
}
|
||||
return definition->additionalinfo->ArrayAdInfo->typeofarray;
|
||||
@ -1132,8 +1134,8 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
|
||||
}
|
||||
if (getAdInfoType(entry) == TYPE_ARRAY) {
|
||||
char *arrayType = (char *)malloc(100);
|
||||
sprintf(arrayType, " %d -> %s", getNumArrDim(entry),
|
||||
getName(getArrType(entry)));
|
||||
//sprintf(arrayType, " %d -> %s", getNumArrDim(entry),
|
||||
// getName(getArrType(entry)));
|
||||
|
||||
if (parentScopeNum == 0) {
|
||||
st_fprint(file_ptr, getName(entry), currentScopeNum, -100, getType(entry), " Array Instance");
|
||||
|
Reference in New Issue
Block a user