Make JetStream 2
[WebKit-https.git] / PerformanceTests / JetStream2 / Octane / typescript-compiler.js
1 var TypeScript;
2 (function (TypeScript) {
3     function hasFlag(val, flag) {
4         return (val & flag) != 0;
5     }
6     TypeScript.hasFlag = hasFlag;
7     (function (ErrorRecoverySet) {
8         ErrorRecoverySet._map = [];
9         ErrorRecoverySet.None = 0;
10         ErrorRecoverySet.Comma = 1;
11         ErrorRecoverySet.SColon = 1 << 1;
12         ErrorRecoverySet.Asg = 1 << 2;
13         ErrorRecoverySet.BinOp = 1 << 3;
14         ErrorRecoverySet.RBrack = 1 << 4;
15         ErrorRecoverySet.RCurly = 1 << 5;
16         ErrorRecoverySet.RParen = 1 << 6;
17         ErrorRecoverySet.Dot = 1 << 7;
18         ErrorRecoverySet.Colon = 1 << 8;
19         ErrorRecoverySet.PrimType = 1 << 9;
20         ErrorRecoverySet.AddOp = 1 << 10;
21         ErrorRecoverySet.LCurly = 1 << 11;
22         ErrorRecoverySet.PreOp = 1 << 12;
23         ErrorRecoverySet.RegExp = 1 << 13;
24         ErrorRecoverySet.LParen = 1 << 14;
25         ErrorRecoverySet.LBrack = 1 << 15;
26         ErrorRecoverySet.Scope = 1 << 16;
27         ErrorRecoverySet.In = 1 << 17;
28         ErrorRecoverySet.SCase = 1 << 18;
29         ErrorRecoverySet.Else = 1 << 19;
30         ErrorRecoverySet.Catch = 1 << 20;
31         ErrorRecoverySet.Var = 1 << 21;
32         ErrorRecoverySet.Stmt = 1 << 22;
33         ErrorRecoverySet.While = 1 << 23;
34         ErrorRecoverySet.ID = 1 << 24;
35         ErrorRecoverySet.Prefix = 1 << 25;
36         ErrorRecoverySet.Literal = 1 << 26;
37         ErrorRecoverySet.RLit = 1 << 27;
38         ErrorRecoverySet.Func = 1 << 28;
39         ErrorRecoverySet.EOF = 1 << 29;
40         ErrorRecoverySet.TypeScriptS = 1 << 30;
41         ErrorRecoverySet.ExprStart = ErrorRecoverySet.SColon | ErrorRecoverySet.AddOp | ErrorRecoverySet.LCurly | ErrorRecoverySet.PreOp | ErrorRecoverySet.RegExp | ErrorRecoverySet.LParen | ErrorRecoverySet.LBrack | ErrorRecoverySet.ID | ErrorRecoverySet.Prefix | ErrorRecoverySet.RLit | ErrorRecoverySet.Func | ErrorRecoverySet.Literal;
42         ErrorRecoverySet.StmtStart = ErrorRecoverySet.ExprStart | ErrorRecoverySet.SColon | ErrorRecoverySet.Var | ErrorRecoverySet.Stmt | ErrorRecoverySet.While | ErrorRecoverySet.TypeScriptS;
43         ErrorRecoverySet.Postfix = ErrorRecoverySet.Dot | ErrorRecoverySet.LParen | ErrorRecoverySet.LBrack;
44     })(TypeScript.ErrorRecoverySet || (TypeScript.ErrorRecoverySet = {}));
45     var ErrorRecoverySet = TypeScript.ErrorRecoverySet;
46     (function (AllowedElements) {
47         AllowedElements._map = [];
48         AllowedElements.None = 0;
49         AllowedElements.ModuleDeclarations = 1 << 2;
50         AllowedElements.ClassDeclarations = 1 << 3;
51         AllowedElements.InterfaceDeclarations = 1 << 4;
52         AllowedElements.AmbientDeclarations = 1 << 10;
53         AllowedElements.Properties = 1 << 11;
54         AllowedElements.Global = AllowedElements.ModuleDeclarations | AllowedElements.ClassDeclarations | AllowedElements.InterfaceDeclarations | AllowedElements.AmbientDeclarations;
55         AllowedElements.QuickParse = AllowedElements.Global | AllowedElements.Properties;
56     })(TypeScript.AllowedElements || (TypeScript.AllowedElements = {}));
57     var AllowedElements = TypeScript.AllowedElements;
58     (function (Modifiers) {
59         Modifiers._map = [];
60         Modifiers.None = 0;
61         Modifiers.Private = 1;
62         Modifiers.Public = 1 << 1;
63         Modifiers.Readonly = 1 << 2;
64         Modifiers.Ambient = 1 << 3;
65         Modifiers.Exported = 1 << 4;
66         Modifiers.Getter = 1 << 5;
67         Modifiers.Setter = 1 << 6;
68         Modifiers.Static = 1 << 7;
69     })(TypeScript.Modifiers || (TypeScript.Modifiers = {}));
70     var Modifiers = TypeScript.Modifiers;
71     (function (ASTFlags) {
72         ASTFlags._map = [];
73         ASTFlags.None = 0;
74         ASTFlags.ExplicitSemicolon = 1;
75         ASTFlags.AutomaticSemicolon = 1 << 1;
76         ASTFlags.Writeable = 1 << 2;
77         ASTFlags.Error = 1 << 3;
78         ASTFlags.DotLHSPartial = 1 << 4;
79         ASTFlags.DotLHS = 1 << 5;
80         ASTFlags.IsStatement = 1 << 6;
81         ASTFlags.StrictMode = 1 << 7;
82         ASTFlags.PossibleOptionalParameter = 1 << 8;
83         ASTFlags.ClassBaseConstructorCall = 1 << 9;
84         ASTFlags.OptionalName = 1 << 10;
85         ASTFlags.SkipNextRParen = 1 << 11;
86     })(TypeScript.ASTFlags || (TypeScript.ASTFlags = {}));
87     var ASTFlags = TypeScript.ASTFlags;
88     (function (DeclFlags) {
89         DeclFlags._map = [];
90         DeclFlags.None = 0;
91         DeclFlags.Exported = 1;
92         DeclFlags.Private = 1 << 1;
93         DeclFlags.Public = 1 << 2;
94         DeclFlags.Ambient = 1 << 3;
95         DeclFlags.Static = 1 << 4;
96         DeclFlags.LocalStatic = 1 << 5;
97         DeclFlags.GetAccessor = 1 << 6;
98         DeclFlags.SetAccessor = 1 << 7;
99     })(TypeScript.DeclFlags || (TypeScript.DeclFlags = {}));
100     var DeclFlags = TypeScript.DeclFlags;
101     (function (ModuleFlags) {
102         ModuleFlags._map = [];
103         ModuleFlags.None = 0;
104         ModuleFlags.Exported = 1;
105         ModuleFlags.Private = 1 << 1;
106         ModuleFlags.Public = 1 << 2;
107         ModuleFlags.Ambient = 1 << 3;
108         ModuleFlags.Static = 1 << 4;
109         ModuleFlags.LocalStatic = 1 << 5;
110         ModuleFlags.GetAccessor = 1 << 6;
111         ModuleFlags.SetAccessor = 1 << 7;
112         ModuleFlags.IsEnum = 1 << 8;
113         ModuleFlags.ShouldEmitModuleDecl = 1 << 9;
114         ModuleFlags.IsWholeFile = 1 << 10;
115         ModuleFlags.IsDynamic = 1 << 11;
116         ModuleFlags.MustCaptureThis = 1 << 12;
117     })(TypeScript.ModuleFlags || (TypeScript.ModuleFlags = {}));
118     var ModuleFlags = TypeScript.ModuleFlags;
119     (function (SymbolFlags) {
120         SymbolFlags._map = [];
121         SymbolFlags.None = 0;
122         SymbolFlags.Exported = 1;
123         SymbolFlags.Private = 1 << 1;
124         SymbolFlags.Public = 1 << 2;
125         SymbolFlags.Ambient = 1 << 3;
126         SymbolFlags.Static = 1 << 4;
127         SymbolFlags.LocalStatic = 1 << 5;
128         SymbolFlags.GetAccessor = 1 << 6;
129         SymbolFlags.SetAccessor = 1 << 7;
130         SymbolFlags.Property = 1 << 8;
131         SymbolFlags.Readonly = 1 << 9;
132         SymbolFlags.ModuleMember = 1 << 10;
133         SymbolFlags.InterfaceMember = 1 << 11;
134         SymbolFlags.ClassMember = 1 << 12;
135         SymbolFlags.BuiltIn = 1 << 13;
136         SymbolFlags.TypeSetDuringScopeAssignment = 1 << 14;
137         SymbolFlags.Constant = 1 << 15;
138         SymbolFlags.Optional = 1 << 16;
139         SymbolFlags.RecursivelyReferenced = 1 << 17;
140         SymbolFlags.Bound = 1 << 18;
141         SymbolFlags.CompilerGenerated = 1 << 19;
142     })(TypeScript.SymbolFlags || (TypeScript.SymbolFlags = {}));
143     var SymbolFlags = TypeScript.SymbolFlags;
144     (function (VarFlags) {
145         VarFlags._map = [];
146         VarFlags.None = 0;
147         VarFlags.Exported = 1;
148         VarFlags.Private = 1 << 1;
149         VarFlags.Public = 1 << 2;
150         VarFlags.Ambient = 1 << 3;
151         VarFlags.Static = 1 << 4;
152         VarFlags.LocalStatic = 1 << 5;
153         VarFlags.GetAccessor = 1 << 6;
154         VarFlags.SetAccessor = 1 << 7;
155         VarFlags.AutoInit = 1 << 8;
156         VarFlags.Property = 1 << 9;
157         VarFlags.Readonly = 1 << 10;
158         VarFlags.Class = 1 << 11;
159         VarFlags.ClassProperty = 1 << 12;
160         VarFlags.ClassBodyProperty = 1 << 13;
161         VarFlags.ClassConstructorProperty = 1 << 14;
162         VarFlags.ClassSuperMustBeFirstCallInConstructor = 1 << 15;
163         VarFlags.Constant = 1 << 16;
164         VarFlags.MustCaptureThis = 1 << 17;
165     })(TypeScript.VarFlags || (TypeScript.VarFlags = {}));
166     var VarFlags = TypeScript.VarFlags;
167     (function (FncFlags) {
168         FncFlags._map = [];
169         FncFlags.None = 0;
170         FncFlags.Exported = 1;
171         FncFlags.Private = 1 << 1;
172         FncFlags.Public = 1 << 2;
173         FncFlags.Ambient = 1 << 3;
174         FncFlags.Static = 1 << 4;
175         FncFlags.LocalStatic = 1 << 5;
176         FncFlags.GetAccessor = 1 << 6;
177         FncFlags.SetAccessor = 1 << 7;
178         FncFlags.Definition = 1 << 8;
179         FncFlags.Signature = 1 << 9;
180         FncFlags.Method = 1 << 10;
181         FncFlags.HasReturnExpression = 1 << 11;
182         FncFlags.CallMember = 1 << 12;
183         FncFlags.ConstructMember = 1 << 13;
184         FncFlags.HasSelfReference = 1 << 14;
185         FncFlags.IsFatArrowFunction = 1 << 15;
186         FncFlags.IndexerMember = 1 << 16;
187         FncFlags.IsFunctionExpression = 1 << 17;
188         FncFlags.ClassMethod = 1 << 18;
189         FncFlags.ClassPropertyMethodExported = 1 << 19;
190         FncFlags.HasSuperReferenceInFatArrowFunction = 1 << 20;
191         FncFlags.IsPropertyBound = 1 << 21;
192     })(TypeScript.FncFlags || (TypeScript.FncFlags = {}));
193     var FncFlags = TypeScript.FncFlags;
194     (function (SignatureFlags) {
195         SignatureFlags._map = [];
196         SignatureFlags.None = 0;
197         SignatureFlags.IsIndexer = 1;
198         SignatureFlags.IsStringIndexer = 1 << 1;
199         SignatureFlags.IsNumberIndexer = 1 << 2;
200     })(TypeScript.SignatureFlags || (TypeScript.SignatureFlags = {}));
201     var SignatureFlags = TypeScript.SignatureFlags;
202                     function ToDeclFlags(fncOrVarOrSymbolOrModuleFlags) {
203         return fncOrVarOrSymbolOrModuleFlags;
204     }
205     TypeScript.ToDeclFlags = ToDeclFlags;
206     (function (TypeFlags) {
207         TypeFlags._map = [];
208         TypeFlags.None = 0;
209         TypeFlags.HasImplementation = 1;
210         TypeFlags.HasSelfReference = 1 << 1;
211         TypeFlags.MergeResult = 1 << 2;
212         TypeFlags.IsEnum = 1 << 3;
213         TypeFlags.BuildingName = 1 << 4;
214         TypeFlags.HasBaseType = 1 << 5;
215         TypeFlags.HasBaseTypeOfObject = 1 << 6;
216         TypeFlags.IsClass = 1 << 7;
217     })(TypeScript.TypeFlags || (TypeScript.TypeFlags = {}));
218     var TypeFlags = TypeScript.TypeFlags;
219     (function (TypeRelationshipFlags) {
220         TypeRelationshipFlags._map = [];
221         TypeRelationshipFlags.SuccessfulComparison = 0;
222         TypeRelationshipFlags.SourceIsNullTargetIsVoidOrUndefined = 1;
223         TypeRelationshipFlags.RequiredPropertyIsMissing = 1 << 1;
224         TypeRelationshipFlags.IncompatibleSignatures = 1 << 2;
225         TypeRelationshipFlags.SourceSignatureHasTooManyParameters = 3;
226         TypeRelationshipFlags.IncompatibleReturnTypes = 1 << 4;
227         TypeRelationshipFlags.IncompatiblePropertyTypes = 1 << 5;
228         TypeRelationshipFlags.IncompatibleParameterTypes = 1 << 6;
229     })(TypeScript.TypeRelationshipFlags || (TypeScript.TypeRelationshipFlags = {}));
230     var TypeRelationshipFlags = TypeScript.TypeRelationshipFlags;
231     (function (CodeGenTarget) {
232         CodeGenTarget._map = [];
233         CodeGenTarget.ES3 = 0;
234         CodeGenTarget.ES5 = 1;
235     })(TypeScript.CodeGenTarget || (TypeScript.CodeGenTarget = {}));
236     var CodeGenTarget = TypeScript.CodeGenTarget;
237     (function (ModuleGenTarget) {
238         ModuleGenTarget._map = [];
239         ModuleGenTarget.Synchronous = 0;
240         ModuleGenTarget.Asynchronous = 1;
241         ModuleGenTarget.Local = 1 << 1;
242     })(TypeScript.ModuleGenTarget || (TypeScript.ModuleGenTarget = {}));
243     var ModuleGenTarget = TypeScript.ModuleGenTarget;
244     TypeScript.codeGenTarget = CodeGenTarget.ES3;
245     TypeScript.moduleGenTarget = ModuleGenTarget.Synchronous;
246     TypeScript.optimizeModuleCodeGen = true;
247     function flagsToString(e, flags) {
248         var builder = "";
249         for(var i = 1; i < (1 << 31); i = i << 1) {
250             if((flags & i) != 0) {
251                 for(var k in e) {
252                     if(e[k] == i) {
253                         if(builder.length > 0) {
254                             builder += "|";
255                         }
256                         builder += k;
257                         break;
258                     }
259                 }
260             }
261         }
262         return builder;
263     }
264     TypeScript.flagsToString = flagsToString;
265 })(TypeScript || (TypeScript = {}));
266 var TypeScript;
267 (function (TypeScript) {
268     (function (NodeType) {
269         NodeType._map = [];
270         NodeType._map[0] = "None";
271         NodeType.None = 0;
272         NodeType._map[1] = "Empty";
273         NodeType.Empty = 1;
274         NodeType._map[2] = "EmptyExpr";
275         NodeType.EmptyExpr = 2;
276         NodeType._map[3] = "True";
277         NodeType.True = 3;
278         NodeType._map[4] = "False";
279         NodeType.False = 4;
280         NodeType._map[5] = "This";
281         NodeType.This = 5;
282         NodeType._map[6] = "Super";
283         NodeType.Super = 6;
284         NodeType._map[7] = "QString";
285         NodeType.QString = 7;
286         NodeType._map[8] = "Regex";
287         NodeType.Regex = 8;
288         NodeType._map[9] = "Null";
289         NodeType.Null = 9;
290         NodeType._map[10] = "ArrayLit";
291         NodeType.ArrayLit = 10;
292         NodeType._map[11] = "ObjectLit";
293         NodeType.ObjectLit = 11;
294         NodeType._map[12] = "Void";
295         NodeType.Void = 12;
296         NodeType._map[13] = "Comma";
297         NodeType.Comma = 13;
298         NodeType._map[14] = "Pos";
299         NodeType.Pos = 14;
300         NodeType._map[15] = "Neg";
301         NodeType.Neg = 15;
302         NodeType._map[16] = "Delete";
303         NodeType.Delete = 16;
304         NodeType._map[17] = "Await";
305         NodeType.Await = 17;
306         NodeType._map[18] = "In";
307         NodeType.In = 18;
308         NodeType._map[19] = "Dot";
309         NodeType.Dot = 19;
310         NodeType._map[20] = "From";
311         NodeType.From = 20;
312         NodeType._map[21] = "Is";
313         NodeType.Is = 21;
314         NodeType._map[22] = "InstOf";
315         NodeType.InstOf = 22;
316         NodeType._map[23] = "Typeof";
317         NodeType.Typeof = 23;
318         NodeType._map[24] = "NumberLit";
319         NodeType.NumberLit = 24;
320         NodeType._map[25] = "Name";
321         NodeType.Name = 25;
322         NodeType._map[26] = "TypeRef";
323         NodeType.TypeRef = 26;
324         NodeType._map[27] = "Index";
325         NodeType.Index = 27;
326         NodeType._map[28] = "Call";
327         NodeType.Call = 28;
328         NodeType._map[29] = "New";
329         NodeType.New = 29;
330         NodeType._map[30] = "Asg";
331         NodeType.Asg = 30;
332         NodeType._map[31] = "AsgAdd";
333         NodeType.AsgAdd = 31;
334         NodeType._map[32] = "AsgSub";
335         NodeType.AsgSub = 32;
336         NodeType._map[33] = "AsgDiv";
337         NodeType.AsgDiv = 33;
338         NodeType._map[34] = "AsgMul";
339         NodeType.AsgMul = 34;
340         NodeType._map[35] = "AsgMod";
341         NodeType.AsgMod = 35;
342         NodeType._map[36] = "AsgAnd";
343         NodeType.AsgAnd = 36;
344         NodeType._map[37] = "AsgXor";
345         NodeType.AsgXor = 37;
346         NodeType._map[38] = "AsgOr";
347         NodeType.AsgOr = 38;
348         NodeType._map[39] = "AsgLsh";
349         NodeType.AsgLsh = 39;
350         NodeType._map[40] = "AsgRsh";
351         NodeType.AsgRsh = 40;
352         NodeType._map[41] = "AsgRs2";
353         NodeType.AsgRs2 = 41;
354         NodeType._map[42] = "ConditionalExpression";
355         NodeType.ConditionalExpression = 42;
356         NodeType._map[43] = "LogOr";
357         NodeType.LogOr = 43;
358         NodeType._map[44] = "LogAnd";
359         NodeType.LogAnd = 44;
360         NodeType._map[45] = "Or";
361         NodeType.Or = 45;
362         NodeType._map[46] = "Xor";
363         NodeType.Xor = 46;
364         NodeType._map[47] = "And";
365         NodeType.And = 47;
366         NodeType._map[48] = "Eq";
367         NodeType.Eq = 48;
368         NodeType._map[49] = "Ne";
369         NodeType.Ne = 49;
370         NodeType._map[50] = "Eqv";
371         NodeType.Eqv = 50;
372         NodeType._map[51] = "NEqv";
373         NodeType.NEqv = 51;
374         NodeType._map[52] = "Lt";
375         NodeType.Lt = 52;
376         NodeType._map[53] = "Le";
377         NodeType.Le = 53;
378         NodeType._map[54] = "Gt";
379         NodeType.Gt = 54;
380         NodeType._map[55] = "Ge";
381         NodeType.Ge = 55;
382         NodeType._map[56] = "Add";
383         NodeType.Add = 56;
384         NodeType._map[57] = "Sub";
385         NodeType.Sub = 57;
386         NodeType._map[58] = "Mul";
387         NodeType.Mul = 58;
388         NodeType._map[59] = "Div";
389         NodeType.Div = 59;
390         NodeType._map[60] = "Mod";
391         NodeType.Mod = 60;
392         NodeType._map[61] = "Lsh";
393         NodeType.Lsh = 61;
394         NodeType._map[62] = "Rsh";
395         NodeType.Rsh = 62;
396         NodeType._map[63] = "Rs2";
397         NodeType.Rs2 = 63;
398         NodeType._map[64] = "Not";
399         NodeType.Not = 64;
400         NodeType._map[65] = "LogNot";
401         NodeType.LogNot = 65;
402         NodeType._map[66] = "IncPre";
403         NodeType.IncPre = 66;
404         NodeType._map[67] = "DecPre";
405         NodeType.DecPre = 67;
406         NodeType._map[68] = "IncPost";
407         NodeType.IncPost = 68;
408         NodeType._map[69] = "DecPost";
409         NodeType.DecPost = 69;
410         NodeType._map[70] = "TypeAssertion";
411         NodeType.TypeAssertion = 70;
412         NodeType._map[71] = "FuncDecl";
413         NodeType.FuncDecl = 71;
414         NodeType._map[72] = "Member";
415         NodeType.Member = 72;
416         NodeType._map[73] = "VarDecl";
417         NodeType.VarDecl = 73;
418         NodeType._map[74] = "ArgDecl";
419         NodeType.ArgDecl = 74;
420         NodeType._map[75] = "Return";
421         NodeType.Return = 75;
422         NodeType._map[76] = "Break";
423         NodeType.Break = 76;
424         NodeType._map[77] = "Continue";
425         NodeType.Continue = 77;
426         NodeType._map[78] = "Throw";
427         NodeType.Throw = 78;
428         NodeType._map[79] = "For";
429         NodeType.For = 79;
430         NodeType._map[80] = "ForIn";
431         NodeType.ForIn = 80;
432         NodeType._map[81] = "If";
433         NodeType.If = 81;
434         NodeType._map[82] = "While";
435         NodeType.While = 82;
436         NodeType._map[83] = "DoWhile";
437         NodeType.DoWhile = 83;
438         NodeType._map[84] = "Block";
439         NodeType.Block = 84;
440         NodeType._map[85] = "Case";
441         NodeType.Case = 85;
442         NodeType._map[86] = "Switch";
443         NodeType.Switch = 86;
444         NodeType._map[87] = "Try";
445         NodeType.Try = 87;
446         NodeType._map[88] = "TryCatch";
447         NodeType.TryCatch = 88;
448         NodeType._map[89] = "TryFinally";
449         NodeType.TryFinally = 89;
450         NodeType._map[90] = "Finally";
451         NodeType.Finally = 90;
452         NodeType._map[91] = "Catch";
453         NodeType.Catch = 91;
454         NodeType._map[92] = "List";
455         NodeType.List = 92;
456         NodeType._map[93] = "Script";
457         NodeType.Script = 93;
458         NodeType._map[94] = "ClassDeclaration";
459         NodeType.ClassDeclaration = 94;
460         NodeType._map[95] = "InterfaceDeclaration";
461         NodeType.InterfaceDeclaration = 95;
462         NodeType._map[96] = "ModuleDeclaration";
463         NodeType.ModuleDeclaration = 96;
464         NodeType._map[97] = "ImportDeclaration";
465         NodeType.ImportDeclaration = 97;
466         NodeType._map[98] = "With";
467         NodeType.With = 98;
468         NodeType._map[99] = "Label";
469         NodeType.Label = 99;
470         NodeType._map[100] = "LabeledStatement";
471         NodeType.LabeledStatement = 100;
472         NodeType._map[101] = "EBStart";
473         NodeType.EBStart = 101;
474         NodeType._map[102] = "GotoEB";
475         NodeType.GotoEB = 102;
476         NodeType._map[103] = "EndCode";
477         NodeType.EndCode = 103;
478         NodeType._map[104] = "Error";
479         NodeType.Error = 104;
480         NodeType._map[105] = "Comment";
481         NodeType.Comment = 105;
482         NodeType._map[106] = "Debugger";
483         NodeType.Debugger = 106;
484         NodeType.GeneralNode = NodeType.FuncDecl;
485         NodeType.LastAsg = NodeType.AsgRs2;
486     })(TypeScript.NodeType || (TypeScript.NodeType = {}));
487     var NodeType = TypeScript.NodeType;
488 })(TypeScript || (TypeScript = {}));
489 var TypeScript;
490 (function (TypeScript) {
491     var BlockIntrinsics = (function () {
492         function BlockIntrinsics() {
493             this.prototype = undefined;
494             this.toString = undefined;
495             this.toLocaleString = undefined;
496             this.valueOf = undefined;
497             this.hasOwnProperty = undefined;
498             this.propertyIsEnumerable = undefined;
499             this.isPrototypeOf = undefined;
500             this["constructor"] = undefined;
501         }
502         return BlockIntrinsics;
503     })();
504     TypeScript.BlockIntrinsics = BlockIntrinsics;    
505     var StringHashTable = (function () {
506         function StringHashTable() {
507             this.itemCount = 0;
508             this.table = (new BlockIntrinsics());
509         }
510         StringHashTable.prototype.getAllKeys = function () {
511             var result = [];
512             for(var k in this.table) {
513                 if(this.table[k] != undefined) {
514                     result[result.length] = k;
515                 }
516             }
517             return result;
518         };
519         StringHashTable.prototype.add = function (key, data) {
520             if(this.table[key] != undefined) {
521                 return false;
522             }
523             this.table[key] = data;
524             this.itemCount++;
525             return true;
526         };
527         StringHashTable.prototype.addOrUpdate = function (key, data) {
528             if(this.table[key] != undefined) {
529                 this.table[key] = data;
530                 return false;
531             }
532             this.table[key] = data;
533             this.itemCount++;
534             return true;
535         };
536         StringHashTable.prototype.map = function (fn, context) {
537             for(var k in this.table) {
538                 var data = this.table[k];
539                 if(data != undefined) {
540                     fn(k, this.table[k], context);
541                 }
542             }
543         };
544         StringHashTable.prototype.every = function (fn, context) {
545             for(var k in this.table) {
546                 var data = this.table[k];
547                 if(data != undefined) {
548                     if(!fn(k, this.table[k], context)) {
549                         return false;
550                     }
551                 }
552             }
553             return true;
554         };
555         StringHashTable.prototype.some = function (fn, context) {
556             for(var k in this.table) {
557                 var data = this.table[k];
558                 if(data != undefined) {
559                     if(fn(k, this.table[k], context)) {
560                         return true;
561                     }
562                 }
563             }
564             return false;
565         };
566         StringHashTable.prototype.count = function () {
567             return this.itemCount;
568         };
569         StringHashTable.prototype.lookup = function (key) {
570             var data = this.table[key];
571             if(data != undefined) {
572                 return data;
573             } else {
574                 return (null);
575             }
576         };
577         return StringHashTable;
578     })();
579     TypeScript.StringHashTable = StringHashTable;    
580     var DualStringHashTable = (function () {
581         function DualStringHashTable(primaryTable, secondaryTable) {
582             this.primaryTable = primaryTable;
583             this.secondaryTable = secondaryTable;
584             this.insertPrimary = true;
585         }
586         DualStringHashTable.prototype.getAllKeys = function () {
587             return this.primaryTable.getAllKeys().concat(this.secondaryTable.getAllKeys());
588         };
589         DualStringHashTable.prototype.add = function (key, data) {
590             if(this.insertPrimary) {
591                 return this.primaryTable.add(key, data);
592             } else {
593                 return this.secondaryTable.add(key, data);
594             }
595         };
596         DualStringHashTable.prototype.addOrUpdate = function (key, data) {
597             if(this.insertPrimary) {
598                 return this.primaryTable.addOrUpdate(key, data);
599             } else {
600                 return this.secondaryTable.addOrUpdate(key, data);
601             }
602         };
603         DualStringHashTable.prototype.map = function (fn, context) {
604             this.primaryTable.map(fn, context);
605             this.secondaryTable.map(fn, context);
606         };
607         DualStringHashTable.prototype.every = function (fn, context) {
608             return this.primaryTable.every(fn, context) && this.secondaryTable.every(fn, context);
609         };
610         DualStringHashTable.prototype.some = function (fn, context) {
611             return this.primaryTable.some(fn, context) || this.secondaryTable.some(fn, context);
612         };
613         DualStringHashTable.prototype.count = function () {
614             return this.primaryTable.count() + this.secondaryTable.count();
615         };
616         DualStringHashTable.prototype.lookup = function (key) {
617             var data = this.primaryTable.lookup(key);
618             if(data != undefined) {
619                 return data;
620             } else {
621                 return this.secondaryTable.lookup(key);
622             }
623         };
624         return DualStringHashTable;
625     })();
626     TypeScript.DualStringHashTable = DualStringHashTable;    
627     function numberHashFn(key) {
628         var c2 = 668265261;
629         key = (key ^ 61) ^ (key >>> 16);
630         key = key + (key << 3);
631         key = key ^ (key >>> 4);
632         key = key * c2;
633         key = key ^ (key >>> 15);
634         return key;
635     }
636     TypeScript.numberHashFn = numberHashFn;
637     function combineHashes(key1, key2) {
638         return key2 ^ ((key1 >> 5) + key1);
639     }
640     TypeScript.combineHashes = combineHashes;
641     var HashEntry = (function () {
642         function HashEntry(key, data) {
643             this.key = key;
644             this.data = data;
645         }
646         return HashEntry;
647     })();
648     TypeScript.HashEntry = HashEntry;    
649     var HashTable = (function () {
650         function HashTable(size, hashFn, equalsFn) {
651             this.size = size;
652             this.hashFn = hashFn;
653             this.equalsFn = equalsFn;
654             this.itemCount = 0;
655             this.table = new Array();
656             for(var i = 0; i < this.size; i++) {
657                 this.table[i] = null;
658             }
659         }
660         HashTable.prototype.add = function (key, data) {
661             var current;
662             var entry = new HashEntry(key, data);
663             var val = this.hashFn(key);
664             val = val % this.size;
665             for(current = this.table[val]; current != null; current = current.next) {
666                 if(this.equalsFn(key, current.key)) {
667                     return false;
668                 }
669             }
670             entry.next = this.table[val];
671             this.table[val] = entry;
672             this.itemCount++;
673             return true;
674         };
675         HashTable.prototype.remove = function (key) {
676             var current;
677             var val = this.hashFn(key);
678             val = val % this.size;
679             var result = null;
680             var prevEntry = null;
681             for(current = this.table[val]; current != null; current = current.next) {
682                 if(this.equalsFn(key, current.key)) {
683                     result = current.data;
684                     this.itemCount--;
685                     if(prevEntry) {
686                         prevEntry.next = current.next;
687                     } else {
688                         this.table[val] = current.next;
689                     }
690                     break;
691                 }
692                 prevEntry = current;
693             }
694             return result;
695         };
696         HashTable.prototype.count = function () {
697             return this.itemCount;
698         };
699         HashTable.prototype.lookup = function (key) {
700             var current;
701             var val = this.hashFn(key);
702             val = val % this.size;
703             for(current = this.table[val]; current != null; current = current.next) {
704                 if(this.equalsFn(key, current.key)) {
705                     return (current.data);
706                 }
707             }
708             return (null);
709         };
710         return HashTable;
711     })();
712     TypeScript.HashTable = HashTable;    
713     var SimpleHashTable = (function () {
714         function SimpleHashTable() {
715             this.keys = [];
716             this.values = [];
717         }
718         SimpleHashTable.prototype.lookup = function (key, findValue) {
719             var searchArray = this.keys;
720             if(findValue) {
721                 searchArray = this.values;
722             }
723             for(var i = 0; i < searchArray.length; i++) {
724                 if(searchArray[i] == key) {
725                     return {
726                         key: this.keys[i],
727                         data: this.values[i]
728                     };
729                 }
730             }
731             return null;
732         };
733         SimpleHashTable.prototype.add = function (key, data) {
734             var lookupData = this.lookup(key);
735             if(lookupData) {
736                 return false;
737             }
738             this.keys[this.keys.length] = key;
739             this.values[this.values.length] = data;
740             return true;
741         };
742         return SimpleHashTable;
743     })();
744     TypeScript.SimpleHashTable = SimpleHashTable;    
745 })(TypeScript || (TypeScript = {}));
746 var __extends = this.__extends || function (d, b) {
747     function __() { this.constructor = d; }
748     __.prototype = b.prototype;
749     d.prototype = new __();
750 };
751 var TypeScript;
752 (function (TypeScript) {
753     var ASTSpan = (function () {
754         function ASTSpan() {
755             this.minChar = -1;
756             this.limChar = -1;
757         }
758         return ASTSpan;
759     })();
760     TypeScript.ASTSpan = ASTSpan;    
761     var AST = (function (_super) {
762         __extends(AST, _super);
763         function AST(nodeType) {
764                 _super.call(this);
765             this.nodeType = nodeType;
766             this.type = null;
767             this.flags = TypeScript.ASTFlags.Writeable;
768             this.passCreated = TypeScript.CompilerDiagnostics.analysisPass;
769             this.preComments = null;
770             this.postComments = null;
771             this.docComments = null;
772             this.isParenthesized = false;
773         }
774         AST.prototype.isExpression = function () {
775             return false;
776         };
777         AST.prototype.isStatementOrExpression = function () {
778             return false;
779         };
780         AST.prototype.isCompoundStatement = function () {
781             return false;
782         };
783         AST.prototype.isLeaf = function () {
784             return this.isStatementOrExpression() && (!this.isCompoundStatement());
785         };
786         AST.prototype.isDeclaration = function () {
787             return false;
788         };
789         AST.prototype.typeCheck = function (typeFlow) {
790             switch(this.nodeType) {
791                 case TypeScript.NodeType.Error:
792                 case TypeScript.NodeType.EmptyExpr: {
793                     this.type = typeFlow.anyType;
794                     break;
795
796                 }
797                 case TypeScript.NodeType.This: {
798                     return typeFlow.typeCheckThis(this);
799
800                 }
801                 case TypeScript.NodeType.Null: {
802                     this.type = typeFlow.nullType;
803                     break;
804
805                 }
806                 case TypeScript.NodeType.False:
807                 case TypeScript.NodeType.True: {
808                     this.type = typeFlow.booleanType;
809                     break;
810
811                 }
812                 case TypeScript.NodeType.Super: {
813                     return typeFlow.typeCheckSuper(this);
814
815                 }
816                 case TypeScript.NodeType.EndCode:
817                 case TypeScript.NodeType.Empty:
818                 case TypeScript.NodeType.Void: {
819                     this.type = typeFlow.voidType;
820                     break;
821
822                 }
823                 default: {
824                     throw new Error("please implement in derived class");
825
826                 }
827             }
828             return this;
829         };
830         AST.prototype.emit = function (emitter, tokenId, startLine) {
831             emitter.emitParensAndCommentsInPlace(this, true);
832             switch(this.nodeType) {
833                 case TypeScript.NodeType.This: {
834                     emitter.recordSourceMappingStart(this);
835                     if(emitter.thisFnc && (TypeScript.hasFlag(emitter.thisFnc.fncFlags, TypeScript.FncFlags.IsFatArrowFunction))) {
836                         emitter.writeToOutput("_this");
837                     } else {
838                         emitter.writeToOutput("this");
839                     }
840                     emitter.recordSourceMappingEnd(this);
841                     break;
842
843                 }
844                 case TypeScript.NodeType.Null: {
845                     emitter.recordSourceMappingStart(this);
846                     emitter.writeToOutput("null");
847                     emitter.recordSourceMappingEnd(this);
848                     break;
849
850                 }
851                 case TypeScript.NodeType.False: {
852                     emitter.recordSourceMappingStart(this);
853                     emitter.writeToOutput("false");
854                     emitter.recordSourceMappingEnd(this);
855                     break;
856
857                 }
858                 case TypeScript.NodeType.True: {
859                     emitter.recordSourceMappingStart(this);
860                     emitter.writeToOutput("true");
861                     emitter.recordSourceMappingEnd(this);
862                     break;
863
864                 }
865                 case TypeScript.NodeType.Super: {
866                     emitter.recordSourceMappingStart(this);
867                     emitter.emitSuperReference();
868                     emitter.recordSourceMappingEnd(this);
869                     break;
870
871                 }
872                 case TypeScript.NodeType.EndCode:
873                 case TypeScript.NodeType.Error:
874                 case TypeScript.NodeType.EmptyExpr: {
875                     break;
876
877                 }
878                 case TypeScript.NodeType.Empty: {
879                     emitter.recordSourceMappingStart(this);
880                     emitter.recordSourceMappingEnd(this);
881                     break;
882
883                 }
884                 case TypeScript.NodeType.Void: {
885                     emitter.recordSourceMappingStart(this);
886                     emitter.writeToOutput("void ");
887                     emitter.recordSourceMappingEnd(this);
888                     break;
889
890                 }
891                 default: {
892                     throw new Error("please implement in derived class");
893
894                 }
895             }
896             emitter.emitParensAndCommentsInPlace(this, false);
897         };
898         AST.prototype.print = function (context) {
899             context.startLine();
900             var lineCol = {
901                 line: -1,
902                 col: -1
903             };
904             var limLineCol = {
905                 line: -1,
906                 col: -1
907             };
908             if(context.parser !== null) {
909                 context.parser.getSourceLineCol(lineCol, this.minChar);
910                 context.parser.getSourceLineCol(limLineCol, this.limChar);
911                 context.write("(" + lineCol.line + "," + lineCol.col + ")--" + "(" + limLineCol.line + "," + limLineCol.col + "): ");
912             }
913             var lab = this.printLabel();
914             if(TypeScript.hasFlag(this.flags, TypeScript.ASTFlags.Error)) {
915                 lab += " (Error)";
916             }
917             context.writeLine(lab);
918         };
919         AST.prototype.printLabel = function () {
920             if(TypeScript.nodeTypeTable[this.nodeType] !== undefined) {
921                 return TypeScript.nodeTypeTable[this.nodeType];
922             } else {
923                 return (TypeScript.NodeType)._map[this.nodeType];
924             }
925         };
926         AST.prototype.addToControlFlow = function (context) {
927             context.walker.options.goChildren = false;
928             context.addContent(this);
929         };
930         AST.prototype.netFreeUses = function (container, freeUses) {
931         };
932         AST.prototype.treeViewLabel = function () {
933             return (TypeScript.NodeType)._map[this.nodeType];
934         };
935         AST.getResolvedIdentifierName = function getResolvedIdentifierName(name) {
936             if(!name) {
937                 return "";
938             }
939             var resolved = "";
940             var start = 0;
941             var i = 0;
942             while(i <= name.length - 6) {
943                 if(name.charAt(i) == '\\' && name.charAt(i + 1) == 'u') {
944                     var charCode = parseInt(name.substr(i + 2, 4), 16);
945                     resolved += name.substr(start, i - start);
946                     resolved += String.fromCharCode(charCode);
947                     i += 6;
948                     start = i;
949                     continue;
950                 }
951                 i++;
952             }
953             resolved += name.substring(start);
954             return resolved;
955         }
956         AST.prototype.getDocComments = function () {
957             if(!this.isDeclaration() || !this.preComments || this.preComments.length == 0) {
958                 return [];
959             }
960             if(!this.docComments) {
961                 var preCommentsLength = this.preComments.length;
962                 var docComments = [];
963                 for(var i = preCommentsLength - 1; i >= 0; i--) {
964                     if(this.preComments[i].isDocComment()) {
965                         var prevDocComment = docComments.length > 0 ? docComments[docComments.length - 1] : null;
966                         if(prevDocComment == null || (this.preComments[i].limLine == prevDocComment.minLine || this.preComments[i].limLine + 1 == prevDocComment.minLine)) {
967                             docComments.push(this.preComments[i]);
968                             continue;
969                         }
970                     }
971                     break;
972                 }
973                 this.docComments = docComments.reverse();
974             }
975             return this.docComments;
976         };
977         return AST;
978     })(ASTSpan);
979     TypeScript.AST = AST;    
980     var IncompleteAST = (function (_super) {
981         __extends(IncompleteAST, _super);
982         function IncompleteAST(min, lim) {
983                 _super.call(this, TypeScript.NodeType.Error);
984             this.minChar = min;
985             this.limChar = lim;
986         }
987         return IncompleteAST;
988     })(AST);
989     TypeScript.IncompleteAST = IncompleteAST;    
990     var ASTList = (function (_super) {
991         __extends(ASTList, _super);
992         function ASTList() {
993                 _super.call(this, TypeScript.NodeType.List);
994             this.enclosingScope = null;
995             this.members = new Array();
996         }
997         ASTList.prototype.addToControlFlow = function (context) {
998             var len = this.members.length;
999             for(var i = 0; i < len; i++) {
1000                 if(context.noContinuation) {
1001                     context.addUnreachable(this.members[i]);
1002                     break;
1003                 } else {
1004                     this.members[i] = context.walk(this.members[i], this);
1005                 }
1006             }
1007             context.walker.options.goChildren = false;
1008         };
1009         ASTList.prototype.append = function (ast) {
1010             this.members[this.members.length] = ast;
1011             return this;
1012         };
1013         ASTList.prototype.appendAll = function (ast) {
1014             if(ast.nodeType == TypeScript.NodeType.List) {
1015                 var list = ast;
1016                 for(var i = 0, len = list.members.length; i < len; i++) {
1017                     this.append(list.members[i]);
1018                 }
1019             } else {
1020                 this.append(ast);
1021             }
1022             return this;
1023         };
1024         ASTList.prototype.emit = function (emitter, tokenId, startLine) {
1025             emitter.recordSourceMappingStart(this);
1026             emitter.emitJavascriptList(this, null, TypeScript.TokenID.Semicolon, startLine, false, false);
1027             emitter.recordSourceMappingEnd(this);
1028         };
1029         ASTList.prototype.typeCheck = function (typeFlow) {
1030             var len = this.members.length;
1031             typeFlow.nestingLevel++;
1032             for(var i = 0; i < len; i++) {
1033                 if(this.members[i]) {
1034                     this.members[i] = this.members[i].typeCheck(typeFlow);
1035                 }
1036             }
1037             typeFlow.nestingLevel--;
1038             return this;
1039         };
1040         return ASTList;
1041     })(AST);
1042     TypeScript.ASTList = ASTList;    
1043     var Identifier = (function (_super) {
1044         __extends(Identifier, _super);
1045         function Identifier(actualText, hasEscapeSequence) {
1046                 _super.call(this, TypeScript.NodeType.Name);
1047             this.actualText = actualText;
1048             this.hasEscapeSequence = hasEscapeSequence;
1049             this.sym = null;
1050             this.cloId = -1;
1051             this.setText(actualText, hasEscapeSequence);
1052         }
1053         Identifier.prototype.setText = function (actualText, hasEscapeSequence) {
1054             this.actualText = actualText;
1055             if(hasEscapeSequence) {
1056                 this.text = AST.getResolvedIdentifierName(actualText);
1057             } else {
1058                 this.text = actualText;
1059             }
1060         };
1061         Identifier.prototype.isMissing = function () {
1062             return false;
1063         };
1064         Identifier.prototype.isLeaf = function () {
1065             return true;
1066         };
1067         Identifier.prototype.treeViewLabel = function () {
1068             return "id: " + this.actualText;
1069         };
1070         Identifier.prototype.printLabel = function () {
1071             if(this.actualText) {
1072                 return "id: " + this.actualText;
1073             } else {
1074                 return "name node";
1075             }
1076         };
1077         Identifier.prototype.typeCheck = function (typeFlow) {
1078             return typeFlow.typeCheckName(this);
1079         };
1080         Identifier.prototype.emit = function (emitter, tokenId, startLine) {
1081             emitter.emitJavascriptName(this, true);
1082         };
1083         Identifier.fromToken = function fromToken(token) {
1084             return new Identifier(token.getText(), (token).hasEscapeSequence);
1085         }
1086         return Identifier;
1087     })(AST);
1088     TypeScript.Identifier = Identifier;    
1089     var MissingIdentifier = (function (_super) {
1090         __extends(MissingIdentifier, _super);
1091         function MissingIdentifier() {
1092                 _super.call(this, "__missing");
1093         }
1094         MissingIdentifier.prototype.isMissing = function () {
1095             return true;
1096         };
1097         MissingIdentifier.prototype.emit = function (emitter, tokenId, startLine) {
1098         };
1099         return MissingIdentifier;
1100     })(Identifier);
1101     TypeScript.MissingIdentifier = MissingIdentifier;    
1102     var Label = (function (_super) {
1103         __extends(Label, _super);
1104         function Label(id) {
1105                 _super.call(this, TypeScript.NodeType.Label);
1106             this.id = id;
1107         }
1108         Label.prototype.printLabel = function () {
1109             return this.id.actualText + ":";
1110         };
1111         Label.prototype.typeCheck = function (typeFlow) {
1112             this.type = typeFlow.voidType;
1113             return this;
1114         };
1115         Label.prototype.emit = function (emitter, tokenId, startLine) {
1116             emitter.emitParensAndCommentsInPlace(this, true);
1117             emitter.recordSourceMappingStart(this);
1118             emitter.recordSourceMappingStart(this.id);
1119             emitter.writeToOutput(this.id.actualText);
1120             emitter.recordSourceMappingEnd(this.id);
1121             emitter.writeLineToOutput(":");
1122             emitter.recordSourceMappingEnd(this);
1123             emitter.emitParensAndCommentsInPlace(this, false);
1124         };
1125         return Label;
1126     })(AST);
1127     TypeScript.Label = Label;    
1128     var Expression = (function (_super) {
1129         __extends(Expression, _super);
1130         function Expression(nodeType) {
1131                 _super.call(this, nodeType);
1132         }
1133         Expression.prototype.isExpression = function () {
1134             return true;
1135         };
1136         Expression.prototype.isStatementOrExpression = function () {
1137             return true;
1138         };
1139         return Expression;
1140     })(AST);
1141     TypeScript.Expression = Expression;    
1142     var UnaryExpression = (function (_super) {
1143         __extends(UnaryExpression, _super);
1144         function UnaryExpression(nodeType, operand) {
1145                 _super.call(this, nodeType);
1146             this.operand = operand;
1147             this.targetType = null;
1148             this.castTerm = null;
1149         }
1150         UnaryExpression.prototype.addToControlFlow = function (context) {
1151             _super.prototype.addToControlFlow.call(this, context);
1152             if(this.nodeType == TypeScript.NodeType.Throw) {
1153                 context.returnStmt();
1154             }
1155         };
1156         UnaryExpression.prototype.typeCheck = function (typeFlow) {
1157             switch(this.nodeType) {
1158                 case TypeScript.NodeType.Not: {
1159                     return typeFlow.typeCheckBitNot(this);
1160
1161                 }
1162                 case TypeScript.NodeType.LogNot: {
1163                     return typeFlow.typeCheckLogNot(this);
1164
1165                 }
1166                 case TypeScript.NodeType.Pos:
1167                 case TypeScript.NodeType.Neg: {
1168                     return typeFlow.typeCheckUnaryNumberOperator(this);
1169
1170                 }
1171                 case TypeScript.NodeType.IncPost:
1172                 case TypeScript.NodeType.IncPre:
1173                 case TypeScript.NodeType.DecPost:
1174                 case TypeScript.NodeType.DecPre: {
1175                     return typeFlow.typeCheckIncOrDec(this);
1176
1177                 }
1178                 case TypeScript.NodeType.ArrayLit: {
1179                     typeFlow.typeCheckArrayLit(this);
1180                     return this;
1181
1182                 }
1183                 case TypeScript.NodeType.ObjectLit: {
1184                     typeFlow.typeCheckObjectLit(this);
1185                     return this;
1186
1187                 }
1188                 case TypeScript.NodeType.Throw: {
1189                     this.operand = typeFlow.typeCheck(this.operand);
1190                     this.type = typeFlow.voidType;
1191                     return this;
1192
1193                 }
1194                 case TypeScript.NodeType.Typeof: {
1195                     this.operand = typeFlow.typeCheck(this.operand);
1196                     this.type = typeFlow.stringType;
1197                     return this;
1198
1199                 }
1200                 case TypeScript.NodeType.Delete: {
1201                     this.operand = typeFlow.typeCheck(this.operand);
1202                     this.type = typeFlow.booleanType;
1203                     break;
1204
1205                 }
1206                 case TypeScript.NodeType.TypeAssertion: {
1207                     this.castTerm = typeFlow.typeCheck(this.castTerm);
1208                     var applyTargetType = !this.operand.isParenthesized;
1209                     var targetType = applyTargetType ? this.castTerm.type : null;
1210                     typeFlow.checker.typeCheckWithContextualType(targetType, typeFlow.checker.inProvisionalTypecheckMode(), true, this.operand);
1211                     typeFlow.castWithCoercion(this.operand, this.castTerm.type, false, true);
1212                     this.type = this.castTerm.type;
1213                     return this;
1214
1215                 }
1216                 case TypeScript.NodeType.Void: {
1217                     this.operand = typeFlow.typeCheck(this.operand);
1218                     this.type = typeFlow.checker.undefinedType;
1219                     break;
1220
1221                 }
1222                 default: {
1223                     throw new Error("please implement in derived class");
1224
1225                 }
1226             }
1227             return this;
1228         };
1229         UnaryExpression.prototype.emit = function (emitter, tokenId, startLine) {
1230             emitter.emitParensAndCommentsInPlace(this, true);
1231             emitter.recordSourceMappingStart(this);
1232             switch(this.nodeType) {
1233                 case TypeScript.NodeType.IncPost: {
1234                     emitter.emitJavascript(this.operand, TypeScript.TokenID.PlusPlus, false);
1235                     emitter.writeToOutput("++");
1236                     break;
1237
1238                 }
1239                 case TypeScript.NodeType.LogNot: {
1240                     emitter.writeToOutput("!");
1241                     emitter.emitJavascript(this.operand, TypeScript.TokenID.Exclamation, false);
1242                     break;
1243
1244                 }
1245                 case TypeScript.NodeType.DecPost: {
1246                     emitter.emitJavascript(this.operand, TypeScript.TokenID.MinusMinus, false);
1247                     emitter.writeToOutput("--");
1248                     break;
1249
1250                 }
1251                 case TypeScript.NodeType.ObjectLit: {
1252                     emitter.emitObjectLiteral(this.operand);
1253                     break;
1254
1255                 }
1256                 case TypeScript.NodeType.ArrayLit: {
1257                     emitter.emitArrayLiteral(this.operand);
1258                     break;
1259
1260                 }
1261                 case TypeScript.NodeType.Not: {
1262                     emitter.writeToOutput("~");
1263                     emitter.emitJavascript(this.operand, TypeScript.TokenID.Tilde, false);
1264                     break;
1265
1266                 }
1267                 case TypeScript.NodeType.Neg: {
1268                     emitter.writeToOutput("-");
1269                     if(this.operand.nodeType == TypeScript.NodeType.Neg) {
1270                         this.operand.isParenthesized = true;
1271                     }
1272                     emitter.emitJavascript(this.operand, TypeScript.TokenID.Minus, false);
1273                     break;
1274
1275                 }
1276                 case TypeScript.NodeType.Pos: {
1277                     emitter.writeToOutput("+");
1278                     if(this.operand.nodeType == TypeScript.NodeType.Pos) {
1279                         this.operand.isParenthesized = true;
1280                     }
1281                     emitter.emitJavascript(this.operand, TypeScript.TokenID.Plus, false);
1282                     break;
1283
1284                 }
1285                 case TypeScript.NodeType.IncPre: {
1286                     emitter.writeToOutput("++");
1287                     emitter.emitJavascript(this.operand, TypeScript.TokenID.PlusPlus, false);
1288                     break;
1289
1290                 }
1291                 case TypeScript.NodeType.DecPre: {
1292                     emitter.writeToOutput("--");
1293                     emitter.emitJavascript(this.operand, TypeScript.TokenID.MinusMinus, false);
1294                     break;
1295
1296                 }
1297                 case TypeScript.NodeType.Throw: {
1298                     emitter.writeToOutput("throw ");
1299                     emitter.emitJavascript(this.operand, TypeScript.TokenID.Tilde, false);
1300                     emitter.writeToOutput(";");
1301                     break;
1302
1303                 }
1304                 case TypeScript.NodeType.Typeof: {
1305                     emitter.writeToOutput("typeof ");
1306                     emitter.emitJavascript(this.operand, TypeScript.TokenID.Tilde, false);
1307                     break;
1308
1309                 }
1310                 case TypeScript.NodeType.Delete: {
1311                     emitter.writeToOutput("delete ");
1312                     emitter.emitJavascript(this.operand, TypeScript.TokenID.Tilde, false);
1313                     break;
1314
1315                 }
1316                 case TypeScript.NodeType.Void: {
1317                     emitter.writeToOutput("void ");
1318                     emitter.emitJavascript(this.operand, TypeScript.TokenID.Tilde, false);
1319                     break;
1320
1321                 }
1322                 case TypeScript.NodeType.TypeAssertion: {
1323                     emitter.emitJavascript(this.operand, TypeScript.TokenID.Tilde, false);
1324                     break;
1325
1326                 }
1327                 default: {
1328                     throw new Error("please implement in derived class");
1329
1330                 }
1331             }
1332             emitter.recordSourceMappingEnd(this);
1333             emitter.emitParensAndCommentsInPlace(this, false);
1334         };
1335         return UnaryExpression;
1336     })(Expression);
1337     TypeScript.UnaryExpression = UnaryExpression;    
1338     var CallExpression = (function (_super) {
1339         __extends(CallExpression, _super);
1340         function CallExpression(nodeType, target, arguments) {
1341                 _super.call(this, nodeType);
1342             this.target = target;
1343             this.arguments = arguments;
1344             this.signature = null;
1345             this.minChar = this.target.minChar;
1346         }
1347         CallExpression.prototype.typeCheck = function (typeFlow) {
1348             if(this.nodeType == TypeScript.NodeType.New) {
1349                 return typeFlow.typeCheckNew(this);
1350             } else {
1351                 return typeFlow.typeCheckCall(this);
1352             }
1353         };
1354         CallExpression.prototype.emit = function (emitter, tokenId, startLine) {
1355             emitter.emitParensAndCommentsInPlace(this, true);
1356             emitter.recordSourceMappingStart(this);
1357             if(this.nodeType == TypeScript.NodeType.New) {
1358                 emitter.emitNew(this.target, this.arguments);
1359             } else {
1360                 emitter.emitCall(this, this.target, this.arguments);
1361             }
1362             emitter.recordSourceMappingEnd(this);
1363             emitter.emitParensAndCommentsInPlace(this, false);
1364         };
1365         return CallExpression;
1366     })(Expression);
1367     TypeScript.CallExpression = CallExpression;    
1368     var BinaryExpression = (function (_super) {
1369         __extends(BinaryExpression, _super);
1370         function BinaryExpression(nodeType, operand1, operand2) {
1371                 _super.call(this, nodeType);
1372             this.operand1 = operand1;
1373             this.operand2 = operand2;
1374         }
1375         BinaryExpression.prototype.typeCheck = function (typeFlow) {
1376             switch(this.nodeType) {
1377                 case TypeScript.NodeType.Dot: {
1378                     return typeFlow.typeCheckDotOperator(this);
1379
1380                 }
1381                 case TypeScript.NodeType.Asg: {
1382                     return typeFlow.typeCheckAsgOperator(this);
1383
1384                 }
1385                 case TypeScript.NodeType.Add:
1386                 case TypeScript.NodeType.Sub:
1387                 case TypeScript.NodeType.Mul:
1388                 case TypeScript.NodeType.Div:
1389                 case TypeScript.NodeType.Mod:
1390                 case TypeScript.NodeType.Or:
1391                 case TypeScript.NodeType.And: {
1392                     return typeFlow.typeCheckArithmeticOperator(this, false);
1393
1394                 }
1395                 case TypeScript.NodeType.Xor: {
1396                     return typeFlow.typeCheckBitwiseOperator(this, false);
1397
1398                 }
1399                 case TypeScript.NodeType.Ne:
1400                 case TypeScript.NodeType.Eq: {
1401                     var text;
1402                     if(typeFlow.checker.styleSettings.eqeqeq) {
1403                         text = TypeScript.nodeTypeTable[this.nodeType];
1404                         typeFlow.checker.errorReporter.styleError(this, "use of " + text);
1405                     } else {
1406                         if(typeFlow.checker.styleSettings.eqnull) {
1407                             text = TypeScript.nodeTypeTable[this.nodeType];
1408                             if((this.operand2 !== null) && (this.operand2.nodeType == TypeScript.NodeType.Null)) {
1409                                 typeFlow.checker.errorReporter.styleError(this, "use of " + text + " to compare with null");
1410                             }
1411                         }
1412                     }
1413
1414                 }
1415                 case TypeScript.NodeType.Eqv:
1416                 case TypeScript.NodeType.NEqv:
1417                 case TypeScript.NodeType.Lt:
1418                 case TypeScript.NodeType.Le:
1419                 case TypeScript.NodeType.Ge:
1420                 case TypeScript.NodeType.Gt: {
1421                     return typeFlow.typeCheckBooleanOperator(this);
1422
1423                 }
1424                 case TypeScript.NodeType.Index: {
1425                     return typeFlow.typeCheckIndex(this);
1426
1427                 }
1428                 case TypeScript.NodeType.Member: {
1429                     this.type = typeFlow.voidType;
1430                     return this;
1431
1432                 }
1433                 case TypeScript.NodeType.LogOr: {
1434                     return typeFlow.typeCheckLogOr(this);
1435
1436                 }
1437                 case TypeScript.NodeType.LogAnd: {
1438                     return typeFlow.typeCheckLogAnd(this);
1439
1440                 }
1441                 case TypeScript.NodeType.AsgAdd:
1442                 case TypeScript.NodeType.AsgSub:
1443                 case TypeScript.NodeType.AsgMul:
1444                 case TypeScript.NodeType.AsgDiv:
1445                 case TypeScript.NodeType.AsgMod:
1446                 case TypeScript.NodeType.AsgOr:
1447                 case TypeScript.NodeType.AsgAnd: {
1448                     return typeFlow.typeCheckArithmeticOperator(this, true);
1449
1450                 }
1451                 case TypeScript.NodeType.AsgXor: {
1452                     return typeFlow.typeCheckBitwiseOperator(this, true);
1453
1454                 }
1455                 case TypeScript.NodeType.Lsh:
1456                 case TypeScript.NodeType.Rsh:
1457                 case TypeScript.NodeType.Rs2: {
1458                     return typeFlow.typeCheckShift(this, false);
1459
1460                 }
1461                 case TypeScript.NodeType.AsgLsh:
1462                 case TypeScript.NodeType.AsgRsh:
1463                 case TypeScript.NodeType.AsgRs2: {
1464                     return typeFlow.typeCheckShift(this, true);
1465
1466                 }
1467                 case TypeScript.NodeType.Comma: {
1468                     return typeFlow.typeCheckCommaOperator(this);
1469
1470                 }
1471                 case TypeScript.NodeType.InstOf: {
1472                     return typeFlow.typeCheckInstOf(this);
1473
1474                 }
1475                 case TypeScript.NodeType.In: {
1476                     return typeFlow.typeCheckInOperator(this);
1477
1478                 }
1479                 case TypeScript.NodeType.From: {
1480                     typeFlow.checker.errorReporter.simpleError(this, "Illegal use of 'from' keyword in binary expression");
1481                     break;
1482
1483                 }
1484                 default: {
1485                     throw new Error("please implement in derived class");
1486
1487                 }
1488             }
1489             return this;
1490         };
1491         BinaryExpression.prototype.emit = function (emitter, tokenId, startLine) {
1492             var binTokenId = TypeScript.nodeTypeToTokTable[this.nodeType];
1493             emitter.emitParensAndCommentsInPlace(this, true);
1494             emitter.recordSourceMappingStart(this);
1495             if(binTokenId != undefined) {
1496                 emitter.emitJavascript(this.operand1, binTokenId, false);
1497                 if(TypeScript.tokenTable[binTokenId].text == "instanceof") {
1498                     emitter.writeToOutput(" instanceof ");
1499                 } else {
1500                     if(TypeScript.tokenTable[binTokenId].text == "in") {
1501                         emitter.writeToOutput(" in ");
1502                     } else {
1503                         emitter.writeToOutputTrimmable(" " + TypeScript.tokenTable[binTokenId].text + " ");
1504                     }
1505                 }
1506                 emitter.emitJavascript(this.operand2, binTokenId, false);
1507             } else {
1508                 switch(this.nodeType) {
1509                     case TypeScript.NodeType.Dot: {
1510                         if(!emitter.tryEmitConstant(this)) {
1511                             emitter.emitJavascript(this.operand1, TypeScript.TokenID.Dot, false);
1512                             emitter.writeToOutput(".");
1513                             emitter.emitJavascriptName(this.operand2, false);
1514                         }
1515                         break;
1516
1517                     }
1518                     case TypeScript.NodeType.Index: {
1519                         emitter.emitIndex(this.operand1, this.operand2);
1520                         break;
1521
1522                     }
1523                     case TypeScript.NodeType.Member: {
1524                         if(this.operand2.nodeType == TypeScript.NodeType.FuncDecl && (this.operand2).isAccessor()) {
1525                             var funcDecl = this.operand2;
1526                             if(TypeScript.hasFlag(funcDecl.fncFlags, TypeScript.FncFlags.GetAccessor)) {
1527                                 emitter.writeToOutput("get ");
1528                             } else {
1529                                 emitter.writeToOutput("set ");
1530                             }
1531                             emitter.emitJavascript(this.operand1, TypeScript.TokenID.Colon, false);
1532                         } else {
1533                             emitter.emitJavascript(this.operand1, TypeScript.TokenID.Colon, false);
1534                             emitter.writeToOutputTrimmable(": ");
1535                         }
1536                         emitter.emitJavascript(this.operand2, TypeScript.TokenID.Comma, false);
1537                         break;
1538
1539                     }
1540                     case TypeScript.NodeType.Comma: {
1541                         emitter.emitJavascript(this.operand1, TypeScript.TokenID.Comma, false);
1542                         if(emitter.emitState.inObjectLiteral) {
1543                             emitter.writeLineToOutput(", ");
1544                         } else {
1545                             emitter.writeToOutput(",");
1546                         }
1547                         emitter.emitJavascript(this.operand2, TypeScript.TokenID.Comma, false);
1548                         break;
1549
1550                     }
1551                     case TypeScript.NodeType.Is: {
1552                         throw new Error("should be de-sugared during type check");
1553
1554                     }
1555                     default: {
1556                         throw new Error("please implement in derived class");
1557
1558                     }
1559                 }
1560             }
1561             emitter.recordSourceMappingEnd(this);
1562             emitter.emitParensAndCommentsInPlace(this, false);
1563         };
1564         return BinaryExpression;
1565     })(Expression);
1566     TypeScript.BinaryExpression = BinaryExpression;    
1567     var ConditionalExpression = (function (_super) {
1568         __extends(ConditionalExpression, _super);
1569         function ConditionalExpression(operand1, operand2, operand3) {
1570                 _super.call(this, TypeScript.NodeType.ConditionalExpression);
1571             this.operand1 = operand1;
1572             this.operand2 = operand2;
1573             this.operand3 = operand3;
1574         }
1575         ConditionalExpression.prototype.typeCheck = function (typeFlow) {
1576             return typeFlow.typeCheckQMark(this);
1577         };
1578         ConditionalExpression.prototype.emit = function (emitter, tokenId, startLine) {
1579             emitter.emitParensAndCommentsInPlace(this, true);
1580             emitter.recordSourceMappingStart(this);
1581             emitter.emitJavascript(this.operand1, TypeScript.TokenID.Question, false);
1582             emitter.writeToOutput(" ? ");
1583             emitter.emitJavascript(this.operand2, TypeScript.TokenID.Question, false);
1584             emitter.writeToOutput(" : ");
1585             emitter.emitJavascript(this.operand3, TypeScript.TokenID.Question, false);
1586             emitter.recordSourceMappingEnd(this);
1587             emitter.emitParensAndCommentsInPlace(this, false);
1588         };
1589         return ConditionalExpression;
1590     })(Expression);
1591     TypeScript.ConditionalExpression = ConditionalExpression;    
1592     var NumberLiteral = (function (_super) {
1593         __extends(NumberLiteral, _super);
1594         function NumberLiteral(value, hasEmptyFraction) {
1595                 _super.call(this, TypeScript.NodeType.NumberLit);
1596             this.value = value;
1597             this.hasEmptyFraction = hasEmptyFraction;
1598             this.isNegativeZero = false;
1599         }
1600         NumberLiteral.prototype.typeCheck = function (typeFlow) {
1601             this.type = typeFlow.doubleType;
1602             return this;
1603         };
1604         NumberLiteral.prototype.treeViewLabel = function () {
1605             return "num: " + this.printLabel();
1606         };
1607         NumberLiteral.prototype.emit = function (emitter, tokenId, startLine) {
1608             emitter.emitParensAndCommentsInPlace(this, true);
1609             emitter.recordSourceMappingStart(this);
1610             if(this.isNegativeZero) {
1611                 emitter.writeToOutput("-");
1612             }
1613             emitter.writeToOutput(this.value.toString());
1614             if(this.hasEmptyFraction) {
1615                 emitter.writeToOutput(".0");
1616             }
1617             emitter.recordSourceMappingEnd(this);
1618             emitter.emitParensAndCommentsInPlace(this, false);
1619         };
1620         NumberLiteral.prototype.printLabel = function () {
1621             if(Math.floor(this.value) != this.value) {
1622                 return this.value.toFixed(2).toString();
1623             } else {
1624                 if(this.hasEmptyFraction) {
1625                     return this.value.toString() + ".0";
1626                 } else {
1627                     return this.value.toString();
1628                 }
1629             }
1630         };
1631         return NumberLiteral;
1632     })(Expression);
1633     TypeScript.NumberLiteral = NumberLiteral;    
1634     var RegexLiteral = (function (_super) {
1635         __extends(RegexLiteral, _super);
1636         function RegexLiteral(regex) {
1637                 _super.call(this, TypeScript.NodeType.Regex);
1638             this.regex = regex;
1639         }
1640         RegexLiteral.prototype.typeCheck = function (typeFlow) {
1641             this.type = typeFlow.regexType;
1642             return this;
1643         };
1644         RegexLiteral.prototype.emit = function (emitter, tokenId, startLine) {
1645             emitter.emitParensAndCommentsInPlace(this, true);
1646             emitter.recordSourceMappingStart(this);
1647             emitter.writeToOutput(this.regex.toString());
1648             emitter.recordSourceMappingEnd(this);
1649             emitter.emitParensAndCommentsInPlace(this, false);
1650         };
1651         return RegexLiteral;
1652     })(Expression);
1653     TypeScript.RegexLiteral = RegexLiteral;    
1654     var StringLiteral = (function (_super) {
1655         __extends(StringLiteral, _super);
1656         function StringLiteral(text) {
1657                 _super.call(this, TypeScript.NodeType.QString);
1658             this.text = text;
1659         }
1660         StringLiteral.prototype.emit = function (emitter, tokenId, startLine) {
1661             emitter.emitParensAndCommentsInPlace(this, true);
1662             emitter.recordSourceMappingStart(this);
1663             emitter.emitStringLiteral(this.text);
1664             emitter.recordSourceMappingEnd(this);
1665             emitter.emitParensAndCommentsInPlace(this, false);
1666         };
1667         StringLiteral.prototype.typeCheck = function (typeFlow) {
1668             this.type = typeFlow.stringType;
1669             return this;
1670         };
1671         StringLiteral.prototype.treeViewLabel = function () {
1672             return "st: " + this.text;
1673         };
1674         StringLiteral.prototype.printLabel = function () {
1675             return this.text;
1676         };
1677         return StringLiteral;
1678     })(Expression);
1679     TypeScript.StringLiteral = StringLiteral;    
1680     var ModuleElement = (function (_super) {
1681         __extends(ModuleElement, _super);
1682         function ModuleElement(nodeType) {
1683                 _super.call(this, nodeType);
1684         }
1685         return ModuleElement;
1686     })(AST);
1687     TypeScript.ModuleElement = ModuleElement;    
1688     var ImportDeclaration = (function (_super) {
1689         __extends(ImportDeclaration, _super);
1690         function ImportDeclaration(id, alias) {
1691                 _super.call(this, TypeScript.NodeType.ImportDeclaration);
1692             this.id = id;
1693             this.alias = alias;
1694             this.varFlags = TypeScript.VarFlags.None;
1695             this.isDynamicImport = false;
1696         }
1697         ImportDeclaration.prototype.isStatementOrExpression = function () {
1698             return true;
1699         };
1700         ImportDeclaration.prototype.isDeclaration = function () {
1701             return true;
1702         };
1703         ImportDeclaration.prototype.emit = function (emitter, tokenId, startLine) {
1704             var mod = this.alias.type;
1705             if(!this.isDynamicImport || (this.id.sym && !(this.id.sym).onlyReferencedAsTypeRef)) {
1706                 var prevModAliasId = emitter.modAliasId;
1707                 var prevFirstModAlias = emitter.firstModAlias;
1708                 emitter.recordSourceMappingStart(this);
1709                 emitter.emitParensAndCommentsInPlace(this, true);
1710                 emitter.writeToOutput("var " + this.id.actualText + " = ");
1711                 emitter.modAliasId = this.id.actualText;
1712                 emitter.firstModAlias = this.firstAliasedModToString();
1713                 emitter.emitJavascript(this.alias, TypeScript.TokenID.Tilde, false);
1714                 if(!this.isDynamicImport) {
1715                     emitter.writeToOutput(";");
1716                 }
1717                 emitter.emitParensAndCommentsInPlace(this, false);
1718                 emitter.recordSourceMappingEnd(this);
1719                 emitter.modAliasId = prevModAliasId;
1720                 emitter.firstModAlias = prevFirstModAlias;
1721             }
1722         };
1723         ImportDeclaration.prototype.typeCheck = function (typeFlow) {
1724             return typeFlow.typeCheckImportDecl(this);
1725         };
1726         ImportDeclaration.prototype.getAliasName = function (aliasAST) {
1727             if (typeof aliasAST === "undefined") { aliasAST = this.alias; }
1728             if(aliasAST.nodeType == TypeScript.NodeType.Name) {
1729                 return (aliasAST).actualText;
1730             } else {
1731                 var dotExpr = aliasAST;
1732                 return this.getAliasName(dotExpr.operand1) + "." + this.getAliasName(dotExpr.operand2);
1733             }
1734         };
1735         ImportDeclaration.prototype.firstAliasedModToString = function () {
1736             if(this.alias.nodeType == TypeScript.NodeType.Name) {
1737                 return (this.alias).actualText;
1738             } else {
1739                 var dotExpr = this.alias;
1740                 var firstMod = dotExpr.operand1;
1741                 return firstMod.actualText;
1742             }
1743         };
1744         return ImportDeclaration;
1745     })(ModuleElement);
1746     TypeScript.ImportDeclaration = ImportDeclaration;    
1747     var BoundDecl = (function (_super) {
1748         __extends(BoundDecl, _super);
1749         function BoundDecl(id, nodeType, nestingLevel) {
1750                 _super.call(this, nodeType);
1751             this.id = id;
1752             this.nestingLevel = nestingLevel;
1753             this.init = null;
1754             this.typeExpr = null;
1755             this.varFlags = TypeScript.VarFlags.None;
1756             this.sym = null;
1757         }
1758         BoundDecl.prototype.isDeclaration = function () {
1759             return true;
1760         };
1761         BoundDecl.prototype.isStatementOrExpression = function () {
1762             return true;
1763         };
1764         BoundDecl.prototype.isPrivate = function () {
1765             return TypeScript.hasFlag(this.varFlags, TypeScript.VarFlags.Private);
1766         };
1767         BoundDecl.prototype.isPublic = function () {
1768             return TypeScript.hasFlag(this.varFlags, TypeScript.VarFlags.Public);
1769         };
1770         BoundDecl.prototype.isProperty = function () {
1771             return TypeScript.hasFlag(this.varFlags, TypeScript.VarFlags.Property);
1772         };
1773         BoundDecl.prototype.typeCheck = function (typeFlow) {
1774             return typeFlow.typeCheckBoundDecl(this);
1775         };
1776         BoundDecl.prototype.printLabel = function () {
1777             return this.treeViewLabel();
1778         };
1779         return BoundDecl;
1780     })(AST);
1781     TypeScript.BoundDecl = BoundDecl;    
1782     var VarDecl = (function (_super) {
1783         __extends(VarDecl, _super);
1784         function VarDecl(id, nest) {
1785                 _super.call(this, id, TypeScript.NodeType.VarDecl, nest);
1786         }
1787         VarDecl.prototype.isAmbient = function () {
1788             return TypeScript.hasFlag(this.varFlags, TypeScript.VarFlags.Ambient);
1789         };
1790         VarDecl.prototype.isExported = function () {
1791             return TypeScript.hasFlag(this.varFlags, TypeScript.VarFlags.Exported);
1792         };
1793         VarDecl.prototype.isStatic = function () {
1794             return TypeScript.hasFlag(this.varFlags, TypeScript.VarFlags.Static);
1795         };
1796         VarDecl.prototype.emit = function (emitter, tokenId, startLine) {
1797             emitter.emitJavascriptVarDecl(this, tokenId);
1798         };
1799         VarDecl.prototype.treeViewLabel = function () {
1800             return "var " + this.id.actualText;
1801         };
1802         return VarDecl;
1803     })(BoundDecl);
1804     TypeScript.VarDecl = VarDecl;    
1805     var ArgDecl = (function (_super) {
1806         __extends(ArgDecl, _super);
1807         function ArgDecl(id) {
1808                 _super.call(this, id, TypeScript.NodeType.ArgDecl, 0);
1809             this.isOptional = false;
1810             this.parameterPropertySym = null;
1811         }
1812         ArgDecl.prototype.isOptionalArg = function () {
1813             return this.isOptional || this.init;
1814         };
1815         ArgDecl.prototype.treeViewLabel = function () {
1816             return "arg: " + this.id.actualText;
1817         };
1818         ArgDecl.prototype.emit = function (emitter, tokenId, startLine) {
1819             emitter.emitParensAndCommentsInPlace(this, true);
1820             emitter.recordSourceMappingStart(this);
1821             emitter.writeToOutput(this.id.actualText);
1822             emitter.recordSourceMappingEnd(this);
1823             emitter.emitParensAndCommentsInPlace(this, false);
1824         };
1825         return ArgDecl;
1826     })(BoundDecl);
1827     TypeScript.ArgDecl = ArgDecl;    
1828     var internalId = 0;
1829     var FuncDecl = (function (_super) {
1830         __extends(FuncDecl, _super);
1831         function FuncDecl(name, bod, isConstructor, arguments, vars, scopes, statics, nodeType) {
1832                 _super.call(this, nodeType);
1833             this.name = name;
1834             this.bod = bod;
1835             this.isConstructor = isConstructor;
1836             this.arguments = arguments;
1837             this.vars = vars;
1838             this.scopes = scopes;
1839             this.statics = statics;
1840             this.hint = null;
1841             this.fncFlags = TypeScript.FncFlags.None;
1842             this.returnTypeAnnotation = null;
1843             this.variableArgList = false;
1844             this.jumpRefs = null;
1845             this.internalNameCache = null;
1846             this.tmp1Declared = false;
1847             this.enclosingFnc = null;
1848             this.freeVariables = [];
1849             this.unitIndex = -1;
1850             this.classDecl = null;
1851             this.boundToProperty = null;
1852             this.isOverload = false;
1853             this.innerStaticFuncs = [];
1854             this.isTargetTypedAsMethod = false;
1855             this.isInlineCallLiteral = false;
1856             this.accessorSymbol = null;
1857             this.leftCurlyCount = 0;
1858             this.rightCurlyCount = 0;
1859             this.returnStatementsWithExpressions = [];
1860             this.scopeType = null;
1861             this.endingToken = null;
1862         }
1863         FuncDecl.prototype.isDeclaration = function () {
1864             return true;
1865         };
1866         FuncDecl.prototype.internalName = function () {
1867             if(this.internalNameCache == null) {
1868                 var extName = this.getNameText();
1869                 if(extName) {
1870                     this.internalNameCache = "_internal_" + extName;
1871                 } else {
1872                     this.internalNameCache = "_internal_" + internalId++;
1873                 }
1874             }
1875             return this.internalNameCache;
1876         };
1877         FuncDecl.prototype.hasSelfReference = function () {
1878             return TypeScript.hasFlag(this.fncFlags, TypeScript.FncFlags.HasSelfReference);
1879         };
1880         FuncDecl.prototype.setHasSelfReference = function () {
1881             this.fncFlags |= TypeScript.FncFlags.HasSelfReference;
1882         };
1883         FuncDecl.prototype.hasSuperReferenceInFatArrowFunction = function () {
1884             return TypeScript.hasFlag(this.fncFlags, TypeScript.FncFlags.HasSuperReferenceInFatArrowFunction);
1885         };
1886         FuncDecl.prototype.setHasSuperReferenceInFatArrowFunction = function () {
1887             this.fncFlags |= TypeScript.FncFlags.HasSuperReferenceInFatArrowFunction;
1888         };
1889         FuncDecl.prototype.addCloRef = function (id, sym) {
1890             if(this.envids == null) {
1891                 this.envids = new Array();
1892             }
1893             this.envids[this.envids.length] = id;
1894             var outerFnc = this.enclosingFnc;
1895             if(sym) {
1896                 while(outerFnc && (outerFnc.type.symbol != sym.container)) {
1897                     outerFnc.addJumpRef(sym);
1898                     outerFnc = outerFnc.enclosingFnc;
1899                 }
1900             }
1901             return this.envids.length - 1;
1902         };
1903         FuncDecl.prototype.addJumpRef = function (sym) {
1904             if(this.jumpRefs == null) {
1905                 this.jumpRefs = new Array();
1906             }
1907             var id = new Identifier(sym.name);
1908             this.jumpRefs[this.jumpRefs.length] = id;
1909             id.sym = sym;
1910             id.cloId = this.addCloRef(id, null);
1911         };
1912         FuncDecl.prototype.buildControlFlow = function () {
1913             var entry = new TypeScript.BasicBlock();
1914             var exit = new TypeScript.BasicBlock();
1915             var context = new TypeScript.ControlFlowContext(entry, exit);
1916             var controlFlowPrefix = function (ast, parent, walker) {
1917                 ast.addToControlFlow(walker.state);
1918                 return ast;
1919             };
1920             var walker = TypeScript.getAstWalkerFactory().getWalker(controlFlowPrefix, null, null, context);
1921             context.walker = walker;
1922             walker.walk(this.bod, this);
1923             return context;
1924         };
1925         FuncDecl.prototype.typeCheck = function (typeFlow) {
1926             return typeFlow.typeCheckFunction(this);
1927         };
1928         FuncDecl.prototype.emit = function (emitter, tokenId, startLine) {
1929             emitter.emitJavascriptFunction(this);
1930         };
1931         FuncDecl.prototype.getNameText = function () {
1932             if(this.name) {
1933                 return this.name.actualText;
1934             } else {
1935                 return this.hint;
1936             }
1937         };
1938         FuncDecl.prototype.isMethod = function () {
1939             return (this.fncFlags & TypeScript.FncFlags.Method) != TypeScript.FncFlags.None;
1940         };
1941         FuncDecl.prototype.isCallMember = function () {
1942             return TypeScript.hasFlag(this.fncFlags, TypeScript.FncFlags.CallMember);
1943         };
1944         FuncDecl.prototype.isConstructMember = function () {
1945             return TypeScript.hasFlag(this.fncFlags, TypeScript.FncFlags.ConstructMember);
1946         };
1947         FuncDecl.prototype.isIndexerMember = function () {
1948             return TypeScript.hasFlag(this.fncFlags, TypeScript.FncFlags.IndexerMember);
1949         };
1950         FuncDecl.prototype.isSpecialFn = function () {
1951             return this.isCallMember() || this.isIndexerMember() || this.isConstructMember();
1952         };
1953         FuncDecl.prototype.isAnonymousFn = function () {
1954             return this.name === null;
1955         };
1956         FuncDecl.prototype.isAccessor = function () {
1957             return TypeScript.hasFlag(this.fncFlags, TypeScript.FncFlags.GetAccessor) || TypeScript.hasFlag(this.fncFlags, TypeScript.FncFlags.SetAccessor);
1958         };
1959         FuncDecl.prototype.isGetAccessor = function () {
1960             return TypeScript.hasFlag(this.fncFlags, TypeScript.FncFlags.GetAccessor);
1961         };
1962         FuncDecl.prototype.isSetAccessor = function () {
1963             return TypeScript.hasFlag(this.fncFlags, TypeScript.FncFlags.SetAccessor);
1964         };
1965         FuncDecl.prototype.isAmbient = function () {
1966             return TypeScript.hasFlag(this.fncFlags, TypeScript.FncFlags.Ambient);
1967         };
1968         FuncDecl.prototype.isExported = function () {
1969             return TypeScript.hasFlag(this.fncFlags, TypeScript.FncFlags.Exported);
1970         };
1971         FuncDecl.prototype.isPrivate = function () {
1972             return TypeScript.hasFlag(this.fncFlags, TypeScript.FncFlags.Private);
1973         };
1974         FuncDecl.prototype.isPublic = function () {
1975             return TypeScript.hasFlag(this.fncFlags, TypeScript.FncFlags.Public);
1976         };
1977         FuncDecl.prototype.isStatic = function () {
1978             return TypeScript.hasFlag(this.fncFlags, TypeScript.FncFlags.Static);
1979         };
1980         FuncDecl.prototype.treeViewLabel = function () {
1981             if(this.name == null) {
1982                 return "funcExpr";
1983             } else {
1984                 return "func: " + this.name.actualText;
1985             }
1986         };
1987         FuncDecl.prototype.ClearFlags = function () {
1988             this.fncFlags = TypeScript.FncFlags.None;
1989         };
1990         FuncDecl.prototype.isSignature = function () {
1991             return (this.fncFlags & TypeScript.FncFlags.Signature) != TypeScript.FncFlags.None;
1992         };
1993         return FuncDecl;
1994     })(AST);
1995     TypeScript.FuncDecl = FuncDecl;    
1996     var LocationInfo = (function () {
1997         function LocationInfo(filename, lineMap, unitIndex) {
1998             this.filename = filename;
1999             this.lineMap = lineMap;
2000             this.unitIndex = unitIndex;
2001         }
2002         return LocationInfo;
2003     })();
2004     TypeScript.LocationInfo = LocationInfo;    
2005     TypeScript.unknownLocationInfo = new LocationInfo("unknown", null, -1);
2006     var Script = (function (_super) {
2007         __extends(Script, _super);
2008         function Script(vars, scopes) {
2009                 _super.call(this, new Identifier("script"), null, false, null, vars, scopes, null, TypeScript.NodeType.Script);
2010             this.locationInfo = null;
2011             this.referencedFiles = [];
2012             this.requiresGlobal = false;
2013             this.requiresExtendsBlock = false;
2014             this.isResident = false;
2015             this.isDeclareFile = false;
2016             this.hasBeenTypeChecked = false;
2017             this.topLevelMod = null;
2018             this.leftCurlyCount = 0;
2019             this.rightCurlyCount = 0;
2020             this.containsUnicodeChar = false;
2021             this.containsUnicodeCharInComment = false;
2022             this.externallyVisibleImportedSymbols = [];
2023             this.vars = vars;
2024             this.scopes = scopes;
2025         }
2026         Script.prototype.setCachedEmitRequired = function (value) {
2027             this.cachedEmitRequired = value;
2028             return this.cachedEmitRequired;
2029         };
2030         Script.prototype.typeCheck = function (typeFlow) {
2031             return typeFlow.typeCheckScript(this);
2032         };
2033         Script.prototype.treeViewLabel = function () {
2034             return "Script";
2035         };
2036         Script.prototype.emitRequired = function (emitOptions) {
2037             if(this.cachedEmitRequired != undefined) {
2038                 return this.cachedEmitRequired;
2039             }
2040             if(!this.isDeclareFile && !this.isResident && this.bod) {
2041                 for(var i = 0, len = this.bod.members.length; i < len; i++) {
2042                     var stmt = this.bod.members[i];
2043                     if(stmt.nodeType == TypeScript.NodeType.ModuleDeclaration) {
2044                         if(!TypeScript.hasFlag((stmt).modFlags, TypeScript.ModuleFlags.ShouldEmitModuleDecl | TypeScript.ModuleFlags.Ambient)) {
2045                             return this.setCachedEmitRequired(true);
2046                         }
2047                     } else {
2048                         if(stmt.nodeType == TypeScript.NodeType.ClassDeclaration) {
2049                             if(!TypeScript.hasFlag((stmt).varFlags, TypeScript.VarFlags.Ambient)) {
2050                                 return this.setCachedEmitRequired(true);
2051                             }
2052                         } else {
2053                             if(stmt.nodeType == TypeScript.NodeType.VarDecl) {
2054                                 if(!TypeScript.hasFlag((stmt).varFlags, TypeScript.VarFlags.Ambient)) {
2055                                     return this.setCachedEmitRequired(true);
2056                                 }
2057                             } else {
2058                                 if(stmt.nodeType == TypeScript.NodeType.FuncDecl) {
2059                                     if(!(stmt).isSignature()) {
2060                                         return this.setCachedEmitRequired(true);
2061                                     }
2062                                 } else {
2063                                     if(stmt.nodeType != TypeScript.NodeType.InterfaceDeclaration && stmt.nodeType != TypeScript.NodeType.Empty) {
2064                                         return this.setCachedEmitRequired(true);
2065                                     }
2066                                 }
2067                             }
2068                         }
2069                     }
2070                 }
2071                 if(emitOptions.emitComments && ((this.bod.preComments && this.bod.preComments.length > 0) || (this.bod.postComments && this.bod.postComments.length > 0))) {
2072                     return this.setCachedEmitRequired(true);
2073                 }
2074             }
2075             return this.setCachedEmitRequired(false);
2076         };
2077         Script.prototype.emit = function (emitter, tokenId, startLine) {
2078             if(this.emitRequired(emitter.emitOptions)) {
2079                 emitter.emitParensAndCommentsInPlace(this.bod, true);
2080                 emitter.emitJavascriptList(this.bod, null, TypeScript.TokenID.Semicolon, true, false, false, true, this.requiresExtendsBlock);
2081                 emitter.emitParensAndCommentsInPlace(this.bod, false);
2082             }
2083         };
2084         Script.prototype.AddExternallyVisibleImportedSymbol = function (symbol, checker) {
2085             if(this.isExternallyVisibleSymbol(symbol)) {
2086                 return;
2087             }
2088             if(!symbol.getType().symbol.isExternallyVisible(checker)) {
2089                 var quotes = "";
2090                 var moduleName = symbol.getType().symbol.prettyName;
2091                 if(!TypeScript.isQuoted(moduleName)) {
2092                     quotes = "'";
2093                 }
2094                 checker.errorReporter.simpleError(symbol.declAST, "Externally visible import statement uses non exported module " + quotes + moduleName + quotes);
2095             }
2096             this.externallyVisibleImportedSymbols.push(symbol);
2097         };
2098         Script.prototype.isExternallyVisibleSymbol = function (symbol) {
2099             for(var i = 0; i < this.externallyVisibleImportedSymbols.length; i++) {
2100                 if(this.externallyVisibleImportedSymbols[i] == symbol) {
2101                     return true;
2102                 }
2103             }
2104             return false;
2105         };
2106         return Script;
2107     })(FuncDecl);
2108     TypeScript.Script = Script;    
2109     var NamedDeclaration = (function (_super) {
2110         __extends(NamedDeclaration, _super);
2111         function NamedDeclaration(nodeType, name, members) {
2112                 _super.call(this, nodeType);
2113             this.name = name;
2114             this.members = members;
2115             this.leftCurlyCount = 0;
2116             this.rightCurlyCount = 0;
2117         }
2118         NamedDeclaration.prototype.isDeclaration = function () {
2119             return true;
2120         };
2121         return NamedDeclaration;
2122     })(ModuleElement);
2123     TypeScript.NamedDeclaration = NamedDeclaration;    
2124     var ModuleDeclaration = (function (_super) {
2125         __extends(ModuleDeclaration, _super);
2126         function ModuleDeclaration(name, members, vars, scopes, endingToken) {
2127                 _super.call(this, TypeScript.NodeType.ModuleDeclaration, name, members);
2128             this.endingToken = endingToken;
2129             this.modFlags = TypeScript.ModuleFlags.ShouldEmitModuleDecl;
2130             this.amdDependencies = [];
2131             this.containsUnicodeChar = false;
2132             this.containsUnicodeCharInComment = false;
2133             this.vars = vars;
2134             this.scopes = scopes;
2135             this.prettyName = this.name.actualText;
2136         }
2137         ModuleDeclaration.prototype.isExported = function () {
2138             return TypeScript.hasFlag(this.modFlags, TypeScript.ModuleFlags.Exported);
2139         };
2140         ModuleDeclaration.prototype.isAmbient = function () {
2141             return TypeScript.hasFlag(this.modFlags, TypeScript.ModuleFlags.Ambient);
2142         };
2143         ModuleDeclaration.prototype.isEnum = function () {
2144             return TypeScript.hasFlag(this.modFlags, TypeScript.ModuleFlags.IsEnum);
2145         };
2146         ModuleDeclaration.prototype.recordNonInterface = function () {
2147             this.modFlags &= ~TypeScript.ModuleFlags.ShouldEmitModuleDecl;
2148         };
2149         ModuleDeclaration.prototype.typeCheck = function (typeFlow) {
2150             return typeFlow.typeCheckModule(this);
2151         };
2152         ModuleDeclaration.prototype.emit = function (emitter, tokenId, startLine) {
2153             if(!TypeScript.hasFlag(this.modFlags, TypeScript.ModuleFlags.ShouldEmitModuleDecl)) {
2154                 emitter.emitParensAndCommentsInPlace(this, true);
2155                 emitter.recordSourceMappingStart(this);
2156                 emitter.emitJavascriptModule(this);
2157                 emitter.recordSourceMappingEnd(this);
2158                 emitter.emitParensAndCommentsInPlace(this, false);
2159             }
2160         };
2161         return ModuleDeclaration;
2162     })(NamedDeclaration);
2163     TypeScript.ModuleDeclaration = ModuleDeclaration;    
2164     var TypeDeclaration = (function (_super) {
2165         __extends(TypeDeclaration, _super);
2166         function TypeDeclaration(nodeType, name, extendsList, implementsList, members) {
2167                 _super.call(this, nodeType, name, members);
2168             this.extendsList = extendsList;
2169             this.implementsList = implementsList;
2170             this.varFlags = TypeScript.VarFlags.None;
2171         }
2172         TypeDeclaration.prototype.isExported = function () {
2173             return TypeScript.hasFlag(this.varFlags, TypeScript.VarFlags.Exported);
2174         };
2175         TypeDeclaration.prototype.isAmbient = function () {
2176             return TypeScript.hasFlag(this.varFlags, TypeScript.VarFlags.Ambient);
2177         };
2178         return TypeDeclaration;
2179     })(NamedDeclaration);
2180     TypeScript.TypeDeclaration = TypeDeclaration;    
2181     var ClassDeclaration = (function (_super) {
2182         __extends(ClassDeclaration, _super);
2183         function ClassDeclaration(name, members, extendsList, implementsList) {
2184                 _super.call(this, TypeScript.NodeType.ClassDeclaration, name, extendsList, implementsList, members);
2185             this.knownMemberNames = {
2186             };
2187             this.constructorDecl = null;
2188             this.constructorNestingLevel = 0;
2189             this.endingToken = null;
2190         }
2191         ClassDeclaration.prototype.typeCheck = function (typeFlow) {
2192             return typeFlow.typeCheckClass(this);
2193         };
2194         ClassDeclaration.prototype.emit = function (emitter, tokenId, startLine) {
2195             emitter.emitJavascriptClass(this);
2196         };
2197         return ClassDeclaration;
2198     })(TypeDeclaration);
2199     TypeScript.ClassDeclaration = ClassDeclaration;    
2200     var InterfaceDeclaration = (function (_super) {
2201         __extends(InterfaceDeclaration, _super);
2202         function InterfaceDeclaration(name, members, extendsList, implementsList) {
2203                 _super.call(this, TypeScript.NodeType.InterfaceDeclaration, name, extendsList, implementsList, members);
2204         }
2205         InterfaceDeclaration.prototype.typeCheck = function (typeFlow) {
2206             return typeFlow.typeCheckInterface(this);
2207         };
2208         InterfaceDeclaration.prototype.emit = function (emitter, tokenId, startLine) {
2209         };
2210         return InterfaceDeclaration;
2211     })(TypeDeclaration);
2212     TypeScript.InterfaceDeclaration = InterfaceDeclaration;    
2213     var Statement = (function (_super) {
2214         __extends(Statement, _super);
2215         function Statement(nodeType) {
2216                 _super.call(this, nodeType);
2217             this.flags |= TypeScript.ASTFlags.IsStatement;
2218         }
2219         Statement.prototype.isLoop = function () {
2220             return false;
2221         };
2222         Statement.prototype.isStatementOrExpression = function () {
2223             return true;
2224         };
2225         Statement.prototype.isCompoundStatement = function () {
2226             return this.isLoop();
2227         };
2228         Statement.prototype.typeCheck = function (typeFlow) {
2229             this.type = typeFlow.voidType;
2230             return this;
2231         };
2232         return Statement;
2233     })(ModuleElement);
2234     TypeScript.Statement = Statement;    
2235     var LabeledStatement = (function (_super) {
2236         __extends(LabeledStatement, _super);
2237         function LabeledStatement(labels, stmt) {
2238                 _super.call(this, TypeScript.NodeType.LabeledStatement);
2239             this.labels = labels;
2240             this.stmt = stmt;
2241         }
2242         LabeledStatement.prototype.emit = function (emitter, tokenId, startLine) {
2243             emitter.emitParensAndCommentsInPlace(this, true);
2244             emitter.recordSourceMappingStart(this);
2245             if(this.labels) {
2246                 var labelsLen = this.labels.members.length;
2247                 for(var i = 0; i < labelsLen; i++) {
2248                     this.labels.members[i].emit(emitter, tokenId, startLine);
2249                 }
2250             }
2251             this.stmt.emit(emitter, tokenId, true);
2252             emitter.recordSourceMappingEnd(this);
2253             emitter.emitParensAndCommentsInPlace(this, false);
2254         };
2255         LabeledStatement.prototype.typeCheck = function (typeFlow) {
2256             typeFlow.typeCheck(this.labels);
2257             this.stmt = this.stmt.typeCheck(typeFlow);
2258             return this;
2259         };
2260         LabeledStatement.prototype.addToControlFlow = function (context) {
2261             var beforeBB = context.current;
2262             var bb = new TypeScript.BasicBlock();
2263             context.current = bb;
2264             beforeBB.addSuccessor(bb);
2265         };
2266         return LabeledStatement;
2267     })(Statement);
2268     TypeScript.LabeledStatement = LabeledStatement;    
2269     var Block = (function (_super) {
2270         __extends(Block, _super);
2271         function Block(statements, isStatementBlock) {
2272                 _super.call(this, TypeScript.NodeType.Block);
2273             this.statements = statements;
2274             this.isStatementBlock = isStatementBlock;
2275         }
2276         Block.prototype.emit = function (emitter, tokenId, startLine) {
2277             emitter.emitParensAndCommentsInPlace(this, true);
2278             emitter.recordSourceMappingStart(this);
2279             if(this.isStatementBlock) {
2280                 emitter.writeLineToOutput(" {");
2281                 emitter.indenter.increaseIndent();
2282             } else {
2283                 emitter.setInVarBlock(this.statements.members.length);
2284             }
2285             var temp = emitter.setInObjectLiteral(false);
2286             if(this.statements) {
2287                 emitter.emitJavascriptList(this.statements, null, TypeScript.TokenID.Semicolon, true, false, false);
2288             }
2289             if(this.isStatementBlock) {
2290                 emitter.indenter.decreaseIndent();
2291                 emitter.emitIndent();
2292                 emitter.writeToOutput("}");
2293             }
2294             emitter.setInObjectLiteral(temp);
2295             emitter.recordSourceMappingEnd(this);
2296             emitter.emitParensAndCommentsInPlace(this, false);
2297         };
2298         Block.prototype.addToControlFlow = function (context) {
2299             var afterIfNeeded = new TypeScript.BasicBlock();
2300             context.pushStatement(this, context.current, afterIfNeeded);
2301             if(this.statements) {
2302                 context.walk(this.statements, this);
2303             }
2304             context.walker.options.goChildren = false;
2305             context.popStatement();
2306             if(afterIfNeeded.predecessors.length > 0) {
2307                 context.current.addSuccessor(afterIfNeeded);
2308                 context.current = afterIfNeeded;
2309             }
2310         };
2311         Block.prototype.typeCheck = function (typeFlow) {
2312             if(!typeFlow.checker.styleSettings.emptyBlocks) {
2313                 if((this.statements === null) || (this.statements.members.length == 0)) {
2314                     typeFlow.checker.errorReporter.styleError(this, "empty block");
2315                 }
2316             }
2317             typeFlow.typeCheck(this.statements);
2318             return this;
2319         };
2320         return Block;
2321     })(Statement);
2322     TypeScript.Block = Block;    
2323     var Jump = (function (_super) {
2324         __extends(Jump, _super);
2325         function Jump(nodeType) {
2326                 _super.call(this, nodeType);
2327             this.target = null;
2328             this.resolvedTarget = null;
2329         }
2330         Jump.prototype.hasExplicitTarget = function () {
2331             return (this.target);
2332         };
2333         Jump.prototype.setResolvedTarget = function (parser, stmt) {
2334             if(stmt.isLoop()) {
2335                 this.resolvedTarget = stmt;
2336                 return true;
2337             }
2338             if(this.nodeType === TypeScript.NodeType.Continue) {
2339                 parser.reportParseError("continue statement applies only to loops");
2340                 return false;
2341             } else {
2342                 if((stmt.nodeType == TypeScript.NodeType.Switch) || this.hasExplicitTarget()) {
2343                     this.resolvedTarget = stmt;
2344                     return true;
2345                 } else {
2346                     parser.reportParseError("break statement with no label can apply only to a loop or switch statement");
2347                     return false;
2348                 }
2349             }
2350         };
2351         Jump.prototype.addToControlFlow = function (context) {
2352             _super.prototype.addToControlFlow.call(this, context);
2353             context.unconditionalBranch(this.resolvedTarget, (this.nodeType == TypeScript.NodeType.Continue));
2354         };
2355         Jump.prototype.emit = function (emitter, tokenId, startLine) {
2356             emitter.emitParensAndCommentsInPlace(this, true);
2357             emitter.recordSourceMappingStart(this);
2358             if(this.nodeType == TypeScript.NodeType.Break) {
2359                 emitter.writeToOutput("break");
2360             } else {
2361                 emitter.writeToOutput("continue");
2362             }
2363             if(this.hasExplicitTarget()) {
2364                 emitter.writeToOutput(" " + this.target);
2365             }
2366             emitter.recordSourceMappingEnd(this);
2367             emitter.writeToOutput(";");
2368             emitter.emitParensAndCommentsInPlace(this, false);
2369         };
2370         return Jump;
2371     })(Statement);
2372     TypeScript.Jump = Jump;    
2373     var WhileStatement = (function (_super) {
2374         __extends(WhileStatement, _super);
2375         function WhileStatement(cond) {
2376                 _super.call(this, TypeScript.NodeType.While);
2377             this.cond = cond;
2378             this.body = null;
2379         }
2380         WhileStatement.prototype.isLoop = function () {
2381             return true;
2382         };
2383         WhileStatement.prototype.emit = function (emitter, tokenId, startLine) {
2384             emitter.emitParensAndCommentsInPlace(this, true);
2385             emitter.recordSourceMappingStart(this);
2386             var temp = emitter.setInObjectLiteral(false);
2387             emitter.writeToOutput("while(");
2388             emitter.emitJavascript(this.cond, TypeScript.TokenID.While, false);
2389             emitter.writeToOutput(")");
2390             emitter.emitJavascriptStatements(this.body, false);
2391             emitter.setInObjectLiteral(temp);
2392             emitter.recordSourceMappingEnd(this);
2393             emitter.emitParensAndCommentsInPlace(this, false);
2394         };
2395         WhileStatement.prototype.typeCheck = function (typeFlow) {
2396             return typeFlow.typeCheckWhile(this);
2397         };
2398         WhileStatement.prototype.addToControlFlow = function (context) {
2399             var loopHeader = context.current;
2400             var loopStart = new TypeScript.BasicBlock();
2401             var afterLoop = new TypeScript.BasicBlock();
2402             loopHeader.addSuccessor(loopStart);
2403             context.current = loopStart;
2404             context.addContent(this.cond);
2405             var condBlock = context.current;
2406             var targetInfo = null;
2407             if(this.body) {
2408                 context.current = new TypeScript.BasicBlock();
2409                 condBlock.addSuccessor(context.current);
2410                 context.pushStatement(this, loopStart, afterLoop);
2411                 context.walk(this.body, this);
2412                 targetInfo = context.popStatement();
2413             }
2414             if(!(context.noContinuation)) {
2415                 var loopEnd = context.current;
2416                 loopEnd.addSuccessor(loopStart);
2417             }
2418             context.current = afterLoop;
2419             condBlock.addSuccessor(afterLoop);
2420             context.noContinuation = false;
2421             context.walker.options.goChildren = false;
2422         };
2423         return WhileStatement;
2424     })(Statement);
2425     TypeScript.WhileStatement = WhileStatement;    
2426     var DoWhileStatement = (function (_super) {
2427         __extends(DoWhileStatement, _super);
2428         function DoWhileStatement() {
2429                 _super.call(this, TypeScript.NodeType.DoWhile);
2430             this.body = null;
2431             this.whileAST = null;
2432             this.cond = null;
2433         }
2434         DoWhileStatement.prototype.isLoop = function () {
2435             return true;
2436         };
2437         DoWhileStatement.prototype.emit = function (emitter, tokenId, startLine) {
2438             emitter.emitParensAndCommentsInPlace(this, true);
2439             emitter.recordSourceMappingStart(this);
2440             var temp = emitter.setInObjectLiteral(false);
2441             emitter.writeToOutput("do");
2442             emitter.emitJavascriptStatements(this.body, true);
2443             emitter.recordSourceMappingStart(this.whileAST);
2444             emitter.writeToOutput("while");
2445             emitter.recordSourceMappingEnd(this.whileAST);
2446             emitter.writeToOutput('(');
2447             emitter.emitJavascript(this.cond, TypeScript.TokenID.CloseParen, false);
2448             emitter.writeToOutput(")");
2449             emitter.setInObjectLiteral(temp);
2450             emitter.recordSourceMappingEnd(this);
2451             emitter.writeToOutput(";");
2452             emitter.emitParensAndCommentsInPlace(this, false);
2453         };
2454         DoWhileStatement.prototype.typeCheck = function (typeFlow) {
2455             return typeFlow.typeCheckDoWhile(this);
2456         };
2457         DoWhileStatement.prototype.addToControlFlow = function (context) {
2458             var loopHeader = context.current;
2459             var loopStart = new TypeScript.BasicBlock();
2460             var afterLoop = new TypeScript.BasicBlock();
2461             loopHeader.addSuccessor(loopStart);
2462             context.current = loopStart;
2463             var targetInfo = null;
2464             if(this.body) {
2465                 context.pushStatement(this, loopStart, afterLoop);
2466                 context.walk(this.body, this);
2467                 targetInfo = context.popStatement();
2468             }
2469             if(!(context.noContinuation)) {
2470                 var loopEnd = context.current;
2471                 loopEnd.addSuccessor(loopStart);
2472                 context.addContent(this.cond);
2473                 context.current = afterLoop;
2474                 loopEnd.addSuccessor(afterLoop);
2475             } else {
2476                 context.addUnreachable(this.cond);
2477             }
2478             context.walker.options.goChildren = false;
2479         };
2480         return DoWhileStatement;
2481     })(Statement);
2482     TypeScript.DoWhileStatement = DoWhileStatement;    
2483     var IfStatement = (function (_super) {
2484         __extends(IfStatement, _super);
2485         function IfStatement(cond) {
2486                 _super.call(this, TypeScript.NodeType.If);
2487             this.cond = cond;
2488             this.elseBod = null;
2489             this.statement = new ASTSpan();
2490         }
2491         IfStatement.prototype.isCompoundStatement = function () {
2492             return true;
2493         };
2494         IfStatement.prototype.emit = function (emitter, tokenId, startLine) {
2495             emitter.emitParensAndCommentsInPlace(this, true);
2496             emitter.recordSourceMappingStart(this);
2497             var temp = emitter.setInObjectLiteral(false);
2498             emitter.recordSourceMappingStart(this.statement);
2499             emitter.writeToOutput("if(");
2500             emitter.emitJavascript(this.cond, TypeScript.TokenID.If, false);
2501             emitter.writeToOutput(")");
2502             emitter.recordSourceMappingEnd(this.statement);
2503             emitter.emitJavascriptStatements(this.thenBod, true);
2504             if(this.elseBod) {
2505                 if(this.elseBod.nodeType === TypeScript.NodeType.If) {
2506                     emitter.writeToOutput(" else ");
2507                     this.elseBod.emit(emitter, tokenId, false);
2508                 } else {
2509                     emitter.writeToOutput(" else");
2510                     emitter.emitJavascriptStatements(this.elseBod, true);
2511                 }
2512             }
2513             emitter.setInObjectLiteral(temp);
2514             emitter.recordSourceMappingEnd(this);
2515             emitter.emitParensAndCommentsInPlace(this, false);
2516         };
2517         IfStatement.prototype.typeCheck = function (typeFlow) {
2518             return typeFlow.typeCheckIf(this);
2519         };
2520         IfStatement.prototype.addToControlFlow = function (context) {
2521             this.cond.addToControlFlow(context);
2522             var afterIf = new TypeScript.BasicBlock();
2523             var beforeIf = context.current;
2524             context.pushStatement(this, beforeIf, afterIf);
2525             var hasContinuation = false;
2526             context.current = new TypeScript.BasicBlock();
2527             beforeIf.addSuccessor(context.current);
2528             context.walk(this.thenBod, this);
2529             if(!context.noContinuation) {
2530                 hasContinuation = true;
2531                 context.current.addSuccessor(afterIf);
2532             }
2533             if(this.elseBod) {
2534                 context.current = new TypeScript.BasicBlock();
2535                 context.noContinuation = false;
2536                 beforeIf.addSuccessor(context.current);
2537                 context.walk(this.elseBod, this);
2538                 if(!context.noContinuation) {
2539                     hasContinuation = true;
2540                     context.current.addSuccessor(afterIf);
2541                 } else {
2542                     if(hasContinuation) {
2543                         context.noContinuation = false;
2544                     }
2545                 }
2546             } else {
2547                 beforeIf.addSuccessor(afterIf);
2548                 context.noContinuation = false;
2549                 hasContinuation = true;
2550             }
2551             var targetInfo = context.popStatement();
2552             if(afterIf.predecessors.length > 0) {
2553                 context.noContinuation = false;
2554                 hasContinuation = true;
2555             }
2556             if(hasContinuation) {
2557                 context.current = afterIf;
2558             }
2559             context.walker.options.goChildren = false;
2560         };
2561         return IfStatement;
2562     })(Statement);
2563     TypeScript.IfStatement = IfStatement;    
2564     var ReturnStatement = (function (_super) {
2565         __extends(ReturnStatement, _super);
2566         function ReturnStatement() {
2567                 _super.call(this, TypeScript.NodeType.Return);
2568             this.returnExpression = null;
2569         }
2570         ReturnStatement.prototype.emit = function (emitter, tokenId, startLine) {
2571             emitter.emitParensAndCommentsInPlace(this, true);
2572             emitter.recordSourceMappingStart(this);
2573             var temp = emitter.setInObjectLiteral(false);
2574             if(this.returnExpression) {
2575                 emitter.writeToOutput("return ");
2576                 emitter.emitJavascript(this.returnExpression, TypeScript.TokenID.Semicolon, false);
2577                 if(this.returnExpression.nodeType === TypeScript.NodeType.FuncDecl) {
2578                     emitter.writeToOutput(";");
2579                 }
2580             } else {
2581                 emitter.writeToOutput("return;");
2582             }
2583             emitter.setInObjectLiteral(temp);
2584             emitter.recordSourceMappingEnd(this);
2585             emitter.emitParensAndCommentsInPlace(this, false);
2586         };
2587         ReturnStatement.prototype.addToControlFlow = function (context) {
2588             _super.prototype.addToControlFlow.call(this, context);
2589             context.returnStmt();
2590         };
2591         ReturnStatement.prototype.typeCheck = function (typeFlow) {
2592             return typeFlow.typeCheckReturn(this);
2593         };
2594         return ReturnStatement;
2595     })(Statement);
2596     TypeScript.ReturnStatement = ReturnStatement;    
2597     var EndCode = (function (_super) {
2598         __extends(EndCode, _super);
2599         function EndCode() {
2600                 _super.call(this, TypeScript.NodeType.EndCode);
2601         }
2602         return EndCode;
2603     })(AST);
2604     TypeScript.EndCode = EndCode;    
2605     var ForInStatement = (function (_super) {
2606         __extends(ForInStatement, _super);
2607         function ForInStatement(lval, obj) {
2608                 _super.call(this, TypeScript.NodeType.ForIn);
2609             this.lval = lval;
2610             this.obj = obj;
2611             this.statement = new ASTSpan();
2612             if(this.lval && (this.lval.nodeType == TypeScript.NodeType.VarDecl)) {
2613                 (this.lval).varFlags |= TypeScript.VarFlags.AutoInit;
2614             }
2615         }
2616         ForInStatement.prototype.isLoop = function () {
2617             return true;
2618         };
2619         ForInStatement.prototype.isFiltered = function () {
2620             if(this.body) {
2621                 var singleItem = null;
2622                 if(this.body.nodeType == TypeScript.NodeType.List) {
2623                     var stmts = this.body;
2624                     if(stmts.members.length == 1) {
2625                         singleItem = stmts.members[0];
2626                     }
2627                 } else {
2628                     singleItem = this.body;
2629                 }
2630                 if(singleItem !== null) {
2631                     if(singleItem.nodeType == TypeScript.NodeType.Block) {
2632                         var block = singleItem;
2633                         if((block.statements !== null) && (block.statements.members.length == 1)) {
2634                             singleItem = block.statements.members[0];
2635                         }
2636                     }
2637                     if(singleItem.nodeType == TypeScript.NodeType.If) {
2638                         var cond = (singleItem).cond;
2639                         if(cond.nodeType == TypeScript.NodeType.Call) {
2640                             var target = (cond).target;
2641                             if(target.nodeType == TypeScript.NodeType.Dot) {
2642                                 var binex = target;
2643                                 if((binex.operand1.nodeType == TypeScript.NodeType.Name) && (this.obj.nodeType == TypeScript.NodeType.Name) && ((binex.operand1).actualText == (this.obj).actualText)) {
2644                                     var prop = binex.operand2;
2645                                     if(prop.actualText == "hasOwnProperty") {
2646                                         var args = (cond).arguments;
2647                                         if((args !== null) && (args.members.length == 1)) {
2648                                             var arg = args.members[0];
2649                                             if((arg.nodeType == TypeScript.NodeType.Name) && (this.lval.nodeType == TypeScript.NodeType.Name)) {
2650                                                 if(((this.lval).actualText) == (arg).actualText) {
2651                                                     return true;
2652                                                 }
2653                                             }
2654                                         }
2655                                     }
2656                                 }
2657                             }
2658                         }
2659                     }
2660                 }
2661             }
2662             return false;
2663         };
2664         ForInStatement.prototype.emit = function (emitter, tokenId, startLine) {
2665             emitter.emitParensAndCommentsInPlace(this, true);
2666             emitter.recordSourceMappingStart(this);
2667             var temp = emitter.setInObjectLiteral(false);
2668             emitter.recordSourceMappingStart(this.statement);
2669             emitter.writeToOutput("for(");
2670             emitter.emitJavascript(this.lval, TypeScript.TokenID.For, false);
2671             emitter.writeToOutput(" in ");
2672             emitter.emitJavascript(this.obj, TypeScript.TokenID.For, false);
2673             emitter.writeToOutput(")");
2674             emitter.recordSourceMappingEnd(this.statement);
2675             emitter.emitJavascriptStatements(this.body, true);
2676             emitter.setInObjectLiteral(temp);
2677             emitter.recordSourceMappingEnd(this);
2678             emitter.emitParensAndCommentsInPlace(this, false);
2679         };
2680         ForInStatement.prototype.typeCheck = function (typeFlow) {
2681             if(typeFlow.checker.styleSettings.forin) {
2682                 if(!this.isFiltered()) {
2683                     typeFlow.checker.errorReporter.styleError(this, "no hasOwnProperty filter");
2684                 }
2685             }
2686             return typeFlow.typeCheckForIn(this);
2687         };
2688         ForInStatement.prototype.addToControlFlow = function (context) {
2689             if(this.lval) {
2690                 context.addContent(this.lval);
2691             }
2692             if(this.obj) {
2693                 context.addContent(this.obj);
2694             }
2695             var loopHeader = context.current;
2696             var loopStart = new TypeScript.BasicBlock();
2697             var afterLoop = new TypeScript.BasicBlock();
2698             loopHeader.addSuccessor(loopStart);
2699             context.current = loopStart;
2700             if(this.body) {
2701                 context.pushStatement(this, loopStart, afterLoop);
2702                 context.walk(this.body, this);
2703                 context.popStatement();
2704             }
2705             if(!(context.noContinuation)) {
2706                 var loopEnd = context.current;
2707                 loopEnd.addSuccessor(loopStart);
2708             }
2709             context.current = afterLoop;
2710             context.noContinuation = false;
2711             loopHeader.addSuccessor(afterLoop);
2712             context.walker.options.goChildren = false;
2713         };
2714         return ForInStatement;
2715     })(Statement);
2716     TypeScript.ForInStatement = ForInStatement;    
2717     var ForStatement = (function (_super) {
2718         __extends(ForStatement, _super);
2719         function ForStatement(init) {
2720                 _super.call(this, TypeScript.NodeType.For);
2721             this.init = init;
2722         }
2723         ForStatement.prototype.isLoop = function () {
2724             return true;
2725         };
2726         ForStatement.prototype.emit = function (emitter, tokenId, startLine) {
2727             emitter.emitParensAndCommentsInPlace(this, true);
2728             emitter.recordSourceMappingStart(this);
2729             var temp = emitter.setInObjectLiteral(false);
2730             emitter.writeToOutput("for(");
2731             if(this.init) {
2732                 if(this.init.nodeType != TypeScript.NodeType.List) {
2733                     emitter.emitJavascript(this.init, TypeScript.TokenID.For, false);
2734                 } else {
2735                     emitter.setInVarBlock((this.init).members.length);
2736                     emitter.emitJavascriptList(this.init, null, TypeScript.TokenID.For, false, false, false);
2737                 }
2738             }
2739             emitter.writeToOutput("; ");
2740             emitter.emitJavascript(this.cond, TypeScript.TokenID.For, false);
2741             emitter.writeToOutput("; ");
2742             emitter.emitJavascript(this.incr, TypeScript.TokenID.For, false);
2743             emitter.writeToOutput(")");
2744             emitter.emitJavascriptStatements(this.body, true);
2745             emitter.setInObjectLiteral(temp);
2746             emitter.recordSourceMappingEnd(this);
2747             emitter.emitParensAndCommentsInPlace(this, false);
2748         };
2749         ForStatement.prototype.typeCheck = function (typeFlow) {
2750             return typeFlow.typeCheckFor(this);
2751         };
2752         ForStatement.prototype.addToControlFlow = function (context) {
2753             if(this.init) {
2754                 context.addContent(this.init);
2755             }
2756             var loopHeader = context.current;
2757             var loopStart = new TypeScript.BasicBlock();
2758             var afterLoop = new TypeScript.BasicBlock();
2759             loopHeader.addSuccessor(loopStart);
2760             context.current = loopStart;
2761             var condBlock = null;
2762             var continueTarget = loopStart;
2763             var incrBB = null;
2764             if(this.incr) {
2765                 incrBB = new TypeScript.BasicBlock();
2766                 continueTarget = incrBB;
2767             }
2768             if(this.cond) {
2769                 condBlock = context.current;
2770                 context.addContent(this.cond);
2771                 context.current = new TypeScript.BasicBlock();
2772                 condBlock.addSuccessor(context.current);
2773             }
2774             var targetInfo = null;
2775             if(this.body) {
2776                 context.pushStatement(this, continueTarget, afterLoop);
2777                 context.walk(this.body, this);
2778                 targetInfo = context.popStatement();
2779             }
2780             if(this.incr) {
2781                 if(context.noContinuation) {
2782                     if(incrBB.predecessors.length == 0) {
2783                         context.addUnreachable(this.incr);
2784                     }
2785                 } else {
2786                     context.current.addSuccessor(incrBB);
2787                     context.current = incrBB;
2788                     context.addContent(this.incr);
2789                 }
2790             }
2791             var loopEnd = context.current;
2792             if(!(context.noContinuation)) {
2793                 loopEnd.addSuccessor(loopStart);
2794             }
2795             if(condBlock) {
2796                 condBlock.addSuccessor(afterLoop);
2797                 context.noContinuation = false;
2798             }
2799             if(afterLoop.predecessors.length > 0) {
2800                 context.noContinuation = false;
2801                 context.current = afterLoop;
2802             }
2803             context.walker.options.goChildren = false;
2804         };
2805         return ForStatement;
2806     })(Statement);
2807     TypeScript.ForStatement = ForStatement;    
2808     var WithStatement = (function (_super) {
2809         __extends(WithStatement, _super);
2810         function WithStatement(expr) {
2811                 _super.call(this, TypeScript.NodeType.With);
2812             this.expr = expr;
2813             this.withSym = null;
2814         }
2815         WithStatement.prototype.isCompoundStatement = function () {
2816             return true;
2817         };
2818         WithStatement.prototype.emit = function (emitter, tokenId, startLine) {
2819             emitter.emitParensAndCommentsInPlace(this, true);
2820             emitter.recordSourceMappingStart(this);
2821             emitter.writeToOutput("with (");
2822             if(this.expr) {
2823                 emitter.emitJavascript(this.expr, TypeScript.TokenID.With, false);
2824             }
2825             emitter.writeToOutput(")");
2826             emitter.emitJavascriptStatements(this.body, true);
2827             emitter.recordSourceMappingEnd(this);
2828             emitter.emitParensAndCommentsInPlace(this, false);
2829         };
2830         WithStatement.prototype.typeCheck = function (typeFlow) {
2831             return typeFlow.typeCheckWith(this);
2832         };
2833         return WithStatement;
2834     })(Statement);
2835     TypeScript.WithStatement = WithStatement;    
2836     var SwitchStatement = (function (_super) {
2837         __extends(SwitchStatement, _super);
2838         function SwitchStatement(val) {
2839                 _super.call(this, TypeScript.NodeType.Switch);
2840             this.val = val;
2841             this.defaultCase = null;
2842             this.statement = new ASTSpan();
2843         }
2844         SwitchStatement.prototype.isCompoundStatement = function () {
2845             return true;
2846         };
2847         SwitchStatement.prototype.emit = function (emitter, tokenId, startLine) {
2848             emitter.emitParensAndCommentsInPlace(this, true);
2849             emitter.recordSourceMappingStart(this);
2850             var temp = emitter.setInObjectLiteral(false);
2851             emitter.recordSourceMappingStart(this.statement);
2852             emitter.writeToOutput("switch(");
2853             emitter.emitJavascript(this.val, TypeScript.TokenID.Identifier, false);
2854             emitter.writeToOutput(")");
2855             emitter.recordSourceMappingEnd(this.statement);
2856             emitter.writeLineToOutput(" {");
2857             emitter.indenter.increaseIndent();
2858             var casesLen = this.caseList.members.length;
2859             for(var i = 0; i < casesLen; i++) {
2860                 var caseExpr = this.caseList.members[i];
2861                 emitter.emitJavascript(caseExpr, TypeScript.TokenID.Case, true);
2862             }
2863             emitter.indenter.decreaseIndent();
2864             emitter.emitIndent();
2865             emitter.writeToOutput("}");
2866             emitter.setInObjectLiteral(temp);
2867             emitter.recordSourceMappingEnd(this);
2868             emitter.emitParensAndCommentsInPlace(this, false);
2869         };
2870         SwitchStatement.prototype.typeCheck = function (typeFlow) {
2871             var len = this.caseList.members.length;
2872             this.val = typeFlow.typeCheck(this.val);
2873             for(var i = 0; i < len; i++) {
2874                 this.caseList.members[i] = typeFlow.typeCheck(this.caseList.members[i]);
2875             }
2876             this.defaultCase = typeFlow.typeCheck(this.defaultCase);
2877             this.type = typeFlow.voidType;
2878             return this;
2879         };
2880         SwitchStatement.prototype.addToControlFlow = function (context) {
2881             var condBlock = context.current;
2882             context.addContent(this.val);
2883             var execBlock = new TypeScript.BasicBlock();
2884             var afterSwitch = new TypeScript.BasicBlock();
2885             condBlock.addSuccessor(execBlock);
2886             context.pushSwitch(execBlock);
2887             context.current = execBlock;
2888             context.pushStatement(this, execBlock, afterSwitch);
2889             context.walk(this.caseList, this);
2890             context.popSwitch();
2891             var targetInfo = context.popStatement();
2892             var hasCondContinuation = (this.defaultCase == null);
2893             if(this.defaultCase == null) {
2894                 condBlock.addSuccessor(afterSwitch);
2895             }
2896             if(afterSwitch.predecessors.length > 0) {
2897                 context.noContinuation = false;
2898                 context.current = afterSwitch;
2899             } else {
2900                 context.noContinuation = true;
2901             }
2902             context.walker.options.goChildren = false;
2903         };
2904         return SwitchStatement;
2905     })(Statement);
2906     TypeScript.SwitchStatement = SwitchStatement;    
2907     var CaseStatement = (function (_super) {
2908         __extends(CaseStatement, _super);
2909         function CaseStatement() {