reduce false positives from noop (#2933)
This commit is contained in:
@@ -27,9 +27,10 @@ var FUNC_TOSTRING = [
|
|||||||
"});",
|
"});",
|
||||||
"Function.prototype.toString = function() {",
|
"Function.prototype.toString = function() {",
|
||||||
" var id = 100000;",
|
" var id = 100000;",
|
||||||
|
" var toString = Function.prototype.toString;",
|
||||||
" return function() {",
|
" return function() {",
|
||||||
" var n = this.name;",
|
" var n = this.name;",
|
||||||
' if (!/^F[0-9]{6}N$/.test(n)) {',
|
" if (!/^F[0-9]{6}N$/.test(n)) {",
|
||||||
' n = "F" + ++id + "N";',
|
' n = "F" + ++id + "N";',
|
||||||
].concat(Object.getOwnPropertyDescriptor(Function.prototype, "name").configurable ? [
|
].concat(Object.getOwnPropertyDescriptor(Function.prototype, "name").configurable ? [
|
||||||
' Object.defineProperty(this, "name", {',
|
' Object.defineProperty(this, "name", {',
|
||||||
@@ -39,12 +40,19 @@ var FUNC_TOSTRING = [
|
|||||||
" });",
|
" });",
|
||||||
] : [], [
|
] : [], [
|
||||||
" }",
|
" }",
|
||||||
' return "function " + n + "() {' + function() {
|
" var body = toString.call(this);",
|
||||||
var s = "\7";
|
' body = body.slice(body.indexOf("{") + 1, -1);',
|
||||||
for (var i = 10; --i >= 0;) s += s;
|
' if (/^(?:\\s|\\{|\\}|;|[0-9\\.]+|"[^"]*"|var [^=;]+|\\/\\/.*|\\/\\*[\\s\\S]*\\*\\/)*(?:$|return(?:;|\\n))/.test(body)) {',
|
||||||
|
' body = "";',
|
||||||
|
" } else {",
|
||||||
|
' body = n + "' + function() {
|
||||||
|
var s = ";";
|
||||||
|
for (var i = 7; --i >= 0;) s += s;
|
||||||
return s;
|
return s;
|
||||||
}() + '}";',
|
}() + '";',
|
||||||
" }",
|
" }",
|
||||||
|
' return "function(){" + body + "}";',
|
||||||
|
" };",
|
||||||
"}();",
|
"}();",
|
||||||
]).join("\n");
|
]).join("\n");
|
||||||
exports.run_code = function(code) {
|
exports.run_code = function(code) {
|
||||||
|
|||||||
Reference in New Issue
Block a user