mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 20:28:58 +00:00
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.
This commit is contained in:
parent
a49f4915de
commit
c04b9aa5db
2 changed files with 3 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue