pr 02
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use crate::common::spans::Span;
|
||||
use prometeu_analysis::NameInterner;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
|
||||
@@ -60,19 +61,20 @@ pub fn collect_symbols(
|
||||
project_id: &str,
|
||||
module_symbols: &HashMap<String, crate::frontends::pbs::symbols::ModuleSymbols>,
|
||||
file_manager: &crate::common::files::FileManager,
|
||||
interner: &NameInterner,
|
||||
) -> Vec<Symbol> {
|
||||
let mut result = Vec::new();
|
||||
|
||||
for (module_path, ms) in module_symbols {
|
||||
// Collect from type_symbols
|
||||
for sym in ms.type_symbols.symbols.values() {
|
||||
if let Some(s) = convert_symbol(project_id, module_path, sym, file_manager) {
|
||||
if let Some(s) = convert_symbol(project_id, module_path, sym, file_manager, interner) {
|
||||
result.push(s);
|
||||
}
|
||||
}
|
||||
// Collect from value_symbols
|
||||
for sym in ms.value_symbols.symbols.values() {
|
||||
if let Some(s) = convert_symbol(project_id, module_path, sym, file_manager) {
|
||||
if let Some(s) = convert_symbol(project_id, module_path, sym, file_manager, interner) {
|
||||
result.push(s);
|
||||
}
|
||||
}
|
||||
@@ -94,6 +96,7 @@ fn convert_symbol(
|
||||
module_path: &str,
|
||||
sym: &crate::frontends::pbs::symbols::Symbol,
|
||||
file_manager: &crate::common::files::FileManager,
|
||||
interner: &NameInterner,
|
||||
) -> Option<Symbol> {
|
||||
use crate::frontends::pbs::symbols::{SymbolKind, Visibility};
|
||||
|
||||
@@ -130,11 +133,12 @@ fn convert_symbol(
|
||||
};
|
||||
|
||||
let hash = decl_span.compute_hash();
|
||||
let id = format!("{}:{}:{}:{}:{:016x}", project_id, kind, module_path, sym.name, hash);
|
||||
let name = interner.resolve(sym.name).to_string();
|
||||
let id = format!("{}:{}:{}:{}:{:016x}", project_id, kind, module_path, name, hash);
|
||||
|
||||
Some(Symbol {
|
||||
id,
|
||||
name: sym.name.clone(),
|
||||
name,
|
||||
kind: kind.to_string(),
|
||||
exported,
|
||||
module_path: module_path.to_string(),
|
||||
|
||||
Reference in New Issue
Block a user