Function brane_ast::traversals::flatten::do_traversal
source · pub fn do_traversal(
state: &mut CompileState,
root: Program,
) -> Result<Program, Vec<AstError>>
Expand description
Flattens the symbol tables in the given AST to only have a global and function-wide scope.
Note that this cannot lead to conflicts, since variable names (should) have already been resolved.
§Arguments
state
: The CompileState that we use to pre-define and flatten scopes in.root
: The root node of the tree on which this compiler pass will be done.
§Returns
The same nodes as went in, but now with a flattened symbol table structure (i.e., nested blocks will have empty tables).
§Errors
This pass doesn’t really error, but the option is here for convention purposes.