1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
|
tests/cases/conformance/parser/ecmascript5/parserRealSource2.ts(4,1): error TS6053: File 'tests/cases/conformance/parser/ecmascript5/typescript.ts' not found.
==== tests/cases/conformance/parser/ecmascript5/parserRealSource2.ts (1 errors) ====
// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0.
// See LICENSE.txt in the project root for complete license information.
///<reference path='typescript.ts' />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS6053: File 'tests/cases/conformance/parser/ecmascript5/typescript.ts' not found.
module TypeScript {
export function hasFlag(val: number, flag: number) {
return (val & flag) != 0;
}
export enum ErrorRecoverySet {
None = 0,
Comma = 1, // Comma
SColon = 1 << 1, // SColon
Asg = 1 << 2, // Asg
BinOp = 1 << 3, // Lsh, Rsh, Rs2, Le, Ge, INSTANCEOF, EQ, NE, Eqv, NEqv, LogAnd, LogOr, AsgMul, AsgDiv
// AsgMod, AsgAdd, AsgSub, AsgLsh, AsgRsh, AsgRs2, AsgAnd, AsgXor, AsgOr, QMark, Mult, Div,
// Pct, GT, LT, And, Xor, Or
RBrack = 1 << 4, // RBrack
RCurly = 1 << 5, // RCurly
RParen = 1 << 6, // RParen
Dot = 1 << 7, // Dot
Colon = 1 << 8, // Colon
PrimType = 1 << 9, // number, string, boolean
AddOp = 1 << 10, // Add, Sub
LCurly = 1 << 11, // LCurly
PreOp = 1 << 12, // Tilde, Bang, Inc, Dec
RegExp = 1 << 13, // RegExp
LParen = 1 << 14, // LParen
LBrack = 1 << 15, // LBrack
Scope = 1 << 16, // Scope
In = 1 << 17, // IN
SCase = 1 << 18, // CASE, DEFAULT
Else = 1 << 19, // ELSE
Catch = 1 << 20, // CATCH, FINALLY
Var = 1 << 21, //
Stmt = 1 << 22, // BREAK, RETURN, THROW, DEBUGGER, FOR, SWITCH, DO, IF, TRY, WITH
While = 1 << 23, // WHILE
ID = 1 << 24, // ID
Prefix = 1 << 25, // VOID, DELETE, TYPEOF, AWAIT
Literal = 1 << 26, // IntCon, FltCon, StrCon
RLit = 1 << 27, // THIS, TRUE, FALSE, NULL
Func = 1 << 28, // FUNCTION
EOF = 1 << 29, // EOF
// REVIEW: Name this something clearer.
TypeScriptS = 1 << 30, // PROPERTY, PRIVATE, STATIC, INTERFACE, CLASS, MODULE, EXPORT, IMPORT
ExprStart = SColon | AddOp | LCurly | PreOp | RegExp | LParen | LBrack | ID | Prefix | RLit | Func | Literal,
StmtStart = ExprStart | SColon | Var | Stmt | While | TypeScriptS,
Postfix = Dot | LParen | LBrack,
}
export enum AllowedElements {
None = 0,
ModuleDeclarations = 1 << 2,
ClassDeclarations = 1 << 3,
InterfaceDeclarations = 1 << 4,
AmbientDeclarations = 1 << 10,
Properties = 1 << 11,
Global = ModuleDeclarations | ClassDeclarations | InterfaceDeclarations | AmbientDeclarations,
QuickParse = Global | Properties,
}
export enum Modifiers {
None = 0,
Private = 1,
Public = 1 << 1,
Readonly = 1 << 2,
Ambient = 1 << 3,
Exported = 1 << 4,
Getter = 1 << 5,
Setter = 1 << 6,
Static = 1 << 7,
}
export enum ASTFlags {
None = 0,
ExplicitSemicolon = 1, // statment terminated by an explicit semicolon
AutomaticSemicolon = 1 << 1, // statment terminated by an automatic semicolon
Writeable = 1 << 2, // node is lhs that can be modified
Error = 1 << 3, // node has an error
DotLHSPartial = 1 << 4, // node is the lhs of an incomplete dot expr at cursor
DotLHS = 1 << 5, // node is the lhs of a dot expr
IsStatement = 1 << 6, // node is a statement
StrictMode = 1 << 7, // node is in the strict mode environment
PossibleOptionalParameter = 1 << 8,
ClassBaseConstructorCall = 1 << 9,
OptionalName = 1 << 10,
// REVIEW: This flag is to mark lambda nodes to note that the LParen of an expression has already been matched in the lambda header.
// The flag is used to communicate this piece of information to the calling parseTerm, which intern will remove it.
// Once we have a better way to associate information with nodes, this flag should not be used.
SkipNextRParen = 1 << 11,
}
export enum DeclFlags {
None = 0,
Exported = 1,
Private = 1 << 1,
Public = 1 << 2,
Ambient = 1 << 3,
Static = 1 << 4,
LocalStatic = 1 << 5,
GetAccessor = 1 << 6,
SetAccessor = 1 << 7,
}
export enum ModuleFlags {
None = 0,
Exported = 1,
Private = 1 << 1,
Public = 1 << 2,
Ambient = 1 << 3,
Static = 1 << 4,
LocalStatic = 1 << 5,
GetAccessor = 1 << 6,
SetAccessor = 1 << 7,
IsEnum = 1 << 8,
ShouldEmitModuleDecl = 1 << 9,
IsWholeFile = 1 << 10,
IsDynamic = 1 << 11,
MustCaptureThis = 1 << 12,
}
export enum SymbolFlags {
None = 0,
Exported = 1,
Private = 1 << 1,
Public = 1 << 2,
Ambient = 1 << 3,
Static = 1 << 4,
LocalStatic = 1 << 5,
GetAccessor = 1 << 6,
SetAccessor = 1 << 7,
Property = 1 << 8,
Readonly = 1 << 9,
ModuleMember = 1 << 10,
InterfaceMember = 1 << 11,
ClassMember = 1 << 12,
BuiltIn = 1 << 13,
TypeSetDuringScopeAssignment = 1 << 14,
Constant = 1 << 15,
Optional = 1 << 16,
RecursivelyReferenced = 1 << 17,
Bound = 1 << 18,
CompilerGenerated = 1 << 19,
}
export enum VarFlags {
None = 0,
Exported = 1,
Private = 1 << 1,
Public = 1 << 2,
Ambient = 1 << 3,
Static = 1 << 4,
LocalStatic = 1 << 5,
GetAccessor = 1 << 6,
SetAccessor = 1 << 7,
AutoInit = 1 << 8,
Property = 1 << 9,
Readonly = 1 << 10,
Class = 1 << 11,
ClassProperty = 1 << 12,
ClassBodyProperty = 1 << 13,
ClassConstructorProperty = 1 << 14,
ClassSuperMustBeFirstCallInConstructor = 1 << 15,
Constant = 1 << 16,
MustCaptureThis = 1 << 17,
}
export enum FncFlags {
None = 0,
Exported = 1,
Private = 1 << 1,
Public = 1 << 2,
Ambient = 1 << 3,
Static = 1 << 4,
LocalStatic = 1 << 5,
GetAccessor = 1 << 6,
SetAccessor = 1 << 7,
Definition = 1 << 8,
Signature = 1 << 9,
Method = 1 << 10,
HasReturnExpression = 1 << 11,
CallMember = 1 << 12,
ConstructMember = 1 << 13,
HasSelfReference = 1 << 14,
IsFatArrowFunction = 1 << 15,
IndexerMember = 1 << 16,
IsFunctionExpression = 1 << 17,
ClassMethod = 1 << 18,
ClassPropertyMethodExported = 1 << 19,
}
export enum SignatureFlags {
None = 0,
IsIndexer = 1,
IsStringIndexer = 1 << 1,
IsNumberIndexer = 1 << 2,
}
export function ToDeclFlags(fncFlags: FncFlags) : DeclFlags;
export function ToDeclFlags(varFlags: VarFlags) : DeclFlags;
export function ToDeclFlags(symFlags: SymbolFlags): DeclFlags;
export function ToDeclFlags(moduleFlags: ModuleFlags): DeclFlags;
export function ToDeclFlags(fncOrVarOrSymbolOrModuleFlags: any) {
return <DeclFlags>fncOrVarOrSymbolOrModuleFlags;
}
export enum TypeFlags {
None = 0,
HasImplementation = 1,
HasSelfReference = 1 << 1,
MergeResult = 1 << 2,
IsEnum = 1 << 3,
BuildingName = 1 << 4,
HasBaseType = 1 << 5,
HasBaseTypeOfObject = 1 << 6,
IsClass = 1 << 7,
}
export enum TypeRelationshipFlags {
SuccessfulComparison = 0,
SourceIsNullTargetIsVoidOrUndefined = 1,
RequiredPropertyIsMissing = 1 << 1,
IncompatibleSignatures = 1 << 2,
SourceSignatureHasTooManyParameters = 3,
IncompatibleReturnTypes = 1 << 4,
IncompatiblePropertyTypes = 1 << 5,
IncompatibleParameterTypes = 1 << 6,
}
export enum CodeGenTarget {
ES3 = 0,
ES5 = 1,
}
export enum ModuleGenTarget {
Synchronous = 0,
Asynchronous = 1,
Local = 1 << 1,
}
// Compiler defaults to generating ES5-compliant code for
// - getters and setters
export var codeGenTarget: CodeGenTarget = CodeGenTarget.ES3;
export var moduleGenTarget: ModuleGenTarget = ModuleGenTarget.Synchronous;
export var optimizeModuleCodeGen = true;
export function flagsToString(e, flags: number): string {
var builder = "";
for (var i = 1; i < (1 << 31) ; i = i << 1) {
if ((flags & i) != 0) {
for (var k in e) {
if (e[k] == i) {
if (builder.length > 0) {
builder += "|";
}
builder += k;
break;
}
}
}
}
return builder;
}
}
|