Skip to content

Commit 5e45d5e

Browse files
committed
Lightscript OBA fixup
1 parent 1aded08 commit 5e45d5e

28 files changed

+1453
-443
lines changed

test/fixtures/lightscript/arrow-expressions/skinny-curly/expected.json

+72-17
Original file line numberDiff line numberDiff line change
@@ -79,40 +79,95 @@
7979
"body": [
8080
{
8181
"type": "ExpressionStatement",
82-
"start": 10,
83-
"end": 11,
82+
"start": 6,
83+
"end": 13,
8484
"loc": {
8585
"start": {
86-
"line": 2,
87-
"column": 2
86+
"line": 1,
87+
"column": 6
8888
},
8989
"end": {
90-
"line": 2,
91-
"column": 3
90+
"line": 3,
91+
"column": 1
9292
}
9393
},
9494
"expression": {
95-
"type": "Identifier",
96-
"start": 10,
97-
"end": 11,
95+
"type": "ObjectExpression",
96+
"start": 6,
97+
"end": 13,
9898
"loc": {
9999
"start": {
100-
"line": 2,
101-
"column": 2
100+
"line": 1,
101+
"column": 6
102102
},
103103
"end": {
104-
"line": 2,
105-
"column": 3
106-
},
107-
"identifierName": "x"
104+
"line": 3,
105+
"column": 1
106+
}
108107
},
109-
"name": "x"
108+
"properties": [
109+
{
110+
"type": "ObjectProperty",
111+
"start": 10,
112+
"end": 11,
113+
"loc": {
114+
"start": {
115+
"line": 2,
116+
"column": 2
117+
},
118+
"end": {
119+
"line": 2,
120+
"column": 3
121+
}
122+
},
123+
"method": false,
124+
"shorthand": true,
125+
"computed": false,
126+
"key": {
127+
"type": "Identifier",
128+
"start": 10,
129+
"end": 11,
130+
"loc": {
131+
"start": {
132+
"line": 2,
133+
"column": 2
134+
},
135+
"end": {
136+
"line": 2,
137+
"column": 3
138+
},
139+
"identifierName": "x"
140+
},
141+
"name": "x"
142+
},
143+
"value": {
144+
"type": "Identifier",
145+
"start": 10,
146+
"end": 11,
147+
"loc": {
148+
"start": {
149+
"line": 2,
150+
"column": 2
151+
},
152+
"end": {
153+
"line": 2,
154+
"column": 3
155+
},
156+
"identifierName": "x"
157+
},
158+
"name": "x"
159+
},
160+
"extra": {
161+
"shorthand": true
162+
}
163+
}
164+
]
110165
}
111166
}
112167
],
113168
"directives": [],
114169
"extra": {
115-
"curly": true
170+
"curly": false
116171
}
117172
}
118173
}

test/fixtures/lightscript/commaless/arrow-expr-params/expected.json

+34-2
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,42 @@
111111
"column": 7
112112
}
113113
},
114-
"body": [],
114+
"body": [
115+
{
116+
"type": "ExpressionStatement",
117+
"start": 15,
118+
"end": 17,
119+
"loc": {
120+
"start": {
121+
"line": 4,
122+
"column": 5
123+
},
124+
"end": {
125+
"line": 4,
126+
"column": 7
127+
}
128+
},
129+
"expression": {
130+
"type": "ObjectExpression",
131+
"start": 15,
132+
"end": 17,
133+
"loc": {
134+
"start": {
135+
"line": 4,
136+
"column": 5
137+
},
138+
"end": {
139+
"line": 4,
140+
"column": 7
141+
}
142+
},
143+
"properties": []
144+
}
145+
}
146+
],
115147
"directives": [],
116148
"extra": {
117-
"curly": true
149+
"curly": false
118150
}
119151
}
120152
}

test/fixtures/lightscript/commaless/arrow-expr-params/options.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"alternatives": {
33
"objectBlockAmbiguity": {
4-
"excludePlugins": ["objectBlockAmbiguity_preferObject"],
4+
"excludePlugins": ["whiteblockOnly", "whiteblockPreferred"],
55
"expected": "expected.objectBlockAmbiguity.json"
66
}
77
}

test/fixtures/lightscript/for-in/now/expected.whiteblock.json test/fixtures/lightscript/for-in/now/expected.braceblock.json

