Skip to content

Commit bfe69c7

Browse files
fixup! Add diagnostics to Declaration
1 parent bdba770 commit bfe69c7

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

rust/rubydex/src/diagnostic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use crate::model::document::Document;
33
use crate::{model::ids::UriId, offset::Offset};
44

5-
#[derive(Debug)]
5+
#[derive(Debug, Clone)]
66
pub struct Diagnostic {
77
rule: Rule,
88
uri_id: UriId,

rust/rubydex/src/model/declaration.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ macro_rules! namespace_declaration {
127127
self.definition_ids.extend(other.definitions());
128128
self.references.extend(other.references());
129129
self.members.extend(other.members());
130+
self.diagnostics.extend(other.diagnostics().iter().cloned());
130131
}
131132

132133
pub fn set_singleton_class_id(&mut self, declaration_id: DeclarationId) {
@@ -228,6 +229,7 @@ macro_rules! simple_declaration {
228229
pub fn extend(&mut self, other: Declaration) {
229230
self.definition_ids.extend(other.definitions());
230231
self.references.extend(other.references());
232+
self.diagnostics.extend(other.diagnostics().iter().cloned());
231233
}
232234
}
233235
};
@@ -393,6 +395,11 @@ impl Namespace {
393395
all_namespaces!(self, it => &it.members)
394396
}
395397

398+
#[must_use]
399+
pub fn diagnostics(&self) -> &[Diagnostic] {
400+
all_namespaces!(self, it => &it.diagnostics)
401+
}
402+
396403
/// # Panics
397404
///
398405
/// Panics if the declaration is not a namespace or a constant

0 commit comments

Comments
 (0)