swc_ecma_codegen::text_writer

Trait WriteJs

source
pub trait WriteJs {
Show 19 methods // Required methods fn increase_indent(&mut self) -> Result; fn decrease_indent(&mut self) -> Result; fn write_semi(&mut self, span: Option<Span>) -> Result; fn write_space(&mut self) -> Result; fn write_keyword(&mut self, span: Option<Span>, s: &'static str) -> Result; fn write_operator(&mut self, span: Option<Span>, s: &str) -> Result; fn write_param(&mut self, s: &str) -> Result; fn write_property(&mut self, s: &str) -> Result; fn write_line(&mut self) -> Result; fn write_lit(&mut self, span: Span, s: &str) -> Result; fn write_comment(&mut self, s: &str) -> Result; fn write_str_lit(&mut self, span: Span, s: &str) -> Result; fn write_str(&mut self, s: &str) -> Result; fn write_symbol(&mut self, span: Span, s: &str) -> Result; fn write_punct(&mut self, span: Option<Span>, s: &'static str) -> Result; fn care_about_srcmap(&self) -> bool; fn add_srcmap(&mut self, pos: BytePos) -> Result; fn commit_pending_semi(&mut self) -> Result; // Provided method fn can_ignore_invalid_unicodes(&mut self) -> bool { ... }
}
Expand description

Ecmascript writer.

Ported from EmitWriteJs.

Required Methods§

source

fn increase_indent(&mut self) -> Result

source

fn decrease_indent(&mut self) -> Result

source

fn write_semi(&mut self, span: Option<Span>) -> Result

This may write semicolon.

source

fn write_space(&mut self) -> Result

source

fn write_keyword(&mut self, span: Option<Span>, s: &'static str) -> Result

source

fn write_operator(&mut self, span: Option<Span>, s: &str) -> Result

source

fn write_param(&mut self, s: &str) -> Result

source

fn write_property(&mut self, s: &str) -> Result

source

fn write_line(&mut self) -> Result

source

fn write_lit(&mut self, span: Span, s: &str) -> Result

source

fn write_comment(&mut self, s: &str) -> Result

source

fn write_str_lit(&mut self, span: Span, s: &str) -> Result

source

fn write_str(&mut self, s: &str) -> Result

source

fn write_symbol(&mut self, span: Span, s: &str) -> Result

source

fn write_punct(&mut self, span: Option<Span>, s: &'static str) -> Result

source

fn care_about_srcmap(&self) -> bool

source

fn add_srcmap(&mut self, pos: BytePos) -> Result

source

fn commit_pending_semi(&mut self) -> Result

Provided Methods§

source

fn can_ignore_invalid_unicodes(&mut self) -> bool

If true, the code generator will skip modification of invalid unicode characters.

Defaults to `false``

Implementations on Foreign Types§

source§

impl<W> WriteJs for &mut W
where W: ?Sized + WriteJs,

source§

fn increase_indent(&mut self) -> Result

source§

fn decrease_indent(&mut self) -> Result

source§

fn write_semi(&mut self, span: Option<Span>) -> Result

source§

fn write_space(&mut self) -> Result

source§

fn write_keyword(&mut self, span: Option<Span>, s: &'static str) -> Result

source§

fn write_operator(&mut self, span: Option<Span>, s: &str) -> Result

source§

fn write_param(&mut self, s: &str) -> Result

source§

fn write_property(&mut self, s: &str) -> Result

source§

fn write_line(&mut self) -> Result

source§

fn write_lit(&mut self, span: Span, s: &str) -> Result

source§

fn write_comment(&mut self, s: &str) -> Result

source§

fn write_str_lit(&mut self, span: Span, s: &str) -> Result

source§

fn write_str(&mut self, s: &str) -> Result

source§

fn write_symbol(&mut self, span: Span, s: &str) -> Result

source§

fn write_punct(&mut self, span: Option<Span>, s: &'static str) -> Result

source§

fn care_about_srcmap(&self) -> bool

source§

fn add_srcmap(&mut self, pos: BytePos) -> Result

source§

fn commit_pending_semi(&mut self) -> Result

source§

fn can_ignore_invalid_unicodes(&mut self) -> bool

source§

impl<W> WriteJs for Box<W>
where W: ?Sized + WriteJs,

source§

fn increase_indent(&mut self) -> Result

source§

fn decrease_indent(&mut self) -> Result

source§

fn write_semi(&mut self, span: Option<Span>) -> Result

source§

fn write_space(&mut self) -> Result

source§

fn write_keyword(&mut self, span: Option<Span>, s: &'static str) -> Result

source§

fn write_operator(&mut self, span: Option<Span>, s: &str) -> Result

source§

fn write_param(&mut self, s: &str) -> Result

source§

fn write_property(&mut self, s: &str) -> Result

source§

fn write_line(&mut self) -> Result

source§

fn write_lit(&mut self, span: Span, s: &str) -> Result

source§

fn write_comment(&mut self, s: &str) -> Result

source§

fn write_str_lit(&mut self, span: Span, s: &str) -> Result

source§

fn write_str(&mut self, s: &str) -> Result

source§

fn write_symbol(&mut self, span: Span, s: &str) -> Result

source§

fn write_punct(&mut self, span: Option<Span>, s: &'static str) -> Result

source§

fn care_about_srcmap(&self) -> bool

source§

fn add_srcmap(&mut self, pos: BytePos) -> Result

source§

fn commit_pending_semi(&mut self) -> Result

source§

fn can_ignore_invalid_unicodes(&mut self) -> bool

Implementors§

source§

impl<W: Write> WriteJs for JsWriter<'_, W>