mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 05:32:09 +03:00
fix(es/codegen): Fix sourcemap (#2142)
swc_ecma_codegen: - Use span for `await` token. - Use span for debugger statements. - Use span for object literals. - Use span for object patterns. - Use span for array literals. - Use span for `try`. - Use span for `for`. - Use span for `return`. - Use span for `break`. - Use span for `continue`. - Use span for `this`. - Use span for `switch`. - Use span for `catch`. - Use span for `case`. - Use span for `function`. - Use span for unary expressions. swc_ecma_minifier: - Normalize sequences expressions if the length is 1.
This commit is contained in:
parent
78a7c6befe
commit
427df9a979
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -2398,7 +2398,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_codegen"
|
||||
version = "0.67.1"
|
||||
version = "0.67.2"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"num-bigint",
|
||||
@ -2470,7 +2470,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_minifier"
|
||||
version = "0.22.1"
|
||||
version = "0.22.2"
|
||||
dependencies = [
|
||||
"ansi_term 0.12.1",
|
||||
"anyhow",
|
||||
|
@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_ecma_codegen"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.67.1"
|
||||
version = "0.67.2"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1"
|
||||
|
@ -1250,24 +1250,31 @@ impl<'a> Emitter<'a> {
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_fn_expr(&mut self, node: &FnExpr) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
fn emit_fn_expr(&mut self, n: &FnExpr) -> Result {
|
||||
self.emit_leading_comments_of_span(n.span(), false)?;
|
||||
|
||||
if node.function.is_async {
|
||||
if n.function.is_async {
|
||||
keyword!("async");
|
||||
space!()
|
||||
space!();
|
||||
keyword!("function");
|
||||
} else {
|
||||
let span = if n.span().is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(n.span().lo, n.span().lo + BytePos(8), Default::default())
|
||||
};
|
||||
keyword!(span, "function");
|
||||
}
|
||||
keyword!("function");
|
||||
|
||||
if node.function.is_generator {
|
||||
if n.function.is_generator {
|
||||
punct!("*");
|
||||
}
|
||||
if let Some(ref i) = node.ident {
|
||||
if let Some(ref i) = n.ident {
|
||||
space!();
|
||||
emit!(i);
|
||||
}
|
||||
|
||||
self.emit_fn_trailing(&node.function)?;
|
||||
self.emit_fn_trailing(&n.function)?;
|
||||
}
|
||||
|
||||
/// prints `(b){}` from `function a(b){}`
|
||||
@ -1314,7 +1321,7 @@ impl<'a> Emitter<'a> {
|
||||
fn emit_this_expr(&mut self, node: &ThisExpr) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
|
||||
keyword!("this");
|
||||
keyword!(node.span, "this");
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
@ -1356,27 +1363,37 @@ impl<'a> Emitter<'a> {
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_unary_expr(&mut self, node: &UnaryExpr) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
fn emit_unary_expr(&mut self, n: &UnaryExpr) -> Result {
|
||||
self.emit_leading_comments_of_span(n.span(), false)?;
|
||||
|
||||
let need_formatting_space = match node.op {
|
||||
let need_formatting_space = match n.op {
|
||||
op!("typeof") | op!("void") | op!("delete") => {
|
||||
keyword!(node.op.as_str());
|
||||
let span = if n.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(
|
||||
n.span.lo,
|
||||
n.span.lo + BytePos(n.op.as_str().len() as _),
|
||||
Default::default(),
|
||||
)
|
||||
};
|
||||
keyword!(span, n.op.as_str());
|
||||
|
||||
true
|
||||
}
|
||||
op!(unary, "+") | op!(unary, "-") | op!("!") | op!("~") => {
|
||||
punct!(node.op.as_str());
|
||||
punct!(n.op.as_str());
|
||||
false
|
||||
}
|
||||
};
|
||||
|
||||
if should_emit_whitespace_before_operand(node) {
|
||||
if should_emit_whitespace_before_operand(n) {
|
||||
space!();
|
||||
} else if need_formatting_space {
|
||||
formatting_space!();
|
||||
}
|
||||
|
||||
emit!(node.arg);
|
||||
emit!(n.arg);
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
@ -1433,34 +1450,62 @@ impl<'a> Emitter<'a> {
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_await_expr(&mut self, node: &AwaitExpr) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
fn emit_await_expr(&mut self, n: &AwaitExpr) -> Result {
|
||||
self.emit_leading_comments_of_span(n.span(), false)?;
|
||||
|
||||
keyword!("await");
|
||||
{
|
||||
let span = if n.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(n.span.lo, n.span.lo + BytePos(5), Default::default())
|
||||
};
|
||||
keyword!(span, "await");
|
||||
}
|
||||
|
||||
space!();
|
||||
|
||||
emit!(&node.arg);
|
||||
emit!(&n.arg);
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_array_lit(&mut self, node: &ArrayLit) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
|
||||
punct!("[");
|
||||
{
|
||||
let span = if node.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(node.span.lo, node.span.lo + BytePos(1), Default::default())
|
||||
};
|
||||
punct!(span, "[");
|
||||
}
|
||||
self.emit_list(
|
||||
node.span(),
|
||||
Some(&node.elems),
|
||||
ListFormat::ArrayLiteralExpressionElements,
|
||||
)?;
|
||||
punct!("]");
|
||||
{
|
||||
let span = if node.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(node.span.hi - BytePos(1), node.span.hi, Default::default())
|
||||
};
|
||||
punct!(span, "]");
|
||||
}
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_object_lit(&mut self, node: &ObjectLit) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
|
||||
punct!("{");
|
||||
{
|
||||
let span = if node.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(node.span.lo, node.span.lo + BytePos(1), Default::default())
|
||||
};
|
||||
punct!(span, "{");
|
||||
}
|
||||
if !self.cfg.minify {
|
||||
self.wr.write_line()?;
|
||||
}
|
||||
@ -1472,7 +1517,14 @@ impl<'a> Emitter<'a> {
|
||||
if !self.cfg.minify {
|
||||
self.wr.write_line()?;
|
||||
}
|
||||
punct!("}");
|
||||
{
|
||||
let span = if node.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(node.span.hi - BytePos(1), node.span.hi, Default::default())
|
||||
};
|
||||
punct!(span, "}");
|
||||
}
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
@ -1588,7 +1640,14 @@ impl<'a> Emitter<'a> {
|
||||
fn emit_private_name(&mut self, n: &PrivateName) -> Result {
|
||||
self.emit_leading_comments_of_span(n.span(), false)?;
|
||||
|
||||
punct!("#");
|
||||
{
|
||||
let span = if n.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(n.span.lo, n.span.lo + BytePos(1), Default::default())
|
||||
};
|
||||
punct!(span, "#");
|
||||
}
|
||||
emit!(n.id)
|
||||
}
|
||||
|
||||
@ -1981,13 +2040,27 @@ impl<'a> Emitter<'a> {
|
||||
ListFormat::ObjectBindingPatternElements
|
||||
};
|
||||
|
||||
punct!("{");
|
||||
{
|
||||
let span = if node.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(node.span.lo, node.span.lo + BytePos(1), Default::default())
|
||||
};
|
||||
punct!(span, "{");
|
||||
}
|
||||
self.emit_list(
|
||||
node.span(),
|
||||
Some(&node.props),
|
||||
format | ListFormat::CanSkipTrailingComma,
|
||||
)?;
|
||||
punct!("}");
|
||||
{
|
||||
let span = if node.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(node.span.hi - BytePos(1), node.span.hi, Default::default())
|
||||
};
|
||||
punct!(span, "}");
|
||||
}
|
||||
if node.optional {
|
||||
punct!("?");
|
||||
}
|
||||
@ -2123,7 +2196,7 @@ impl<'a> Emitter<'a> {
|
||||
fn emit_debugger_stmt(&mut self, node: &DebuggerStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
|
||||
keyword!("debugger");
|
||||
keyword!(node.span, "debugger");
|
||||
formatting_semi!();
|
||||
}
|
||||
|
||||
@ -2140,14 +2213,22 @@ impl<'a> Emitter<'a> {
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_return_stmt(&mut self, node: &ReturnStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span, false)?;
|
||||
fn emit_return_stmt(&mut self, n: &ReturnStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(n.span, false)?;
|
||||
|
||||
keyword!("return");
|
||||
if let Some(ref arg) = node.arg {
|
||||
let need_paren = !node.arg.span().is_dummy()
|
||||
{
|
||||
let span = if n.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(n.span.lo, n.span.lo + BytePos(6), Default::default())
|
||||
};
|
||||
keyword!(span, "return");
|
||||
}
|
||||
|
||||
if let Some(ref arg) = n.arg {
|
||||
let need_paren = !n.arg.span().is_dummy()
|
||||
&& if let Some(cmt) = self.comments {
|
||||
let lo = node.arg.span().lo();
|
||||
let lo = n.arg.span().lo();
|
||||
|
||||
// see #415
|
||||
cmt.has_leading(lo)
|
||||
@ -2184,9 +2265,17 @@ impl<'a> Emitter<'a> {
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_break_stmt(&mut self, node: &BreakStmt) -> Result {
|
||||
keyword!("break");
|
||||
if let Some(ref label) = node.label {
|
||||
fn emit_break_stmt(&mut self, n: &BreakStmt) -> Result {
|
||||
{
|
||||
let span = if n.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(n.span.lo, n.span.lo + BytePos(5), Default::default())
|
||||
};
|
||||
keyword!(span, "break");
|
||||
}
|
||||
|
||||
if let Some(ref label) = n.label {
|
||||
space!();
|
||||
emit!(label);
|
||||
}
|
||||
@ -2194,9 +2283,16 @@ impl<'a> Emitter<'a> {
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_continue_stmt(&mut self, node: &ContinueStmt) -> Result {
|
||||
keyword!("continue");
|
||||
if let Some(ref label) = node.label {
|
||||
fn emit_continue_stmt(&mut self, n: &ContinueStmt) -> Result {
|
||||
{
|
||||
let span = if n.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(n.span.lo, n.span.lo + BytePos(8), Default::default())
|
||||
};
|
||||
keyword!(span, "continue");
|
||||
}
|
||||
if let Some(ref label) = n.label {
|
||||
space!();
|
||||
emit!(label);
|
||||
}
|
||||
@ -2204,28 +2300,32 @@ impl<'a> Emitter<'a> {
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_if_stmt(&mut self, node: &IfStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
fn emit_if_stmt(&mut self, n: &IfStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(n.span(), false)?;
|
||||
|
||||
{
|
||||
let span = self.cm.span_until_char(node.span, ' ');
|
||||
let span = if n.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(n.span.lo, n.span.lo + BytePos(2), Default::default())
|
||||
};
|
||||
keyword!(span, "if");
|
||||
}
|
||||
|
||||
formatting_space!();
|
||||
punct!("(");
|
||||
emit!(node.test);
|
||||
emit!(n.test);
|
||||
punct!(")");
|
||||
formatting_space!();
|
||||
|
||||
let is_cons_block = match *node.cons {
|
||||
let is_cons_block = match *n.cons {
|
||||
Stmt::Block(..) => true,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
emit!(node.cons);
|
||||
emit!(n.cons);
|
||||
|
||||
if let Some(ref alt) = node.alt {
|
||||
if let Some(ref alt) = n.alt {
|
||||
if is_cons_block {
|
||||
formatting_space!();
|
||||
}
|
||||
@ -2240,28 +2340,42 @@ impl<'a> Emitter<'a> {
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_switch_stmt(&mut self, node: &SwitchStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
fn emit_switch_stmt(&mut self, n: &SwitchStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(n.span(), false)?;
|
||||
|
||||
keyword!("switch");
|
||||
{
|
||||
let span = if n.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(n.span.lo, n.span.lo + BytePos(6), Default::default())
|
||||
};
|
||||
keyword!(span, "switch");
|
||||
}
|
||||
|
||||
punct!("(");
|
||||
emit!(node.discriminant);
|
||||
emit!(n.discriminant);
|
||||
punct!(")");
|
||||
|
||||
punct!("{");
|
||||
self.emit_list(node.span(), Some(&node.cases), ListFormat::CaseBlockClauses)?;
|
||||
self.emit_list(n.span(), Some(&n.cases), ListFormat::CaseBlockClauses)?;
|
||||
punct!("}");
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_catch_clause(&mut self, node: &CatchClause) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
fn emit_catch_clause(&mut self, n: &CatchClause) -> Result {
|
||||
self.emit_leading_comments_of_span(n.span(), false)?;
|
||||
|
||||
keyword!("catch");
|
||||
{
|
||||
let span = if n.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(n.span.lo, n.span.lo + BytePos(5), Default::default())
|
||||
};
|
||||
keyword!(span, "catch");
|
||||
}
|
||||
formatting_space!();
|
||||
|
||||
if let Some(param) = &node.param {
|
||||
if let Some(param) = &n.param {
|
||||
punct!("(");
|
||||
emit!(param);
|
||||
punct!(")");
|
||||
@ -2269,15 +2383,22 @@ impl<'a> Emitter<'a> {
|
||||
|
||||
formatting_space!();
|
||||
|
||||
emit!(node.body);
|
||||
emit!(n.body);
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_switch_case(&mut self, node: &SwitchCase) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
fn emit_switch_case(&mut self, n: &SwitchCase) -> Result {
|
||||
self.emit_leading_comments_of_span(n.span(), false)?;
|
||||
|
||||
if let Some(ref test) = node.test {
|
||||
keyword!("case");
|
||||
if let Some(ref test) = n.test {
|
||||
{
|
||||
let span = if n.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(n.span.lo, n.span.lo + BytePos(4), Default::default())
|
||||
};
|
||||
keyword!(span, "case");
|
||||
}
|
||||
|
||||
let starts_with_alpha_num = test.starts_with_alpha_num();
|
||||
|
||||
@ -2292,13 +2413,13 @@ impl<'a> Emitter<'a> {
|
||||
keyword!("default");
|
||||
}
|
||||
|
||||
let emit_as_single_stmt = node.cons.len() == 1 && {
|
||||
let emit_as_single_stmt = n.cons.len() == 1 && {
|
||||
// treat synthesized nodes as located on the same line for emit purposes
|
||||
node.is_synthesized()
|
||||
|| node.cons[0].is_synthesized()
|
||||
n.is_synthesized()
|
||||
|| n.cons[0].is_synthesized()
|
||||
|| self
|
||||
.cm
|
||||
.is_on_same_line(node.span().lo(), node.cons[0].span().lo())
|
||||
.is_on_same_line(n.span().lo(), n.cons[0].span().lo())
|
||||
};
|
||||
|
||||
let mut format = ListFormat::CaseOrDefaultClauseStatements;
|
||||
@ -2309,42 +2430,54 @@ impl<'a> Emitter<'a> {
|
||||
} else {
|
||||
punct!(":");
|
||||
}
|
||||
self.emit_list(node.span(), Some(&node.cons), format)?;
|
||||
self.emit_list(n.span(), Some(&n.cons), format)?;
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_throw_stmt(&mut self, node: &ThrowStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
|
||||
let throw_span = self.cm.span_until_char(node.span, ' ');
|
||||
|
||||
keyword!(throw_span, "throw");
|
||||
fn emit_throw_stmt(&mut self, n: &ThrowStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(n.span(), false)?;
|
||||
|
||||
{
|
||||
if node.arg.starts_with_alpha_num() {
|
||||
let span = if n.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(n.span.lo, n.span.lo + BytePos(5), Default::default())
|
||||
};
|
||||
keyword!(span, "throw");
|
||||
}
|
||||
|
||||
{
|
||||
if n.arg.starts_with_alpha_num() {
|
||||
space!();
|
||||
} else {
|
||||
formatting_space!();
|
||||
}
|
||||
emit!(node.arg);
|
||||
emit!(n.arg);
|
||||
}
|
||||
formatting_semi!();
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_try_stmt(&mut self, node: &TryStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
fn emit_try_stmt(&mut self, n: &TryStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(n.span(), false)?;
|
||||
|
||||
keyword!("try");
|
||||
{
|
||||
let span = if n.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(n.span.lo, n.span.lo + BytePos(3), Default::default())
|
||||
};
|
||||
keyword!(span, "try");
|
||||
}
|
||||
formatting_space!();
|
||||
emit!(node.block);
|
||||
emit!(n.block);
|
||||
|
||||
if let Some(ref catch) = node.handler {
|
||||
if let Some(ref catch) = n.handler {
|
||||
formatting_space!();
|
||||
emit!(catch);
|
||||
}
|
||||
|
||||
if let Some(ref finally) = node.finalizer {
|
||||
if let Some(ref finally) = n.finalizer {
|
||||
formatting_space!();
|
||||
keyword!("finally");
|
||||
// space!();
|
||||
@ -2387,30 +2520,44 @@ impl<'a> Emitter<'a> {
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_for_stmt(&mut self, node: &ForStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
fn emit_for_stmt(&mut self, n: &ForStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(n.span(), false)?;
|
||||
|
||||
keyword!("for");
|
||||
{
|
||||
let span = if n.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(n.span.lo, n.span.lo + BytePos(3), Default::default())
|
||||
};
|
||||
keyword!(span, "for");
|
||||
}
|
||||
punct!("(");
|
||||
opt!(node.init);
|
||||
opt!(n.init);
|
||||
semi!();
|
||||
opt_leading_space!(node.test);
|
||||
opt_leading_space!(n.test);
|
||||
semi!();
|
||||
opt_leading_space!(node.update);
|
||||
opt_leading_space!(n.update);
|
||||
punct!(")");
|
||||
|
||||
emit!(node.body);
|
||||
emit!(n.body);
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_for_in_stmt(&mut self, node: &ForInStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
fn emit_for_in_stmt(&mut self, n: &ForInStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(n.span(), false)?;
|
||||
|
||||
keyword!("for");
|
||||
{
|
||||
let span = if n.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(n.span.lo, n.span.lo + BytePos(3), Default::default())
|
||||
};
|
||||
keyword!(span, "for");
|
||||
}
|
||||
punct!("(");
|
||||
emit!(node.left);
|
||||
emit!(n.left);
|
||||
|
||||
if node.left.ends_with_alpha_num() {
|
||||
if n.left.ends_with_alpha_num() {
|
||||
space!();
|
||||
} else {
|
||||
formatting_space!();
|
||||
@ -2418,34 +2565,41 @@ impl<'a> Emitter<'a> {
|
||||
keyword!("in");
|
||||
|
||||
{
|
||||
let starts_with_alpha_num = node.right.starts_with_alpha_num();
|
||||
let starts_with_alpha_num = n.right.starts_with_alpha_num();
|
||||
|
||||
if starts_with_alpha_num {
|
||||
space!();
|
||||
} else {
|
||||
formatting_space!()
|
||||
}
|
||||
emit!(node.right);
|
||||
emit!(n.right);
|
||||
}
|
||||
|
||||
punct!(")");
|
||||
|
||||
emit!(node.body);
|
||||
emit!(n.body);
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_for_of_stmt(&mut self, node: &ForOfStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
fn emit_for_of_stmt(&mut self, n: &ForOfStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(n.span(), false)?;
|
||||
|
||||
keyword!("for");
|
||||
if node.await_token.is_some() {
|
||||
{
|
||||
let span = if n.span.is_dummy() {
|
||||
DUMMY_SP
|
||||
} else {
|
||||
Span::new(n.span.lo, n.span.lo + BytePos(3), Default::default())
|
||||
};
|
||||
keyword!(span, "for");
|
||||
}
|
||||
if n.await_token.is_some() {
|
||||
space!();
|
||||
keyword!("await");
|
||||
}
|
||||
formatting_space!();
|
||||
punct!("(");
|
||||
emit!(node.left);
|
||||
if node.left.ends_with_alpha_num() {
|
||||
emit!(n.left);
|
||||
if n.left.ends_with_alpha_num() {
|
||||
space!();
|
||||
} else {
|
||||
formatting_space!();
|
||||
@ -2453,17 +2607,17 @@ impl<'a> Emitter<'a> {
|
||||
keyword!("of");
|
||||
|
||||
{
|
||||
let starts_with_alpha_num = node.right.starts_with_alpha_num();
|
||||
let starts_with_alpha_num = n.right.starts_with_alpha_num();
|
||||
|
||||
if starts_with_alpha_num {
|
||||
space!();
|
||||
} else {
|
||||
formatting_space!()
|
||||
}
|
||||
emit!(node.right);
|
||||
emit!(n.right);
|
||||
}
|
||||
punct!(")");
|
||||
emit!(node.body);
|
||||
emit!(n.body);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "src/lists/*.json"]
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_ecma_minifier"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.22.1"
|
||||
version = "0.22.2"
|
||||
|
||||
[features]
|
||||
debug = []
|
||||
|
@ -1653,6 +1653,14 @@ impl VisitMut for Optimizer<'_> {
|
||||
};
|
||||
e.visit_mut_children_with(&mut *self.with_ctx(ctx));
|
||||
|
||||
match e {
|
||||
Expr::Seq(seq) if seq.exprs.len() == 1 => {
|
||||
*e = *seq.exprs[0].take();
|
||||
}
|
||||
|
||||
_ => {}
|
||||
}
|
||||
|
||||
self.remove_invalid(e);
|
||||
|
||||
self.optimize_str_access_to_arguments(e);
|
||||
|
@ -6,7 +6,7 @@ use once_cell::sync::Lazy;
|
||||
use serde::Deserialize;
|
||||
use std::{
|
||||
env,
|
||||
fmt::Debug,
|
||||
fmt::{self, Debug},
|
||||
fs::read_to_string,
|
||||
panic::catch_unwind,
|
||||
path::{Path, PathBuf},
|
||||
@ -15,7 +15,7 @@ use std::{
|
||||
};
|
||||
use swc_common::{
|
||||
comments::SingleThreadedComments, errors::Handler, sync::Lrc, EqIgnoreSpan, FileName, Mark,
|
||||
SourceMap,
|
||||
SourceMap, Spanned,
|
||||
};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_codegen::{text_writer::JsWriter, Emitter};
|
||||
@ -32,7 +32,7 @@ use swc_ecma_parser::{
|
||||
};
|
||||
use swc_ecma_transforms::{fixer, hygiene, resolver_with_mark};
|
||||
use swc_ecma_utils::drop_span;
|
||||
use swc_ecma_visit::FoldWith;
|
||||
use swc_ecma_visit::{FoldWith, Node, Visit, VisitWith};
|
||||
use testing::{assert_eq, DebugUsingDisplay, NormalizedOutput};
|
||||
|
||||
fn load_txt(filename: &str) -> Vec<String> {
|
||||
@ -471,3 +471,850 @@ fn print<N: swc_ecma_codegen::Node>(cm: Lrc<SourceMap>, nodes: &[N], minify: boo
|
||||
|
||||
String::from_utf8(buf).unwrap()
|
||||
}
|
||||
|
||||
struct Shower<'a> {
|
||||
cm: Lrc<SourceMap>,
|
||||
handler: &'a Handler,
|
||||
}
|
||||
|
||||
impl Shower<'_> {
|
||||
fn show<N>(&self, name: &str, node: &N)
|
||||
where
|
||||
N: Spanned + fmt::Debug + swc_ecma_codegen::Node,
|
||||
{
|
||||
let span = node.span();
|
||||
|
||||
if span.is_dummy() {
|
||||
let src = print(self.cm.clone(), &[node], false);
|
||||
self.handler
|
||||
.struct_span_warn(span, &format!("{}: {}", name, src))
|
||||
.emit();
|
||||
} else {
|
||||
self.handler.struct_span_warn(span, name).emit();
|
||||
}
|
||||
}
|
||||
|
||||
fn show_name<N>(&self, name: &str, node: &N)
|
||||
where
|
||||
N: Spanned + fmt::Debug,
|
||||
{
|
||||
let span = node.span();
|
||||
|
||||
if span.is_dummy() {
|
||||
self.handler
|
||||
.struct_span_warn(span, &format!("{:?}", node))
|
||||
.emit();
|
||||
} else {
|
||||
self.handler.struct_span_warn(span, name).emit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Visit for Shower<'_> {
|
||||
fn visit_array_lit(&mut self, n: &ArrayLit, _parent: &dyn Node) {
|
||||
self.show("ArrayLit", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_array_pat(&mut self, n: &ArrayPat, _parent: &dyn Node) {
|
||||
self.show("ArrayPat", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_arrow_expr(&mut self, n: &ArrowExpr, _parent: &dyn Node) {
|
||||
self.show("ArrowExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_assign_expr(&mut self, n: &AssignExpr, _parent: &dyn Node) {
|
||||
self.show("AssignExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_assign_pat(&mut self, n: &AssignPat, _parent: &dyn Node) {
|
||||
self.show("AssignPat", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_assign_pat_prop(&mut self, n: &AssignPatProp, _parent: &dyn Node) {
|
||||
self.show("AssignPatProp", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_assign_prop(&mut self, n: &AssignProp, _parent: &dyn Node) {
|
||||
self.show("AssignProp", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_await_expr(&mut self, n: &AwaitExpr, _parent: &dyn Node) {
|
||||
self.show("AwaitExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_bin_expr(&mut self, n: &BinExpr, _parent: &dyn Node) {
|
||||
self.show("BinExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_block_stmt(&mut self, n: &BlockStmt, _parent: &dyn Node) {
|
||||
self.show("BlockStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_block_stmt_or_expr(&mut self, n: &BlockStmtOrExpr, _parent: &dyn Node) {
|
||||
self.show("BlockStmtOrExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_bool(&mut self, n: &Bool, _parent: &dyn Node) {
|
||||
self.show("Bool", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_break_stmt(&mut self, n: &BreakStmt, _parent: &dyn Node) {
|
||||
self.show("BreakStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_call_expr(&mut self, n: &CallExpr, _parent: &dyn Node) {
|
||||
self.show("CallExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_catch_clause(&mut self, n: &CatchClause, _parent: &dyn Node) {
|
||||
self.show("CatchClause", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_class(&mut self, n: &Class, _parent: &dyn Node) {
|
||||
self.show("Class", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_class_decl(&mut self, n: &ClassDecl, _parent: &dyn Node) {
|
||||
self.show("ClassDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_class_expr(&mut self, n: &ClassExpr, _parent: &dyn Node) {
|
||||
self.show("ClassExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_class_member(&mut self, n: &ClassMember, _parent: &dyn Node) {
|
||||
self.show("ClassMember", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_class_method(&mut self, n: &ClassMethod, _parent: &dyn Node) {
|
||||
self.show("ClassMethod", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_class_prop(&mut self, n: &ClassProp, _parent: &dyn Node) {
|
||||
self.show("ClassProp", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_computed_prop_name(&mut self, n: &ComputedPropName, _parent: &dyn Node) {
|
||||
self.show("ComputedPropName", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_cond_expr(&mut self, n: &CondExpr, _parent: &dyn Node) {
|
||||
self.show("CondExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_constructor(&mut self, n: &Constructor, _parent: &dyn Node) {
|
||||
self.show("Constructor", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_continue_stmt(&mut self, n: &ContinueStmt, _parent: &dyn Node) {
|
||||
self.show("ContinueStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_debugger_stmt(&mut self, n: &DebuggerStmt, _parent: &dyn Node) {
|
||||
self.show("DebuggerStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_decl(&mut self, n: &Decl, _parent: &dyn Node) {
|
||||
self.show("Decl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_decorator(&mut self, n: &Decorator, _parent: &dyn Node) {
|
||||
self.show("Decorator", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_default_decl(&mut self, n: &DefaultDecl, _parent: &dyn Node) {
|
||||
self.show_name("DefaultDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_do_while_stmt(&mut self, n: &DoWhileStmt, _parent: &dyn Node) {
|
||||
self.show("DoWhileStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_empty_stmt(&mut self, n: &EmptyStmt, _parent: &dyn Node) {
|
||||
self.show("EmptyStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_export_all(&mut self, n: &ExportAll, _parent: &dyn Node) {
|
||||
self.show("ExportAll", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_export_decl(&mut self, n: &ExportDecl, _parent: &dyn Node) {
|
||||
self.show("ExportDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_export_default_decl(&mut self, n: &ExportDefaultDecl, _parent: &dyn Node) {
|
||||
self.show("ExportDefaultDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_export_default_expr(&mut self, n: &ExportDefaultExpr, _parent: &dyn Node) {
|
||||
self.show("ExportDefaultExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_export_default_specifier(&mut self, n: &ExportDefaultSpecifier, _parent: &dyn Node) {
|
||||
self.show_name("ExportDefaultSpecifier", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_export_named_specifier(&mut self, n: &ExportNamedSpecifier, _parent: &dyn Node) {
|
||||
self.show("ExportNamedSpecifier", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_export_namespace_specifier(
|
||||
&mut self,
|
||||
n: &ExportNamespaceSpecifier,
|
||||
_parent: &dyn Node,
|
||||
) {
|
||||
self.show("ExportNamespaceSpecifier", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_export_specifier(&mut self, n: &ExportSpecifier, _parent: &dyn Node) {
|
||||
self.show("ExportSpecifier", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_expr(&mut self, n: &Expr, _parent: &dyn Node) {
|
||||
self.show("Expr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_expr_or_spread(&mut self, n: &ExprOrSpread, _parent: &dyn Node) {
|
||||
self.show("ExprOrSpread", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_expr_or_super(&mut self, n: &ExprOrSuper, _parent: &dyn Node) {
|
||||
self.show("ExprOrSuper", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_fn_decl(&mut self, n: &FnDecl, _parent: &dyn Node) {
|
||||
self.show("FnDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_fn_expr(&mut self, n: &FnExpr, _parent: &dyn Node) {
|
||||
self.show("FnExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_for_in_stmt(&mut self, n: &ForInStmt, _parent: &dyn Node) {
|
||||
self.show("ForInStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_for_of_stmt(&mut self, n: &ForOfStmt, _parent: &dyn Node) {
|
||||
self.show("ForOfStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_for_stmt(&mut self, n: &ForStmt, _parent: &dyn Node) {
|
||||
self.show("ForStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_function(&mut self, n: &Function, _parent: &dyn Node) {
|
||||
self.show("Function", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_getter_prop(&mut self, n: &GetterProp, _parent: &dyn Node) {
|
||||
self.show("GetterProp", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ident(&mut self, n: &Ident, _parent: &dyn Node) {
|
||||
self.show("Ident", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_if_stmt(&mut self, n: &IfStmt, _parent: &dyn Node) {
|
||||
self.show("IfStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_import_decl(&mut self, n: &ImportDecl, _parent: &dyn Node) {
|
||||
self.show("ImportDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_import_default_specifier(&mut self, n: &ImportDefaultSpecifier, _parent: &dyn Node) {
|
||||
self.show_name("ImportDefaultSpecifier", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_import_named_specifier(&mut self, n: &ImportNamedSpecifier, _parent: &dyn Node) {
|
||||
self.show("ImportNamedSpecifier", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_import_specifier(&mut self, n: &ImportSpecifier, _parent: &dyn Node) {
|
||||
self.show_name("ImportSpecifier", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_import_star_as_specifier(&mut self, n: &ImportStarAsSpecifier, _parent: &dyn Node) {
|
||||
self.show_name("ImportStarAsSpecifier", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_invalid(&mut self, n: &Invalid, _parent: &dyn Node) {
|
||||
self.show("Invalid", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_attr(&mut self, n: &JSXAttr, _parent: &dyn Node) {
|
||||
self.show("JSXAttr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_attr_name(&mut self, n: &JSXAttrName, _parent: &dyn Node) {
|
||||
self.show("JSXAttrName", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_attr_or_spread(&mut self, n: &JSXAttrOrSpread, _parent: &dyn Node) {
|
||||
self.show("JSXAttrOrSpread", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_attr_value(&mut self, n: &JSXAttrValue, _parent: &dyn Node) {
|
||||
self.show("JSXAttrValue", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_closing_element(&mut self, n: &JSXClosingElement, _parent: &dyn Node) {
|
||||
self.show("JSXClosingElement", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_closing_fragment(&mut self, n: &JSXClosingFragment, _parent: &dyn Node) {
|
||||
self.show("JSXClosingFragment", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_element(&mut self, n: &JSXElement, _parent: &dyn Node) {
|
||||
self.show("JSXElement", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_element_child(&mut self, n: &JSXElementChild, _parent: &dyn Node) {
|
||||
self.show("JSXElementChild", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_element_name(&mut self, n: &JSXElementName, _parent: &dyn Node) {
|
||||
self.show("JSXElementName", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_empty_expr(&mut self, n: &JSXEmptyExpr, _parent: &dyn Node) {
|
||||
self.show("JSXEmptyExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_expr(&mut self, n: &JSXExpr, _parent: &dyn Node) {
|
||||
self.show("JSXExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_expr_container(&mut self, n: &JSXExprContainer, _parent: &dyn Node) {
|
||||
self.show("JSXExprContainer", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_fragment(&mut self, n: &JSXFragment, _parent: &dyn Node) {
|
||||
self.show("JSXFragment", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_member_expr(&mut self, n: &JSXMemberExpr, _parent: &dyn Node) {
|
||||
self.show("JSXMemberExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_namespaced_name(&mut self, n: &JSXNamespacedName, _parent: &dyn Node) {
|
||||
self.show("JSXNamespacedName", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_object(&mut self, n: &JSXObject, _parent: &dyn Node) {
|
||||
self.show("JSXObject", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_opening_element(&mut self, n: &JSXOpeningElement, _parent: &dyn Node) {
|
||||
self.show("JSXOpeningElement", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_opening_fragment(&mut self, n: &JSXOpeningFragment, _parent: &dyn Node) {
|
||||
self.show("JSXOpeningFragment", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_spread_child(&mut self, n: &JSXSpreadChild, _parent: &dyn Node) {
|
||||
self.show("JSXSpreadChild", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_jsx_text(&mut self, n: &JSXText, _parent: &dyn Node) {
|
||||
self.show("JSXText", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_key_value_pat_prop(&mut self, n: &KeyValuePatProp, _parent: &dyn Node) {
|
||||
self.show("KeyValuePatProp", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_key_value_prop(&mut self, n: &KeyValueProp, _parent: &dyn Node) {
|
||||
self.show("KeyValueProp", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_labeled_stmt(&mut self, n: &LabeledStmt, _parent: &dyn Node) {
|
||||
self.show("LabeledStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_lit(&mut self, n: &Lit, _parent: &dyn Node) {
|
||||
self.show("Lit", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_member_expr(&mut self, n: &MemberExpr, _parent: &dyn Node) {
|
||||
self.show("MemberExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_meta_prop_expr(&mut self, n: &MetaPropExpr, _parent: &dyn Node) {
|
||||
self.show("MetaPropExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_method_prop(&mut self, n: &MethodProp, _parent: &dyn Node) {
|
||||
self.show("MethodProp", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_module(&mut self, n: &Module, _parent: &dyn Node) {
|
||||
self.show("Module", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_module_decl(&mut self, n: &ModuleDecl, _parent: &dyn Node) {
|
||||
self.show("ModuleDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_named_export(&mut self, n: &NamedExport, _parent: &dyn Node) {
|
||||
self.show("NamedExport", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_new_expr(&mut self, n: &NewExpr, _parent: &dyn Node) {
|
||||
self.show("NewExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_null(&mut self, n: &Null, _parent: &dyn Node) {
|
||||
self.show_name("Null", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_number(&mut self, n: &Number, _parent: &dyn Node) {
|
||||
self.show("Number", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_object_lit(&mut self, n: &ObjectLit, _parent: &dyn Node) {
|
||||
self.show("ObjectLit", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_object_pat(&mut self, n: &ObjectPat, _parent: &dyn Node) {
|
||||
self.show("ObjectPat", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_object_pat_prop(&mut self, n: &ObjectPatProp, _parent: &dyn Node) {
|
||||
self.show("ObjectPatProp", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_opt_chain_expr(&mut self, n: &OptChainExpr, _parent: &dyn Node) {
|
||||
self.show("OptChainExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_param(&mut self, n: &Param, _parent: &dyn Node) {
|
||||
self.show("Param", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_param_or_ts_param_prop(&mut self, n: &ParamOrTsParamProp, _parent: &dyn Node) {
|
||||
self.show("ParamOrTsParamProp", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_paren_expr(&mut self, n: &ParenExpr, _parent: &dyn Node) {
|
||||
self.show("ParenExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_pat(&mut self, n: &Pat, _parent: &dyn Node) {
|
||||
self.show("Pat", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_pat_or_expr(&mut self, n: &PatOrExpr, _parent: &dyn Node) {
|
||||
self.show("PatOrExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_private_method(&mut self, n: &PrivateMethod, _parent: &dyn Node) {
|
||||
self.show("PrivateMethod", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_private_name(&mut self, n: &PrivateName, _parent: &dyn Node) {
|
||||
self.show("PrivateName", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_private_prop(&mut self, n: &PrivateProp, _parent: &dyn Node) {
|
||||
self.show("PrivateProp", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_program(&mut self, n: &Program, _parent: &dyn Node) {
|
||||
self.show("Program", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_prop(&mut self, n: &Prop, _parent: &dyn Node) {
|
||||
self.show("Prop", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_prop_name(&mut self, n: &PropName, _parent: &dyn Node) {
|
||||
self.show("PropName", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_prop_or_spread(&mut self, n: &PropOrSpread, _parent: &dyn Node) {
|
||||
self.show("PropOrSpread", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_regex(&mut self, n: &Regex, _parent: &dyn Node) {
|
||||
self.show_name("Regex", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_rest_pat(&mut self, n: &RestPat, _parent: &dyn Node) {
|
||||
self.show("RestPat", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_return_stmt(&mut self, n: &ReturnStmt, _parent: &dyn Node) {
|
||||
self.show("ReturnStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_script(&mut self, n: &Script, _parent: &dyn Node) {
|
||||
self.show("Script", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_seq_expr(&mut self, n: &SeqExpr, _parent: &dyn Node) {
|
||||
self.show("SeqExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_setter_prop(&mut self, n: &SetterProp, _parent: &dyn Node) {
|
||||
self.show("SetterProp", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_spread_element(&mut self, n: &SpreadElement, _parent: &dyn Node) {
|
||||
self.show("SpreadElement", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_str(&mut self, n: &Str, _parent: &dyn Node) {
|
||||
self.show("Str", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_super(&mut self, n: &Super, _parent: &dyn Node) {
|
||||
self.show("Super", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_switch_case(&mut self, n: &SwitchCase, _parent: &dyn Node) {
|
||||
self.show("SwitchCase", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_switch_stmt(&mut self, n: &SwitchStmt, _parent: &dyn Node) {
|
||||
self.show("SwitchStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_tagged_tpl(&mut self, n: &TaggedTpl, _parent: &dyn Node) {
|
||||
self.show("TaggedTpl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_this_expr(&mut self, n: &ThisExpr, _parent: &dyn Node) {
|
||||
self.show("ThisExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_throw_stmt(&mut self, n: &ThrowStmt, _parent: &dyn Node) {
|
||||
self.show("ThrowStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_tpl(&mut self, n: &Tpl, _parent: &dyn Node) {
|
||||
self.show("Tpl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_tpl_element(&mut self, n: &TplElement, _parent: &dyn Node) {
|
||||
self.show("TplElement", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_try_stmt(&mut self, n: &TryStmt, _parent: &dyn Node) {
|
||||
self.show("TryStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_array_type(&mut self, n: &TsArrayType, _parent: &dyn Node) {
|
||||
self.show("TsArrayType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_as_expr(&mut self, n: &TsAsExpr, _parent: &dyn Node) {
|
||||
self.show("TsAsExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_call_signature_decl(&mut self, n: &TsCallSignatureDecl, _parent: &dyn Node) {
|
||||
self.show("TsCallSignatureDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_conditional_type(&mut self, n: &TsConditionalType, _parent: &dyn Node) {
|
||||
self.show("TsConditionalType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_const_assertion(&mut self, n: &TsConstAssertion, _parent: &dyn Node) {
|
||||
self.show("TsConstAssertion", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_construct_signature_decl(
|
||||
&mut self,
|
||||
n: &TsConstructSignatureDecl,
|
||||
_parent: &dyn Node,
|
||||
) {
|
||||
self.show("TsConstructSignatureDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_constructor_type(&mut self, n: &TsConstructorType, _parent: &dyn Node) {
|
||||
self.show("TsConstructorType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_entity_name(&mut self, n: &TsEntityName, _parent: &dyn Node) {
|
||||
self.show("TsEntityName", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_enum_decl(&mut self, n: &TsEnumDecl, _parent: &dyn Node) {
|
||||
self.show("TsEnumDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_enum_member(&mut self, n: &TsEnumMember, _parent: &dyn Node) {
|
||||
self.show("TsEnumMember", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_enum_member_id(&mut self, n: &TsEnumMemberId, _parent: &dyn Node) {
|
||||
self.show("TsEnumMemberId", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_export_assignment(&mut self, n: &TsExportAssignment, _parent: &dyn Node) {
|
||||
self.show("TsExportAssignment", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_expr_with_type_args(&mut self, n: &TsExprWithTypeArgs, _parent: &dyn Node) {
|
||||
self.show("TsExprWithTypeArgs", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_external_module_ref(&mut self, n: &TsExternalModuleRef, _parent: &dyn Node) {
|
||||
self.show("TsExternalModuleRef", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_fn_or_constructor_type(&mut self, n: &TsFnOrConstructorType, _parent: &dyn Node) {
|
||||
self.show("TsFnOrConstructorType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_fn_param(&mut self, n: &TsFnParam, _parent: &dyn Node) {
|
||||
self.show("TsFnParam", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_fn_type(&mut self, n: &TsFnType, _parent: &dyn Node) {
|
||||
self.show("TsFnType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_import_equals_decl(&mut self, n: &TsImportEqualsDecl, _parent: &dyn Node) {
|
||||
self.show("TsImportEqualsDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_import_type(&mut self, n: &TsImportType, _parent: &dyn Node) {
|
||||
self.show("TsImportType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_index_signature(&mut self, n: &TsIndexSignature, _parent: &dyn Node) {
|
||||
self.show("TsIndexSignature", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_indexed_access_type(&mut self, n: &TsIndexedAccessType, _parent: &dyn Node) {
|
||||
self.show("TsIndexedAccessType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_infer_type(&mut self, n: &TsInferType, _parent: &dyn Node) {
|
||||
self.show("TsInferType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_interface_body(&mut self, n: &TsInterfaceBody, _parent: &dyn Node) {
|
||||
self.show("TsInterfaceBody", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_interface_decl(&mut self, n: &TsInterfaceDecl, _parent: &dyn Node) {
|
||||
self.show("TsInterfaceDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_intersection_type(&mut self, n: &TsIntersectionType, _parent: &dyn Node) {
|
||||
self.show("TsIntersectionType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_keyword_type(&mut self, n: &TsKeywordType, _parent: &dyn Node) {
|
||||
self.show("TsKeywordType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
|
||||
fn visit_ts_lit(&mut self, n: &TsLit, _parent: &dyn Node) {
|
||||
self.show("TsLit", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_lit_type(&mut self, n: &TsLitType, _parent: &dyn Node) {
|
||||
self.show("TsLitType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_mapped_type(&mut self, n: &TsMappedType, _parent: &dyn Node) {
|
||||
self.show("TsMappedType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_method_signature(&mut self, n: &TsMethodSignature, _parent: &dyn Node) {
|
||||
self.show("TsMethodSignature", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_module_block(&mut self, n: &TsModuleBlock, _parent: &dyn Node) {
|
||||
self.show("TsModuleBlock", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_module_decl(&mut self, n: &TsModuleDecl, _parent: &dyn Node) {
|
||||
self.show("TsModuleDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_module_name(&mut self, n: &TsModuleName, _parent: &dyn Node) {
|
||||
self.show("TsModuleName", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_module_ref(&mut self, n: &TsModuleRef, _parent: &dyn Node) {
|
||||
self.show("TsModuleRef", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_namespace_body(&mut self, n: &TsNamespaceBody, _parent: &dyn Node) {
|
||||
self.show("TsNamespaceBody", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_namespace_decl(&mut self, n: &TsNamespaceDecl, _parent: &dyn Node) {
|
||||
self.show("TsNamespaceDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_namespace_export_decl(&mut self, n: &TsNamespaceExportDecl, _parent: &dyn Node) {
|
||||
self.show("TsNamespaceExportDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_non_null_expr(&mut self, n: &TsNonNullExpr, _parent: &dyn Node) {
|
||||
self.show("TsNonNullExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_optional_type(&mut self, n: &TsOptionalType, _parent: &dyn Node) {
|
||||
self.show("TsOptionalType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_param_prop(&mut self, n: &TsParamProp, _parent: &dyn Node) {
|
||||
self.show("TsParamProp", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_param_prop_param(&mut self, n: &TsParamPropParam, _parent: &dyn Node) {
|
||||
self.show("TsParamPropParam", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_parenthesized_type(&mut self, n: &TsParenthesizedType, _parent: &dyn Node) {
|
||||
self.show("TsParenthesizedType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_property_signature(&mut self, n: &TsPropertySignature, _parent: &dyn Node) {
|
||||
self.show("TsPropertySignature", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_qualified_name(&mut self, n: &TsQualifiedName, _parent: &dyn Node) {
|
||||
self.show("TsQualifiedName", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_rest_type(&mut self, n: &TsRestType, _parent: &dyn Node) {
|
||||
self.show("TsRestType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_this_type(&mut self, n: &TsThisType, _parent: &dyn Node) {
|
||||
self.show("TsThisType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_this_type_or_ident(&mut self, n: &TsThisTypeOrIdent, _parent: &dyn Node) {
|
||||
self.show("TsThisTypeOrIdent", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_tuple_element(&mut self, n: &TsTupleElement, _parent: &dyn Node) {
|
||||
self.show("TsTupleElement", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_tuple_type(&mut self, n: &TsTupleType, _parent: &dyn Node) {
|
||||
self.show("TsTupleType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_type(&mut self, n: &TsType, _parent: &dyn Node) {
|
||||
self.show("TsType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_type_alias_decl(&mut self, n: &TsTypeAliasDecl, _parent: &dyn Node) {
|
||||
self.show("TsTypeAliasDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_type_ann(&mut self, n: &TsTypeAnn, _parent: &dyn Node) {
|
||||
self.show("TsTypeAnn", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_type_assertion(&mut self, n: &TsTypeAssertion, _parent: &dyn Node) {
|
||||
self.show("TsTypeAssertion", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_type_element(&mut self, n: &TsTypeElement, _parent: &dyn Node) {
|
||||
self.show("TsTypeElement", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_type_lit(&mut self, n: &TsTypeLit, _parent: &dyn Node) {
|
||||
self.show("TsTypeLit", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_type_operator(&mut self, n: &TsTypeOperator, _parent: &dyn Node) {
|
||||
self.show("TsTypeOperator", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
|
||||
fn visit_ts_type_param(&mut self, n: &TsTypeParam, _parent: &dyn Node) {
|
||||
self.show("TsTypeParam", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_type_param_decl(&mut self, n: &TsTypeParamDecl, _parent: &dyn Node) {
|
||||
self.show("TsTypeParamDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_type_param_instantiation(
|
||||
&mut self,
|
||||
n: &TsTypeParamInstantiation,
|
||||
_parent: &dyn Node,
|
||||
) {
|
||||
self.show("TsTypeParamInstantiation", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_type_predicate(&mut self, n: &TsTypePredicate, _parent: &dyn Node) {
|
||||
self.show("TsTypePredicate", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_type_query(&mut self, n: &TsTypeQuery, _parent: &dyn Node) {
|
||||
self.show("TsTypeQuery", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_type_query_expr(&mut self, n: &TsTypeQueryExpr, _parent: &dyn Node) {
|
||||
self.show("TsTypeQueryExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_type_ref(&mut self, n: &TsTypeRef, _parent: &dyn Node) {
|
||||
self.show("TsTypeRef", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_union_or_intersection_type(
|
||||
&mut self,
|
||||
n: &TsUnionOrIntersectionType,
|
||||
_parent: &dyn Node,
|
||||
) {
|
||||
self.show("TsUnionOrIntersectionType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_ts_union_type(&mut self, n: &TsUnionType, _parent: &dyn Node) {
|
||||
self.show("TsUnionType", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_unary_expr(&mut self, n: &UnaryExpr, _parent: &dyn Node) {
|
||||
self.show("UnaryExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_update_expr(&mut self, n: &UpdateExpr, _parent: &dyn Node) {
|
||||
self.show("UpdateExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_var_decl(&mut self, n: &VarDecl, _parent: &dyn Node) {
|
||||
self.show("VarDecl", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_var_decl_or_expr(&mut self, n: &VarDeclOrExpr, _parent: &dyn Node) {
|
||||
self.show("VarDeclOrExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_var_decl_or_pat(&mut self, n: &VarDeclOrPat, _parent: &dyn Node) {
|
||||
self.show("VarDeclOrPat", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_var_declarator(&mut self, n: &VarDeclarator, _parent: &dyn Node) {
|
||||
self.show("VarDeclarator", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_while_stmt(&mut self, n: &WhileStmt, _parent: &dyn Node) {
|
||||
self.show("WhileStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_with_stmt(&mut self, n: &WithStmt, _parent: &dyn Node) {
|
||||
self.show("WithStmt", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
fn visit_yield_expr(&mut self, n: &YieldExpr, _parent: &dyn Node) {
|
||||
self.show("YieldExpr", n);
|
||||
n.visit_children_with(self)
|
||||
}
|
||||
}
|
||||
|
@ -2598,13 +2598,13 @@
|
||||
var promise, pathVal = locals && locals.hasOwnProperty(key0) ? locals : scope;
|
||||
return null === pathVal || pathVal === undefined || ((pathVal = pathVal[key0]) && pathVal.then && (promiseWarning(fullExp), "$$v" in pathVal || ((promise = pathVal).$$v = undefined, promise.then(function(val) {
|
||||
promise.$$v = val;
|
||||
})), pathVal = pathVal.$$v), key1 && null !== pathVal && pathVal !== undefined && ((pathVal = pathVal[key1]) && pathVal.then && (promiseWarning(fullExp), "$$v" in pathVal || ((promise = pathVal).$$v = undefined, promise.then(function(val) {
|
||||
})), pathVal = pathVal.$$v), !key1 || null === pathVal || pathVal === undefined || ((pathVal = pathVal[key1]) && pathVal.then && (promiseWarning(fullExp), "$$v" in pathVal || ((promise = pathVal).$$v = undefined, promise.then(function(val) {
|
||||
promise.$$v = val;
|
||||
})), pathVal = pathVal.$$v), key2 && null !== pathVal && pathVal !== undefined && ((pathVal = pathVal[key2]) && pathVal.then && (promiseWarning(fullExp), "$$v" in pathVal || ((promise = pathVal).$$v = undefined, promise.then(function(val) {
|
||||
})), pathVal = pathVal.$$v), !key2 || null === pathVal || pathVal === undefined || ((pathVal = pathVal[key2]) && pathVal.then && (promiseWarning(fullExp), "$$v" in pathVal || ((promise = pathVal).$$v = undefined, promise.then(function(val) {
|
||||
promise.$$v = val;
|
||||
})), pathVal = pathVal.$$v), key3 && null !== pathVal && pathVal !== undefined && ((pathVal = pathVal[key3]) && pathVal.then && (promiseWarning(fullExp), "$$v" in pathVal || ((promise = pathVal).$$v = undefined, promise.then(function(val) {
|
||||
})), pathVal = pathVal.$$v), !key3 || null === pathVal || pathVal === undefined || ((pathVal = pathVal[key3]) && pathVal.then && (promiseWarning(fullExp), "$$v" in pathVal || ((promise = pathVal).$$v = undefined, promise.then(function(val) {
|
||||
promise.$$v = val;
|
||||
})), pathVal = pathVal.$$v), key4 && null !== pathVal && pathVal !== undefined && (pathVal = pathVal[key4]) && pathVal.then && (promiseWarning(fullExp), "$$v" in pathVal || ((promise = pathVal).$$v = undefined, promise.then(function(val) {
|
||||
})), pathVal = pathVal.$$v), !key4 || null === pathVal || pathVal === undefined || (pathVal = pathVal[key4]) && pathVal.then && (promiseWarning(fullExp), "$$v" in pathVal || ((promise = pathVal).$$v = undefined, promise.then(function(val) {
|
||||
promise.$$v = val;
|
||||
})), pathVal = pathVal.$$v))))), pathVal;
|
||||
} : function(scope, locals) {
|
||||
|
@ -561,6 +561,7 @@
|
||||
}
|
||||
});
|
||||
})(jQuery, this), (function($17, window, undefined) {
|
||||
"$:nomunge";
|
||||
var fake_onhashchange, doc = document, special = $17.event.special, doc_mode = doc.documentMode, supports_onhashchange = "onhashchange" in window && (doc_mode === undefined || doc_mode > 7);
|
||||
function get_fragment(url) {
|
||||
return "#" + (url = url || location.href).replace(/^[^#]*#?(.*)$/, "$1");
|
||||
@ -2594,7 +2595,7 @@
|
||||
this._keySliding && (this._keySliding = !1, this.handle.removeClass("ui-state-active"));
|
||||
},
|
||||
_sliderVMouseDown: function(event) {
|
||||
return !this.options.disabled && !!(1 === event.which || 0 === event.which || undefined === event.which) && !1 !== this._trigger("beforestart", event) && (this.dragging = !0, this.userModified = !1, this.mouseMoved = !1, this.isToggleSwitch && (this.beforeStart = this.element[0].selectedIndex), this.refresh(event), this._trigger("start"), !1);
|
||||
return this.options.disabled || !(1 === event.which || 0 === event.which || undefined === event.which) || !1 === this._trigger("beforestart", event) || (this.dragging = !0, this.userModified = !1, this.mouseMoved = !1, this.isToggleSwitch && (this.beforeStart = this.element[0].selectedIndex), this.refresh(event), this._trigger("start")), !1;
|
||||
},
|
||||
_sliderVMouseUp: function() {
|
||||
if (this.dragging) return this.dragging = !1, this.isToggleSwitch && (this.handle.addClass("ui-slider-handle-snapping"), this.mouseMoved ? this.userModified ? this.refresh(0 === this.beforeStart ? 1 : 0) : this.refresh(this.beforeStart) : this.refresh(0 === this.beforeStart ? 1 : 0)), this.mouseMoved = !1, this._trigger("stop"), !1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"mappings": "OAAO,GAAK,CAAC,GAAG,cAAS,CAAC;WACf,CAAC;AACZ,CAAC",
|
||||
"mappings": "OAAO,GAAK,CAAC,GAAG,GAAG,QACnB,GADyB,CAAC;IACtB,MAAM,CAAC,CAAC;AACZ,CAAC",
|
||||
"names": [],
|
||||
"sources": [
|
||||
"../../input/index.js"
|
||||
|
25
tests/fixture/sourcemap/001/input/.swcrc
Normal file
25
tests/fixture/sourcemap/001/input/.swcrc
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"tsx": true,
|
||||
"dynamicImport": false,
|
||||
"decorators": false
|
||||
},
|
||||
"transform": {
|
||||
"legacyDecorator": true,
|
||||
"decoratorMetadata": true
|
||||
},
|
||||
"target": "es2016",
|
||||
"loose": false,
|
||||
"externalHelpers": true
|
||||
},
|
||||
"module": {
|
||||
"type": "commonjs",
|
||||
"strict": false,
|
||||
"strictMode": true,
|
||||
"lazy": false,
|
||||
"noInterop": false
|
||||
},
|
||||
"sourceMaps": true
|
||||
}
|
5
tests/fixture/sourcemap/001/input/index.ts
Normal file
5
tests/fixture/sourcemap/001/input/index.ts
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
export const foo = {
|
||||
arr: []
|
||||
};
|
11
tests/fixture/sourcemap/001/output/index.map
Normal file
11
tests/fixture/sourcemap/001/output/index.map
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"mappings": ";;;;;AAEO,KAAK,CAAC,GAAG,GAAG,CAAC;IAChB,GAAG,EAAE,CAAC,CAAC;AACX,CAAC;QAFY,GAAG,GAAH,GAAG",
|
||||
"names": [],
|
||||
"sources": [
|
||||
"../../input/index.ts"
|
||||
],
|
||||
"sourcesContent": [
|
||||
"\n\nexport const foo = {\n arr: []\n};"
|
||||
],
|
||||
"version": 3
|
||||
}
|
9
tests/fixture/sourcemap/001/output/index.ts
Normal file
9
tests/fixture/sourcemap/001/output/index.ts
Normal file
@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.foo = void 0;
|
||||
const foo = {
|
||||
arr: []
|
||||
};
|
||||
exports.foo = foo;
|
Loading…
Reference in New Issue
Block a user