This commit is contained in:
parent
0e985fb287
commit
b651a6f6ab
@ -129,16 +129,6 @@ const pluginNameMap = {
|
||||
url: "https://git.io/JfeDR",
|
||||
},
|
||||
},
|
||||
logicalAssignment: {
|
||||
syntax: {
|
||||
name: "@babel/plugin-syntax-logical-assignment-operators",
|
||||
url: "https://git.io/vAlBp",
|
||||
},
|
||||
transform: {
|
||||
name: "@babel/plugin-proposal-logical-assignment-operators",
|
||||
url: "https://git.io/vAlRe",
|
||||
},
|
||||
},
|
||||
moduleAttributes: {
|
||||
syntax: {
|
||||
name: "@babel/plugin-syntax-module-attributes",
|
||||
@ -226,6 +216,16 @@ const pluginNameMap = {
|
||||
url: "https://git.io/vb4yp",
|
||||
},
|
||||
},
|
||||
logicalAssignment: {
|
||||
syntax: {
|
||||
name: "@babel/plugin-syntax-logical-assignment-operators",
|
||||
url: "https://git.io/vAlBp",
|
||||
},
|
||||
transform: {
|
||||
name: "@babel/plugin-proposal-logical-assignment-operators",
|
||||
url: "https://git.io/vAlRe",
|
||||
},
|
||||
},
|
||||
nullishCoalescingOperator: {
|
||||
syntax: {
|
||||
name: "@babel/plugin-syntax-nullish-coalescing-operator",
|
||||
|
||||
@ -804,10 +804,10 @@ describe("api", function () {
|
||||
options,
|
||||
function (err) {
|
||||
expect(err.message).toMatch(
|
||||
"Support for the experimental syntax 'logicalAssignment' isn't currently enabled (1:3):",
|
||||
"Support for the experimental syntax 'doExpressions' isn't currently enabled (1:2):",
|
||||
);
|
||||
expect(err.message).toMatch(
|
||||
"Add @babel/plugin-proposal-logical-assignment-operators (https://git.io/vAlRe) to the " +
|
||||
"Add @babel/plugin-proposal-do-expressions (https://git.io/vb4S3) to the " +
|
||||
"'plugins' section of your Babel config to enable transformation.",
|
||||
);
|
||||
done();
|
||||
|
||||
@ -1 +1,3 @@
|
||||
a ||= 2;
|
||||
(do {
|
||||
x;
|
||||
});
|
||||
|
||||
@ -229,12 +229,6 @@ export default class ExpressionParser extends LValParser {
|
||||
const operator = this.state.value;
|
||||
node.operator = operator;
|
||||
|
||||
if (operator === "??=") {
|
||||
this.expectPlugin("logicalAssignment");
|
||||
}
|
||||
if (operator === "||=" || operator === "&&=") {
|
||||
this.expectPlugin("logicalAssignment");
|
||||
}
|
||||
if (this.match(tt.eq)) {
|
||||
node.left = this.toAssignable(left);
|
||||
refExpressionErrors.doubleProto = -1; // reset because double __proto__ is valid in assignment expression
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"plugins": [],
|
||||
"throws": "This experimental syntax requires enabling the parser plugin: 'logicalAssignment' (1:2)"
|
||||
}
|
||||
@ -1,2 +0,0 @@
|
||||
a &&= b;
|
||||
obj.a &&= b;
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"plugins": ["logicalAssignment"]
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
a ||= b;
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"plugins": [],
|
||||
"throws": "This experimental syntax requires enabling the parser plugin: 'logicalAssignment' (1:2)"
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"plugins": ["logicalAssignment"]
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "This experimental syntax requires enabling the parser plugin: 'logicalAssignment' (1:2)"
|
||||
}
|
||||
@ -1,2 +0,0 @@
|
||||
a ??= b;
|
||||
obj.a ??= b;
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"plugins": ["logicalAssignment"]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user