Skip to content

Commit e89cd31

Browse files
committed
trait impl
1 parent c663c32 commit e89cd31

File tree

1 file changed

+12
-6
lines changed
  • crates/swc_ecma_codegen/src

1 file changed

+12
-6
lines changed

crates/swc_ecma_codegen/src/lib.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,28 +75,34 @@ pub fn to_code(node: &impl Node) -> String {
7575
}
7676

7777
pub trait Node: Spanned + Sized {
78-
fn emit_with<W, S>(&self, e: &mut Emitter<'_, W, S>) -> Result
78+
fn emit_with<W, S>(&self, emitter: &mut Emitter<'_, W, S>) -> Result
7979
where
8080
W: WriteJs,
8181
S: SourceMapper + SourceMapperExt;
8282

83-
fn with_new_span<W, S>(&self, e: &mut NodeEmitter<'_, W, S>) -> Result<Self>
83+
fn with_new_span<W, S>(&self, emitter: &mut NodeEmitter<'_, W, S>) -> Result<Self>
8484
where
8585
W: WriteJs,
8686
S: SourceMapper + SourceMapperExt;
8787
}
8888

8989
impl<N: Node> Node for Box<N> {
90-
#[inline]
91-
fn emit_with<W, S>(&self, e: &mut Emitter<'_, W, S>) -> Result
90+
fn emit_with<W, S>(&self, emitter: &mut Emitter<'_, W, S>) -> Result
9291
where
9392
W: WriteJs,
9493
S: SourceMapper + SourceMapperExt,
9594
{
96-
(**self).emit_with(e)
95+
(**self).emit_with(emitter)
9796
}
98-
}
9997

98+
fn with_new_span<W, S>(&self, emitter: &mut NodeEmitter<'_, W, S>) -> Result<Self>
99+
where
100+
W: WriteJs,
101+
S: SourceMapper + SourceMapperExt,
102+
{
103+
Box::new((**self).with_new_span(emitter))
104+
}
105+
}
100106
pub struct Emitter<'a, W, S>
101107
where
102108
W: WriteJs,

0 commit comments

Comments
 (0)