scopes.c
// Search for a symbol in a scope and recurse to parents if not found.
// Returns zero if not found in any parents
Search for a symbol in a scope and recurse to parents if not found.
Returns zero if not found in any parents
Search for a symbol in a scope and recurse to parents if not found . Returns zero if not found in any parents
Symbol *lookup_symbol(char *name, Scope *scope, int recurse) {
    Symbol *symbol = strmap_get(scope->symbols, name);
    if (symbol) return symbol;
    else if (recurse && scope->parent) return lookup_symbol(name, scope->parent, recurse);
    else return 0;
}
Symbol * lookup_symbol ( char * name , Scope * scope , int recurse ) { Symbol * symbol = strmap_get ( scope -> symbols , name ) ; if ( symbol ) return symbol ; else if ( recurse && scope -> parent ) return lookup_symbol ( name , scope -> parent , recurse ) ; else return 0 ; }
Search for a symbol in a scope and recurse to parents if not found.
Search for a symbol in a scope and recurse to parents if not found .