Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 591fffc

Browse files
committed
JS: Add test case for wide constants in char class
1 parent 68d23bc commit 591fffc

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| tst.js:1:1:1:9 | /[\\u12340\\udf40-\\u12345\\udf45]/ | Character class with supplementary characters in non-unicode literal. |
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import javascript
2+
3+
from RegExpLiteral literal, RegExpConstant wideConstant
4+
where wideConstant.getLiteral() = literal and
5+
not literal.getFlags().matches("%u%") and
6+
wideConstant.getValue().length() > 1 and
7+
(
8+
wideConstant.getParent() instanceof RegExpCharacterClass
9+
or
10+
wideConstant.getParent() instanceof RegExpCharacterRange
11+
)
12+
select literal, "Character class with supplementary characters in non-unicode literal."
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/[𒍀-𒍅]/; // NOT OK
2+
/[𒍀-𒍅]/u; // OK

0 commit comments

Comments
 (0)