diff --git a/src/protocol/parser/symbol_table.rs b/src/protocol/parser/symbol_table.rs index 0d64b4d7d5515fa4c0c530f8dc43dff3d74f36b6..088dc52d102199b6cf2e4b2f981cb4aebc30af6f 100644 --- a/src/protocol/parser/symbol_table.rs +++ b/src/protocol/parser/symbol_table.rs @@ -85,7 +85,6 @@ pub struct SymbolDefinition { // spans and module IDs pub defined_in_module: RootId, pub defined_in_scope: SymbolScope, - pub definition_span: InputSpan, // full span of definition pub identifier_span: InputSpan, // span of just the identifier // Location where the symbol is introduced in its scope pub imported_at: Option, @@ -231,6 +230,14 @@ impl SymbolTable { Ok(()) } + /// Insert a symbol in the global scope. Naturally there will be a + /// collision (as the symbol originates from a module), so we do *not* check + /// for this. + pub(crate) fn insert_symbol_in_global_scope(&mut self, symbol: Symbol) { + let scoped_symbols = self.scope_lookup.get_mut(&SymbolScope::Global).unwrap(); + scoped_symbols.symbols.push(symbol); + } + /// Retrieves a symbol by name by searching in a particular scope and that scope's parents. The /// returned symbol may both be imported as defined within any of the searched scopes. pub(crate) fn get_symbol_by_name(