Skip to content

Conversation

@niloc132
Copy link
Member

@niloc132 niloc132 commented Nov 6, 2025

Enhances the AstDumper utility class with the aim of bringing back some of the functionality previously removed in 64f9b00, where individual methods could be traced from source Java all the way to JS output. This is a small step in that direction that nevertheless provides more insight into what the compiler is doing, through a series of changes:

  • Improve printed Java output - classes should list their name, enums and records should be labeled as such, etc. AST traversal is made more visitor-like to make filtering easier.
  • JS AST should also be printed, rather than ending with the Java optimization loops, allowing insight into JS passes.
  • A filter can be applied to the ast at any stage, resulting in only printing code from the specified files or lines, to more easily follow specific changes through a program.

More improvement remains - multiple permutations may end up mixed in the same file, different compiler passes are not individually listed or labeled, arguments are re-parsed every time they are used, but impact to the API is minimal for now.

@niloc132
Copy link
Member Author

niloc132 commented Nov 6, 2025

Example of generating an AST dump with JS output included, while working on a fix for #9731 - running a build of the Hello sample before and after the change, and running diff -U10 before.dump after.dump results in this sample output (demonstrating two ways that the code is improving):

 function Button(handler){
   $clinit_FocusWidget();
   ButtonBase.call(this, $createPushButtonElement($doc));
   ($clinit_DOM() , this.element).className = 'gwt-Button' || '';
-  ($clinit_DOM() , this.element).innerHTML = 'Click me' || '';
-  $addDomHandler(this, handler, ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE));
+  this.element.innerHTML = 'Click me' || '';
+  $addDomHandler(this, handler, ($clinit_ClickEvent() , TYPE));
 }

@niloc132 niloc132 added the ready This PR has been reviewed by a maintainer and is ready for a CI run. label Nov 6, 2025
@niloc132
Copy link
Member Author

niloc132 commented Nov 6, 2025

CompilerTest doesn't fail locally, investigating...

@niloc132
Copy link
Member Author

niloc132 commented Nov 6, 2025

Failures appear to be an example of #9947, rerunning.

@niloc132 niloc132 added this to the 2.13 milestone Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready This PR has been reviewed by a maintainer and is ready for a CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant