suppress invalid test case generation (#4930)
This commit is contained in:
@@ -132,6 +132,8 @@ module.exports = function reduce_test(testcase, minify_options, reduce_options)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (parent instanceof U.AST_VarDef && parent.name === node) return;
|
if (parent instanceof U.AST_VarDef && parent.name === node) return;
|
||||||
|
// preserve class methods
|
||||||
|
if (parent instanceof U.AST_ClassMethod && parent.value === node) return;
|
||||||
// preserve exports
|
// preserve exports
|
||||||
if (parent instanceof U.AST_ExportDeclaration) return;
|
if (parent instanceof U.AST_ExportDeclaration) return;
|
||||||
if (parent instanceof U.AST_ExportDefault) return;
|
if (parent instanceof U.AST_ExportDefault) return;
|
||||||
@@ -147,6 +149,9 @@ module.exports = function reduce_test(testcase, minify_options, reduce_options)
|
|||||||
if (parent instanceof U.AST_For && parent.init === node && node instanceof U.AST_Definitions) return node;
|
if (parent instanceof U.AST_For && parent.init === node && node instanceof U.AST_Definitions) return node;
|
||||||
// preserve for (xxx in/of ...)
|
// preserve for (xxx in/of ...)
|
||||||
if (parent instanceof U.AST_ForEnumeration && parent.init === node) return node;
|
if (parent instanceof U.AST_ForEnumeration && parent.init === node) return node;
|
||||||
|
// preserve super(...)
|
||||||
|
if (node.TYPE == "Call" && node.expression instanceof U.AST_Super) return;
|
||||||
|
if (node instanceof U.AST_Super && parent.TYPE == "Call" && parent.expression === node) return node;
|
||||||
|
|
||||||
// node specific permutations with no parent logic
|
// node specific permutations with no parent logic
|
||||||
|
|
||||||
|
|||||||
@@ -356,6 +356,7 @@ var block_vars = [];
|
|||||||
var lambda_vars = [];
|
var lambda_vars = [];
|
||||||
var unique_vars = [];
|
var unique_vars = [];
|
||||||
var classes = [];
|
var classes = [];
|
||||||
|
var allow_this = true;
|
||||||
var async = false;
|
var async = false;
|
||||||
var has_await = false;
|
var has_await = false;
|
||||||
var export_default = false;
|
var export_default = false;
|
||||||
@@ -402,6 +403,7 @@ function createTopLevelCode() {
|
|||||||
lambda_vars.length = 0;
|
lambda_vars.length = 0;
|
||||||
unique_vars.length = 0;
|
unique_vars.length = 0;
|
||||||
classes.length = 0;
|
classes.length = 0;
|
||||||
|
allow_this = true;
|
||||||
async = false;
|
async = false;
|
||||||
has_await = false;
|
has_await = false;
|
||||||
export_default = false;
|
export_default = false;
|
||||||
@@ -1731,6 +1733,8 @@ function createObjectFunction(recurmax, stmtDepth, canThrow, internal, isClazz)
|
|||||||
fn = function(defns) {
|
fn = function(defns) {
|
||||||
if (generator) name = "*" + name;
|
if (generator) name = "*" + name;
|
||||||
if (async) name = "async "+ name;
|
if (async) name = "async "+ name;
|
||||||
|
var save_allow = allow_this;
|
||||||
|
if (internal == "super") allow_this = false;
|
||||||
s = [
|
s = [
|
||||||
name + "(" + createParams(save_async, save_generator, NO_DUPLICATE) + "){",
|
name + "(" + createParams(save_async, save_generator, NO_DUPLICATE) + "){",
|
||||||
strictMode(),
|
strictMode(),
|
||||||
@@ -1738,6 +1742,7 @@ function createObjectFunction(recurmax, stmtDepth, canThrow, internal, isClazz)
|
|||||||
];
|
];
|
||||||
s.push(_createStatements(2, recurmax, canThrow, CANNOT_BREAK, CANNOT_CONTINUE, CANNOT_RETURN, stmtDepth));
|
s.push(_createStatements(2, recurmax, canThrow, CANNOT_BREAK, CANNOT_CONTINUE, CANNOT_RETURN, stmtDepth));
|
||||||
if (internal == "super") s.push("super" + createArgs(recurmax, stmtDepth, canThrow, NO_TEMPLATE) + ";");
|
if (internal == "super") s.push("super" + createArgs(recurmax, stmtDepth, canThrow, NO_TEMPLATE) + ";");
|
||||||
|
allow_this = save_allow;
|
||||||
if (/^(constructor|super)$/.test(internal) || rng(10) == 0) for (var i = rng(4); --i >= 0;) {
|
if (/^(constructor|super)$/.test(internal) || rng(10) == 0) for (var i = rng(4); --i >= 0;) {
|
||||||
s.push(rng(2) ? createSuperAssignment(recurmax, stmtDepth, canThrow) : createThisAssignment(recurmax, stmtDepth, canThrow));
|
s.push(rng(2) ? createSuperAssignment(recurmax, stmtDepth, canThrow) : createThisAssignment(recurmax, stmtDepth, canThrow));
|
||||||
}
|
}
|
||||||
@@ -1974,7 +1979,7 @@ function createValue() {
|
|||||||
var v;
|
var v;
|
||||||
do {
|
do {
|
||||||
v = VALUES[rng(VALUES.length)];
|
v = VALUES[rng(VALUES.length)];
|
||||||
} while (v == "new.target" && rng(200));
|
} while (v == "new.target" && rng(200) || !allow_this && v == "this");
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2298,7 +2303,7 @@ function is_error_in(ex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function is_error_spread(ex) {
|
function is_error_spread(ex) {
|
||||||
return ex.name == "TypeError" && /Found non-callable @@iterator| is not iterable| is not a function/.test(ex.message);
|
return ex.name == "TypeError" && /Found non-callable @@iterator| is not iterable| not a function/.test(ex.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
function is_error_recursion(ex) {
|
function is_error_recursion(ex) {
|
||||||
|
|||||||
Reference in New Issue
Block a user