Trait swc_core::ecma::utils::swc_common::errors::SourceMapper

pub trait SourceMapper: Send + Sync {
    // Required methods
    fn lookup_char_pos(&self, pos: BytePos) -> Loc;
    fn span_to_lines(&self, sp: Span) -> Result<FileLines, Box<SpanLinesError>>;
    fn span_to_string(&self, sp: Span) -> String;
    fn span_to_filename(&self, sp: Span) -> FileName;
    fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>;
    fn call_span_if_macro(&self, sp: Span) -> Span;
    fn doctest_offset_line(&self, line: usize) -> usize;
    fn span_to_snippet(&self, sp: Span) -> Result<String, Box<SpanSnippetError>>;
}
Available on crate features __ecma and __utils only.

Required Methods§

fn lookup_char_pos(&self, pos: BytePos) -> Loc

fn span_to_lines(&self, sp: Span) -> Result<FileLines, Box<SpanLinesError>>

fn span_to_string(&self, sp: Span) -> String

fn span_to_filename(&self, sp: Span) -> FileName

fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>

fn call_span_if_macro(&self, sp: Span) -> Span

fn doctest_offset_line(&self, line: usize) -> usize

fn span_to_snippet(&self, sp: Span) -> Result<String, Box<SpanSnippetError>>

Trait Implementations§

§

impl SourceMapperExt for dyn SourceMapper

§

fn get_code_map(&self) -> &dyn SourceMapper

§

fn is_on_same_line(&self, _lo: BytePos, _hi: BytePos) -> bool

§

fn should_write_separating_line_terminator( &self, prev: Option<Span>, next: Option<Span>, format: ListFormat ) -> bool

§

fn should_write_leading_line_terminator( &self, parent_node: Span, first_child: Option<Span>, format: ListFormat ) -> bool

§

fn should_write_closing_line_terminator( &self, parent_node: Span, last_child: Option<Span>, format: ListFormat ) -> bool

Implementors§

§

impl SourceMapper for SourceMap

§

impl SourceMapper for PluginSourceMapProxy

Subset of SourceMap interface supported in plugin. Unlike Comments, this does not fully implement SourceMap.