fixed symbol_table entries not working
This commit is contained in:
@ -37,17 +37,18 @@ SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column) {
|
||||
//create entry just for things below top level scope
|
||||
TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id) {
|
||||
|
||||
if(table ==NULL || table->Parent_Scope == NULL){
|
||||
if(table ==NULL /*|| table->Parent_Scope == NULL*/){
|
||||
printf("Null reference to table given for create entry or given top level scope which is invalid\n");
|
||||
return NULL;
|
||||
}
|
||||
TableNode* topDef = (table_lookup(getAncestor(table),typeOf));
|
||||
/*TableNode* topDef = (table_lookup(getAncestor(table),typeOf));
|
||||
if(topDef == NULL){
|
||||
printf("This type is not defined at the top level\n");
|
||||
return NULL;
|
||||
}
|
||||
}*/
|
||||
TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode));
|
||||
newEntry->theType = topDef->theName;
|
||||
//newEntry->theType = topDef->theName;
|
||||
newEntry->theType=typeOf;
|
||||
newEntry->theName = id;
|
||||
if (table->entries == NULL) {
|
||||
table->entries = newEntry;
|
||||
|
Reference in New Issue
Block a user