reduce function-related false positives (#2925)

This commit is contained in:
Alex Lam S.L
2018-02-17 04:35:03 +08:00
committed by GitHub
parent d626e9bf19
commit e529f54e90

View File

@@ -24,9 +24,8 @@ function strip_func_ids(text) {
var FUNC_TOSTRING = [ var FUNC_TOSTRING = [
"[ Array, Boolean, Error, Function, Number, Object, RegExp, String].forEach(function(f) {", "[ Array, Boolean, Error, Function, Number, Object, RegExp, String].forEach(function(f) {",
" f.toString = Function.prototype.toString;", " f.toString = Function.prototype.toString;",
" f.valueOf = Function.prototype.valueOf;",
"});", "});",
"Function.prototype.toString = Function.prototype.valueOf = function() {", "Function.prototype.toString = function() {",
" var id = 100000;", " var id = 100000;",
" return function() {", " return function() {",
" var n = this.name;", " var n = this.name;",
@@ -40,10 +39,9 @@ var FUNC_TOSTRING = [
" });", " });",
] : [], [ ] : [], [
" }", " }",
' return "[Function: " + n + "]";', ' return "function " + n + "() {...}";',
" }", " }",
"}();", "}();",
'Object.defineProperty(Function.prototype, "valueOf", { enumerable: false });',
]).join("\n"); ]).join("\n");
exports.run_code = function(code) { exports.run_code = function(code) {
var stdout = ""; var stdout = "";