Skip to content

Associativity of member expressions is incorrect #52

@tobil4sk

Description

@tobil4sk

Right now, nested member expressions are parsed incorrectly.

a.b.c;
/*
is parsed as:
(module
  (member_expression
    (identifier)
    (member_expression (identifier) (identifier))
  )
)

---
instead of:

(module
  (member_expression
    (member_expression (identifier) (identifier))
    (identifier)
  )
)
*/

The second one is the correct interpretation. This can be verified by added parentheses to the expression:

(a.b).c; // this is valid haxe
a.(b.c); // this is invalid haxe

Solving this would also fix this problem:

; TODO: Figure out how to determined when "nested member call" is last ident.
; apparently this is a known issue https://github.com/tree-sitter/tree-sitter/issues/880
(call_expression object: [
(_) @function
(_ (identifier) @function .)
; (_(_ (identifier) @function .))
; (_(_(_ (identifier) @function .)))
; (_(_(_(_ (identifier) @function .))))
; (_(_(_(_(_ (identifier) @function .)))))
])

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions