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
{{ message }}
Repository navigation
Compiler to remove every last possible space or ;Β #986
Found in GWT Release:
Trunk r958
Detailed description:
There exist a few remaining cases in which the compiler in OBFUSCATED mode
could get rid of some white-space or semi-colons. There's not much left
after #968, but here are some suggestions:
1) Last semi-colon before closing brace (Note: this represents 3% of the
KitchenSink!)
{return a;} --> {return a}
2) Keywords (e.g. new|delete|case|else|function|return|throw|var) may be
immediately followed by certain characters, e.g. ' " [ ( { + - ! ~ ;
return 'text' --> return'text'
return ; --> return;
return [a,b] -> return[a,b]
3) Certain operator combinations
a&& !b --> a&&!b
a|| !b --> a||!b
4) Negative numbers
(-1) -> -1
5) Not equal (combined with negative numbers)
a!= (-1) --> a!=-1
6) The hard coded header and footer on the *.cache.html files could lose a
few hand trimmed bytes:
* lose white-space
* comma separate three var delcarations: $doc, $wnd, $moduleName
* possibly lose <head>, or was there a reason to have one script tag in
the head, and one in the body?
* lose <font> tag; we're bean counting, right?
Okay, this *is* feature creep, but c'mon!
If just removing ';' before closing braces is 3% in KS, then it seems like a pretty
low-risk tweak and a nice little peephole improvement? Scott, please take a look. If
it isn't pretty easy, let's punt. I don't think we should try anything other than #1
for 1.4.
I don't think we can do this for 1.4 unless we put more research into this. Doing it
the trivial way, I ended up with a syntax error in IE but ending a function with:
...;if(a)}
Apparently, it's not ok to end with no semi if the last statement is an empty if. Now
granted, dead code should have probably eliminated the if (although it could happen
in JSNI code as well), but still, it seems risky to put this in without a more
thorough investigation.
I've attached a patch file representing the work in progress.
Reported by gwt.team.scottb on 2007-04-27 19:38:42
Makes sense since "if(a)" is incomplete but in "if(a);" the semi-colon is a valid
empty statement.
Sounds like we will need to wait for "if(a)" to either be reduced to "a" (if there
are side-effects), or be (dead-code) eliminated.
Activity
dankurka commentedon Jun 10, 2015
Reported by
gwt.team.bruceon 2007-04-26 14:32:18dankurka commentedon Jun 10, 2015
Reported by
gwt.team.scottbon 2007-04-26 16:10:34Accepteddankurka commentedon Jun 10, 2015
Reported by
gwt.team.scottbon 2007-04-26 16:10:48dankurka commentedon Jun 10, 2015
Reported by
gwt.team.morrildlon 2007-04-27 13:52:09dankurka commentedon Jun 10, 2015
Reported by
gwt.team.scottbon 2007-04-27 19:38:42NeedsInfo- _Attachment: [semi-code-gen-r977.patch](https://storage.googleapis.com/google-code-attachments/google-web-toolkit/issue-978/comment-5/semi-code-gen-r977.patch)_
dankurka commentedon Jun 10, 2015
Reported by
fredsaon 2007-04-27 20:36:23dankurka commentedon Jun 10, 2015
Reported by
fredsaon 2007-04-27 20:37:22dankurka commentedon Jun 10, 2015
Reported by
gwt.team.scottbon 2007-04-28 16:48:30dankurka commentedon Jun 10, 2015
Reported by
scottb+legacy@google.comon 2008-02-07 20:18:25ReviewPendingdankurka commentedon Jun 10, 2015
Reported by
scottb+legacy@google.comon 2008-02-07 21:24:30FixedNotReleaseddankurka commentedon Jun 10, 2015
Reported by
scottb+legacy@google.comon 2008-08-14 02:24:14Fixeddankurka commentedon Jun 10, 2015
Reported by
rjrjr@google.comon 2011-02-09 00:18:07