JS: Added ecma2021, thus extractor now can deal with RegExp v flag

This commit is contained in:
Napalys
2024-11-21 13:44:55 +01:00
committed by erik-krogh
parent 5f4871d609
commit 4097aa9f78
2 changed files with 4 additions and 2 deletions

View File

@@ -788,6 +788,7 @@ public class Parser {
String validFlags = "gim";
if (this.options.ecmaVersion() >= 6) validFlags = "gimuy";
if (this.options.ecmaVersion() >= 9) validFlags = "gimsuy";
if (this.options.ecmaVersion() >= 12) validFlags = "gimsuyv";
if (!mods.matches("^[" + validFlags + "]*$"))
this.raise(start, "Invalid regular expression flag");
if (mods.indexOf('u') >= 0) {

View File

@@ -41,7 +41,8 @@ public class ExtractorConfig {
ECMA2017(2017, 8),
ECMA2018(2018, 9),
ECMA2019(2019, 10),
ECMA2020(2020, 11);
ECMA2020(2020, 11),
ECMA2021(2021, 12);
private final int version;
public final int legacyVersion;
@@ -232,7 +233,7 @@ public class ExtractorConfig {
private VirtualSourceRoot virtualSourceRoot;
public ExtractorConfig(boolean experimental) {
this.ecmaVersion = experimental ? ECMAVersion.ECMA2020 : ECMAVersion.ECMA2019;
this.ecmaVersion = experimental ? ECMAVersion.ECMA2021 : ECMAVersion.ECMA2019;
this.platform = Platform.AUTO;
this.jsx = true;
this.sourceType = SourceType.AUTO;