Skip to content

Commit e5a4cd4

Browse files
committed
Update tree-sitter-javascript
1 parent 0ae3828 commit e5a4cd4

File tree

9 files changed

+274317
-272710
lines changed

9 files changed

+274317
-272710
lines changed

common/corpus/declarations.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,42 @@ class Foo<Bar> extends Baz { bar = 5; static one(a) { return a; }; two(b) { retu
755755
(formal_parameters (required_parameter (identifier)))
756756
(statement_block (return_statement (identifier)))))))
757757

758+
=======================================
759+
Classes with static blocks
760+
=======================================
761+
762+
class Foo {
763+
static {
764+
this.#bar = '';
765+
}
766+
static {
767+
this.baz();
768+
}
769+
}
770+
771+
---
772+
773+
(program
774+
(class_declaration
775+
(type_identifier)
776+
(class_body
777+
(class_static_block
778+
(statement_block
779+
(expression_statement
780+
(assignment_expression
781+
(member_expression
782+
(this)
783+
(private_property_identifier))
784+
(string)))))
785+
(class_static_block
786+
(statement_block
787+
(expression_statement
788+
(call_expression
789+
(member_expression
790+
(this)
791+
(property_identifier))
792+
(arguments))))))))
793+
758794
=======================================
759795
Global namespace declarations
760796
=======================================

common/define-grammar.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,12 @@ module.exports = function defineGrammar(dialect) {
257257
'>'
258258
)),
259259

260-
_import_export_specifier: ($, previous) => seq(
260+
export_specifier: ($, previous) => seq(
261+
optional(choice('type', 'typeof')),
262+
previous
263+
),
264+
265+
import_specifier: ($, previous) => seq(
261266
optional(choice('type', 'typeof')),
262267
previous
263268
),
@@ -360,6 +365,7 @@ module.exports = function defineGrammar(dialect) {
360365
// The same rule applies for functions and that's why we use
361366
// "_function_signature_automatic_semicolon".
362367
seq($.method_signature, choice($._function_signature_automatic_semicolon, ',')),
368+
$.class_static_block,
363369
seq(
364370
choice(
365371
$.abstract_method_signature,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"main": "./bindings/node",
2020
"devDependencies": {
2121
"tree-sitter-cli": "^0.20.6",
22-
"tree-sitter-javascript": "github:tree-sitter/tree-sitter-javascript#936d976"
22+
"tree-sitter-javascript": "github:tree-sitter/tree-sitter-javascript#7a29d06"
2323
},
2424
"scripts": {
2525
"build": "npm run build-typescript && npm run build-tsx",

0 commit comments

Comments
 (0)