From 54a87e83dae1dde1f8189f6ee12d53fe14daaf87 Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Thu, 19 Oct 2023 16:50:03 -0400 Subject: [PATCH] Fix another potential crash --- src/analyzer/expr/shape_analyzer.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/analyzer/expr/shape_analyzer.rs b/src/analyzer/expr/shape_analyzer.rs index 9dfc8ea6..8f936555 100644 --- a/src/analyzer/expr/shape_analyzer.rs +++ b/src/analyzer/expr/shape_analyzer.rs @@ -57,11 +57,18 @@ pub(crate) fn analyze( ShapeFieldName::SFlitInt(name) => Some(DictKey::Int(name.1.parse::().unwrap())), ShapeFieldName::SFlitStr(name) => Some(DictKey::String(name.1.to_string())), ShapeFieldName::SFclassConst(lhs, name) => { - let lhs_name = statements_analyzer + let lhs_name = if let Some(name) = statements_analyzer .get_file_analyzer() .resolved_names .get(&lhs.0.start_offset()) - .unwrap(); + { + name + } else { + return Err(AnalysisError::InternalError( + format!("unknown classname at pos {}", &lhs.1), + statements_analyzer.get_hpos(&lhs.0), + )); + }; let constant_type = codebase.get_class_constant_type( &lhs_name,