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 @@ -75,14 +75,8 @@ impl<'a> NullishCoalescingOperator<'a> {
ctx: &mut TraverseCtx<'a>,
) -> IdentifierReference<'a> {
// Add `var name` to scope
let name = match expr {
Expression::Identifier(ident) => ident.name.as_str(),
// TODO: needs to port generateUidIdentifierBasedOnNode
// https://github.com/babel/babel/blob/419644f27c5c59deb19e71aaabd417a3bc5483ca/packages/babel-traverse/src/scope/index.ts#L543-L545
_ => "nullish_coalescing_operator",
};
let symbol_id =
ctx.generate_uid_in_current_scope(name, SymbolFlags::FunctionScopedVariable);
let symbol_id = ctx
.generate_uid_in_current_scope_based_on_node(expr, SymbolFlags::FunctionScopedVariable);
let symbol_name = ctx.ast.atom(ctx.symbols().get_name(symbol_id));

{
Expand Down
8 changes: 4 additions & 4 deletions tasks/transform_conformance/babel.snap.md
Original file line number Diff line number Diff line change
Expand Up @@ -1310,9 +1310,9 @@ ReferenceId mismatch after transform
* assumption-noDocumentAll/transform-in-default-param/input.js
Bindings Mismatch:
previous scope ScopeId(0): ["bar", "foo"]
current scope ScopeId(0): ["_nullish_coalescing_operator", "bar", "foo"]
current scope ScopeId(0): ["_foo$bar", "bar", "foo"]
Bindings Mismatch:
previous scope ScopeId(1): ["_nullish_coalescing_operator", "foo", "qux"]
previous scope ScopeId(1): ["_foo$bar", "foo", "qux"]
current scope ScopeId(1): ["foo", "qux"]
Symbols mismatch after transform
ReferenceId mismatch after transform
Expand All @@ -1334,9 +1334,9 @@ ReferenceId mismatch after transform
* nullish-coalescing/transform-in-default-param/input.js
Bindings Mismatch:
previous scope ScopeId(0): ["bar", "foo"]
current scope ScopeId(0): ["_nullish_coalescing_operator", "bar", "foo"]
current scope ScopeId(0): ["_foo$bar", "bar", "foo"]
Bindings Mismatch:
previous scope ScopeId(1): ["_nullish_coalescing_operator", "foo", "qux"]
previous scope ScopeId(1): ["_foo$bar", "foo", "qux"]
current scope ScopeId(1): ["foo", "qux"]
Symbols mismatch after transform
ReferenceId mismatch after transform
Expand Down