Skip to content
This repository was archived by the owner on Apr 10, 2023. It is now read-only.

Commit c748e8a

Browse files
committed
feat(ArrayExpression): ✨Support muliple arguments
1 parent 1a25cb6 commit c748e8a

File tree

24 files changed

+445
-67
lines changed

24 files changed

+445
-67
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a(b)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"type": "Program",
3+
"body": [
4+
{
5+
"type": "ExpressionStatement",
6+
"expression": {
7+
"type": "CallExpression",
8+
"callee": {
9+
"type": "Identifier",
10+
"name": "a"
11+
},
12+
"arguments": [
13+
{
14+
"type": "Identifier",
15+
"name": "b"
16+
}
17+
]
18+
}
19+
}
20+
]
21+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a(b, c)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"type": "Program",
3+
"body": [
4+
{
5+
"type": "ExpressionStatement",
6+
"expression": {
7+
"type": "CallExpression",
8+
"callee": {
9+
"type": "Identifier",
10+
"name": "a"
11+
},
12+
"arguments": [
13+
{
14+
"type": "Identifier",
15+
"name": "b"
16+
},
17+
{
18+
"type": "Identifier",
19+
"name": "c"
20+
}
21+
]
22+
}
23+
}
24+
]
25+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"type": "Program",
3+
"body": [
4+
{
5+
"type": "ExpressionStatement",
6+
"expression": {
7+
"type": "ArrayExpression",
8+
"elements": [
9+
{
10+
"type": "Literal",
11+
"value": 1
12+
},
13+
{
14+
"type": "Literal",
15+
"value": "string"
16+
},
17+
{
18+
"type": "Literal",
19+
"value": true
20+
},
21+
{
22+
"type": "Identifier",
23+
"name": "id"
24+
}
25+
]
26+
}
27+
}
28+
]
29+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[1, 'string', true, id]

lib/__tests__/fixtures/serialize/binary-expression-precedences-000/input.js

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"type": "Program",
3+
"body": [
4+
{
5+
"type": "ExpressionStatement",
6+
"expression": {
7+
"type": "BinaryExpression",
8+
"operator": "-",
9+
"left": {
10+
"type": "BinaryExpression",
11+
"operator": "*",
12+
"left": {
13+
"type": "Literal",
14+
"value": 1
15+
},
16+
"right": {
17+
"type": "BinaryExpression",
18+
"operator": "+",
19+
"left": {
20+
"type": "BinaryExpression",
21+
"operator": "+",
22+
"left": {
23+
"type": "Literal",
24+
"value": 2
25+
},
26+
"right": {
27+
"type": "BinaryExpression",
28+
"operator": "-",
29+
"left": {
30+
"type": "Literal",
31+
"value": 3
32+
},
33+
"right": {
34+
"type": "Literal",
35+
"value": 3
36+
},
37+
"paren": true
38+
}
39+
},
40+
"right": {
41+
"type": "Literal",
42+
"value": 2
43+
},
44+
"paren": true
45+
}
46+
},
47+
"right": {
48+
"type": "Literal",
49+
"value": 1
50+
}
51+
}
52+
}
53+
]
54+
}

lib/__tests__/fixtures/serialize/binary-expression-precedences-001/input.js

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
{
2+
"type": "Program",
3+
"body": [
4+
{
5+
"type": "ExpressionStatement",
6+
"expression": {
7+
"type": "ConditionalExpression",
8+
"test": {
9+
"type": "LogicalExpression",
10+
"operator": "||",
11+
"left": {
12+
"type": "Identifier",
13+
"name": "a"
14+
},
15+
"right": {
16+
"type": "LogicalExpression",
17+
"operator": "&&",
18+
"left": {
19+
"type": "Identifier",
20+
"name": "d"
21+
},
22+
"right": {
23+
"type": "BinaryExpression",
24+
"operator": "^",
25+
"left": {
26+
"type": "Identifier",
27+
"name": "e"
28+
},
29+
"right": {
30+
"type": "BinaryExpression",
31+
"operator": "&",
32+
"left": {
33+
"type": "Identifier",
34+
"name": "f"
35+
},
36+
"right": {
37+
"type": "BinaryExpression",
38+
"operator": "===",
39+
"left": {
40+
"type": "Identifier",
41+
"name": "g"
42+
},
43+
"right": {
44+
"type": "BinaryExpression",
45+
"operator": "<",
46+
"left": {
47+
"type": "Identifier",
48+
"name": "h"
49+
},
50+
"right": {
51+
"type": "BinaryExpression",
52+
"operator": "<<",
53+
"left": {
54+
"type": "Identifier",
55+
"name": "i"
56+
},
57+
"right": {
58+
"type": "BinaryExpression",
59+
"operator": "+",
60+
"left": {
61+
"type": "Identifier",
62+
"name": "j"
63+
},
64+
"right": {
65+
"type": "BinaryExpression",
66+
"operator": "%",
67+
"left": {
68+
"type": "Identifier",
69+
"name": "k"
70+
},
71+
"right": {
72+
"type": "BinaryExpression",
73+
"operator": "**",
74+
"left": {
75+
"type": "Identifier",
76+
"name": "l"
77+
},
78+
"right": {
79+
"type": "UnaryExpression",
80+
"operator": "!",
81+
"argument": {
82+
"type": "UpdateExpression",
83+
"operator": "++",
84+
"argument": {
85+
"type": "Identifier",
86+
"name": "m"
87+
},
88+
"prefix": false
89+
}
90+
}
91+
}
92+
}
93+
}
94+
}
95+
}
96+
}
97+
}
98+
}
99+
}
100+
},
101+
"consequent": {
102+
"type": "Identifier",
103+
"name": "b"
104+
},
105+
"alternate": {
106+
"type": "Identifier",
107+
"name": "c"
108+
}
109+
}
110+
}
111+
]
112+
}

0 commit comments

Comments
 (0)