aboutsummaryrefslogtreecommitdiffstats
path: root/queries/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'queries/javascript')
-rw-r--r--queries/javascript/locals.scm30
1 files changed, 30 insertions, 0 deletions
diff --git a/queries/javascript/locals.scm b/queries/javascript/locals.scm
index f4f0e92de..098f18af6 100644
--- a/queries/javascript/locals.scm
+++ b/queries/javascript/locals.scm
@@ -1,5 +1,20 @@
; inherits: ecma,jsx
+; Both properties are matched here.
+;
+; class Foo {
+; this.#bar = "baz";
+; this.quuz = "qux";
+; }
+(field_definition
+ property: [(property_identifier) (private_property_identifier)] @definition.var)
+
+; this.foo = "bar"
+(assignment_expression
+ left: (member_expression
+ object: (this)
+ property: (property_identifier) @definition.var))
+
(formal_parameters
(identifier) @definition.parameter)
@@ -31,3 +46,18 @@
(formal_parameters
(rest_pattern
(identifier) @definition.parameter))
+
+; Both methods are matched here.
+;
+; class Foo {
+; #bar(x) { x }
+; baz(y) { y }
+; }
+(method_definition
+ ([(property_identifier) (private_property_identifier)] @definition.function)
+ (#set! definition.var.scope parent))
+
+; this.foo()
+(member_expression
+ object: (this)
+ property: (property_identifier) @reference)