Skip to content

Allow default export for any declaration (extension of #160) #168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 20, 2021

Conversation

mjambon
Copy link
Contributor

@mjambon mjambon commented Apr 16, 2021

Implements suggestion from pending PR #160 (review)

@mjambon
Copy link
Contributor Author

mjambon commented Apr 16, 2021

EDIT: nevermind, I fixed it

Hmm, CI is giving us an error that I don't get on my machine:

export default function () { }
export default function name1() { }

is expected to be parsed into

  (export_statement
    (function (formal_parameters) (statement_block)))
  (export_statement
    (function_declaration (identifier) (formal_parameters) (statement_block)))

but CI finds a function instead of a function_declaration:

  (export_statement
    (function (formal_parameters) (statement_block)))
  (export_statement
    (function (identifier) (formal_parameters) (statement_block)))
  1. I don't know what I did wrong or what CI is doing different than me. I'm using tree-sitter 0.19.4. This is strange.
  2. Both interpretations seem valid since after default we allow a declaration (including function_declaration) or an expression (including function). I don't see a dynamic conflict being declared, and even if this was a case of dynamic conflict resolution, can it be non-deterministic?

@mjambon
Copy link
Contributor Author

mjambon commented Apr 16, 2021

I had forgotten to regenerate the parser after having undone/redone a bunch of times... This time it should work.

@mjambon mjambon requested a review from maxbrunsfeld April 16, 2021 02:26
@mjambon
Copy link
Contributor Author

mjambon commented Apr 20, 2021

I just removed a conflict declaration that was left over by accident. The diffs are simple now.

@mjambon
Copy link
Contributor Author

mjambon commented Apr 20, 2021

ok, I'm merging this because there's nothing left that's controversial, and I'll close the original PR by @resolritter .

@mjambon mjambon merged commit 40a1427 into tree-sitter:master Apr 20, 2021
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