diff options
author | Igor Aleksanov <[email protected]> | 2020-10-03 10:48:02 +0100 |
---|---|---|
committer | Igor Aleksanov <[email protected]> | 2020-10-12 08:59:54 +0100 |
commit | 4039176ec63e5c75d76398f2debe26ac6fa59cbc (patch) | |
tree | 8f2f2b6d22c57985fc6a8f1b40d84663d40b09f6 /crates/hir | |
parent | 518f6d772482c7c58e59081f340947087a9b4800 (diff) |
Create basic support for names case checks and implement function name case check
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/code_model.rs | 31 |
1 files changed, 31 insertions, 0 deletions
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 { | |||
255 | ModuleDef::BuiltinType(it) => Some(it.as_name()), | 255 | ModuleDef::BuiltinType(it) => Some(it.as_name()), |
256 | } | 256 | } |
257 | } | 257 | } |
258 | |||
259 | pub fn diagnostics(self, db: &dyn HirDatabase, sink: &mut DiagnosticSink) { | ||
260 | match self { | ||
261 | ModuleDef::Adt(it) => match it { | ||
262 | Adt::Struct(it) => { | ||
263 | hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) | ||
264 | } | ||
265 | Adt::Enum(it) => hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink), | ||
266 | Adt::Union(it) => hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink), | ||
267 | }, | ||
268 | ModuleDef::Trait(it) => { | ||
269 | hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) | ||
270 | } | ||
271 | ModuleDef::Function(it) => { | ||
272 | hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) | ||
273 | } | ||
274 | ModuleDef::TypeAlias(it) => { | ||
275 | hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) | ||
276 | } | ||
277 | ModuleDef::Module(it) => { | ||
278 | hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) | ||
279 | } | ||
280 | ModuleDef::Const(it) => { | ||
281 | hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) | ||
282 | } | ||
283 | ModuleDef::Static(it) => { | ||
284 | hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) | ||
285 | } | ||
286 | _ => return, | ||
287 | } | ||
288 | } | ||
258 | } | 289 | } |
259 | 290 | ||
260 | pub use hir_def::{ | 291 | pub use hir_def::{ |