Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,19 @@ fn test() {
this.#x = 1;
}
}",
r"type Callback<T> = () => Promise<T> | T;

export class Issue_11039<T> {
load: () => Promise<T>;

constructor(callback: Callback<T>) {
this.load = () => this.#load(callback);
}

async #load(callback: Callback<T>) {
callback;
}
}",
];

let fail = vec![
Expand Down
6 changes: 5 additions & 1 deletion crates/oxc_semantic/src/class/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ impl<'a> ClassTableBuilder<'a> {
if matches!(parent_kind, AstKind::PrivateInExpression(_) | AstKind::MemberExpression(_))
{
if let Some(class_id) = self.current_class_id {
let element_ids = self.classes.get_element_ids(class_id, &ident.name);
let element_ids = self.classes.get_element_ids(
class_id,
&ident.name,
/* is_private */ true,
);

let reference = PrivateIdentifierReference::new(
current_node_id,
Expand Down
9 changes: 7 additions & 2 deletions crates/oxc_semantic/src/class/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,15 @@ impl<'a> ClassTable<'a> {
self.declarations[class_id]
}

pub fn get_element_ids(&self, class_id: ClassId, name: &str) -> Vec<ElementId> {
pub fn get_element_ids(
&self,
class_id: ClassId,
name: &str,
is_private: bool,
) -> Vec<ElementId> {
let mut element_ids = vec![];
for (element_id, element) in self.elements[class_id].iter_enumerated() {
if element.name == name {
if element.name == name && element.is_private == is_private {
element_ids.push(element_id);

// Property or Accessor only has 1 element
Expand Down
Loading