You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The init expression for the JsVar should not itself contain an assignment, unless there is some benefit to doing so - and in this case, I can't imagine any, but I might not be imaginative enough...
Reviewing git history, an earlier commit (that was never released had this code, with the apparent expectation of allowing linkers to rewrite gwtOnLoad:
As that was removed before it was even released, I'm inclined to ignore it as a fluke. The implementation that follows appears to do what it claims to do, but does use createAssignment to do so - perhaps in 339188d it was accidentally inlined instead of rewritten?
Looking more closely at the code review for the change that introduced this https://gwt-review.googlesource.com/c/gwt/+/7821, there is some commentary modular compilation and the need to re-assign the variable, plus some bug in HtmlUnit - but the reassignment shouldn't need to bother the a = a = b pattern, which will unconditionally assign b to a, rather than somehow chain or redefine it. I'll do some more testing to be sure that nothing subtle is happening here in HtmlUnit or incremental compile. Note: I'm not 100% confident that "modular compile" is an earlier name for "incremental compile", but signs do point in that direction.
I'm inclined to think that this is just a bug introduced by accidentally reusing too much of the previous revision, and we can safely remove the extra assignment, and shrink every GWT app by about 10 bytes.
The text was updated successfully, but these errors were encountered:
References to incremental compilation predate all of the above (see a5b133e, unfortunately the review is a casualty of python updates within google...), though that is old enough that it might not reference the same idea of a feature - ab4f599 points out that what we now know as "incremental compilation" was previously "per file compilation".
**GWT version: 2.7 to 2.12.1
Browser (with version): any
Operating System: any
Description
Discovered while exploring how compiled GWT modules start up, in looking for some ways to simplify this output slightly.
The current implementation generates code that assigns gwtOnLoad to itself, from the current init method. From the showcase JS in 2.12.1:
This is the comment in latest that describes what this block of code is supposed to do:
gwt/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
Lines 2129 to 2137 in 339188d
and the actual relevant code a few lines down:
gwt/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
Lines 2146 to 2151 in 339188d
The init expression for the JsVar should not itself contain an assignment, unless there is some benefit to doing so - and in this case, I can't imagine any, but I might not be imaginative enough...
Reviewing git history, an earlier commit (that was never released had this code, with the apparent expectation of allowing linkers to rewrite gwtOnLoad:
gwt/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
Lines 1957 to 1971 in ec75b53
As that was removed before it was even released, I'm inclined to ignore it as a fluke. The implementation that follows appears to do what it claims to do, but does use createAssignment to do so - perhaps in 339188d it was accidentally inlined instead of rewritten?
Next relevant change in history is simpler still, and dates to the beginning of of GWT's public history:
https://github.com/gwtproject/gwt/blame/ab0aa686820319e15d3adf123f4502dc3349f6de/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java#L948-L969
No
var
or assignment at all.Looking more closely at the code review for the change that introduced this https://gwt-review.googlesource.com/c/gwt/+/7821, there is some commentary modular compilation and the need to re-assign the variable, plus some bug in HtmlUnit - but the reassignment shouldn't need to bother the
a = a = b
pattern, which will unconditionally assignb
toa
, rather than somehow chain or redefine it. I'll do some more testing to be sure that nothing subtle is happening here in HtmlUnit or incremental compile. Note: I'm not 100% confident that "modular compile" is an earlier name for "incremental compile", but signs do point in that direction.I'm inclined to think that this is just a bug introduced by accidentally reusing too much of the previous revision, and we can safely remove the extra assignment, and shrink every GWT app by about 10 bytes.
The text was updated successfully, but these errors were encountered: