fix corner cases with template literals (#4780)

This commit is contained in:
Alex Lam S.L
2021-03-15 13:54:05 +00:00
committed by GitHub
parent 01aa078e9c
commit 176581d732
4 changed files with 46 additions and 2 deletions

View File

@@ -1493,7 +1493,9 @@ function _createExpression(recurmax, noComma, stmtDepth, canThrow) {
case p++:
var name = getVarName();
var fn = name + "." + getDotKey();
var s = "typeof " + fn + ' == "function" && --_calls_ >= 0 && ' + fn + createArgs(recurmax, stmtDepth, canThrow);
var s = "typeof " + fn + ' == "function" && --_calls_ >= 0 && ';
s += rng(5) ? fn : "(" + createExpression(recurmax, NO_COMMA, stmtDepth, canThrow) + ", " + fn + ")";
s += createArgs(recurmax, stmtDepth, canThrow);
return mayDefer(canThrow && rng(20) == 0 ? s : name + " && " + s);
case p++:
if (SUPPORT.class) {