2 different SourceType
s needed for parser options, and for in AST
#6249
Labels
C-cleanup
Category - technical debt or refactoring. Solution not expected to change behavior
ModuleKind
has 3 different options:oxc/crates/oxc_span/src/source_type/mod.rs
Lines 49 to 62 in d085c2c
The "unambiguous" option only makes sense as an input argument to the parser. The parser decides whether it's a script or module during parsing, so a
Program
is always one or the other, never "unambiguous".Can we rule out the erroneous "unambiguous" option for
Program::source_type
by making the existingModuleKind
only "script" or "module", and introducing a separateSourceType
tooxc_parser
which is only used inParseOptions
?While we're at it, we could also simplify
SourceType
by making it just abitflags
byte, or a 1-byte enum.The text was updated successfully, but these errors were encountered: