Enable nullish coalescing by default in @babel/parser (#10819)
* move files, remove hasPlugin() & expectPlugin() * restore permissions
This commit is contained in:
parent
5b907e9bb7
commit
c3388ea42f
@ -113,16 +113,6 @@ const pluginNameMap = {
|
|||||||
url: "https://git.io/vAlRe",
|
url: "https://git.io/vAlRe",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
nullishCoalescingOperator: {
|
|
||||||
syntax: {
|
|
||||||
name: "@babel/plugin-syntax-nullish-coalescing-operator",
|
|
||||||
url: "https://git.io/vb4yx",
|
|
||||||
},
|
|
||||||
transform: {
|
|
||||||
name: "@babel/plugin-proposal-nullish-coalescing-operator",
|
|
||||||
url: "https://git.io/vb4Se",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
numericSeparator: {
|
numericSeparator: {
|
||||||
syntax: {
|
syntax: {
|
||||||
name: "@babel/plugin-syntax-numeric-separator",
|
name: "@babel/plugin-syntax-numeric-separator",
|
||||||
@ -188,6 +178,16 @@ const pluginNameMap = {
|
|||||||
url: "https://git.io/vb4yp",
|
url: "https://git.io/vb4yp",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
nullishCoalescingOperator: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-nullish-coalescing-operator",
|
||||||
|
url: "https://git.io/vb4yx",
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-nullish-coalescing-operator",
|
||||||
|
url: "https://git.io/vb4Se",
|
||||||
|
},
|
||||||
|
},
|
||||||
objectRestSpread: {
|
objectRestSpread: {
|
||||||
syntax: {
|
syntax: {
|
||||||
name: "@babel/plugin-syntax-object-rest-spread",
|
name: "@babel/plugin-syntax-object-rest-spread",
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": ["nullishCoalescingOperator"]
|
|
||||||
}
|
|
||||||
@ -196,7 +196,6 @@ export default class ExpressionParser extends LValParser {
|
|||||||
node.operator = operator;
|
node.operator = operator;
|
||||||
|
|
||||||
if (operator === "??=") {
|
if (operator === "??=") {
|
||||||
this.expectPlugin("nullishCoalescingOperator");
|
|
||||||
this.expectPlugin("logicalAssignment");
|
this.expectPlugin("logicalAssignment");
|
||||||
}
|
}
|
||||||
if (operator === "||=" || operator === "&&=") {
|
if (operator === "||=" || operator === "&&=") {
|
||||||
@ -333,8 +332,6 @@ export default class ExpressionParser extends LValParser {
|
|||||||
this.expectPlugin("pipelineOperator");
|
this.expectPlugin("pipelineOperator");
|
||||||
this.state.inPipeline = true;
|
this.state.inPipeline = true;
|
||||||
this.checkPipelineAtInfixOperator(left, leftStartPos);
|
this.checkPipelineAtInfixOperator(left, leftStartPos);
|
||||||
} else if (op === tt.nullishCoalescing) {
|
|
||||||
this.expectPlugin("nullishCoalescingOperator");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.next();
|
this.next();
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"plugins": ["nullishCoalescingOperator", "estree"],
|
"plugins": ["estree"],
|
||||||
"throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:0)"
|
"throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:0)"
|
||||||
}
|
}
|
||||||
@ -1,4 +1,3 @@
|
|||||||
{
|
{
|
||||||
"plugins": ["nullishCoalescingOperator"],
|
|
||||||
"throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:5)"
|
"throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:5)"
|
||||||
}
|
}
|
||||||
@ -1,4 +1,3 @@
|
|||||||
{
|
{
|
||||||
"plugins": ["nullishCoalescingOperator"],
|
|
||||||
"throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:10)"
|
"throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:10)"
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"plugins": ["nullishCoalescingOperator", "estree"],
|
"plugins": ["estree"],
|
||||||
"throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:0)"
|
"throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:0)"
|
||||||
}
|
}
|
||||||
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"nullishCoalescingOperator",
|
|
||||||
["pipelineOperator", { "proposal": "minimal" }]
|
["pipelineOperator", { "proposal": "minimal" }]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -1,2 +0,0 @@
|
|||||||
a ??= b;
|
|
||||||
obj.a ??= b;
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": ["logicalAssignment"],
|
|
||||||
"throws": "This experimental syntax requires enabling the parser plugin: 'nullishCoalescingOperator' (1:2)"
|
|
||||||
}
|
|
||||||
@ -1,4 +1,3 @@
|
|||||||
{
|
{
|
||||||
"plugins": ["nullishCoalescingOperator"],
|
|
||||||
"throws": "This experimental syntax requires enabling the parser plugin: 'logicalAssignment' (1:2)"
|
"throws": "This experimental syntax requires enabling the parser plugin: 'logicalAssignment' (1:2)"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"plugins": ["logicalAssignment", "nullishCoalescingOperator"]
|
"plugins": ["logicalAssignment"]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": ["nullishCoalescingOperator"]
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": ["nullishCoalescingOperator"]
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": ["nullishCoalescingOperator"]
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": ["nullishCoalescingOperator"]
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
foo ?? 1;
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"throws": "This experimental syntax requires enabling the parser plugin: 'nullishCoalescingOperator' (1:4)"
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": ["nullishCoalescingOperator"]
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": ["nullishCoalescingOperator"]
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": ["nullishCoalescingOperator"]
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user