Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
ije committed Dec 11, 2024
1 parent 87134f9 commit 31d1c0f
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 69 deletions.
8 changes: 4 additions & 4 deletions lexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ use swc_ecmascript::ast::{EsVersion, Module, Program};
use swc_ecmascript::parser::{lexer::Lexer, EsSyntax, StringInput, Syntax};
use swc_ecmascript::visit::FoldWith;

pub struct CjsModuleLexer {
pub struct CommonJSModuleLexer {
pub module: Module,
}

impl CjsModuleLexer {
impl CommonJSModuleLexer {
/// parse the module from the source code.
pub fn parse(specifier: &str, source: &str) -> Result<Self, DiagnosticBuffer> {
pub fn init(specifier: &str, source: &str) -> Result<Self, DiagnosticBuffer> {
let source_map = SourceMap::default();
let source_file =
source_map.new_source_file(FileName::Real(Path::new(specifier).to_path_buf()).into(), source.into());
Expand All @@ -44,7 +44,7 @@ impl CjsModuleLexer {
diagnostic.emit();
DiagnosticBuffer::from_error_buffer(error_buffer, |span| sm.lookup_char_pos(span.lo))
})?;
Ok(CjsModuleLexer { module })
Ok(CommonJSModuleLexer { module })
}

/// get named exports and reexports of the module.
Expand Down
Loading

0 comments on commit 31d1c0f

Please sign in to comment.