From ed16c9f4e00ca47c05972c4cf940105486cdae8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Fri, 15 Apr 2022 19:11:35 +0900 Subject: [PATCH] Add a test for https://github.com/vercel/next.js/issues/36127#issuecomment-1099794402 --- .../compress/fixture/next/36127/2/input.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 crates/swc_ecma_minifier/tests/compress/fixture/next/36127/2/input.js diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/next/36127/2/input.js b/crates/swc_ecma_minifier/tests/compress/fixture/next/36127/2/input.js new file mode 100644 index 000000000000..e37927aca72b --- /dev/null +++ b/crates/swc_ecma_minifier/tests/compress/fixture/next/36127/2/input.js @@ -0,0 +1,19 @@ +/** + * Create a code check from a regex. + * + * @param {RegExp} regex + * @returns {(code: Code) => code is number} + */ +function regexCheck(regex) { + return check + + /** + * Check whether a code matches the bound regex. + * + * @param {Code} code Character code + * @returns {code is number} Whether the character code matches the bound regex + */ + function check(code) { + return code !== null && regex.test(String.fromCharCode(code)) + } +} \ No newline at end of file