Skip to content

Commit

Permalink
fix(semantic): reference flags not correctly resolved when after an e…
Browse files Browse the repository at this point in the history
…xport stmt
  • Loading branch information
camc314 committed Dec 27, 2024
1 parent 6b51e6d commit 2601a3a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,14 @@ fn test() {
// ",
// None,
// ),
(
"import { Bar } from './bar';
export type { Baz } from './baz';
export class Foo extends Bar {}
",
None,
),
];

let fail = vec![
Expand Down
4 changes: 3 additions & 1 deletion crates/oxc_semantic/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,6 @@ impl<'a> SemanticBuilder<'a> {
let symbol_flags = self.symbols.get_flags(symbol_id);
references.retain(|&reference_id| {
let reference = &mut self.symbols.references[reference_id];

let flags = reference.flags_mut();

// Determine the symbol whether can be referenced by this reference.
Expand Down Expand Up @@ -1880,6 +1879,9 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
if let Some(with_clause) = &it.with_clause {
self.visit_with_clause(with_clause);
}
if it.source.is_some() {
mem::take(&mut self.current_reference_flags);
}
self.leave_node(kind);
}

Expand Down

0 comments on commit 2601a3a

Please sign in to comment.