1//// [parserRealSource2.ts] 2// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. 3// See LICENSE.txt in the project root for complete license information. 4 5///<reference path='typescript.ts' /> 6 7module TypeScript { 8 9 export function hasFlag(val: number, flag: number) { 10 return (val & flag) != 0; 11 } 12 13 export enum ErrorRecoverySet { 14 None = 0, 15 Comma = 1, // Comma 16 SColon = 1 << 1, // SColon 17 Asg = 1 << 2, // Asg 18 BinOp = 1 << 3, // Lsh, Rsh, Rs2, Le, Ge, INSTANCEOF, EQ, NE, Eqv, NEqv, LogAnd, LogOr, AsgMul, AsgDiv 19 // AsgMod, AsgAdd, AsgSub, AsgLsh, AsgRsh, AsgRs2, AsgAnd, AsgXor, AsgOr, QMark, Mult, Div, 20 // Pct, GT, LT, And, Xor, Or 21 RBrack = 1 << 4, // RBrack 22 RCurly = 1 << 5, // RCurly 23 RParen = 1 << 6, // RParen 24 Dot = 1 << 7, // Dot 25 Colon = 1 << 8, // Colon 26 PrimType = 1 << 9, // number, string, boolean 27 AddOp = 1 << 10, // Add, Sub 28 LCurly = 1 << 11, // LCurly 29 PreOp = 1 << 12, // Tilde, Bang, Inc, Dec 30 RegExp = 1 << 13, // RegExp 31 LParen = 1 << 14, // LParen 32 LBrack = 1 << 15, // LBrack 33 Scope = 1 << 16, // Scope 34 In = 1 << 17, // IN 35 SCase = 1 << 18, // CASE, DEFAULT 36 Else = 1 << 19, // ELSE 37 Catch = 1 << 20, // CATCH, FINALLY 38 Var = 1 << 21, // 39 Stmt = 1 << 22, // BREAK, RETURN, THROW, DEBUGGER, FOR, SWITCH, DO, IF, TRY, WITH 40 While = 1 << 23, // WHILE 41 ID = 1 << 24, // ID 42 Prefix = 1 << 25, // VOID, DELETE, TYPEOF, AWAIT 43 Literal = 1 << 26, // IntCon, FltCon, StrCon 44 RLit = 1 << 27, // THIS, TRUE, FALSE, NULL 45 Func = 1 << 28, // FUNCTION 46 EOF = 1 << 29, // EOF 47 48 // REVIEW: Name this something clearer. 49 TypeScriptS = 1 << 30, // PROPERTY, PRIVATE, STATIC, INTERFACE, CLASS, MODULE, EXPORT, IMPORT 50 ExprStart = SColon | AddOp | LCurly | PreOp | RegExp | LParen | LBrack | ID | Prefix | RLit | Func | Literal, 51 StmtStart = ExprStart | SColon | Var | Stmt | While | TypeScriptS, 52 Postfix = Dot | LParen | LBrack, 53 } 54 55 export enum AllowedElements { 56 None = 0, 57 ModuleDeclarations = 1 << 2, 58 ClassDeclarations = 1 << 3, 59 InterfaceDeclarations = 1 << 4, 60 AmbientDeclarations = 1 << 10, 61 Properties = 1 << 11, 62 63 Global = ModuleDeclarations | ClassDeclarations | InterfaceDeclarations | AmbientDeclarations, 64 QuickParse = Global | Properties, 65 } 66 67 export enum Modifiers { 68 None = 0, 69 Private = 1, 70 Public = 1 << 1, 71 Readonly = 1 << 2, 72 Ambient = 1 << 3, 73 Exported = 1 << 4, 74 Getter = 1 << 5, 75 Setter = 1 << 6, 76 Static = 1 << 7, 77 } 78 79 export enum ASTFlags { 80 None = 0, 81 ExplicitSemicolon = 1, // statment terminated by an explicit semicolon 82 AutomaticSemicolon = 1 << 1, // statment terminated by an automatic semicolon 83 Writeable = 1 << 2, // node is lhs that can be modified 84 Error = 1 << 3, // node has an error 85 DotLHSPartial = 1 << 4, // node is the lhs of an incomplete dot expr at cursor 86 DotLHS = 1 << 5, // node is the lhs of a dot expr 87 IsStatement = 1 << 6, // node is a statement 88 StrictMode = 1 << 7, // node is in the strict mode environment 89 PossibleOptionalParameter = 1 << 8, 90 ClassBaseConstructorCall = 1 << 9, 91 OptionalName = 1 << 10, 92 // REVIEW: This flag is to mark lambda nodes to note that the LParen of an expression has already been matched in the lambda header. 93 // The flag is used to communicate this piece of information to the calling parseTerm, which intern will remove it. 94 // Once we have a better way to associate information with nodes, this flag should not be used. 95 SkipNextRParen = 1 << 11, 96 } 97 98 export enum DeclFlags { 99 None = 0, 100 Exported = 1, 101 Private = 1 << 1, 102 Public = 1 << 2, 103 Ambient = 1 << 3, 104 Static = 1 << 4, 105 LocalStatic = 1 << 5, 106 GetAccessor = 1 << 6, 107 SetAccessor = 1 << 7, 108 } 109 110 export enum ModuleFlags { 111 None = 0, 112 Exported = 1, 113 Private = 1 << 1, 114 Public = 1 << 2, 115 Ambient = 1 << 3, 116 Static = 1 << 4, 117 LocalStatic = 1 << 5, 118 GetAccessor = 1 << 6, 119 SetAccessor = 1 << 7, 120 IsEnum = 1 << 8, 121 ShouldEmitModuleDecl = 1 << 9, 122 IsWholeFile = 1 << 10, 123 IsDynamic = 1 << 11, 124 MustCaptureThis = 1 << 12, 125 } 126 127 export enum SymbolFlags { 128 None = 0, 129 Exported = 1, 130 Private = 1 << 1, 131 Public = 1 << 2, 132 Ambient = 1 << 3, 133 Static = 1 << 4, 134 LocalStatic = 1 << 5, 135 GetAccessor = 1 << 6, 136 SetAccessor = 1 << 7, 137 Property = 1 << 8, 138 Readonly = 1 << 9, 139 ModuleMember = 1 << 10, 140 InterfaceMember = 1 << 11, 141 ClassMember = 1 << 12, 142 BuiltIn = 1 << 13, 143 TypeSetDuringScopeAssignment = 1 << 14, 144 Constant = 1 << 15, 145 Optional = 1 << 16, 146 RecursivelyReferenced = 1 << 17, 147 Bound = 1 << 18, 148 CompilerGenerated = 1 << 19, 149 } 150 151 export enum VarFlags { 152 None = 0, 153 Exported = 1, 154 Private = 1 << 1, 155 Public = 1 << 2, 156 Ambient = 1 << 3, 157 Static = 1 << 4, 158 LocalStatic = 1 << 5, 159 GetAccessor = 1 << 6, 160 SetAccessor = 1 << 7, 161 AutoInit = 1 << 8, 162 Property = 1 << 9, 163 Readonly = 1 << 10, 164 Class = 1 << 11, 165 ClassProperty = 1 << 12, 166 ClassBodyProperty = 1 << 13, 167 ClassConstructorProperty = 1 << 14, 168 ClassSuperMustBeFirstCallInConstructor = 1 << 15, 169 Constant = 1 << 16, 170 MustCaptureThis = 1 << 17, 171 } 172 173 export enum FncFlags { 174 None = 0, 175 Exported = 1, 176 Private = 1 << 1, 177 Public = 1 << 2, 178 Ambient = 1 << 3, 179 Static = 1 << 4, 180 LocalStatic = 1 << 5, 181 GetAccessor = 1 << 6, 182 SetAccessor = 1 << 7, 183 Definition = 1 << 8, 184 Signature = 1 << 9, 185 Method = 1 << 10, 186 HasReturnExpression = 1 << 11, 187 CallMember = 1 << 12, 188 ConstructMember = 1 << 13, 189 HasSelfReference = 1 << 14, 190 IsFatArrowFunction = 1 << 15, 191 IndexerMember = 1 << 16, 192 IsFunctionExpression = 1 << 17, 193 ClassMethod = 1 << 18, 194 ClassPropertyMethodExported = 1 << 19, 195 } 196 197 export enum SignatureFlags { 198 None = 0, 199 IsIndexer = 1, 200 IsStringIndexer = 1 << 1, 201 IsNumberIndexer = 1 << 2, 202 } 203 204 export function ToDeclFlags(fncFlags: FncFlags) : DeclFlags; 205 export function ToDeclFlags(varFlags: VarFlags) : DeclFlags; 206 export function ToDeclFlags(symFlags: SymbolFlags): DeclFlags; 207 export function ToDeclFlags(moduleFlags: ModuleFlags): DeclFlags; 208 export function ToDeclFlags(fncOrVarOrSymbolOrModuleFlags: any) { 209 return <DeclFlags>fncOrVarOrSymbolOrModuleFlags; 210 } 211 212 export enum TypeFlags { 213 None = 0, 214 HasImplementation = 1, 215 HasSelfReference = 1 << 1, 216 MergeResult = 1 << 2, 217 IsEnum = 1 << 3, 218 BuildingName = 1 << 4, 219 HasBaseType = 1 << 5, 220 HasBaseTypeOfObject = 1 << 6, 221 IsClass = 1 << 7, 222 } 223 224 export enum TypeRelationshipFlags { 225 SuccessfulComparison = 0, 226 SourceIsNullTargetIsVoidOrUndefined = 1, 227 RequiredPropertyIsMissing = 1 << 1, 228 IncompatibleSignatures = 1 << 2, 229 SourceSignatureHasTooManyParameters = 3, 230 IncompatibleReturnTypes = 1 << 4, 231 IncompatiblePropertyTypes = 1 << 5, 232 IncompatibleParameterTypes = 1 << 6, 233 } 234 235 export enum CodeGenTarget { 236 ES3 = 0, 237 ES5 = 1, 238 } 239 240 export enum ModuleGenTarget { 241 Synchronous = 0, 242 Asynchronous = 1, 243 Local = 1 << 1, 244 } 245 246 // Compiler defaults to generating ES5-compliant code for 247 // - getters and setters 248 export var codeGenTarget: CodeGenTarget = CodeGenTarget.ES3; 249 250 export var moduleGenTarget: ModuleGenTarget = ModuleGenTarget.Synchronous; 251 252 export var optimizeModuleCodeGen = true; 253 254 export function flagsToString(e, flags: number): string { 255 var builder = ""; 256 for (var i = 1; i < (1 << 31) ; i = i << 1) { 257 if ((flags & i) != 0) { 258 for (var k in e) { 259 if (e[k] == i) { 260 if (builder.length > 0) { 261 builder += "|"; 262 } 263 builder += k; 264 break; 265 } 266 } 267 } 268 } 269 return builder; 270 } 271 272} 273 274//// [parserRealSource2.js] 275// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. 276// See LICENSE.txt in the project root for complete license information. 277///<reference path='typescript.ts' /> 278var TypeScript; 279(function (TypeScript) { 280 function hasFlag(val, flag) { 281 return (val & flag) != 0; 282 } 283 TypeScript.hasFlag = hasFlag; 284 var ErrorRecoverySet; 285 (function (ErrorRecoverySet) { 286 ErrorRecoverySet[ErrorRecoverySet["None"] = 0] = "None"; 287 ErrorRecoverySet[ErrorRecoverySet["Comma"] = 1] = "Comma"; 288 ErrorRecoverySet[ErrorRecoverySet["SColon"] = 2] = "SColon"; 289 ErrorRecoverySet[ErrorRecoverySet["Asg"] = 4] = "Asg"; 290 ErrorRecoverySet[ErrorRecoverySet["BinOp"] = 8] = "BinOp"; 291 // AsgMod, AsgAdd, AsgSub, AsgLsh, AsgRsh, AsgRs2, AsgAnd, AsgXor, AsgOr, QMark, Mult, Div, 292 // Pct, GT, LT, And, Xor, Or 293 ErrorRecoverySet[ErrorRecoverySet["RBrack"] = 16] = "RBrack"; 294 ErrorRecoverySet[ErrorRecoverySet["RCurly"] = 32] = "RCurly"; 295 ErrorRecoverySet[ErrorRecoverySet["RParen"] = 64] = "RParen"; 296 ErrorRecoverySet[ErrorRecoverySet["Dot"] = 128] = "Dot"; 297 ErrorRecoverySet[ErrorRecoverySet["Colon"] = 256] = "Colon"; 298 ErrorRecoverySet[ErrorRecoverySet["PrimType"] = 512] = "PrimType"; 299 ErrorRecoverySet[ErrorRecoverySet["AddOp"] = 1024] = "AddOp"; 300 ErrorRecoverySet[ErrorRecoverySet["LCurly"] = 2048] = "LCurly"; 301 ErrorRecoverySet[ErrorRecoverySet["PreOp"] = 4096] = "PreOp"; 302 ErrorRecoverySet[ErrorRecoverySet["RegExp"] = 8192] = "RegExp"; 303 ErrorRecoverySet[ErrorRecoverySet["LParen"] = 16384] = "LParen"; 304 ErrorRecoverySet[ErrorRecoverySet["LBrack"] = 32768] = "LBrack"; 305 ErrorRecoverySet[ErrorRecoverySet["Scope"] = 65536] = "Scope"; 306 ErrorRecoverySet[ErrorRecoverySet["In"] = 131072] = "In"; 307 ErrorRecoverySet[ErrorRecoverySet["SCase"] = 262144] = "SCase"; 308 ErrorRecoverySet[ErrorRecoverySet["Else"] = 524288] = "Else"; 309 ErrorRecoverySet[ErrorRecoverySet["Catch"] = 1048576] = "Catch"; 310 ErrorRecoverySet[ErrorRecoverySet["Var"] = 2097152] = "Var"; 311 ErrorRecoverySet[ErrorRecoverySet["Stmt"] = 4194304] = "Stmt"; 312 ErrorRecoverySet[ErrorRecoverySet["While"] = 8388608] = "While"; 313 ErrorRecoverySet[ErrorRecoverySet["ID"] = 16777216] = "ID"; 314 ErrorRecoverySet[ErrorRecoverySet["Prefix"] = 33554432] = "Prefix"; 315 ErrorRecoverySet[ErrorRecoverySet["Literal"] = 67108864] = "Literal"; 316 ErrorRecoverySet[ErrorRecoverySet["RLit"] = 134217728] = "RLit"; 317 ErrorRecoverySet[ErrorRecoverySet["Func"] = 268435456] = "Func"; 318 ErrorRecoverySet[ErrorRecoverySet["EOF"] = 536870912] = "EOF"; 319 // REVIEW: Name this something clearer. 320 ErrorRecoverySet[ErrorRecoverySet["TypeScriptS"] = 1073741824] = "TypeScriptS"; 321 ErrorRecoverySet[ErrorRecoverySet["ExprStart"] = 520158210] = "ExprStart"; 322 ErrorRecoverySet[ErrorRecoverySet["StmtStart"] = 1608580098] = "StmtStart"; 323 ErrorRecoverySet[ErrorRecoverySet["Postfix"] = 49280] = "Postfix"; 324 })(ErrorRecoverySet = TypeScript.ErrorRecoverySet || (TypeScript.ErrorRecoverySet = {})); 325 var AllowedElements; 326 (function (AllowedElements) { 327 AllowedElements[AllowedElements["None"] = 0] = "None"; 328 AllowedElements[AllowedElements["ModuleDeclarations"] = 4] = "ModuleDeclarations"; 329 AllowedElements[AllowedElements["ClassDeclarations"] = 8] = "ClassDeclarations"; 330 AllowedElements[AllowedElements["InterfaceDeclarations"] = 16] = "InterfaceDeclarations"; 331 AllowedElements[AllowedElements["AmbientDeclarations"] = 1024] = "AmbientDeclarations"; 332 AllowedElements[AllowedElements["Properties"] = 2048] = "Properties"; 333 AllowedElements[AllowedElements["Global"] = 1052] = "Global"; 334 AllowedElements[AllowedElements["QuickParse"] = 3100] = "QuickParse"; 335 })(AllowedElements = TypeScript.AllowedElements || (TypeScript.AllowedElements = {})); 336 var Modifiers; 337 (function (Modifiers) { 338 Modifiers[Modifiers["None"] = 0] = "None"; 339 Modifiers[Modifiers["Private"] = 1] = "Private"; 340 Modifiers[Modifiers["Public"] = 2] = "Public"; 341 Modifiers[Modifiers["Readonly"] = 4] = "Readonly"; 342 Modifiers[Modifiers["Ambient"] = 8] = "Ambient"; 343 Modifiers[Modifiers["Exported"] = 16] = "Exported"; 344 Modifiers[Modifiers["Getter"] = 32] = "Getter"; 345 Modifiers[Modifiers["Setter"] = 64] = "Setter"; 346 Modifiers[Modifiers["Static"] = 128] = "Static"; 347 })(Modifiers = TypeScript.Modifiers || (TypeScript.Modifiers = {})); 348 var ASTFlags; 349 (function (ASTFlags) { 350 ASTFlags[ASTFlags["None"] = 0] = "None"; 351 ASTFlags[ASTFlags["ExplicitSemicolon"] = 1] = "ExplicitSemicolon"; 352 ASTFlags[ASTFlags["AutomaticSemicolon"] = 2] = "AutomaticSemicolon"; 353 ASTFlags[ASTFlags["Writeable"] = 4] = "Writeable"; 354 ASTFlags[ASTFlags["Error"] = 8] = "Error"; 355 ASTFlags[ASTFlags["DotLHSPartial"] = 16] = "DotLHSPartial"; 356 ASTFlags[ASTFlags["DotLHS"] = 32] = "DotLHS"; 357 ASTFlags[ASTFlags["IsStatement"] = 64] = "IsStatement"; 358 ASTFlags[ASTFlags["StrictMode"] = 128] = "StrictMode"; 359 ASTFlags[ASTFlags["PossibleOptionalParameter"] = 256] = "PossibleOptionalParameter"; 360 ASTFlags[ASTFlags["ClassBaseConstructorCall"] = 512] = "ClassBaseConstructorCall"; 361 ASTFlags[ASTFlags["OptionalName"] = 1024] = "OptionalName"; 362 // REVIEW: This flag is to mark lambda nodes to note that the LParen of an expression has already been matched in the lambda header. 363 // The flag is used to communicate this piece of information to the calling parseTerm, which intern will remove it. 364 // Once we have a better way to associate information with nodes, this flag should not be used. 365 ASTFlags[ASTFlags["SkipNextRParen"] = 2048] = "SkipNextRParen"; 366 })(ASTFlags = TypeScript.ASTFlags || (TypeScript.ASTFlags = {})); 367 var DeclFlags; 368 (function (DeclFlags) { 369 DeclFlags[DeclFlags["None"] = 0] = "None"; 370 DeclFlags[DeclFlags["Exported"] = 1] = "Exported"; 371 DeclFlags[DeclFlags["Private"] = 2] = "Private"; 372 DeclFlags[DeclFlags["Public"] = 4] = "Public"; 373 DeclFlags[DeclFlags["Ambient"] = 8] = "Ambient"; 374 DeclFlags[DeclFlags["Static"] = 16] = "Static"; 375 DeclFlags[DeclFlags["LocalStatic"] = 32] = "LocalStatic"; 376 DeclFlags[DeclFlags["GetAccessor"] = 64] = "GetAccessor"; 377 DeclFlags[DeclFlags["SetAccessor"] = 128] = "SetAccessor"; 378 })(DeclFlags = TypeScript.DeclFlags || (TypeScript.DeclFlags = {})); 379 var ModuleFlags; 380 (function (ModuleFlags) { 381 ModuleFlags[ModuleFlags["None"] = 0] = "None"; 382 ModuleFlags[ModuleFlags["Exported"] = 1] = "Exported"; 383 ModuleFlags[ModuleFlags["Private"] = 2] = "Private"; 384 ModuleFlags[ModuleFlags["Public"] = 4] = "Public"; 385 ModuleFlags[ModuleFlags["Ambient"] = 8] = "Ambient"; 386 ModuleFlags[ModuleFlags["Static"] = 16] = "Static"; 387 ModuleFlags[ModuleFlags["LocalStatic"] = 32] = "LocalStatic"; 388 ModuleFlags[ModuleFlags["GetAccessor"] = 64] = "GetAccessor"; 389 ModuleFlags[ModuleFlags["SetAccessor"] = 128] = "SetAccessor"; 390 ModuleFlags[ModuleFlags["IsEnum"] = 256] = "IsEnum"; 391 ModuleFlags[ModuleFlags["ShouldEmitModuleDecl"] = 512] = "ShouldEmitModuleDecl"; 392 ModuleFlags[ModuleFlags["IsWholeFile"] = 1024] = "IsWholeFile"; 393 ModuleFlags[ModuleFlags["IsDynamic"] = 2048] = "IsDynamic"; 394 ModuleFlags[ModuleFlags["MustCaptureThis"] = 4096] = "MustCaptureThis"; 395 })(ModuleFlags = TypeScript.ModuleFlags || (TypeScript.ModuleFlags = {})); 396 var SymbolFlags; 397 (function (SymbolFlags) { 398 SymbolFlags[SymbolFlags["None"] = 0] = "None"; 399 SymbolFlags[SymbolFlags["Exported"] = 1] = "Exported"; 400 SymbolFlags[SymbolFlags["Private"] = 2] = "Private"; 401 SymbolFlags[SymbolFlags["Public"] = 4] = "Public"; 402 SymbolFlags[SymbolFlags["Ambient"] = 8] = "Ambient"; 403 SymbolFlags[SymbolFlags["Static"] = 16] = "Static"; 404 SymbolFlags[SymbolFlags["LocalStatic"] = 32] = "LocalStatic"; 405 SymbolFlags[SymbolFlags["GetAccessor"] = 64] = "GetAccessor"; 406 SymbolFlags[SymbolFlags["SetAccessor"] = 128] = "SetAccessor"; 407 SymbolFlags[SymbolFlags["Property"] = 256] = "Property"; 408 SymbolFlags[SymbolFlags["Readonly"] = 512] = "Readonly"; 409 SymbolFlags[SymbolFlags["ModuleMember"] = 1024] = "ModuleMember"; 410 SymbolFlags[SymbolFlags["InterfaceMember"] = 2048] = "InterfaceMember"; 411 SymbolFlags[SymbolFlags["ClassMember"] = 4096] = "ClassMember"; 412 SymbolFlags[SymbolFlags["BuiltIn"] = 8192] = "BuiltIn"; 413 SymbolFlags[SymbolFlags["TypeSetDuringScopeAssignment"] = 16384] = "TypeSetDuringScopeAssignment"; 414 SymbolFlags[SymbolFlags["Constant"] = 32768] = "Constant"; 415 SymbolFlags[SymbolFlags["Optional"] = 65536] = "Optional"; 416 SymbolFlags[SymbolFlags["RecursivelyReferenced"] = 131072] = "RecursivelyReferenced"; 417 SymbolFlags[SymbolFlags["Bound"] = 262144] = "Bound"; 418 SymbolFlags[SymbolFlags["CompilerGenerated"] = 524288] = "CompilerGenerated"; 419 })(SymbolFlags = TypeScript.SymbolFlags || (TypeScript.SymbolFlags = {})); 420 var VarFlags; 421 (function (VarFlags) { 422 VarFlags[VarFlags["None"] = 0] = "None"; 423 VarFlags[VarFlags["Exported"] = 1] = "Exported"; 424 VarFlags[VarFlags["Private"] = 2] = "Private"; 425 VarFlags[VarFlags["Public"] = 4] = "Public"; 426 VarFlags[VarFlags["Ambient"] = 8] = "Ambient"; 427 VarFlags[VarFlags["Static"] = 16] = "Static"; 428 VarFlags[VarFlags["LocalStatic"] = 32] = "LocalStatic"; 429 VarFlags[VarFlags["GetAccessor"] = 64] = "GetAccessor"; 430 VarFlags[VarFlags["SetAccessor"] = 128] = "SetAccessor"; 431 VarFlags[VarFlags["AutoInit"] = 256] = "AutoInit"; 432 VarFlags[VarFlags["Property"] = 512] = "Property"; 433 VarFlags[VarFlags["Readonly"] = 1024] = "Readonly"; 434 VarFlags[VarFlags["Class"] = 2048] = "Class"; 435 VarFlags[VarFlags["ClassProperty"] = 4096] = "ClassProperty"; 436 VarFlags[VarFlags["ClassBodyProperty"] = 8192] = "ClassBodyProperty"; 437 VarFlags[VarFlags["ClassConstructorProperty"] = 16384] = "ClassConstructorProperty"; 438 VarFlags[VarFlags["ClassSuperMustBeFirstCallInConstructor"] = 32768] = "ClassSuperMustBeFirstCallInConstructor"; 439 VarFlags[VarFlags["Constant"] = 65536] = "Constant"; 440 VarFlags[VarFlags["MustCaptureThis"] = 131072] = "MustCaptureThis"; 441 })(VarFlags = TypeScript.VarFlags || (TypeScript.VarFlags = {})); 442 var FncFlags; 443 (function (FncFlags) { 444 FncFlags[FncFlags["None"] = 0] = "None"; 445 FncFlags[FncFlags["Exported"] = 1] = "Exported"; 446 FncFlags[FncFlags["Private"] = 2] = "Private"; 447 FncFlags[FncFlags["Public"] = 4] = "Public"; 448 FncFlags[FncFlags["Ambient"] = 8] = "Ambient"; 449 FncFlags[FncFlags["Static"] = 16] = "Static"; 450 FncFlags[FncFlags["LocalStatic"] = 32] = "LocalStatic"; 451 FncFlags[FncFlags["GetAccessor"] = 64] = "GetAccessor"; 452 FncFlags[FncFlags["SetAccessor"] = 128] = "SetAccessor"; 453 FncFlags[FncFlags["Definition"] = 256] = "Definition"; 454 FncFlags[FncFlags["Signature"] = 512] = "Signature"; 455 FncFlags[FncFlags["Method"] = 1024] = "Method"; 456 FncFlags[FncFlags["HasReturnExpression"] = 2048] = "HasReturnExpression"; 457 FncFlags[FncFlags["CallMember"] = 4096] = "CallMember"; 458 FncFlags[FncFlags["ConstructMember"] = 8192] = "ConstructMember"; 459 FncFlags[FncFlags["HasSelfReference"] = 16384] = "HasSelfReference"; 460 FncFlags[FncFlags["IsFatArrowFunction"] = 32768] = "IsFatArrowFunction"; 461 FncFlags[FncFlags["IndexerMember"] = 65536] = "IndexerMember"; 462 FncFlags[FncFlags["IsFunctionExpression"] = 131072] = "IsFunctionExpression"; 463 FncFlags[FncFlags["ClassMethod"] = 262144] = "ClassMethod"; 464 FncFlags[FncFlags["ClassPropertyMethodExported"] = 524288] = "ClassPropertyMethodExported"; 465 })(FncFlags = TypeScript.FncFlags || (TypeScript.FncFlags = {})); 466 var SignatureFlags; 467 (function (SignatureFlags) { 468 SignatureFlags[SignatureFlags["None"] = 0] = "None"; 469 SignatureFlags[SignatureFlags["IsIndexer"] = 1] = "IsIndexer"; 470 SignatureFlags[SignatureFlags["IsStringIndexer"] = 2] = "IsStringIndexer"; 471 SignatureFlags[SignatureFlags["IsNumberIndexer"] = 4] = "IsNumberIndexer"; 472 })(SignatureFlags = TypeScript.SignatureFlags || (TypeScript.SignatureFlags = {})); 473 function ToDeclFlags(fncOrVarOrSymbolOrModuleFlags) { 474 return fncOrVarOrSymbolOrModuleFlags; 475 } 476 TypeScript.ToDeclFlags = ToDeclFlags; 477 var TypeFlags; 478 (function (TypeFlags) { 479 TypeFlags[TypeFlags["None"] = 0] = "None"; 480 TypeFlags[TypeFlags["HasImplementation"] = 1] = "HasImplementation"; 481 TypeFlags[TypeFlags["HasSelfReference"] = 2] = "HasSelfReference"; 482 TypeFlags[TypeFlags["MergeResult"] = 4] = "MergeResult"; 483 TypeFlags[TypeFlags["IsEnum"] = 8] = "IsEnum"; 484 TypeFlags[TypeFlags["BuildingName"] = 16] = "BuildingName"; 485 TypeFlags[TypeFlags["HasBaseType"] = 32] = "HasBaseType"; 486 TypeFlags[TypeFlags["HasBaseTypeOfObject"] = 64] = "HasBaseTypeOfObject"; 487 TypeFlags[TypeFlags["IsClass"] = 128] = "IsClass"; 488 })(TypeFlags = TypeScript.TypeFlags || (TypeScript.TypeFlags = {})); 489 var TypeRelationshipFlags; 490 (function (TypeRelationshipFlags) { 491 TypeRelationshipFlags[TypeRelationshipFlags["SuccessfulComparison"] = 0] = "SuccessfulComparison"; 492 TypeRelationshipFlags[TypeRelationshipFlags["SourceIsNullTargetIsVoidOrUndefined"] = 1] = "SourceIsNullTargetIsVoidOrUndefined"; 493 TypeRelationshipFlags[TypeRelationshipFlags["RequiredPropertyIsMissing"] = 2] = "RequiredPropertyIsMissing"; 494 TypeRelationshipFlags[TypeRelationshipFlags["IncompatibleSignatures"] = 4] = "IncompatibleSignatures"; 495 TypeRelationshipFlags[TypeRelationshipFlags["SourceSignatureHasTooManyParameters"] = 3] = "SourceSignatureHasTooManyParameters"; 496 TypeRelationshipFlags[TypeRelationshipFlags["IncompatibleReturnTypes"] = 16] = "IncompatibleReturnTypes"; 497 TypeRelationshipFlags[TypeRelationshipFlags["IncompatiblePropertyTypes"] = 32] = "IncompatiblePropertyTypes"; 498 TypeRelationshipFlags[TypeRelationshipFlags["IncompatibleParameterTypes"] = 64] = "IncompatibleParameterTypes"; 499 })(TypeRelationshipFlags = TypeScript.TypeRelationshipFlags || (TypeScript.TypeRelationshipFlags = {})); 500 var CodeGenTarget; 501 (function (CodeGenTarget) { 502 CodeGenTarget[CodeGenTarget["ES3"] = 0] = "ES3"; 503 CodeGenTarget[CodeGenTarget["ES5"] = 1] = "ES5"; 504 })(CodeGenTarget = TypeScript.CodeGenTarget || (TypeScript.CodeGenTarget = {})); 505 var ModuleGenTarget; 506 (function (ModuleGenTarget) { 507 ModuleGenTarget[ModuleGenTarget["Synchronous"] = 0] = "Synchronous"; 508 ModuleGenTarget[ModuleGenTarget["Asynchronous"] = 1] = "Asynchronous"; 509 ModuleGenTarget[ModuleGenTarget["Local"] = 2] = "Local"; 510 })(ModuleGenTarget = TypeScript.ModuleGenTarget || (TypeScript.ModuleGenTarget = {})); 511 // Compiler defaults to generating ES5-compliant code for 512 // - getters and setters 513 TypeScript.codeGenTarget = CodeGenTarget.ES3; 514 TypeScript.moduleGenTarget = ModuleGenTarget.Synchronous; 515 TypeScript.optimizeModuleCodeGen = true; 516 function flagsToString(e, flags) { 517 var builder = ""; 518 for (var i = 1; i < (1 << 31); i = i << 1) { 519 if ((flags & i) != 0) { 520 for (var k in e) { 521 if (e[k] == i) { 522 if (builder.length > 0) { 523 builder += "|"; 524 } 525 builder += k; 526 break; 527 } 528 } 529 } 530 } 531 return builder; 532 } 533 TypeScript.flagsToString = flagsToString; 534})(TypeScript || (TypeScript = {})); 535