Skip to content

Commit

Permalink
Remove PipelineBody node
Browse files Browse the repository at this point in the history
This isn't strictly need, as it's just an extra layer of nesting and
provides no additional information.
  • Loading branch information
mAAdhaTTah committed Apr 15, 2019
1 parent 5b8cb23 commit f34dc8a
Show file tree
Hide file tree
Showing 17 changed files with 1,165 additions and 1,616 deletions.
5 changes: 2 additions & 3 deletions packages/babel-parser/src/parser/expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -2364,12 +2364,11 @@ export default class ExpressionParser extends LValParser {
const startPos = this.state.start;
const startLoc = this.state.startLoc;

const node = this.startNode();
this.state.potentialArrowAt = this.state.start;
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
this.state.inFSharpPipelineDirectBody = true;

node.body = this.parseExprOp(
const ret = this.parseExprOp(
this.parseMaybeUnary(),
startPos,
startLoc,
Expand All @@ -2379,6 +2378,6 @@ export default class ExpressionParser extends LValParser {

this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;

return this.finishNode(node, "PipelineBody");
return ret;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
},
"operator": "|>",
"right": {
"type": "PipelineBody",
"type": "ArrayExpression",
"start": 10,
"end": 36,
"loc": {
Expand All @@ -125,234 +125,204 @@
"column": 36
}
},
"body": {
"type": "ArrayExpression",
"start": 10,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 10
"elements": [
{
"type": "ArrowFunctionExpression",
"start": 11,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 35
}
},
"end": {
"line": 1,
"column": 36
}
},
"elements": [
{
"type": "ArrowFunctionExpression",
"start": 11,
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 11,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 12
},
"identifierName": "y"
},
"name": "y"
}
],
"body": {
"type": "BinaryExpression",
"start": 16,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 11
"column": 16
},
"end": {
"line": 1,
"column": 35
}
},
"id": null,
"generator": false,
"async": false,
"params": [
{
"left": {
"type": "BinaryExpression",
"start": 16,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 21
}
},
"left": {
"type": "Identifier",
"start": 11,
"end": 12,
"start": 16,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 11
"column": 16
},
"end": {
"line": 1,
"column": 12
"column": 17
},
"identifierName": "y"
},
"name": "y"
},
"operator": "+",
"right": {
"type": "NumericLiteral",
"start": 20,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 20
},
"end": {
"line": 1,
"column": 21
}
},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
],
"body": {
"type": "BinaryExpression",
"start": 16,
},
"operator": "|>",
"right": {
"type": "ArrowFunctionExpression",
"start": 25,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 16
"column": 25
},
"end": {
"line": 1,
"column": 35
}
},
"left": {
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 25,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 26
},
"identifierName": "z"
},
"name": "z"
}
],
"body": {
"type": "BinaryExpression",
"start": 16,
"end": 21,
"start": 30,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 16
"column": 30
},
"end": {
"line": 1,
"column": 21
"column": 35
}
},
"left": {
"type": "Identifier",
"start": 16,
"end": 17,
"start": 30,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 16
"column": 30
},
"end": {
"line": 1,
"column": 17
"column": 31
},
"identifierName": "y"
"identifierName": "z"
},
"name": "y"
"name": "z"
},
"operator": "+",
"operator": "*",
"right": {
"type": "NumericLiteral",
"start": 20,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 20
},
"end": {
"line": 1,
"column": 21
}
},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
},
"operator": "|>",
"right": {
"type": "PipelineBody",
"start": 25,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 35
}
},
"body": {
"type": "ArrowFunctionExpression",
"start": 25,
"start": 34,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 25
"column": 34
},
"end": {
"line": 1,
"column": 35
}
},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 25,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 26
},
"identifierName": "z"
},
"name": "z"
}
],
"body": {
"type": "BinaryExpression",
"start": 30,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 30
},
"end": {
"line": 1,
"column": 35
}
},
"left": {
"type": "Identifier",
"start": 30,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 30
},
"end": {
"line": 1,
"column": 31
},
"identifierName": "z"
},
"name": "z"
},
"operator": "*",
"right": {
"type": "NumericLiteral",
"start": 34,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 34
},
"end": {
"line": 1,
"column": 35
}
},
"extra": {
"rawValue": 2,
"raw": "2"
},
"value": 2
}
}
"extra": {
"rawValue": 2,
"raw": "2"
},
"value": 2
}
}
}
}
]
}
}
]
}
}
}
Expand Down

0 comments on commit f34dc8a

Please sign in to comment.