Skip to content

Commit b8c0f5d

Browse files
committedSep 30, 2024
Add patch to fix quickjs-ng/quickjs#286
1 parent bb4a97b commit b8c0f5d

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
 

‎sys/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ fn main() {
147147
"get_function_proto.patch",
148148
"check_stack_overflow.patch",
149149
"infinity_handling.patch",
150+
"accept-slash-dash-inside-brackets-as-regex.patch",
150151
];
151152

152153
let version =
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
diff --git a/libregexp.c b/libregexp.c
2+
index a2d56a7..bf8f540 100644
3+
--- a/libregexp.c
4+
+++ b/libregexp.c
5+
@@ -676,6 +676,9 @@ static int get_class_atom(REParseState *s, CharRange *cr,
6+
c &= 0x1f;
7+
p++;
8+
} else if (s->is_unicode) {
9+
+ // special case: allowed inside [] but not outside
10+
+ if (ret == -2 && *p == '-' && inclass)
11+
+ goto normal_char;
12+
goto invalid_escape;
13+
} else {
14+
/* otherwise return '\' and 'c' */
15+
diff --git a/tests/test_builtin.js b/tests/test_builtin.js
16+
index 15cd189..8cdadc2 100644
17+
--- a/tests/test_builtin.js
18+
+++ b/tests/test_builtin.js
19+
@@ -680,6 +680,9 @@ function test_regexp()
20+
assert(a, ["123a23", "3"]);
21+
a = /()*?a/.exec(",");
22+
assert(a, null);
23+
+
24+
+ eval("/[\\-]/");
25+
+ eval("/[\\-]/u");
26+
}
27+
28+
function test_symbol()

0 commit comments

Comments
 (0)