Skip to content

Commit 4097aa9

Browse files
Napalyserik-krogh
authored andcommitted
JS: Added ecma2021, thus extractor now can deal with RegExp v flag
1 parent 5f4871d commit 4097aa9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

javascript/extractor/src/com/semmle/jcorn/Parser.java

+1
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,7 @@ private Token readRegexp() {
788788
String validFlags = "gim";
789789
if (this.options.ecmaVersion() >= 6) validFlags = "gimuy";
790790
if (this.options.ecmaVersion() >= 9) validFlags = "gimsuy";
791+
if (this.options.ecmaVersion() >= 12) validFlags = "gimsuyv";
791792
if (!mods.matches("^[" + validFlags + "]*$"))
792793
this.raise(start, "Invalid regular expression flag");
793794
if (mods.indexOf('u') >= 0) {

javascript/extractor/src/com/semmle/js/extractor/ExtractorConfig.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ public static enum ECMAVersion {
4141
ECMA2017(2017, 8),
4242
ECMA2018(2018, 9),
4343
ECMA2019(2019, 10),
44-
ECMA2020(2020, 11);
44+
ECMA2020(2020, 11),
45+
ECMA2021(2021, 12);
4546

4647
private final int version;
4748
public final int legacyVersion;
@@ -232,7 +233,7 @@ public Set<String> getPredefinedGlobals() {
232233
private VirtualSourceRoot virtualSourceRoot;
233234

234235
public ExtractorConfig(boolean experimental) {
235-
this.ecmaVersion = experimental ? ECMAVersion.ECMA2020 : ECMAVersion.ECMA2019;
236+
this.ecmaVersion = experimental ? ECMAVersion.ECMA2021 : ECMAVersion.ECMA2019;
236237
this.platform = Platform.AUTO;
237238
this.jsx = true;
238239
this.sourceType = SourceType.AUTO;

0 commit comments

Comments
 (0)