The idea is to structure the scopes as a tree. A scope is either a lexical block, a function or a compile unit. Each scope is a node in the tree and is represented by the class VariableType. It has a list of variables declared in it and a list of imported variables (for example by importing a namespace). To search for a variable when evaluating an expression we go up through the tree starting from the node representing the current lexical block until we either find a variable or we encounter a NULL node (the parent of a CU is NULL).
The imported variables for each scope are parsed when the variables for the scope is parsed. This is done by the ParseNamespace method in SymbolFileDWARF which is called by ParseVariablesForContext for the compile unit and by ParseVariables for the other scopes. A special case is anonymous namespaces which should be imported to the compile unit.