track canThrow during typeof creation

This commit is contained in:
alexlamsl 2017-04-02 04:12:53 +08:00
parent 49781d0584
commit 0136737c90

View File

@ -514,7 +514,7 @@ function _createExpression(recurmax, noComma, stmtDepth, canThrow) {
VAR_NAMES.length = nameLenBefore; VAR_NAMES.length = nameLenBefore;
return s; return s;
case 9: case 9:
return createTypeofExpr(); return createTypeofExpr(recurmax, stmtDepth, canThrow);
case 10: case 10:
// you could statically infer that this is just `Math`, regardless of the other expression // you could statically infer that this is just `Math`, regardless of the other expression
// I don't think Uglify does this at this time... // I don't think Uglify does this at this time...
@ -573,7 +573,7 @@ function _createSimpleBinaryExpr(recurmax, noComma) {
return s; return s;
} }
function createTypeofExpr() { function createTypeofExpr(recurmax, stmtDepth, canThrow) {
switch (rng(8)) { switch (rng(8)) {
case 0: case 0:
return 'typeof ' + createVarName(MANDATORY, DONT_STORE) + ' === "' + TYPEOF_OUTCOMES[rng(TYPEOF_OUTCOMES.length)] + '"'; return 'typeof ' + createVarName(MANDATORY, DONT_STORE) + ' === "' + TYPEOF_OUTCOMES[rng(TYPEOF_OUTCOMES.length)] + '"';
@ -585,10 +585,8 @@ function createTypeofExpr() {
return 'typeof ' + createVarName(MANDATORY, DONT_STORE) + ' != "' + TYPEOF_OUTCOMES[rng(TYPEOF_OUTCOMES.length)] + '"'; return 'typeof ' + createVarName(MANDATORY, DONT_STORE) + ' != "' + TYPEOF_OUTCOMES[rng(TYPEOF_OUTCOMES.length)] + '"';
case 4: case 4:
return 'typeof ' + createVarName(MANDATORY, DONT_STORE); return 'typeof ' + createVarName(MANDATORY, DONT_STORE);
case 5: default:
case 6: return '(typeof ' + createExpression(recurmax, COMMA_OK, stmtDepth, canThrow) + ')';
case 7:
return '(typeof ' + createExpression(3, COMMA_OK, 2, true) + ')';
} }
} }