+4-36
Original file line numberDiff line numberDiff line change
@@ -79,54 +79,22 @@
7979
},
8080
"body": {
8181
"type": "BlockStatement",
82-
"start": 16,
82+
"start": 18,
8383
"end": 20,
8484
"loc": {
8585
"start": {
8686
"line": 1,
87-
"column": 16
87+
"column": 18
8888
},
8989
"end": {
9090
"line": 1,
9191
"column": 20
9292
}
9393
},
94-
"body": [
95-
{
96-
"type": "ExpressionStatement",
97-
"start": 18,
98-
"end": 20,
99-
"loc": {
100-
"start": {
101-
"line": 1,
102-
"column": 18
103-
},
104-
"end": {
105-
"line": 1,
106-
"column": 20
107-
}
108-
},
109-
"expression": {
110-
"type": "ObjectExpression",
111-
"start": 18,
112-
"end": 20,
113-
"loc": {
114-
"start": {
115-
"line": 1,
116-
"column": 18
117-
},
118-
"end": {
119-
"line": 1,
120-
"column": 20
121-
}
122-
},
123-
"properties": []
124-
}
125-
}
126-
],
94+
"body": [],
12795
"directives": [],
12896
"extra": {
129-
"curly": false
97+
"curly": true
13098
}
13199
}
132100
}

test/fixtures/lightscript/for-in/now/expected.json

+36-4
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,54 @@
7979
},
8080
"body": {
8181
"type": "BlockStatement",
82-
"start": 18,
82+
"start": 16,
8383
"end": 20,
8484
"loc": {
8585
"start": {
8686
"line": 1,
87-
"column": 18
87+
"column": 16
8888
},
8989
"end": {
9090
"line": 1,
9191
"column": 20
9292
}
9393
},
94-
"body": [],
94+
"body": [
95+
{
96+
"type": "ExpressionStatement",
97+
"start": 18,
98+
"end": 20,
99+
"loc": {
100+
"start": {
101+
"line": 1,
102+
"column": 18
103+
},
104+
"end": {
105+
"line": 1,
106+
"column": 20
107+
}
108+
},
109+
"expression": {
110+
"type": "ObjectExpression",
111+
"start": 18,
112+
"end": 20,
113+
"loc": {
114+
"start": {
115+
"line": 1,
116+
"column": 18
117+
},
118+
"end": {
119+
"line": 1,
120+
"column": 20
121+
}
122+
},
123+
"properties": []
124+
}
125+
}
126+
],
95127
"directives": [],
96128
"extra": {
97-
"curly": true
129+
"curly": false
98130
}
99131
}
100132
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"alternatives": {
3-
"whiteblock": {
3+
"braceblock": {
44
"allPlugins": true,
5-
"expected": "expected.whiteblock.json"
5+
"excludePlugins": ["whiteblockOnly", "whiteblockPreferred"],
6+
"expected": "expected.braceblock.json"
67
}
78
}
89
}

test/fixtures/lightscript/named-arrow-functions/skinny-curly/expected.whiteblock.json test/fixtures/lightscript/named-arrow-functions/skinny-curly/expected.braceblock.json

+2-34
Original file line numberDiff line numberDiff line change
@@ -78,42 +78,10 @@
7878
"column": 10
7979
}
8080
},
81-
"body": [
82-
{
83-
"type": "ExpressionStatement",
84-
"start": 8,
85-
"end": 10,
86-
"loc": {
87-
"start": {
88-
"line": 1,
89-
"column": 8
90-
},
91-
"end": {
92-
"line": 1,
93-
"column": 10
94-
}
95-
},
96-
"expression": {
97-
"type": "ObjectExpression",
98-
"start": 8,
99-
"end": 10,
100-
"loc": {
101-
"start": {
102-
"line": 1,
103-
"column": 8
104-
},
105-
"end": {
106-
"line": 1,
107-
"column": 10
108-
}
109-
},
110-
"properties": []
111-
}
112-
}
113-
],
81+
"body": [],
11482
"directives": [],
11583
"extra": {
116-
"curly": false
84+
"curly": true
11785
}
11886
}
11987
}

test/fixtures/lightscript/named-arrow-functions/skinny-curly/expected.json

+34-2
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,42 @@
7878
"column": 10
7979
}
8080
},
81-
"body": [],
81+
"body": [
82+
{
83+
"type": "ExpressionStatement",
84+
"start": 8,
85+
"end": 10,
86+
"loc": {
87+
"start": {
88+
"line": 1,
89+
"column": 8
90+
},
91+
"end": {
92+
"line": 1,
93+
"column": 10
94+
}
95+
},
96+
"expression": {
97+
"type": "ObjectExpression",
98+
"start": 8,
99+
"end": 10,
100+
"loc": {
101+
"start": {
102+
"line": 1,
103+
"column": 8
104+
},
105+
"end": {
106+
"line": 1,
107+
"column": 10
108+
}
109+
},
110+
"properties": []
111+
}
112+
}
113+
],
82114
"directives": [],
83115
"extra": {
84-
"curly": true
116+
"curly": false
85117
}
86118
}
87119
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"alternatives": {
3-
"whiteblock": {
3+
"braceblock": {
44
"allPlugins": true,
5-
"excludePlugins": ["whiteblockPreferred"],
6-
"expected": "expected.whiteblock.json"
5+
"excludePlugins": ["whiteblockPreferred", "whiteblockOnly"],
6+
"expected": "expected.braceblock.json"
77
}
88
}
99
}

0 commit comments

Comments
 (0)