Skip to content

Update the Babel plugin to remove empty static blocks#18562

Merged
Snuffleupagus merged 1 commit into
mozilla:masterfrom
nicolo-ribaudo:babel-static-block
Aug 5, 2024
Merged

Update the Babel plugin to remove empty static blocks#18562
Snuffleupagus merged 1 commit into
mozilla:masterfrom
nicolo-ribaudo:babel-static-block

Conversation

@nicolo-ribaudo

Copy link
Copy Markdown
Collaborator

Update the Babel plugin to remove empty static blocks

This commit updates the Babel plugin to:

  • apply the same flattening logic that we already have for blocks, to flatten blocks nested inside class static blocks
  • remove class static blocks when, after flattening all the blocks they contain, they are empty.

Before this commit, the transform output was the same as the input.

Closes #18559

Comment thread external/builder/fixtures_babel/staticblock-expected.js Fixed
Comment thread external/builder/fixtures_babel/staticblock.js Fixed

@Snuffleupagus Snuffleupagus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

r=me, with the comment addressed and passing tests; thank you!

Comment thread external/builder/fixtures_babel/staticblock.js Outdated
This commit updates the Babel plugin to:
- apply the same flattening logic that we already
  have for blocks, to flatten blocks nested inside
  class static blocks
- remove class static blocks when, after flattening
  all the blocks they contain, they are empty.

Before this commit, the transform output was the
same as the input.
@@ -0,0 +1,8 @@
class A {

Check notice

Code scanning / CodeQL

Unused variable, import, function or class

Unused class A.
@@ -0,0 +1,20 @@
class A {

Check notice

Code scanning / CodeQL

Unused variable, import, function or class

Unused class A.
@Snuffleupagus

Copy link
Copy Markdown
Collaborator

/botio test

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/e38aa397a12e696/output.txt

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/ae26256d9f6719a/output.txt

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/ae26256d9f6719a/output.txt

Total script time: 30.15 mins

  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 15

Image differences available at: http://54.241.84.105:8877/ae26256d9f6719a/reftest-analyzer.html#web=eq.log

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/e38aa397a12e696/output.txt

Total script time: 45.31 mins

  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 1

Image differences available at: http://54.193.163.58:8877/e38aa397a12e696/reftest-analyzer.html#web=eq.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update the Babel plugin to remove empty static initialization blocks

4 participants