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

refactor(rslint_parser): Update while loops to match new AST Facade #1774

Merged
merged 3 commits into from
Nov 12, 2021

Conversation

MichaReiser
Copy link
Contributor

Summary

Changes the js grammar to match our new AST facade as defined in #1725 (and proposed in #1719)

  • Continue Statement
    • Rename from ContinueStmt to JsContinueStatement
    • Inline the label identifier (It's not a normal "variable" reference but a label reference)
  • Break Statement
    • Rename from BreakStmt to JsBreakStatement
    • Inline the label identifier (It's not a normal "variable" reference but a label reference)
  • While Statement
    • Rename from WhileStmt to JsWhileStatement
    • Rename cons to body
    • Inline the condition and rename condition to test
  • DoWhileStatement
    • Rename to JsDoWhileStatement
    • Inline condition
    • rename cons to body
    • rename condition to test

Part of #1725

Test Plan

Verified the output in the updated rast files to correctly reflect the parsing changes and verified that the coverage isn't changing.

* Rename to `JsDoWhileStatement`
* Inline condition
* rename `cons` to `body`
* rename `condition` to `test`
Changes the name and structure of the While statement facade

* Rename from `WhileStmt` to `JsWhileStatement`
* Rename `cons` to `body`
* Inline the condition
Changes the name and structure of the Continue and Break statement facades

* Rename from `ContinueStmt` and `BreakStmt` to `JsContinueStatement` and `JsBreakStatement`
* Inline the identifier (It's not a normal "variable" reference but a label reference)
@cloudflare-workers-and-pages
Copy link

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: cad9c18
Status: ✅  Deploy successful!
Preview URL: https://a2859dbb.tools-8rn.pages.dev

View logs

fn to_format_element(&self, formatter: &Formatter) -> FormatResult<FormatElement> {
let break_element = formatter.format_token(&self.break_token()?)?;
let ident = if let Some(ident_token) = self.ident_token() {
group_elements(format_elements![
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The group here didn't had any effect. Groups only change the output if they contain any soft indent/space/line breaks.

@MichaReiser MichaReiser mentioned this pull request Nov 12, 2021
47 tasks
@MichaReiser MichaReiser merged commit 10a557e into main Nov 12, 2021
@MichaReiser MichaReiser deleted the feature/while-loops-facade branch November 12, 2021 12:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants