PSyclone
PSyclone copied to clipboard
Extend SymbolTable.lookup() with a "default value" argument to avoid need for try...except.
Currently the lookup method of SymbolTable will raise a KeyError if a Symbol cannot be found (c.f. a Python dict). However, this leads to a lot of try..except blocks which could be avoided if we could just tell the method to return e.g. None if no Symbol is found. By adding an optional argument we can make this change backwards-compatible (which is good because it would otherwise touch a lot of code).
Oops, just noticed you'd already implemented these w.r.t. #2588 @arporter. Branch 2585_symbol_table_lookup_default_value can thus be disregarded and/or deleted.