Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions crates/oxc_parser/src/js/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,12 @@ impl<'a> ParserImpl<'a> {
has_default_specifier = true;
should_parse_specifiers = false;
}
} else if self.at(Kind::From) {
} else {
self.expect_without_advance(Kind::From);
// `import source something from ...`
identifier_after_import = Some(identifier_after_source);
phase = Some(ImportPhase::Source);
has_default_specifier = true;
} else {
return self.unexpected();
}
}

Expand Down
1 change: 1 addition & 0 deletions tasks/coverage/misc/fail/import-source-non-from.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import source foo bar from 'module';
9 changes: 8 additions & 1 deletion tasks/coverage/snapshots/parser_misc.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parser_misc Summary:
AST Parsed : 49/49 (100.00%)
Positive Passed: 49/49 (100.00%)
Negative Passed: 110/110 (100.00%)
Negative Passed: 111/111 (100.00%)

× Cannot assign to 'arguments' in strict mode
╭─[misc/fail/arguments-eval.ts:1:10]
Expand Down Expand Up @@ -180,6 +180,13 @@ Negative Passed: 110/110 (100.00%)
· ╰── `,` or `]` expected
╰────

× Expected `from` but found `Identifier`
╭─[misc/fail/import-source-non-from.js:1:19]
1 │ import source foo bar from 'module';
· ─┬─
· ╰── `from` expected
╰────

× Unexpected JSX expression
╭─[misc/fail/jsx-in-js.js:1:20]
1 │ export const foo = <Foo />;
Expand Down
Loading