Skip to content
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

[JavaScript] Clean up class member code #3850

Merged
merged 7 commits into from
Oct 31, 2023

Conversation

Thom1729
Copy link
Collaborator

Inspired by improvements from #3848.

Consolidate the code handling class members (fields and methods) into a more coherent and stack-based approach.

  • Handle “backtrackable” elements (modifiers, accessor keywords, async) in a self-contained way in the method-declaration stack.
  • As a side benefit of the above, remove the duplicate get/set/async code that was needed due to Allow a syntax rule to fail multiple branch points. sublime_text#3494.
  • Also expand function scopes to include modifiers.
  • Explicitly handle semicolons in class field declarations, letting us mark extraneous semicolons punctuation.terminator.statement.empty.js like in statement contexts. (This has proved useful for testing in the past.)
  • Remove static-block-body, which can be replaced with the regular block context.
  • Various minor improvements.

@Thom1729 Thom1729 force-pushed the javascript-cleanup-class-body branch from ffe5d78 to f32e4bd Compare September 30, 2023 21:27
deathaxe and others added 4 commits October 1, 2023 14:22
This commit adds `meta_include_prototype: false` to immediately-pop contexts
as a tiny improvement for scenarios in which those are directly pushed on stack.

That's the case in various branch points.
This commit adds tests to clarify `static` to not be a strictly reserved word,
but may change meaning depending on context.
@deathaxe deathaxe merged commit 4e10175 into sublimehq:master Oct 31, 2023
@Thom1729 Thom1729 deleted the javascript-cleanup-class-body branch October 31, 2023 15:10
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.

4 participants