Skip to content

Commit

Permalink
Bug 1127629 - Handle void in ExpressionDecompiler.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmottola committed Mar 12, 2019
1 parent 444f42a commit 6e20c9d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js/src/jit-test/tests/basic/expression-autopsy.js
Expand Up @@ -97,13 +97,16 @@ check("o[~(o)]");
check("o[+ (o)]");
check("o[- (o)]");


// A few one off tests
check_one("6", (function () { 6() }), " is not a function");
check_one("0", (function () { Array.prototype.reverse.call('123'); }), " is read-only");
check_one(`(intermediate value)[Symbol.iterator](...).next(...).value`,
function () { var [{ x }] = [null, {}]; }, " is null");
check_one(`(intermediate value)[Symbol.iterator](...).next(...).value`,
function () { ieval("{ let x; var [a, b, [c0, c1]] = [x, x, x]; }") }, " is undefined");
check_one("void 1", function() { (void 1)(); }, " is not a function");
check_one("void o[1]", function() { var o = []; (void o[1])() }, " is not a function");

// Check fallback behavior
assertThrowsInstanceOf(function () { for (let x of undefined) {} }, TypeError);
2 changes: 2 additions & 0 deletions js/src/jsopcode.cpp
Expand Up @@ -1627,6 +1627,8 @@ ExpressionDecompiler::decompilePC(jsbytecode* pc)
return false;
return write(str);
}
case JSOP_VOID:
return write("void ") && decompilePCForStackOperand(pc, -1);
default:
break;
}
Expand Down

0 comments on commit 6e20c9d

Please sign in to comment.