@@ -42,7 +42,7 @@ pub mod text_writer;
4242mod typescript;
4343pub 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.
4848pub 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