File tree 2 files changed +25
-2
lines changed
2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -996,7 +996,7 @@ module.exports = grammar({
996
996
jsx_opening_element : $ => prec . dynamic ( - 1 , seq (
997
997
'<' ,
998
998
field ( 'name' , $ . _jsx_element_name ) ,
999
- repeat ( field ( 'attribute' , $ . jsx_attribute ) ) ,
999
+ repeat ( field ( 'attribute' , $ . _jsx_attribute ) ) ,
1000
1000
'>'
1001
1001
) ) ,
1002
1002
@@ -1026,13 +1026,15 @@ module.exports = grammar({
1026
1026
jsx_self_closing_element : $ => seq (
1027
1027
'<' ,
1028
1028
field ( 'name' , $ . _jsx_element_name ) ,
1029
- repeat ( field ( 'attribute' , $ . jsx_attribute ) ) ,
1029
+ repeat ( field ( 'attribute' , $ . _jsx_attribute ) ) ,
1030
1030
'/' ,
1031
1031
'>'
1032
1032
) ,
1033
1033
1034
1034
_jsx_attribute_name : $ => alias ( $ . value_identifier , $ . property_identifier ) ,
1035
1035
1036
+ _jsx_attribute : $ => choice ( $ . jsx_attribute , $ . jsx_expression ) ,
1037
+
1036
1038
jsx_attribute : $ => seq (
1037
1039
optional ( '?' ) ,
1038
1040
$ . _jsx_attribute_name ,
Original file line number Diff line number Diff line change @@ -218,3 +218,24 @@ Attribute Block
218
218
(jsx_identifier))
219
219
(jsx_closing_element
220
220
(jsx_identifier)))))
221
+
222
+ ===================================================
223
+ Spread props
224
+ ===================================================
225
+
226
+ <div {...a}/>
227
+ <Comp {...a}></Comp>
228
+
229
+ ---
230
+
231
+ (source_file
232
+ (expression_statement
233
+ (jsx_self_closing_element
234
+ (jsx_identifier)
235
+ (jsx_expression
236
+ (spread_element (value_identifier)))))
237
+ (expression_statement
238
+ (jsx_element
239
+ (jsx_opening_element (jsx_identifier)
240
+ (jsx_expression (spread_element (value_identifier))))
241
+ (jsx_closing_element (jsx_identifier)))))
You can’t perform that action at this time.
0 commit comments