mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 22:56:11 +03:00
chore(es): Enable tracing spans for release builds (#7379)
This commit is contained in:
parent
65785bdf21
commit
166e77c2b3
@ -495,7 +495,7 @@ where
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn emit_lit(&mut self, node: &Lit) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
|
||||
@ -529,7 +529,7 @@ where
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn emit_str_lit(&mut self, node: &Str) -> Result {
|
||||
self.wr.commit_pending_semi()?;
|
||||
|
||||
@ -577,7 +577,7 @@ where
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn emit_num_lit(&mut self, num: &Number) -> Result {
|
||||
self.emit_num_lit_internal(num, false)?;
|
||||
}
|
||||
@ -757,7 +757,7 @@ where
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn emit_expr(&mut self, node: &Expr) -> Result {
|
||||
match node {
|
||||
Expr::Array(ref n) => emit!(n),
|
||||
@ -1265,7 +1265,7 @@ where
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn emit_class_member(&mut self, node: &ClassMember) -> Result {
|
||||
match *node {
|
||||
ClassMember::Constructor(ref n) => emit!(n),
|
||||
@ -1570,7 +1570,7 @@ where
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn emit_class_constructor(&mut self, n: &Constructor) -> Result {
|
||||
self.emit_leading_comments_of_span(n.span(), false)?;
|
||||
|
||||
@ -2731,7 +2731,7 @@ where
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn emit_expr_stmt(&mut self, e: &ExprStmt) -> Result {
|
||||
let expr_span = e.expr.span();
|
||||
|
||||
@ -2741,7 +2741,7 @@ where
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn emit_block_stmt(&mut self, node: &BlockStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(node.span(), false)?;
|
||||
|
||||
@ -3138,7 +3138,7 @@ where
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn emit_try_stmt(&mut self, n: &TryStmt) -> Result {
|
||||
self.emit_leading_comments_of_span(n.span(), false)?;
|
||||
|
||||
|
@ -68,7 +68,7 @@ impl<'a, W: Write> JsWriter<'a, W> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn write(&mut self, span: Option<Span>, data: &str) -> Result {
|
||||
if !data.is_empty() {
|
||||
if self.line_start {
|
||||
@ -137,63 +137,60 @@ impl<'a, W: Write> JsWriter<'a, W> {
|
||||
|
||||
impl<'a, W: Write> WriteJs for JsWriter<'a, W> {
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
fn increase_indent(&mut self) -> Result {
|
||||
self.indent += 1;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
fn decrease_indent(&mut self) -> Result {
|
||||
self.indent -= 1;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
fn write_semi(&mut self, span: Option<Span>) -> Result {
|
||||
self.write(span, ";")?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn write_space(&mut self) -> Result {
|
||||
self.write(None, " ")?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn write_keyword(&mut self, span: Option<Span>, s: &'static str) -> Result {
|
||||
self.write(span, s)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn write_operator(&mut self, span: Option<Span>, s: &str) -> Result {
|
||||
self.write(span, s)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn write_param(&mut self, s: &str) -> Result {
|
||||
self.write(None, s)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn write_property(&mut self, s: &str) -> Result {
|
||||
self.write(None, s)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn write_line(&mut self) -> Result {
|
||||
let pending = self.pending_srcmap.take();
|
||||
if !self.line_start {
|
||||
@ -213,7 +210,7 @@ impl<'a, W: Write> WriteJs for JsWriter<'a, W> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn write_lit(&mut self, span: Span, s: &str) -> Result {
|
||||
if !s.is_empty() {
|
||||
self.srcmap(span.lo());
|
||||
@ -225,14 +222,14 @@ impl<'a, W: Write> WriteJs for JsWriter<'a, W> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn write_comment(&mut self, s: &str) -> Result {
|
||||
self.write(None, s)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn write_str_lit(&mut self, span: Span, s: &str) -> Result {
|
||||
if !s.is_empty() {
|
||||
self.srcmap(span.lo());
|
||||
@ -244,34 +241,34 @@ impl<'a, W: Write> WriteJs for JsWriter<'a, W> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn write_str(&mut self, s: &str) -> Result {
|
||||
self.write(None, s)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn write_symbol(&mut self, span: Span, s: &str) -> Result {
|
||||
self.write(Some(span), s)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn write_punct(&mut self, span: Option<Span>, s: &'static str) -> Result {
|
||||
self.write(span, s)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn care_about_srcmap(&self) -> bool {
|
||||
self.srcmap.is_some()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn add_srcmap(&mut self, pos: BytePos) -> Result {
|
||||
if self.srcmap.is_some() {
|
||||
if self.line_start {
|
||||
@ -284,7 +281,7 @@ impl<'a, W: Write> WriteJs for JsWriter<'a, W> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn commit_pending_semi(&mut self) -> Result {
|
||||
Ok(())
|
||||
}
|
||||
|
@ -965,7 +965,7 @@ impl VisitMut for Generator {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn visit_mut_stmt(&mut self, node: &mut Stmt) {
|
||||
match node {
|
||||
Stmt::Break(b) => {
|
||||
@ -3041,7 +3041,7 @@ impl Generator {
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip(self)))]
|
||||
#[tracing::instrument(skip(self))]
|
||||
fn try_enter_label(&mut self, op_index: usize) {
|
||||
if self.label_offsets.is_none() {
|
||||
return;
|
||||
@ -3095,7 +3095,7 @@ impl Generator {
|
||||
}
|
||||
|
||||
/// Tries to enter or leave a code block.
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip(self)))]
|
||||
#[tracing::instrument(skip(self))]
|
||||
fn try_enter_or_leave_block(&mut self, op_index: usize) {
|
||||
if let Some(blocks) = &self.blocks {
|
||||
while self.block_index < self.block_actions.as_ref().unwrap().len()
|
||||
@ -3162,7 +3162,7 @@ impl Generator {
|
||||
|
||||
/// Writes an operation as a statement to the current label's statement
|
||||
/// list.
|
||||
#[cfg_attr(debug_assertions, tracing::instrument(skip(self)))]
|
||||
#[tracing::instrument(skip(self))]
|
||||
fn write_operation(&mut self, op_index: usize) {
|
||||
if cfg!(debug_assertions) {
|
||||
debug!("Writing operation {}", op_index);
|
||||
|
Loading…
Reference in New Issue
Block a user