Skip to main content

mago_analyzer/
analysis_result.rs

1#[cfg(not(target_arch = "wasm32"))]
2use std::time::Duration;
3
4use mago_codex::reference::SymbolReferences;
5use mago_reporting::IssueCollection;
6
7#[derive(Clone, Debug)]
8pub struct AnalysisResult {
9    pub issues: IssueCollection,
10    pub symbol_references: SymbolReferences,
11    #[cfg(not(target_arch = "wasm32"))]
12    pub time_in_analysis: Duration,
13}
14
15impl AnalysisResult {
16    #[must_use]
17    pub fn new(symbol_references: SymbolReferences) -> Self {
18        Self {
19            issues: IssueCollection::default(),
20            symbol_references,
21            #[cfg(not(target_arch = "wasm32"))]
22            time_in_analysis: Duration::default(),
23        }
24    }
25
26    pub fn extend(&mut self, other: Self) {
27        self.issues.extend(other.issues);
28        self.symbol_references.extend(other.symbol_references);
29    }
30}