At the top of every dart file's compiled javascript is this odd list.
function dart() {
this.x = 0;
delete this.x;
}
var A = new dart;
var B = new dart;
var C = new dart;
var D = new dart;
var E = new dart;
var F = new dart;
... etc etc ...
var Z = new dart;
I scanned through the rest of the code looking for .A ( or any of the other letters ) without luck. What purpose does this serve exactly? The end result is that the A-Z instances of the dart() function/constructor are empty class objects, but to what use?
Using a regex like /[A-Z]{1}\./
I did find a few of the letter instances are decorated with properties and then all 27 letters are run through this function:
function convertToFastObject(properties) {
function MyClass() {
}
MyClass.prototype = properties;
new MyClass();
return properties;
}
;
A = convertToFastObject(A);
B = convertToFastObject(B);
C = convertToFastObject(C);
... etc etc ...
Z = convertToFastObject(Z);
Which has further confused the hell out of me. As that line seems to read like SomeObject = convertToFastObject(SomeObject);
without change.
Edit/Update: Found an explanation for the convertToFastObject and it's predecessor dart() class - Why the convertToFastObject function make it fast? It's an optimization trick. Still leaves me with the question of why the A-Z list of instances, is it just another optimization trick or some sort of hash table of code?