mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
fix(transformer/private-methods): fix panic if instance private accessor in class (#8362)
Fix panic if a private accessor is present in class which also has property. e.g.:
```js
let C = class C {
prop = 1;
accessor #private = 2;
};
```
Panic occurred due to trying to unwrap `brand` property, but it's `None` because no private instance methods in the class.
This commit is contained in:
parent
f1f129b09d
commit
ac72adbade
1 changed files with 5 additions and 1 deletions
|
|
@ -607,7 +607,11 @@ impl<'a> ClassProperties<'a, '_> {
|
|||
let mut weakmap_symbol_id = None;
|
||||
let mut has_method = false;
|
||||
exprs.extend(private_props.values().filter_map(|prop| {
|
||||
if prop.is_method() || prop.is_accessor {
|
||||
if prop.is_accessor {
|
||||
return None;
|
||||
}
|
||||
|
||||
if prop.is_method() {
|
||||
if prop.is_static || has_method {
|
||||
return None;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue