mirror of
https://github.com/swc-project/swc.git
synced 2024-10-04 12:18:08 +03:00
fix(es/minifier): Mark usage in TaggedTpl
as ref (#8975)
**Related issue:** - Closes #8974
This commit is contained in:
parent
a15474c331
commit
a753c8d191
@ -0,0 +1,47 @@
|
||||
{
|
||||
"defaults": true,
|
||||
"arguments": false,
|
||||
"arrows": true,
|
||||
"booleans": true,
|
||||
"booleans_as_integers": false,
|
||||
"collapse_vars": true,
|
||||
"comparisons": true,
|
||||
"computed_props": true,
|
||||
"conditionals": true,
|
||||
"dead_code": true,
|
||||
"directives": true,
|
||||
"drop_console": false,
|
||||
"drop_debugger": true,
|
||||
"evaluate": true,
|
||||
"expression": false,
|
||||
"hoist_funs": false,
|
||||
"hoist_props": true,
|
||||
"hoist_vars": false,
|
||||
"if_return": true,
|
||||
"join_vars": true,
|
||||
"keep_classnames": false,
|
||||
"keep_fargs": true,
|
||||
"keep_fnames": false,
|
||||
"keep_infinity": false,
|
||||
"loops": true,
|
||||
"negate_iife": true,
|
||||
"properties": true,
|
||||
"reduce_funcs": false,
|
||||
"reduce_vars": false,
|
||||
"side_effects": true,
|
||||
"switches": true,
|
||||
"typeofs": true,
|
||||
"unsafe": false,
|
||||
"unsafe_arrows": false,
|
||||
"unsafe_comps": false,
|
||||
"unsafe_Function": false,
|
||||
"unsafe_math": false,
|
||||
"unsafe_symbols": false,
|
||||
"unsafe_methods": false,
|
||||
"unsafe_proto": false,
|
||||
"unsafe_regexp": false,
|
||||
"unsafe_undefined": false,
|
||||
"unused": true,
|
||||
"const_to_let": true,
|
||||
"pristine_globals": true
|
||||
}
|
13
crates/swc_ecma_minifier/tests/fixture/issues/8974/input.js
Normal file
13
crates/swc_ecma_minifier/tests/fixture/issues/8974/input.js
Normal file
@ -0,0 +1,13 @@
|
||||
const one = {
|
||||
kind: "Document",
|
||||
definitions: [],
|
||||
loc: {}
|
||||
};
|
||||
const two = {
|
||||
kind: "Document",
|
||||
definitions: one.definitions,
|
||||
};
|
||||
|
||||
const three = a`${one}`;
|
||||
|
||||
export { }
|
@ -0,0 +1,7 @@
|
||||
const one = {
|
||||
kind: "Document",
|
||||
definitions: [],
|
||||
loc: {}
|
||||
};
|
||||
one.definitions, a`${one}`;
|
||||
export { };
|
@ -1168,12 +1168,24 @@ where
|
||||
|
||||
#[cfg_attr(feature = "debug", tracing::instrument(skip_all))]
|
||||
fn visit_tagged_tpl(&mut self, n: &TaggedTpl) {
|
||||
let ctx = Ctx {
|
||||
is_id_ref: false,
|
||||
..self.ctx
|
||||
};
|
||||
{
|
||||
let ctx = Ctx {
|
||||
is_id_ref: false,
|
||||
..self.ctx
|
||||
};
|
||||
|
||||
n.visit_children_with(&mut *self.with_ctx(ctx))
|
||||
n.tag.visit_with(&mut *self.with_ctx(ctx));
|
||||
}
|
||||
|
||||
{
|
||||
let ctx = Ctx {
|
||||
is_id_ref: true,
|
||||
..self.ctx
|
||||
};
|
||||
|
||||
// Bypass visit_tpl
|
||||
n.tpl.visit_children_with(&mut *self.with_ctx(ctx))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "debug", tracing::instrument(skip_all))]
|
||||
|
Loading…
Reference in New Issue
Block a user