Skip to content

Compiler to remove every last possible space or ; #986

@dankurka

Description

@dankurka

Originally reported on Google Code with ID 978

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?

Reported by fredsa on 2007-04-26 03:18:36

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions