diff --git a/CHANGELOG.md b/CHANGELOG.md index 7eac311..21b0915 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ - The DLS will now correctly report missing template names in 'in each' constructs - Fixed error where the DLS would fail to match references from within in a template to symbols defined in parents of objects instantiating the template +- The DLS will now index templates declared inside incorrect contexts (objects, methods, etc.). This avoids internal errors in some cases and allows for slightly-better feedback in broken-syntax contexts. ## 0.9.17 - Fixed linter wrongly throwing an error on space after `defined` keyword diff --git a/src/analysis/mod.rs b/src/analysis/mod.rs index 4ae3356..2574f89 100644 --- a/src/analysis/mod.rs +++ b/src/analysis/mod.rs @@ -2311,7 +2311,7 @@ impl DeviceAnalysis { } } - let base_templates = from_device_and_bases(&root, &bases); + let base_templates = templates_from_device_and_bases(&root, &bases); trace!("base template names: {:?}", base_templates.iter() .fold("".to_string(), @@ -2489,15 +2489,14 @@ impl DeviceAnalysis { } } -pub fn from_device_and_bases<'a>(_device: &'a IsolatedAnalysis, +pub fn templates_from_device_and_bases<'a>(_device: &'a IsolatedAnalysis, bases: &'a [IsolatedAnalysis]) -> Vec<&'a ObjectDecl