minor clean-ups (#5282)

This commit is contained in:
Alex Lam S.L
2022-01-10 05:02:26 +00:00
committed by GitHub
parent 4b949f6686
commit caaa753861
7 changed files with 30 additions and 17 deletions

View File

@@ -11,6 +11,21 @@ async_arrow: {
node_version: ">=8"
}
async_computed: {
input: {
var o = {
async [42]() {
return this.p;
},
p: "PASS",
};
o[42]().then(console.log);
}
expect_exact: 'var o={async[42](){return this.p},p:"PASS"};o[42]().then(console.log);'
expect_stdout: "PASS"
node_version: ">=8"
}
async_label: {
input: {
(async function() {

View File

@@ -26,9 +26,11 @@ exports.run_code = semver.satisfies(process.version, "0.8") ? function(code, top
return stdout;
} : semver.satisfies(process.version, "<0.12") ? run_code_vm : function(code, toplevel, timeout) {
if ([
/\basync[ \t]*\([\s\S]*?\)[ \t]*=>/,
/\b(async[ \t]+function|Promise|setImmediate|setInterval|setTimeout)\b/,
/\basync([ \t]+|[ \t]*#|[ \t]*\*[ \t]*)[^\s()[\]{}#:;,.&|!~=*%/+-]+(\s*\(|[ \t]*=>)/,
/\basync([ \t]+|[ \t]*#)[^\s()[\]{}#:;,.&|!~=*%/+-]+(\s*\(|[ \t]*=>)/,
/\basync[ \t]*\*[ \t]*[^\s()[\]{}#:;,.&|!~=*%/+-]+\s*\(/,
/\basync([ \t]*\*)?[ \t]*\[[\s\S]*?\]\s*\(/,
/\basync[ \t]*\([\s\S]*?\)[ \t]*=>/,
].some(function(pattern) {
return pattern.test(code);
})) {

View File

@@ -2290,7 +2290,7 @@ function fuzzy_match(original, uglified) {
return true;
function collect(input, nums) {
return input.replace(/-?([1-9][0-9]*(\.[0-9]+)?|0\.[0-9]+)(e-?[1-9][0-9]*)?/ig, function(num) {
return input.replace(/-?([1-9][0-9]*(\.[0-9]+)?|0\.[0-9]+)(e-?[1-9][0-9]*)?/gi, function(num) {
return "<|" + nums.push(+num) + "|>";
});
}