fix: split duplicate value field in Dart tree-sitter query pattern

This commit is contained in:
adit 2026-01-08 16:29:45 +07:00
parent 52c2574bec
commit 8e8589b5e8
2 changed files with 20 additions and 1 deletions

View file

@ -257,4 +257,18 @@ class StringBuilder {
it("should handle static methods and properties", () => {
expect(parseResult).toMatch(/static double circleArea/)
})
it("should parse variable initialization with identifier reference", () => {
expect(parseResult).toMatch(/var instance = MyClass/)
expect(parseResult).toMatch(/var status = Status/)
})
it("should parse variable initialization with method calls", () => {
expect(parseResult).toMatch(/var logger = LoggerFactory\.create\(\)/)
})
it("should parse reference patterns", () => {
expect(parseResult).toMatch(/instance\.greet/)
expect(parseResult).toMatch(/status\.displayName/)
})
})

View file

@ -70,9 +70,14 @@ export default `
(new_expression
(type_identifier) @name) @reference.class
; Variables initialized with identifier reference
(initialized_variable_definition
name: (identifier)
value: (identifier) @name) @reference.class
; Variables initialized with selector/method call
(initialized_variable_definition
name: (identifier)
value: (identifier) @name
value: (selector
"!"?
(argument_part