mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
refactor(parser)!: treat unambiguous files containing TS export assignments as modules (#6253)
An "unambiguous" TS source which contains an `export = <value>;` statement should be interpreted as an ES module. This is in line with [this Babel test case](94e166782a/packages/babel-parser/test/fixtures/typescript/export/equals-in-unambiguous) which has [input option of `sourceType: "unambiguous"`](94e166782a/packages/babel-parser/test/fixtures/typescript/export/equals-in-unambiguous/options.json (L2)), and [outputs an AST with `sourceType: "module"`](94e166782a/packages/babel-parser/test/fixtures/typescript/export/equals-in-unambiguous/output.json (L7)).
This commit is contained in:
parent
4f6bc79734
commit
32d972e2a4
1 changed files with 1 additions and 0 deletions
|
|
@ -187,6 +187,7 @@ impl<'a> ParserImpl<'a> {
|
|||
self.expect(Kind::Eq)?;
|
||||
let expression = self.parse_assignment_expression_or_higher()?;
|
||||
self.asi()?;
|
||||
self.set_source_type_to_module_if_unambiguous();
|
||||
Ok(self.ast.alloc_ts_export_assignment(self.end_span(start_span), expression))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue