Skip to content

Commit

Permalink
Make safer
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Oct 26, 2023
1 parent ee1922e commit c3da0c2
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,10 @@ pub fn class_to_class_def(
match expr {
Expr::Ident(ident) => Some(ident.sym.to_string()),
Expr::Member(member_expr) => {
let prop = member_expr.to_owned().prop.ident().unwrap().sym.to_string();
let obj = walk_class_extends(&member_expr.obj);
let prop = member_expr.prop.as_ident()?.sym.to_string();
let mut string_path = walk_class_extends(&member_expr.obj)?;

obj.as_ref()?;

let mut string_path = obj.unwrap();

string_path.push_str(".");
string_path.push('.');
string_path.push_str(&prop);

Some(string_path)
Expand Down

0 comments on commit c3da0c2

Please sign in to comment.