aboutsummaryrefslogtreecommitdiff
path: root/test/ufuzz/index.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-10-13 17:09:17 +0100
committerGitHub <noreply@github.com>2020-10-14 00:09:17 +0800
commitc0c04c33bb1652014365fa893cc9b7d29684e59a (patch)
treeb6bbfcf28439c013434f5fd434550da3194fc3e4 /test/ufuzz/index.js
parent0e234a25c52bcfc873fc1ac287995be08a6756aa (diff)
downloadtracifyjs-c0c04c33bb1652014365fa893cc9b7d29684e59a.tar.gz
tracifyjs-c0c04c33bb1652014365fa893cc9b7d29684e59a.zip
fix corner cases in `dead_code` & `reduce_vars` (#4213)
fixes #4212
Diffstat (limited to 'test/ufuzz/index.js')
-rw-r--r--test/ufuzz/index.js35
1 files changed, 18 insertions, 17 deletions
diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js
index 3e2d865d..e650a46f 100644
--- a/test/ufuzz/index.js
+++ b/test/ufuzz/index.js
@@ -899,21 +899,22 @@ function getDotKey(assign) {
function createAccessor(recurmax, stmtDepth, canThrow) {
var namesLenBefore = VAR_NAMES.length;
var s;
- var prop1 = getDotKey();
- if (rng(2) == 0) {
- s = [
- "get " + prop1 + "(){",
- strictMode(),
- createStatements(2, recurmax, canThrow, CANNOT_BREAK, CANNOT_CONTINUE, CAN_RETURN, stmtDepth),
- createStatement(recurmax, canThrow, CANNOT_BREAK, CANNOT_CONTINUE, CAN_RETURN, stmtDepth, STMT_RETURN_ETC),
- "},"
- ];
- } else {
- var prop2;
- do {
- prop2 = getDotKey();
- } while (prop1 == prop2);
- createBlockVariables(recurmax, stmtDepth, canThrow, function(defns) {
+ createBlockVariables(recurmax, stmtDepth, canThrow, function(defns) {
+ var prop1 = getDotKey();
+ if (rng(2) == 0) {
+ s = [
+ "get " + prop1 + "(){",
+ strictMode(),
+ defns(),
+ _createStatements(2, recurmax, canThrow, CANNOT_BREAK, CANNOT_CONTINUE, CAN_RETURN, stmtDepth),
+ createStatement(recurmax, canThrow, CANNOT_BREAK, CANNOT_CONTINUE, CAN_RETURN, stmtDepth, STMT_RETURN_ETC),
+ "},"
+ ];
+ } else {
+ var prop2;
+ do {
+ prop2 = getDotKey();
+ } while (prop1 == prop2);
s = [
"set " + prop1 + "(" + createVarName(MANDATORY) + "){",
strictMode(),
@@ -922,8 +923,8 @@ function createAccessor(recurmax, stmtDepth, canThrow) {
"this." + prop2 + createAssignment() + _createBinaryExpr(recurmax, COMMA_OK, stmtDepth, canThrow) + ";",
"},"
];
- });
- }
+ }
+ });
VAR_NAMES.length = namesLenBefore;
return filterDirective(s).join("\n");
}