From 4039176ec63e5c75d76398f2debe26ac6fa59cbc Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Sat, 3 Oct 2020 12:48:02 +0300 Subject: Create basic support for names case checks and implement function name case check --- crates/hir/src/code_model.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'crates/hir') diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index 650b4fa40..19ea26e36 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs @@ -255,6 +255,37 @@ impl ModuleDef { ModuleDef::BuiltinType(it) => Some(it.as_name()), } } + + pub fn diagnostics(self, db: &dyn HirDatabase, sink: &mut DiagnosticSink) { + match self { + ModuleDef::Adt(it) => match it { + Adt::Struct(it) => { + hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) + } + Adt::Enum(it) => hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink), + Adt::Union(it) => hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink), + }, + ModuleDef::Trait(it) => { + hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) + } + ModuleDef::Function(it) => { + hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) + } + ModuleDef::TypeAlias(it) => { + hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) + } + ModuleDef::Module(it) => { + hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) + } + ModuleDef::Const(it) => { + hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) + } + ModuleDef::Static(it) => { + hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) + } + _ => return, + } + } } pub use hir_def::{ -- cgit v1.2.3