diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-03-16 06:34:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-16 14:34:36 +0800 |
commit | 352a944868b09c9ce3121a49d4a0bf0afe370a35 (patch) | |
tree | e11bb9ad1bcbab701890cdbe6a2d84cc95829ad0 /test/ufuzz/index.js | |
parent | 77c9116c91e8a758263ab68a7a7f720dcb7e0214 (diff) | |
download | tracifyjs-352a944868b09c9ce3121a49d4a0bf0afe370a35.tar.gz tracifyjs-352a944868b09c9ce3121a49d4a0bf0afe370a35.zip |
fix corner cases with `new.target` (#4784)
Diffstat (limited to 'test/ufuzz/index.js')
-rw-r--r-- | test/ufuzz/index.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js index c5a2e75d..bc9e62a0 100644 --- a/test/ufuzz/index.js +++ b/test/ufuzz/index.js @@ -149,6 +149,7 @@ var SUPPORT = function(matrix) { for_of: "for (var a of []);", generator: "function* f(){}", let: "let a;", + new_target: "function f() { new.target; }", nullish: "0 ?? 0", rest: "var [...a] = [];", rest_object: "var {...a} = {};", @@ -1401,13 +1402,16 @@ function _createExpression(recurmax, noComma, stmtDepth, canThrow) { createBlockVariables(recurmax, stmtDepth, canThrow, function(defns) { s.push( instantiate + makeFunction(name) + "(" + createParams(save_async, save_generator) + "){", - strictMode(), - defns() + strictMode() ); + var add_new_target = SUPPORT.new_target && VALUES.indexOf("new.target") < 0; + if (add_new_target) VALUES.push("new.target"); + s.push(defns()); if (instantiate) for (var i = rng(4); --i >= 0;) { s.push((in_class ? "if (this) " : "") + createThisAssignment(recurmax, stmtDepth, canThrow)); } s.push(_createStatements(rng(5) + 1, recurmax, canThrow, CANNOT_BREAK, CANNOT_CONTINUE, CAN_RETURN, stmtDepth)); + if (add_new_target) VALUES.splice(VALUES.indexOf("new.target"), 1); }); generator = save_generator; async = save_async; |