Move ?? to LogicalExpression

This commit is contained in:
Lucas Azzola 2017-10-15 15:10:34 +11:00
parent fcdfb0e31e
commit f1b8404750
8 changed files with 12 additions and 10 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ coverage
lib
node_modules
npm-debug.log
.vscode

View File

@ -791,7 +791,6 @@ enum BinaryOperator {
| "|" | "^" | "&" | "in"
| "instanceof"
| "|>"
| "??"
}
```
@ -839,7 +838,7 @@ A logical operator expression.
```js
enum LogicalOperator {
"||" | "&&"
"||" | "&&" | "??"
}
```

View File

@ -311,7 +311,9 @@ export default class ExpressionParser extends LValParser {
this.finishNode(
node,
op === tt.logicalOR || op === tt.logicalAND
op === tt.logicalOR ||
op === tt.logicalAND ||
op === tt.nullishCoalescing
? "LogicalExpression"
: "BinaryExpression",
);

View File

@ -43,7 +43,7 @@
}
},
"expression": {
"type": "BinaryExpression",
"type": "LogicalExpression",
"start": 0,
"end": 11,
"loc": {
@ -57,7 +57,7 @@
}
},
"left": {
"type": "BinaryExpression",
"type": "LogicalExpression",
"start": 0,
"end": 6,
"loc": {

View File

@ -43,7 +43,7 @@
}
},
"expression": {
"type": "BinaryExpression",
"type": "LogicalExpression",
"start": 0,
"end": 8,
"loc": {

View File

@ -43,7 +43,7 @@
}
},
"expression": {
"type": "BinaryExpression",
"type": "LogicalExpression",
"start": 0,
"end": 16,
"loc": {
@ -57,7 +57,7 @@
}
},
"left": {
"type": "BinaryExpression",
"type": "LogicalExpression",
"start": 0,
"end": 9,
"loc": {

View File

@ -75,7 +75,7 @@
},
"operator": "|>",
"right": {
"type": "BinaryExpression",
"type": "LogicalExpression",
"start": 5,
"end": 11,
"loc": {

View File

@ -43,7 +43,7 @@
}
},
"expression": {
"type": "BinaryExpression",
"type": "LogicalExpression",
"start": 0,
"end": 11,
"loc": {