Implement a mechanism to cleanup foo["bar"] into foo.bar
Since we namespace strings and property keys separately, having both foo["bar"] and foo.bar in the same source hurts compression. We should have a mechanism to optionally clean this up.
I believe that the best place to do so is around the Shift parser.
After discussing with @dominiccooney and @RReverser, we concluded that this PR should not be landed. Leaving it lying on a branch as it may be useful for performance testing.
@dominiccooney @RReverser I feel that we should optimize our dictionary for a case in which foo["bar"] has been rewritten foo.bar, also
{
"sna": "fu"
}
has been rewritten
{
sna: "fu"
}
etc.
Do you have ideas on how to best do this?
One way to do this would, of course, be to perform such rewrites in binjs-ref. Alternatively, we could rely upon a well-configured external minifier to do so.
As for the object literals - as far as I remember, Shift already converts both examples you provided to the same representation.