Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Support for method call syntax in call expressions #139

Open
ad-chaos opened this issue Jan 27, 2023 · 2 comments
Open

Support for method call syntax in call expressions #139

ad-chaos opened this issue Jan 27, 2023 · 2 comments

Comments

@ad-chaos
Copy link

ad-chaos commented Jan 27, 2023

Currently doing something like

call GetThing()->takething()

is broken, it generates the following syntax tree

call_statement [0, 0] - [0, 15]
  call_expression [0, 5] - [0, 15]
    function: identifier [0, 5] - [0, 13]
ERROR [0, 15] - [0, 28]
  keyword [0, 17] - [0, 26]

I tried fixing it by defining call_expression as the following:

call_expression: ($) =>
  prec(
    PREC.CALL,
    sep1(
      seq(
        field("function", $._expression),
        "(",
        commaSep($._expression),
        ")"
      ),
     "->"
    )
  ),

But that seems to only recognises two calls like call foo()->bar() and not the ones after it in call foo()->bar()->baz()
->baz() shows up as an ERROR node.

@clason
Copy link
Contributor

clason commented Jan 28, 2023

Should be fixed by #125.

@ad-chaos
Copy link
Author

Ah, I must've missed it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants