mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29:58 +00:00
docs(span): document validity of ModuleKind::Unambiguous (#6423)
relates #6249
This commit is contained in:
1 parent
b5b0af98cb
commit
6a194f9086
2 files changed
+6
-2
No files matched your search
@@ -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(())
|
||||
|
||||
Reference in new issue
Block a user