зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1629795 - Part 1: Omit "..." when disassembling zero-args call. r=arai
Omit the ellipsis characters when the call has zero arguments. This makes the disassembly of iterator code a bit more readable, because we're now no longer displaying additional "..." strings when the call has no arguments. Depends on D70816 Differential Revision: https://phabricator.services.mozilla.com/D70817 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
d6a7fbec08
Коммит
7aa55e8355
|
@ -77,7 +77,7 @@ check("o[268435455]");
|
|||
check("o['1.1']");
|
||||
check("o[4 + 'h']", "o['4h']");
|
||||
check("ieval(undef)", "ieval(...)");
|
||||
check("ieval.call()", "ieval.call(...)");
|
||||
check("ieval.call()", "ieval.call()");
|
||||
check("ieval(...[])", "ieval(...)");
|
||||
check("ieval(...[undef])", "ieval(...)");
|
||||
check("ieval(...[undef, undef])", "ieval(...)");
|
||||
|
@ -105,7 +105,7 @@ check("o[(- (o + 1))]");
|
|||
check_one("6", (function () { 6() }), " is not a function");
|
||||
check_one("4", (function() { (4||eval)(); }), " is not a function");
|
||||
check_one("0", (function () { Array.prototype.reverse.call('123'); }), " is read-only");
|
||||
check_one("[...][Symbol.iterator](...).next(...).value",
|
||||
check_one("[...][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");
|
||||
|
@ -129,11 +129,11 @@ check_one("(delete obj[y])",
|
|||
function() { "use strict"; var obj = {}, y = {}; (delete obj[y])(); },
|
||||
" is not a function");
|
||||
|
||||
check_one("foo.apply(...)",
|
||||
check_one("foo.apply()",
|
||||
function() { function foo() {} foo.apply()(); },
|
||||
" is not a function");
|
||||
|
||||
check_one("super(...)",
|
||||
check_one("super()",
|
||||
function() {
|
||||
class X extends Object {
|
||||
constructor() {
|
||||
|
@ -179,7 +179,7 @@ check_one("super[a]",
|
|||
},
|
||||
" is not a function");
|
||||
|
||||
check_one("super.a(...)",
|
||||
check_one("super.a()",
|
||||
function() {
|
||||
class Y {
|
||||
a() {
|
||||
|
@ -198,7 +198,7 @@ check_one("super.a(...)",
|
|||
},
|
||||
" is not a function");
|
||||
|
||||
check_one("super[a](...)",
|
||||
check_one("super[a]()",
|
||||
function() {
|
||||
class Y {
|
||||
a() {
|
||||
|
@ -242,13 +242,13 @@ check_one("eval(...)",
|
|||
function() { "use strict"; eval(...[""])(); },
|
||||
" is not a function");
|
||||
|
||||
check_one("(new foo(...))",
|
||||
check_one("(new foo())",
|
||||
function() { function foo() {}; new foo()(); },
|
||||
" is not a function");
|
||||
check_one("(new foo(...))",
|
||||
function() { function foo() {}; new foo(...[])(); },
|
||||
" is not a function");
|
||||
check_one("(new foo.x(...))",
|
||||
check_one("(new foo.x())",
|
||||
function() { var foo = { x: function() {} }; new foo.x()(); },
|
||||
" is not a function");
|
||||
check_one("(new foo.x(...))",
|
||||
|
@ -262,9 +262,9 @@ check_one("[...].foo",
|
|||
function() { [undefined, ...[]].foo(); },
|
||||
" is not a function");
|
||||
|
||||
check_one("[...][Symbol.iterator](...).next(...).value",
|
||||
check_one("[...][Symbol.iterator]().next().value",
|
||||
function () { var [{x}] = [null, {}]; }, " is null");
|
||||
check_one("[...][Symbol.iterator](...).next(...).value",
|
||||
check_one("[...][Symbol.iterator]().next().value",
|
||||
function () { var [{x}] = [void 0, {}]; }, " is undefined");
|
||||
|
||||
try {
|
||||
|
|
|
@ -29,6 +29,6 @@ try {
|
|||
g.foo({ f: () => { return { g: 0 } } });
|
||||
} catch (e) {
|
||||
gotException = true;
|
||||
assertEq(e.toString().includes("v.f(...).g is not a function"), true);
|
||||
assertEq(e.toString().includes("v.f().g is not a function"), true);
|
||||
}
|
||||
assertEq(gotException, true);
|
||||
|
|
|
@ -24,7 +24,7 @@ function test()
|
|||
var [a, b, [c0, c1]] = [x, x, x];
|
||||
}
|
||||
|
||||
expect = /TypeError: .*\[\.\.\.\]\[Symbol.iterator\]\(\.\.\.\)\.next\(\.\.\.\)\.value is null/;
|
||||
expect = /TypeError: .*\[\.\.\.\]\[Symbol.iterator\]\(\)\.next\(\)\.value is null/;
|
||||
actual = 'No Error';
|
||||
try
|
||||
{
|
||||
|
|
|
@ -1890,9 +1890,11 @@ bool ExpressionDecompiler::decompilePC(jsbytecode* pc, uint8_t defIndex) {
|
|||
case JSOp::CallIgnoresRv:
|
||||
case JSOp::CallIter:
|
||||
case JSOp::FunCall:
|
||||
case JSOp::FunApply:
|
||||
return decompilePCForStackOperand(pc, -int32_t(GET_ARGC(pc) + 2)) &&
|
||||
write("(...)");
|
||||
case JSOp::FunApply: {
|
||||
uint16_t argc = GET_ARGC(pc);
|
||||
return decompilePCForStackOperand(pc, -int32_t(argc + 2)) &&
|
||||
write(argc ? "(...)" : "()");
|
||||
}
|
||||
case JSOp::SpreadCall:
|
||||
return decompilePCForStackOperand(pc, -3) && write("(...)");
|
||||
case JSOp::NewArray:
|
||||
|
@ -1940,6 +1942,10 @@ bool ExpressionDecompiler::decompilePC(jsbytecode* pc, uint8_t defIndex) {
|
|||
write(")");
|
||||
|
||||
case JSOp::SuperCall:
|
||||
if (GET_ARGC(pc) == 0) {
|
||||
return write("super()");
|
||||
}
|
||||
[[fallthrough]];
|
||||
case JSOp::SpreadSuperCall:
|
||||
return write("super(...)");
|
||||
case JSOp::SuperFun:
|
||||
|
@ -1951,10 +1957,12 @@ bool ExpressionDecompiler::decompilePC(jsbytecode* pc, uint8_t defIndex) {
|
|||
case JSOp::StrictSpreadEval:
|
||||
return write("eval(...)");
|
||||
|
||||
case JSOp::New:
|
||||
case JSOp::New: {
|
||||
uint16_t argc = GET_ARGC(pc);
|
||||
return write("(new ") &&
|
||||
decompilePCForStackOperand(pc, -int32_t(GET_ARGC(pc) + 3)) &&
|
||||
write("(...))");
|
||||
decompilePCForStackOperand(pc, -int32_t(argc + 3)) &&
|
||||
write(argc ? "(...))" : "())");
|
||||
}
|
||||
|
||||
case JSOp::SpreadNew:
|
||||
return write("(new ") && decompilePCForStackOperand(pc, -4) &&
|
||||
|
|
Загрузка…
Ссылка в новой задаче