Skip to content

Commit

Permalink
Fix another potential crash
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Oct 19, 2023
1 parent dc44169 commit 54a87e8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/analyzer/expr/shape_analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,18 @@ pub(crate) fn analyze(
ShapeFieldName::SFlitInt(name) => Some(DictKey::Int(name.1.parse::<u32>().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,
Expand Down

0 comments on commit 54a87e8

Please sign in to comment.