@willbooster/tree-sitter-javascript 1.0.20 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/grammar.js CHANGED
@@ -137,6 +137,9 @@ module.exports = grammar({
137
137
  ['member', 'template_call', 'new', 'call', $.expression],
138
138
  ['declaration', 'literal'],
139
139
  [$.primary_expression, $.statement_block, 'object'],
140
+ // A `{` that may begin both a block and an object starts a statement or an arrow function's body, where ECMAScript
141
+ // reads it as a block, so `{a: 1}` there is a labeled statement in a block.
142
+ [$.labeled_statement, $._property_name],
140
143
  [$.meta_property, $.import],
141
144
  [$.import_statement, $.import],
142
145
  [$.export_statement, $.primary_expression],
@@ -159,7 +162,6 @@ module.exports = grammar({
159
162
  [$.object, $.object_pattern],
160
163
  [$.assignment_expression, $.pattern],
161
164
  [$.assignment_expression, $.object_assignment_pattern],
162
- [$.labeled_statement, $._property_name],
163
165
  [$.computed_property_name, $.array],
164
166
  [$.binary_expression, $._initializer],
165
167
  ],
@@ -454,13 +456,10 @@ module.exports = grammar({
454
456
  empty_statement: () => ';',
455
457
 
456
458
  labeled_statement: ($) =>
457
- prec.dynamic(
458
- -1,
459
- seq(
460
- field('label', alias(choice($.identifier, $._reserved_identifier), $.statement_identifier)),
461
- ':',
462
- field('body', $.statement)
463
- )
459
+ seq(
460
+ field('label', alias(choice($.identifier, $._reserved_identifier), $.statement_identifier)),
461
+ ':',
462
+ field('body', $.statement)
464
463
  ),
465
464
 
466
465
  //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-javascript",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "JavaScript grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
Binary file
package/tree-sitter.json CHANGED
@@ -24,7 +24,7 @@
24
24
  }
25
25
  ],
26
26
  "metadata": {
27
- "version": "1.0.20",
27
+ "version": "1.0.21",
28
28
  "license": "MIT",
29
29
  "description": "JavaScript grammar for tree-sitter",
30
30
  "authors": [