aboutsummaryrefslogtreecommitdiff
path: root/test/sandbox.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-02-23 14:55:08 +0000
committerGitHub <noreply@github.com>2021-02-23 22:55:08 +0800
commitd68d155f93a355a9f6f0451150186b7fad8c58b8 (patch)
treee3cba7df7cd9d2221ff2b97ea30d8c9a07e7bba1 /test/sandbox.js
parente535f1918915251681df6ffe80a56d56672685ea (diff)
downloadtracifyjs-d68d155f93a355a9f6f0451150186b7fad8c58b8.tar.gz
tracifyjs-d68d155f93a355a9f6f0451150186b7fad8c58b8.zip
support `class` literals (#4658)
Diffstat (limited to 'test/sandbox.js')
-rw-r--r--test/sandbox.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/sandbox.js b/test/sandbox.js
index d8d2da0d..1aee7753 100644
--- a/test/sandbox.js
+++ b/test/sandbox.js
@@ -25,7 +25,13 @@ exports.run_code = semver.satisfies(process.version, "0.8") ? function(code, top
} while (prev !== stdout);
return stdout;
} : semver.satisfies(process.version, "<0.12") ? run_code_vm : function(code, toplevel, timeout) {
- if (/\basync([ \t]+[^\s()[\]{},.&|!~=*%/+-]+|[ \t]*\([\s\S]*?\))[ \t]*=>|\b(async[ \t]+function|setInterval|setTimeout)\b/.test(code)) {
+ if ([
+ /\basync[ \t]*\([\s\S]*?\)[ \t]*=>/,
+ /\b(async[ \t]+function|setInterval|setTimeout)\b/,
+ /\basync([ \t]+|[ \t]*\*[ \t]*)[^\s()[\]{},.&|!~=*%/+-]+(\s*\(|[ \t]*=>)/,
+ ].some(function(pattern) {
+ return pattern.test(code);
+ })) {
return run_code_exec(code, toplevel, timeout);
} else {
return run_code_vm(code, toplevel, timeout);