Skip to content

Commit 880b025

Browse files
committed
with_new_span
1 parent 2d0e878 commit 880b025

File tree

1 file changed

+7
-11
lines changed
  • crates/swc_ecma_codegen/src

1 file changed

+7
-11
lines changed

crates/swc_ecma_codegen/src/lib.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub mod text_writer;
4242
mod typescript;
4343
pub mod util;
4444

45-
pub type Result = io::Result<()>;
45+
pub type Result<T = ()> = io::Result<T>;
4646

4747
/// Generate a code from a syntax node using default options.
4848
pub fn to_code_default(
@@ -74,23 +74,19 @@ pub fn to_code(node: &impl Node) -> String {
7474
to_code_with_comments(None, node)
7575
}
7676

77-
pub trait Node: Spanned {
77+
pub trait Node: Spanned + Sized {
7878
fn emit_with<W, S>(&self, e: &mut Emitter<'_, W, S>) -> Result
7979
where
8080
W: WriteJs,
8181
S: SourceMapper + SourceMapperExt;
82-
}
83-
impl<N: Node> Node for Box<N> {
84-
#[inline]
85-
fn emit_with<W, S>(&self, e: &mut Emitter<'_, W, S>) -> Result
82+
83+
fn with_new_span<W, S>(&self, e: &mut NodeEmitter<'_, W, S>) -> Result<Self>
8684
where
8785
W: WriteJs,
88-
S: SourceMapper + SourceMapperExt,
89-
{
90-
(**self).emit_with(e)
91-
}
86+
S: SourceMapper + SourceMapperExt;
9287
}
93-
impl<N: Node> Node for &N {
88+
89+
impl<N: Node> Node for Box<N> {
9490
#[inline]
9591
fn emit_with<W, S>(&self, e: &mut Emitter<'_, W, S>) -> Result
9692
where

0 commit comments

Comments
 (0)