Bug 1710516 - [devtools] Add privateIn babel plugin to parser worker. r=bomsy.

Since ergonomic brand check were enabled in Bug 1710510,
babel needs support to parse script using this new syntax.
A test case is added, and the test was failing without the
new plugin.

Differential Revision: https://phabricator.services.mozilla.com/D115381
This commit is contained in:
Nicolas Chevobbe 2021-05-20 13:57:13 +00:00
Родитель 1dab329297
Коммит ae6d72720b
5 изменённых файлов: 20 добавлений и 4 удалений

Просмотреть файл

@ -2212,7 +2212,7 @@
"byName": {},
"byBlocks": {},
"usedIds": {
"0": 0
"1": 1
}
}
}
@ -2233,7 +2233,7 @@
"byName": {},
"byBlocks": {},
"usedIds": {
"0": 0
"1": 1
}
}
}
@ -2254,7 +2254,7 @@
"byName": {},
"byBlocks": {},
"usedIds": {
"0": 0
"1": 1
}
}
}

Просмотреть файл

@ -8314,7 +8314,7 @@ const sourceOptions = {
generated: {
sourceType: "unambiguous",
tokens: true,
plugins: ["classPrivateProperties", "classPrivateMethods", "classProperties", "objectRestSpread", "optionalChaining", "nullishCoalescingOperator"]
plugins: ["classPrivateProperties", "classPrivateMethods", "classProperties", "objectRestSpread", "optionalChaining", "privateIn", "nullishCoalescingOperator"]
},
original: {
sourceType: "unambiguous",

Просмотреть файл

@ -27,6 +27,7 @@ const sourceOptions = {
"classProperties",
"objectRestSpread",
"optionalChaining",
"privateIn",
"nullishCoalescingOperator",
],
},

Просмотреть файл

@ -50,6 +50,18 @@ add_task(async function() {
["second", "b"],
],
},
{
line: 51,
column: 26,
expression: "this",
fields: [
["x", "1"],
// TODO: The private properties are not shown in the object preview at the moment,
// this should be fixed as part of Bug 1499679.
// ["#privateVar", "2"],
],
},
{ line: 51, column: 39, expression: "this.#privateVar", result: 2 },
]);
});

Просмотреть файл

@ -48,6 +48,9 @@ function classPreview() {
}
breakFn() {
let i = this.x * this.#privateVar + Foo.#privateStatic;
if (#privateVar in this && this.#privateVar !== 0) {
i = i * 2;
}
debugger;
}
}