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
fix(transformer): add to SymbolTable::declarations for all symbols (#…
…4460)

`declarations` field of `SymbolTable` is part of the SoA group field. For it to be valid to index into with `SymbolId`, an entry must be added for every new symbol which is created.
  • Loading branch information
overlookmotel committed Jul 26, 2024
commit c04b9aa5db4e4e9526cefa6ebb95fe1be4b6f0ac
2 changes: 2 additions & 0 deletions crates/oxc_transformer/src/typescript/enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use oxc_allocator::Vec;
use oxc_ast::{ast::*, visit::walk_mut, VisitMut};
use oxc_span::{Atom, Span, SPAN};
use oxc_syntax::{
node::AstNodeId,
number::{NumberBase, ToJsInt32, ToJsString},
operator::{AssignmentOperator, BinaryOperator, LogicalOperator, UnaryOperator},
reference::ReferenceFlag,
Expand Down Expand Up @@ -80,6 +81,7 @@ impl<'a> TypeScriptEnum<'a> {
SymbolFlags::FunctionScopedVariable,
func_scope_id,
);
ctx.symbols_mut().add_declaration(AstNodeId::DUMMY);
let ident = BindingIdentifier {
span: decl.id.span,
name: decl.id.name.clone(),
Expand Down
1 change: 1 addition & 0 deletions crates/oxc_traverse/src/context/scoping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ impl TraverseScoping {

// Add binding to scope
let symbol_id = self.symbols.create_symbol(SPAN, name.clone(), flags, scope_id);
self.symbols.add_declaration(AstNodeId::DUMMY);
self.scopes.add_binding(scope_id, name, symbol_id);
symbol_id
}
Expand Down