Skip to content

Conversation

@aspeddro
Copy link
Collaborator

See reanalyze exampes

@local
call()
(source_file [0, 0] - [2, 0]
  (ERROR [0, 0] - [1, 6]
    (decorator [0, 0] - [1, 6]
      (decorator_identifier [0, 1] - [0, 6])
      (ERROR [1, 0] - [1, 4]
        (ERROR [1, 0] - [1, 4]))
      (decorator_arguments [1, 4] - [1, 6]))))

grammar.js Outdated
$.module_declaration,
$.external_declaration,
$.exception_declaration,
$.call_expression,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call expression is definitely an expression, not a declaration.

I understand the intent, but it should be structured in another way I guess.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved to call_expression to _decorated_statement

grammar.js Outdated
$.declaration,
choice(
$.declaration,
$.call_expression
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should use expression_statement here. Since decorators/attributes can appear anywhere.

@aspeddro aspeddro force-pushed the decorated-call-function branch from e4e2639 to 8d8680a Compare November 14, 2022 00:52
@aspeddro aspeddro changed the title feat: support decorated call function feat: support decorated expressions Nov 14, 2022
Copy link
Collaborator

@nkrkv nkrkv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is fine now. Thank you!

Yes, decorators can appear anywhere basically. In that sense they might be implemented as comments, for example. But in this case they would appear as siblings to the parts of code they decorate and would not participate in, for example, broader/narrower selection. So I think it is better to eventually come to the grammar where all possible cases are covered semantically. Your addition improves the situation following this way 👍

@nkrkv nkrkv merged commit 41f0b28 into rescript-lang:main Nov 14, 2022
@aspeddro aspeddro deleted the decorated-call-function branch November 14, 2022 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants