mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
docs(span): document validity of ModuleKind::Unambiguous (#6423)
relates #6249
This commit is contained in:
parent
b5b0af98cb
commit
6a194f9086
2 changed files with 6 additions and 2 deletions
|
|
@ -55,7 +55,8 @@ pub enum ModuleKind {
|
|||
///
|
||||
/// ESM syntax includes `import` statement, `export` statement and `import.meta`.
|
||||
///
|
||||
/// Note: Dynamic import expression is not ESM syntax.
|
||||
/// Note1: This value is only valid as a parser input, and does not appear on a valid AST's `Program::source_type`.
|
||||
/// Note2: Dynamic import expression is not ESM syntax.
|
||||
///
|
||||
/// See <https://babel.dev/docs/options#misc-options>
|
||||
Unambiguous = 2,
|
||||
|
|
|
|||
|
|
@ -67,11 +67,14 @@ impl CompilerInterface for Driver {
|
|||
}
|
||||
|
||||
fn after_parse(&mut self, parser_return: &mut ParserReturn) -> ControlFlow<()> {
|
||||
let ParserReturn { program, trivias, panicked, .. } = parser_return;
|
||||
let ParserReturn { program, trivias, panicked, errors } = parser_return;
|
||||
self.panicked = *panicked;
|
||||
if self.check_comments(trivias) {
|
||||
return ControlFlow::Break(());
|
||||
}
|
||||
if (errors.is_empty() || !*panicked) && program.source_type.is_unambiguous() {
|
||||
self.errors.push(OxcDiagnostic::error("SourceType must not be unambiguous."));
|
||||
}
|
||||
// Make sure serialization doesn't crash; also for code coverage.
|
||||
let _serializer = program.serializer();
|
||||
ControlFlow::Continue(())
|
||||
|
|
|
|||
Loading…
Reference in a new issue