Untitled
unknown
c_cpp
a year ago
811 B
9
Indexable
Object *findVariable(char* variableName) {
struct list_scope *scope = current;
struct list_variable *temp;
// Traverse the chain of scopes from the current scope to the global scope
while (scope != NULL) {
// Traverse the list of variables in the current scope
list_for_each_entry(temp, scope->queue, list) {
if (strcmp(temp->variableInfo.symbol->name, variableName) == 0) {
if(temp->variableInfo.type == 1){
if(strcmp(temp->variableInfo.symbol->name, "x") == 0) temp->variableInfo.type = 6;
else temp->variableInfo.type = 8;
}
return &temp->variableInfo;
}
}
scope = list_entry(scope->chain.next, struct list_scope, chain);
}
return NULL;
}Editor is loading...
Leave a Comment