Skip to content

Commit

Permalink
refactor: remove unecessary trailing comma record
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Aug 22, 2023
1 parent 0c8dfc1 commit 4d779bf
Show file tree
Hide file tree
Showing 11 changed files with 3 additions and 49 deletions.
7 changes: 3 additions & 4 deletions packages/babel-parser/src/parser/expression.ts
Expand Up @@ -887,8 +887,7 @@ export default abstract class ExpressionParser extends LValParser {
tt.parenR,
base.type === "Import",
base.type !== "Super",
// @ts-expect-error todo(flow->ts)
node,
maybeAsyncArrow ? node : null,
refExpressionErrors,
);
}
Expand Down Expand Up @@ -1008,7 +1007,7 @@ export default abstract class ExpressionParser extends LValParser {
close: TokenType,
dynamicImport?: boolean,
allowPlaceholder?: boolean,
nodeForExtra?: N.Node | null,
nodeForExtra?: Undone<N.Node> | null,
refExpressionErrors?: ExpressionErrors | null,
): Array<N.Expression | undefined | null> {
const elts: N.Expression[] = [];
Expand Down Expand Up @@ -2075,7 +2074,7 @@ export default abstract class ExpressionParser extends LValParser {
return this.finishNode(node, type);
}

addTrailingCommaExtraToNode(node: N.Node): void {
addTrailingCommaExtraToNode(node: Undone<N.Node>): void {
this.addExtra(node, "trailingComma", this.state.lastTokStart);
this.addExtra(node, "trailingCommaLoc", this.state.lastTokStartLoc, false);
}
Expand Down
Expand Up @@ -18,9 +18,6 @@
"start":0,"end":2,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":2,"index":2},"identifierName":"fn"},
"name": "fn"
},
"extra": {
"trailingComma": 11
},
"arguments": [
{
"type": "Identifier",
Expand Down
Expand Up @@ -18,9 +18,6 @@
"start":0,"end":2,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":2,"index":2},"identifierName":"fn"},
"name": "fn"
},
"extra": {
"trailingComma": 7
},
"arguments": [
{
"type": "Identifier",
Expand Down
Expand Up @@ -18,9 +18,6 @@
"start":0,"end":3,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":3,"index":3},"identifierName":"log"},
"name": "log"
},
"extra": {
"trailingComma": 13
},
"arguments": [
{
"type": "Identifier",
Expand Down
Expand Up @@ -21,9 +21,6 @@
"start":0,"end":3,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":3,"index":3},"identifierName":"log"},
"name": "log"
},
"extra": {
"trailingComma": 4
},
"arguments": [
null
]
Expand Down
Expand Up @@ -20,9 +20,6 @@
"type": "Import",
"start":0,"end":6,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":6,"index":6}}
},
"extra": {
"trailingComma": 12
},
"arguments": [
{
"type": "StringLiteral",
Expand Down
Expand Up @@ -17,9 +17,6 @@
"type": "Import",
"start":0,"end":6,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":6,"index":6}}
},
"extra": {
"trailingComma": 15
},
"arguments": [
{
"type": "StringLiteral",
Expand All @@ -43,9 +40,6 @@
"type": "Import",
"start":19,"end":25,"loc":{"start":{"line":2,"column":0,"index":19},"end":{"line":2,"column":6,"index":25}}
},
"extra": {
"trailingComma": 64
},
"arguments": [
{
"type": "StringLiteral",
Expand Down
Expand Up @@ -17,9 +17,6 @@
"type": "Import",
"start":0,"end":6,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":6,"index":6}}
},
"extra": {
"trailingComma": 15
},
"arguments": [
{
"type": "StringLiteral",
Expand All @@ -43,9 +40,6 @@
"type": "Import",
"start":19,"end":25,"loc":{"start":{"line":2,"column":0,"index":19},"end":{"line":2,"column":6,"index":25}}
},
"extra": {
"trailingComma": 66
},
"arguments": [
{
"type": "StringLiteral",
Expand Down
Expand Up @@ -17,9 +17,6 @@
"type": "Import",
"start":0,"end":6,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":6,"index":6}}
},
"extra": {
"trailingComma": 15
},
"arguments": [
{
"type": "StringLiteral",
Expand All @@ -43,9 +40,6 @@
"type": "Import",
"start":19,"end":25,"loc":{"start":{"line":2,"column":0,"index":19},"end":{"line":2,"column":6,"index":25}}
},
"extra": {
"trailingComma": 66
},
"arguments": [
{
"type": "StringLiteral",
Expand Down
Expand Up @@ -17,9 +17,6 @@
"type": "Import",
"start":0,"end":6,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":6,"index":6}}
},
"extra": {
"trailingComma": 15
},
"arguments": [
{
"type": "StringLiteral",
Expand All @@ -43,9 +40,6 @@
"type": "Import",
"start":19,"end":25,"loc":{"start":{"line":2,"column":0,"index":19},"end":{"line":2,"column":6,"index":25}}
},
"extra": {
"trailingComma": 64
},
"arguments": [
{
"type": "StringLiteral",
Expand Down
Expand Up @@ -17,9 +17,6 @@
"type": "Import",
"start":0,"end":6,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":6,"index":6}}
},
"extra": {
"trailingComma": 15
},
"arguments": [
{
"type": "StringLiteral",
Expand All @@ -43,9 +40,6 @@
"type": "Import",
"start":19,"end":25,"loc":{"start":{"line":2,"column":0,"index":19},"end":{"line":2,"column":6,"index":25}}
},
"extra": {
"trailingComma": 64
},
"arguments": [
{
"type": "StringLiteral",
Expand Down

0 comments on commit 4d779bf

Please sign in to comment.