- if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 248 /* JsxExpression */) {
+ if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 251 /* JsxExpression */) {
return true;
}
//
{
// |
// } < /div>
- if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 248 /* JsxExpression */) {
+ if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 251 /* JsxExpression */) {
return true;
}
//
|
- if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 245 /* JsxClosingElement */) {
+ if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 248 /* JsxClosingElement */) {
return true;
}
return false;
@@ -62702,17 +64736,17 @@ var ts;
}
ts.getNodeModifiers = getNodeModifiers;
function getTypeArgumentOrTypeParameterList(node) {
- if (node.kind === 156 /* TypeReference */ || node.kind === 175 /* CallExpression */) {
+ if (node.kind === 157 /* TypeReference */ || node.kind === 178 /* CallExpression */) {
return node.typeArguments;
}
- if (ts.isFunctionLike(node) || node.kind === 222 /* ClassDeclaration */ || node.kind === 223 /* InterfaceDeclaration */) {
+ if (ts.isFunctionLike(node) || node.kind === 225 /* ClassDeclaration */ || node.kind === 226 /* InterfaceDeclaration */) {
return node.typeParameters;
}
return undefined;
}
ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList;
function isToken(n) {
- return n.kind >= 0 /* FirstToken */ && n.kind <= 139 /* LastToken */;
+ return n.kind >= 0 /* FirstToken */ && n.kind <= 140 /* LastToken */;
}
ts.isToken = isToken;
function isWord(kind) {
@@ -62771,18 +64805,18 @@ var ts;
}
ts.compareDataObjects = compareDataObjects;
function isArrayLiteralOrObjectLiteralDestructuringPattern(node) {
- if (node.kind === 171 /* ArrayLiteralExpression */ ||
- node.kind === 172 /* ObjectLiteralExpression */) {
+ if (node.kind === 174 /* ArrayLiteralExpression */ ||
+ node.kind === 175 /* ObjectLiteralExpression */) {
// [a,b,c] from:
// [a, b, c] = someExpression;
- if (node.parent.kind === 188 /* BinaryExpression */ &&
+ if (node.parent.kind === 191 /* BinaryExpression */ &&
node.parent.left === node &&
node.parent.operatorToken.kind === 57 /* EqualsToken */) {
return true;
}
// [a, b, c] from:
// for([a, b, c] of expression)
- if (node.parent.kind === 209 /* ForOfStatement */ &&
+ if (node.parent.kind === 212 /* ForOfStatement */ &&
node.parent.initializer === node) {
return true;
}
@@ -62790,7 +64824,7 @@ var ts;
// [x, [a, b, c] ] = someExpression
// or
// {x, a: {a, b, c} } = someExpression
- if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 253 /* PropertyAssignment */ ? node.parent.parent : node.parent)) {
+ if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 256 /* PropertyAssignment */ ? node.parent.parent : node.parent)) {
return true;
}
}
@@ -62823,7 +64857,7 @@ var ts;
/* @internal */
(function (ts) {
function isFirstDeclarationOfSymbolParameter(symbol) {
- return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 143 /* Parameter */;
+ return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 144 /* Parameter */;
}
ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter;
var displayPartWriter = getDisplayPartWriter();
@@ -63003,7 +65037,7 @@ var ts;
return location.getText();
}
else if (ts.isStringOrNumericLiteral(location.kind) &&
- location.parent.kind === 141 /* ComputedPropertyName */) {
+ location.parent.kind === 142 /* ComputedPropertyName */) {
return location.text;
}
// Try to get the local symbol if we're dealing with an 'export default'
@@ -63015,7 +65049,7 @@ var ts;
ts.getDeclaredName = getDeclaredName;
function isImportOrExportSpecifierName(location) {
return location.parent &&
- (location.parent.kind === 235 /* ImportSpecifier */ || location.parent.kind === 239 /* ExportSpecifier */) &&
+ (location.parent.kind === 238 /* ImportSpecifier */ || location.parent.kind === 242 /* ExportSpecifier */) &&
location.parent.propertyName === location;
}
ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName;
@@ -63087,7 +65121,7 @@ var ts;
(function (ts) {
/// Classifier
function createClassifier() {
- var scanner = ts.createScanner(4 /* Latest */, /*skipTrivia*/ false);
+ var scanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false);
/// We do not have a full parser support to know when we should parse a regex or not
/// If we consider every slash token to be a regex, we could be missing cases like "1/2/3", where
/// we have a series of divide operator. this list allows us to be more accurate by ruling out
@@ -63130,7 +65164,7 @@ var ts;
function canFollow(keyword1, keyword2) {
if (ts.isAccessibilityModifier(keyword1)) {
if (keyword2 === 124 /* GetKeyword */ ||
- keyword2 === 132 /* SetKeyword */ ||
+ keyword2 === 133 /* SetKeyword */ ||
keyword2 === 122 /* ConstructorKeyword */ ||
keyword2 === 114 /* StaticKeyword */) {
// Allow things like "public get", "public constructor" and "public static".
@@ -63289,10 +65323,10 @@ var ts;
angleBracketStack--;
}
else if (token === 118 /* AnyKeyword */ ||
- token === 133 /* StringKeyword */ ||
- token === 131 /* NumberKeyword */ ||
+ token === 134 /* StringKeyword */ ||
+ token === 132 /* NumberKeyword */ ||
token === 121 /* BooleanKeyword */ ||
- token === 134 /* SymbolKeyword */) {
+ token === 135 /* SymbolKeyword */) {
if (angleBracketStack > 0 && !syntacticClassifierAbsent) {
// If it looks like we're could be in something generic, don't classify this
// as a keyword. We may just get overwritten by the syntactic classifier,
@@ -63464,7 +65498,7 @@ var ts;
}
}
function isKeyword(token) {
- return token >= 71 /* FirstKeyword */ && token <= 139 /* LastKeyword */;
+ return token >= 71 /* FirstKeyword */ && token <= 140 /* LastKeyword */;
}
function classFromKind(token) {
if (isKeyword(token)) {
@@ -63521,10 +65555,10 @@ var ts;
// That means we're calling back into the host around every 1.2k of the file we process.
// Lib.d.ts has similar numbers.
switch (kind) {
- case 226 /* ModuleDeclaration */:
- case 222 /* ClassDeclaration */:
- case 223 /* InterfaceDeclaration */:
- case 221 /* FunctionDeclaration */:
+ case 229 /* ModuleDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 224 /* FunctionDeclaration */:
cancellationToken.throwIfCancellationRequested();
}
}
@@ -63575,7 +65609,7 @@ var ts;
*/
function hasValueSideModule(symbol) {
return ts.forEach(symbol.declarations, function (declaration) {
- return declaration.kind === 226 /* ModuleDeclaration */ &&
+ return declaration.kind === 229 /* ModuleDeclaration */ &&
ts.getModuleInstanceState(declaration) === 1 /* Instantiated */;
});
}
@@ -63654,8 +65688,8 @@ var ts;
var spanStart = span.start;
var spanLength = span.length;
// Make a scanner we can get trivia from.
- var triviaScanner = ts.createScanner(4 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
- var mergeConflictScanner = ts.createScanner(4 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var triviaScanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var mergeConflictScanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
var result = [];
processElement(sourceFile);
return { spans: result, endOfLineState: 0 /* None */ };
@@ -63739,16 +65773,16 @@ var ts;
pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */);
pos = tag.tagName.end;
switch (tag.kind) {
- case 275 /* JSDocParameterTag */:
+ case 279 /* JSDocParameterTag */:
processJSDocParameterTag(tag);
break;
- case 278 /* JSDocTemplateTag */:
+ case 282 /* JSDocTemplateTag */:
processJSDocTemplateTag(tag);
break;
- case 277 /* JSDocTypeTag */:
+ case 281 /* JSDocTypeTag */:
processElement(tag.typeExpression);
break;
- case 276 /* JSDocReturnTag */:
+ case 280 /* JSDocReturnTag */:
processElement(tag.typeExpression);
break;
}
@@ -63835,22 +65869,22 @@ var ts;
}
function tryClassifyJsxElementName(token) {
switch (token.parent && token.parent.kind) {
- case 244 /* JsxOpeningElement */:
+ case 247 /* JsxOpeningElement */:
if (token.parent.tagName === token) {
return 19 /* jsxOpenTagName */;
}
break;
- case 245 /* JsxClosingElement */:
+ case 248 /* JsxClosingElement */:
if (token.parent.tagName === token) {
return 20 /* jsxCloseTagName */;
}
break;
- case 243 /* JsxSelfClosingElement */:
+ case 246 /* JsxSelfClosingElement */:
if (token.parent.tagName === token) {
return 21 /* jsxSelfClosingTagName */;
}
break;
- case 246 /* JsxAttribute */:
+ case 249 /* JsxAttribute */:
if (token.parent.name === token) {
return 22 /* jsxAttribute */;
}
@@ -63878,17 +65912,17 @@ var ts;
if (token) {
if (tokenKind === 57 /* EqualsToken */) {
// the '=' in a variable declaration is special cased here.
- if (token.parent.kind === 219 /* VariableDeclaration */ ||
- token.parent.kind === 146 /* PropertyDeclaration */ ||
- token.parent.kind === 143 /* Parameter */ ||
- token.parent.kind === 246 /* JsxAttribute */) {
+ if (token.parent.kind === 222 /* VariableDeclaration */ ||
+ token.parent.kind === 147 /* PropertyDeclaration */ ||
+ token.parent.kind === 144 /* Parameter */ ||
+ token.parent.kind === 249 /* JsxAttribute */) {
return 5 /* operator */;
}
}
- if (token.parent.kind === 188 /* BinaryExpression */ ||
- token.parent.kind === 186 /* PrefixUnaryExpression */ ||
- token.parent.kind === 187 /* PostfixUnaryExpression */ ||
- token.parent.kind === 189 /* ConditionalExpression */) {
+ if (token.parent.kind === 191 /* BinaryExpression */ ||
+ token.parent.kind === 189 /* PrefixUnaryExpression */ ||
+ token.parent.kind === 190 /* PostfixUnaryExpression */ ||
+ token.parent.kind === 192 /* ConditionalExpression */) {
return 5 /* operator */;
}
}
@@ -63898,7 +65932,7 @@ var ts;
return 4 /* numericLiteral */;
}
else if (tokenKind === 9 /* StringLiteral */) {
- return token.parent.kind === 246 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */;
+ return token.parent.kind === 249 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */;
}
else if (tokenKind === 11 /* RegularExpressionLiteral */) {
// TODO: we should get another classification type for these literals.
@@ -63914,32 +65948,32 @@ var ts;
else if (tokenKind === 70 /* Identifier */) {
if (token) {
switch (token.parent.kind) {
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
if (token.parent.name === token) {
return 11 /* className */;
}
return;
- case 142 /* TypeParameter */:
+ case 143 /* TypeParameter */:
if (token.parent.name === token) {
return 15 /* typeParameterName */;
}
return;
- case 223 /* InterfaceDeclaration */:
+ case 226 /* InterfaceDeclaration */:
if (token.parent.name === token) {
return 13 /* interfaceName */;
}
return;
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
if (token.parent.name === token) {
return 12 /* enumName */;
}
return;
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
if (token.parent.name === token) {
return 14 /* moduleName */;
}
return;
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
if (token.parent.name === token) {
return ts.isThisIdentifier(token) ? 3 /* keyword */ : 17 /* parameterName */;
}
@@ -63999,7 +66033,7 @@ var ts;
else {
if (!symbols || symbols.length === 0) {
if (sourceFile.languageVariant === 1 /* JSX */ &&
- location.parent && location.parent.kind === 245 /* JsxClosingElement */) {
+ location.parent && location.parent.kind === 248 /* JsxClosingElement */) {
// In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag,
// instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element.
// For example:
@@ -64026,14 +66060,14 @@ var ts;
function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) {
var entries = [];
var nameTable = ts.getNameTable(sourceFile);
- for (var name_46 in nameTable) {
+ for (var name_42 in nameTable) {
// Skip identifiers produced only from the current location
- if (nameTable[name_46] === position) {
+ if (nameTable[name_42] === position) {
continue;
}
- if (!uniqueNames[name_46]) {
- uniqueNames[name_46] = name_46;
- var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_46), compilerOptions.target, /*performCharacterChecks*/ true);
+ if (!uniqueNames[name_42]) {
+ uniqueNames[name_42] = name_42;
+ var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_42), compilerOptions.target, /*performCharacterChecks*/ true);
if (displayName) {
var entry = {
name: displayName,
@@ -64093,8 +66127,8 @@ var ts;
if (!node || node.kind !== 9 /* StringLiteral */) {
return undefined;
}
- if (node.parent.kind === 253 /* PropertyAssignment */ &&
- node.parent.parent.kind === 172 /* ObjectLiteralExpression */ &&
+ if (node.parent.kind === 256 /* PropertyAssignment */ &&
+ node.parent.parent.kind === 175 /* ObjectLiteralExpression */ &&
node.parent.name === node) {
// Get quoted name of properties of the object literal expression
// i.e. interface ConfigFiles {
@@ -64119,7 +66153,7 @@ var ts;
// a['/*completion position*/']
return getStringLiteralCompletionEntriesFromElementAccess(node.parent);
}
- else if (node.parent.kind === 231 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) {
+ else if (node.parent.kind === 234 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) {
// Get all known external module names or complete a path to a module
// i.e. import * as ns from "/*completion position*/";
// import x = require("/*completion position*/");
@@ -64510,8 +66544,8 @@ var ts;
}
catch (e) { }
if (typeRoots) {
- for (var _b = 0, typeRoots_2 = typeRoots; _b < typeRoots_2.length; _b++) {
- var root = typeRoots_2[_b];
+ for (var _b = 0, typeRoots_3 = typeRoots; _b < typeRoots_3.length; _b++) {
+ var root = typeRoots_3[_b];
getCompletionEntriesFromDirectories(host, root, span, result);
}
}
@@ -64546,11 +66580,11 @@ var ts;
if (currentConfigPath) {
paths.push(currentConfigPath);
currentDir = ts.getDirectoryPath(currentConfigPath);
- var parent_16 = ts.getDirectoryPath(currentDir);
- if (currentDir === parent_16) {
+ var parent_15 = ts.getDirectoryPath(currentDir);
+ if (currentDir === parent_15) {
break;
}
- currentDir = parent_16;
+ currentDir = parent_15;
}
else {
break;
@@ -64702,9 +66736,9 @@ var ts;
isJsDocTagName = true;
}
switch (tag.kind) {
- case 277 /* JSDocTypeTag */:
- case 275 /* JSDocParameterTag */:
- case 276 /* JSDocReturnTag */:
+ case 281 /* JSDocTypeTag */:
+ case 279 /* JSDocParameterTag */:
+ case 280 /* JSDocReturnTag */:
var tagWithExpression = tag;
if (tagWithExpression.typeExpression) {
insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end;
@@ -64749,13 +66783,13 @@ var ts;
log("Returning an empty list because completion was requested in an invalid position.");
return undefined;
}
- var parent_17 = contextToken.parent, kind = contextToken.kind;
+ var parent_16 = contextToken.parent, kind = contextToken.kind;
if (kind === 22 /* DotToken */) {
- if (parent_17.kind === 173 /* PropertyAccessExpression */) {
+ if (parent_16.kind === 176 /* PropertyAccessExpression */) {
node = contextToken.parent.expression;
isRightOfDot = true;
}
- else if (parent_17.kind === 140 /* QualifiedName */) {
+ else if (parent_16.kind === 141 /* QualifiedName */) {
node = contextToken.parent.left;
isRightOfDot = true;
}
@@ -64770,7 +66804,7 @@ var ts;
isRightOfOpenTag = true;
location = contextToken;
}
- else if (kind === 40 /* SlashToken */ && contextToken.parent.kind === 245 /* JsxClosingElement */) {
+ else if (kind === 40 /* SlashToken */ && contextToken.parent.kind === 248 /* JsxClosingElement */) {
isStartingCloseTag = true;
location = contextToken;
}
@@ -64819,7 +66853,7 @@ var ts;
isGlobalCompletion = false;
isMemberCompletion = true;
isNewIdentifierLocation = false;
- if (node.kind === 70 /* Identifier */ || node.kind === 140 /* QualifiedName */ || node.kind === 173 /* PropertyAccessExpression */) {
+ if (node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */ || node.kind === 176 /* PropertyAccessExpression */) {
var symbol = typeChecker.getSymbolAtLocation(node);
// This is an alias, follow what it aliases
if (symbol && symbol.flags & 8388608 /* Alias */) {
@@ -64875,7 +66909,7 @@ var ts;
}
if (jsxContainer = tryGetContainingJsxElement(contextToken)) {
var attrsType = void 0;
- if ((jsxContainer.kind === 243 /* JsxSelfClosingElement */) || (jsxContainer.kind === 244 /* JsxOpeningElement */)) {
+ if ((jsxContainer.kind === 246 /* JsxSelfClosingElement */) || (jsxContainer.kind === 247 /* JsxOpeningElement */)) {
// Cursor is inside a JSX self-closing element or opening element
attrsType = typeChecker.getJsxElementAttributesType(jsxContainer);
if (attrsType) {
@@ -64923,9 +66957,9 @@ var ts;
var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;
if (scopeNode) {
isGlobalCompletion =
- scopeNode.kind === 256 /* SourceFile */ ||
- scopeNode.kind === 190 /* TemplateExpression */ ||
- scopeNode.kind === 248 /* JsxExpression */ ||
+ scopeNode.kind === 260 /* SourceFile */ ||
+ scopeNode.kind === 193 /* TemplateExpression */ ||
+ scopeNode.kind === 251 /* JsxExpression */ ||
ts.isStatement(scopeNode);
}
/// TODO filter meaning based on the current context
@@ -64958,11 +66992,11 @@ var ts;
return true;
}
if (contextToken.kind === 28 /* GreaterThanToken */ && contextToken.parent) {
- if (contextToken.parent.kind === 244 /* JsxOpeningElement */) {
+ if (contextToken.parent.kind === 247 /* JsxOpeningElement */) {
return true;
}
- if (contextToken.parent.kind === 245 /* JsxClosingElement */ || contextToken.parent.kind === 243 /* JsxSelfClosingElement */) {
- return contextToken.parent.parent && contextToken.parent.parent.kind === 242 /* JsxElement */;
+ if (contextToken.parent.kind === 248 /* JsxClosingElement */ || contextToken.parent.kind === 246 /* JsxSelfClosingElement */) {
+ return contextToken.parent.parent && contextToken.parent.parent.kind === 245 /* JsxElement */;
}
}
return false;
@@ -64972,40 +67006,40 @@ var ts;
var containingNodeKind = previousToken.parent.kind;
switch (previousToken.kind) {
case 25 /* CommaToken */:
- return containingNodeKind === 175 /* CallExpression */ // func( a, |
- || containingNodeKind === 149 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
- || containingNodeKind === 176 /* NewExpression */ // new C(a, |
- || containingNodeKind === 171 /* ArrayLiteralExpression */ // [a, |
- || containingNodeKind === 188 /* BinaryExpression */ // const x = (a, |
- || containingNodeKind === 157 /* FunctionType */; // var x: (s: string, list|
+ return containingNodeKind === 178 /* CallExpression */ // func( a, |
+ || containingNodeKind === 150 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
+ || containingNodeKind === 179 /* NewExpression */ // new C(a, |
+ || containingNodeKind === 174 /* ArrayLiteralExpression */ // [a, |
+ || containingNodeKind === 191 /* BinaryExpression */ // const x = (a, |
+ || containingNodeKind === 158 /* FunctionType */; // var x: (s: string, list|
case 18 /* OpenParenToken */:
- return containingNodeKind === 175 /* CallExpression */ // func( |
- || containingNodeKind === 149 /* Constructor */ // constructor( |
- || containingNodeKind === 176 /* NewExpression */ // new C(a|
- || containingNodeKind === 179 /* ParenthesizedExpression */ // const x = (a|
- || containingNodeKind === 165 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */
+ return containingNodeKind === 178 /* CallExpression */ // func( |
+ || containingNodeKind === 150 /* Constructor */ // constructor( |
+ || containingNodeKind === 179 /* NewExpression */ // new C(a|
+ || containingNodeKind === 182 /* ParenthesizedExpression */ // const x = (a|
+ || containingNodeKind === 166 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */
case 20 /* OpenBracketToken */:
- return containingNodeKind === 171 /* ArrayLiteralExpression */ // [ |
- || containingNodeKind === 154 /* IndexSignature */ // [ | : string ]
- || containingNodeKind === 141 /* ComputedPropertyName */; // [ | /* this can become an index signature */
- case 126 /* ModuleKeyword */: // module |
- case 127 /* NamespaceKeyword */:
+ return containingNodeKind === 174 /* ArrayLiteralExpression */ // [ |
+ || containingNodeKind === 155 /* IndexSignature */ // [ | : string ]
+ || containingNodeKind === 142 /* ComputedPropertyName */; // [ | /* this can become an index signature */
+ case 127 /* ModuleKeyword */: // module |
+ case 128 /* NamespaceKeyword */:
return true;
case 22 /* DotToken */:
- return containingNodeKind === 226 /* ModuleDeclaration */; // module A.|
+ return containingNodeKind === 229 /* ModuleDeclaration */; // module A.|
case 16 /* OpenBraceToken */:
- return containingNodeKind === 222 /* ClassDeclaration */; // class A{ |
+ return containingNodeKind === 225 /* ClassDeclaration */; // class A{ |
case 57 /* EqualsToken */:
- return containingNodeKind === 219 /* VariableDeclaration */ // const x = a|
- || containingNodeKind === 188 /* BinaryExpression */; // x = a|
+ return containingNodeKind === 222 /* VariableDeclaration */ // const x = a|
+ || containingNodeKind === 191 /* BinaryExpression */; // x = a|
case 13 /* TemplateHead */:
- return containingNodeKind === 190 /* TemplateExpression */; // `aa ${|
+ return containingNodeKind === 193 /* TemplateExpression */; // `aa ${|
case 14 /* TemplateMiddle */:
- return containingNodeKind === 198 /* TemplateSpan */; // `aa ${10} dd ${|
+ return containingNodeKind === 201 /* TemplateSpan */; // `aa ${10} dd ${|
case 113 /* PublicKeyword */:
case 111 /* PrivateKeyword */:
case 112 /* ProtectedKeyword */:
- return containingNodeKind === 146 /* PropertyDeclaration */; // class A{ public |
+ return containingNodeKind === 147 /* PropertyDeclaration */; // class A{ public |
}
// Previous token may have been a keyword that was converted to an identifier.
switch (previousToken.getText()) {
@@ -65048,7 +67082,7 @@ var ts;
isMemberCompletion = true;
var typeForObject;
var existingMembers;
- if (objectLikeContainer.kind === 172 /* ObjectLiteralExpression */) {
+ if (objectLikeContainer.kind === 175 /* ObjectLiteralExpression */) {
// We are completing on contextual types, but may also include properties
// other than those within the declared type.
isNewIdentifierLocation = true;
@@ -65058,7 +67092,7 @@ var ts;
typeForObject = typeForObject && typeForObject.getNonNullableType();
existingMembers = objectLikeContainer.properties;
}
- else if (objectLikeContainer.kind === 168 /* ObjectBindingPattern */) {
+ else if (objectLikeContainer.kind === 171 /* ObjectBindingPattern */) {
// We are *only* completing on properties from the type being destructured.
isNewIdentifierLocation = false;
var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent);
@@ -65069,11 +67103,11 @@ var ts;
// Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -
// type of parameter will flow in from the contextual type of the function
var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type);
- if (!canGetType && rootDeclaration.kind === 143 /* Parameter */) {
+ if (!canGetType && rootDeclaration.kind === 144 /* Parameter */) {
if (ts.isExpression(rootDeclaration.parent)) {
canGetType = !!typeChecker.getContextualType(rootDeclaration.parent);
}
- else if (rootDeclaration.parent.kind === 148 /* MethodDeclaration */ || rootDeclaration.parent.kind === 151 /* SetAccessor */) {
+ else if (rootDeclaration.parent.kind === 149 /* MethodDeclaration */ || rootDeclaration.parent.kind === 152 /* SetAccessor */) {
canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent);
}
}
@@ -65115,9 +67149,9 @@ var ts;
* @returns true if 'symbols' was successfully populated; false otherwise.
*/
function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) {
- var declarationKind = namedImportsOrExports.kind === 234 /* NamedImports */ ?
- 231 /* ImportDeclaration */ :
- 237 /* ExportDeclaration */;
+ var declarationKind = namedImportsOrExports.kind === 237 /* NamedImports */ ?
+ 234 /* ImportDeclaration */ :
+ 240 /* ExportDeclaration */;
var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind);
var moduleSpecifier = importOrExportDeclaration.moduleSpecifier;
if (!moduleSpecifier) {
@@ -65142,9 +67176,9 @@ var ts;
switch (contextToken.kind) {
case 16 /* OpenBraceToken */: // const x = { |
case 25 /* CommaToken */:
- var parent_18 = contextToken.parent;
- if (parent_18 && (parent_18.kind === 172 /* ObjectLiteralExpression */ || parent_18.kind === 168 /* ObjectBindingPattern */)) {
- return parent_18;
+ var parent_17 = contextToken.parent;
+ if (parent_17 && (parent_17.kind === 175 /* ObjectLiteralExpression */ || parent_17.kind === 171 /* ObjectBindingPattern */)) {
+ return parent_17;
}
break;
}
@@ -65161,8 +67195,8 @@ var ts;
case 16 /* OpenBraceToken */: // import { |
case 25 /* CommaToken */:
switch (contextToken.parent.kind) {
- case 234 /* NamedImports */:
- case 238 /* NamedExports */:
+ case 237 /* NamedImports */:
+ case 241 /* NamedExports */:
return contextToken.parent;
}
}
@@ -65171,37 +67205,37 @@ var ts;
}
function tryGetContainingJsxElement(contextToken) {
if (contextToken) {
- var parent_19 = contextToken.parent;
+ var parent_18 = contextToken.parent;
switch (contextToken.kind) {
case 27 /* LessThanSlashToken */:
case 40 /* SlashToken */:
case 70 /* Identifier */:
- case 246 /* JsxAttribute */:
- case 247 /* JsxSpreadAttribute */:
- if (parent_19 && (parent_19.kind === 243 /* JsxSelfClosingElement */ || parent_19.kind === 244 /* JsxOpeningElement */)) {
- return parent_19;
+ case 249 /* JsxAttribute */:
+ case 250 /* JsxSpreadAttribute */:
+ if (parent_18 && (parent_18.kind === 246 /* JsxSelfClosingElement */ || parent_18.kind === 247 /* JsxOpeningElement */)) {
+ return parent_18;
}
- else if (parent_19.kind === 246 /* JsxAttribute */) {
- return parent_19.parent;
+ else if (parent_18.kind === 249 /* JsxAttribute */) {
+ return parent_18.parent;
}
break;
// The context token is the closing } or " of an attribute, which means
// its parent is a JsxExpression, whose parent is a JsxAttribute,
// whose parent is a JsxOpeningLikeElement
case 9 /* StringLiteral */:
- if (parent_19 && ((parent_19.kind === 246 /* JsxAttribute */) || (parent_19.kind === 247 /* JsxSpreadAttribute */))) {
- return parent_19.parent;
+ if (parent_18 && ((parent_18.kind === 249 /* JsxAttribute */) || (parent_18.kind === 250 /* JsxSpreadAttribute */))) {
+ return parent_18.parent;
}
break;
case 17 /* CloseBraceToken */:
- if (parent_19 &&
- parent_19.kind === 248 /* JsxExpression */ &&
- parent_19.parent &&
- (parent_19.parent.kind === 246 /* JsxAttribute */)) {
- return parent_19.parent.parent;
+ if (parent_18 &&
+ parent_18.kind === 251 /* JsxExpression */ &&
+ parent_18.parent &&
+ (parent_18.parent.kind === 249 /* JsxAttribute */)) {
+ return parent_18.parent.parent;
}
- if (parent_19 && parent_19.kind === 247 /* JsxSpreadAttribute */) {
- return parent_19.parent;
+ if (parent_18 && parent_18.kind === 250 /* JsxSpreadAttribute */) {
+ return parent_18.parent;
}
break;
}
@@ -65210,16 +67244,16 @@ var ts;
}
function isFunction(kind) {
switch (kind) {
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
- case 221 /* FunctionDeclaration */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 154 /* IndexSignature */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 224 /* FunctionDeclaration */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 155 /* IndexSignature */:
return true;
}
return false;
@@ -65231,66 +67265,66 @@ var ts;
var containingNodeKind = contextToken.parent.kind;
switch (contextToken.kind) {
case 25 /* CommaToken */:
- return containingNodeKind === 219 /* VariableDeclaration */ ||
- containingNodeKind === 220 /* VariableDeclarationList */ ||
- containingNodeKind === 201 /* VariableStatement */ ||
- containingNodeKind === 225 /* EnumDeclaration */ ||
+ return containingNodeKind === 222 /* VariableDeclaration */ ||
+ containingNodeKind === 223 /* VariableDeclarationList */ ||
+ containingNodeKind === 204 /* VariableStatement */ ||
+ containingNodeKind === 228 /* EnumDeclaration */ ||
isFunction(containingNodeKind) ||
- containingNodeKind === 222 /* ClassDeclaration */ ||
- containingNodeKind === 193 /* ClassExpression */ ||
- containingNodeKind === 223 /* InterfaceDeclaration */ ||
- containingNodeKind === 169 /* ArrayBindingPattern */ ||
- containingNodeKind === 224 /* TypeAliasDeclaration */; // type Map, K, |
+ containingNodeKind === 225 /* ClassDeclaration */ ||
+ containingNodeKind === 196 /* ClassExpression */ ||
+ containingNodeKind === 226 /* InterfaceDeclaration */ ||
+ containingNodeKind === 172 /* ArrayBindingPattern */ ||
+ containingNodeKind === 227 /* TypeAliasDeclaration */; // type Map, K, |
case 22 /* DotToken */:
- return containingNodeKind === 169 /* ArrayBindingPattern */; // var [.|
+ return containingNodeKind === 172 /* ArrayBindingPattern */; // var [.|
case 55 /* ColonToken */:
- return containingNodeKind === 170 /* BindingElement */; // var {x :html|
+ return containingNodeKind === 173 /* BindingElement */; // var {x :html|
case 20 /* OpenBracketToken */:
- return containingNodeKind === 169 /* ArrayBindingPattern */; // var [x|
+ return containingNodeKind === 172 /* ArrayBindingPattern */; // var [x|
case 18 /* OpenParenToken */:
- return containingNodeKind === 252 /* CatchClause */ ||
+ return containingNodeKind === 255 /* CatchClause */ ||
isFunction(containingNodeKind);
case 16 /* OpenBraceToken */:
- return containingNodeKind === 225 /* EnumDeclaration */ ||
- containingNodeKind === 223 /* InterfaceDeclaration */ ||
- containingNodeKind === 160 /* TypeLiteral */; // const x : { |
+ return containingNodeKind === 228 /* EnumDeclaration */ ||
+ containingNodeKind === 226 /* InterfaceDeclaration */ ||
+ containingNodeKind === 161 /* TypeLiteral */; // const x : { |
case 24 /* SemicolonToken */:
- return containingNodeKind === 145 /* PropertySignature */ &&
+ return containingNodeKind === 146 /* PropertySignature */ &&
contextToken.parent && contextToken.parent.parent &&
- (contextToken.parent.parent.kind === 223 /* InterfaceDeclaration */ ||
- contextToken.parent.parent.kind === 160 /* TypeLiteral */); // const x : { a; |
+ (contextToken.parent.parent.kind === 226 /* InterfaceDeclaration */ ||
+ contextToken.parent.parent.kind === 161 /* TypeLiteral */); // const x : { a; |
case 26 /* LessThanToken */:
- return containingNodeKind === 222 /* ClassDeclaration */ ||
- containingNodeKind === 193 /* ClassExpression */ ||
- containingNodeKind === 223 /* InterfaceDeclaration */ ||
- containingNodeKind === 224 /* TypeAliasDeclaration */ ||
+ return containingNodeKind === 225 /* ClassDeclaration */ ||
+ containingNodeKind === 196 /* ClassExpression */ ||
+ containingNodeKind === 226 /* InterfaceDeclaration */ ||
+ containingNodeKind === 227 /* TypeAliasDeclaration */ ||
isFunction(containingNodeKind);
case 114 /* StaticKeyword */:
- return containingNodeKind === 146 /* PropertyDeclaration */;
+ return containingNodeKind === 147 /* PropertyDeclaration */;
case 23 /* DotDotDotToken */:
- return containingNodeKind === 143 /* Parameter */ ||
+ return containingNodeKind === 144 /* Parameter */ ||
(contextToken.parent && contextToken.parent.parent &&
- contextToken.parent.parent.kind === 169 /* ArrayBindingPattern */); // var [...z|
+ contextToken.parent.parent.kind === 172 /* ArrayBindingPattern */); // var [...z|
case 113 /* PublicKeyword */:
case 111 /* PrivateKeyword */:
case 112 /* ProtectedKeyword */:
- return containingNodeKind === 143 /* Parameter */;
+ return containingNodeKind === 144 /* Parameter */;
case 117 /* AsKeyword */:
- return containingNodeKind === 235 /* ImportSpecifier */ ||
- containingNodeKind === 239 /* ExportSpecifier */ ||
- containingNodeKind === 233 /* NamespaceImport */;
+ return containingNodeKind === 238 /* ImportSpecifier */ ||
+ containingNodeKind === 242 /* ExportSpecifier */ ||
+ containingNodeKind === 236 /* NamespaceImport */;
case 74 /* ClassKeyword */:
case 82 /* EnumKeyword */:
case 108 /* InterfaceKeyword */:
case 88 /* FunctionKeyword */:
case 103 /* VarKeyword */:
case 124 /* GetKeyword */:
- case 132 /* SetKeyword */:
+ case 133 /* SetKeyword */:
case 90 /* ImportKeyword */:
case 109 /* LetKeyword */:
case 75 /* ConstKeyword */:
case 115 /* YieldKeyword */:
- case 135 /* TypeKeyword */:
+ case 136 /* TypeKeyword */:
return true;
}
// Previous token may have been a keyword that was converted to an identifier.
@@ -65338,8 +67372,8 @@ var ts;
if (element.getStart() <= position && position <= element.getEnd()) {
continue;
}
- var name_47 = element.propertyName || element.name;
- existingImportsOrExports[name_47.text] = true;
+ var name_43 = element.propertyName || element.name;
+ existingImportsOrExports[name_43.text] = true;
}
if (!ts.someProperties(existingImportsOrExports)) {
return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; });
@@ -65360,10 +67394,12 @@ var ts;
for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) {
var m = existingMembers_1[_i];
// Ignore omitted expressions for missing members
- if (m.kind !== 253 /* PropertyAssignment */ &&
- m.kind !== 254 /* ShorthandPropertyAssignment */ &&
- m.kind !== 170 /* BindingElement */ &&
- m.kind !== 148 /* MethodDeclaration */) {
+ if (m.kind !== 256 /* PropertyAssignment */ &&
+ m.kind !== 257 /* ShorthandPropertyAssignment */ &&
+ m.kind !== 173 /* BindingElement */ &&
+ m.kind !== 149 /* MethodDeclaration */ &&
+ m.kind !== 151 /* GetAccessor */ &&
+ m.kind !== 152 /* SetAccessor */) {
continue;
}
// If this is the current item we are editing right now, do not filter it out
@@ -65371,7 +67407,7 @@ var ts;
continue;
}
var existingName = void 0;
- if (m.kind === 170 /* BindingElement */ && m.propertyName) {
+ if (m.kind === 173 /* BindingElement */ && m.propertyName) {
// include only identifiers in completion list
if (m.propertyName.kind === 70 /* Identifier */) {
existingName = m.propertyName.text;
@@ -65401,7 +67437,7 @@ var ts;
if (attr.getStart() <= position && position <= attr.getEnd()) {
continue;
}
- if (attr.kind === 246 /* JsxAttribute */) {
+ if (attr.kind === 249 /* JsxAttribute */) {
seenNames[attr.name.text] = true;
}
}
@@ -65451,7 +67487,7 @@ var ts;
}
// A cache of completion entries for keywords, these do not change between sessions
var keywordCompletions = [];
- for (var i = 71 /* FirstKeyword */; i <= 139 /* LastKeyword */; i++) {
+ for (var i = 71 /* FirstKeyword */; i <= 140 /* LastKeyword */; i++) {
keywordCompletions.push({
name: ts.tokenToString(i),
kind: ts.ScriptElementKind.keyword,
@@ -65528,7 +67564,7 @@ var ts;
function getSemanticDocumentHighlights(node) {
if (node.kind === 70 /* Identifier */ ||
node.kind === 98 /* ThisKeyword */ ||
- node.kind === 166 /* ThisType */ ||
+ node.kind === 167 /* ThisType */ ||
node.kind === 96 /* SuperKeyword */ ||
node.kind === 9 /* StringLiteral */ ||
ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) {
@@ -65582,75 +67618,75 @@ var ts;
switch (node.kind) {
case 89 /* IfKeyword */:
case 81 /* ElseKeyword */:
- if (hasKind(node.parent, 204 /* IfStatement */)) {
+ if (hasKind(node.parent, 207 /* IfStatement */)) {
return getIfElseOccurrences(node.parent);
}
break;
case 95 /* ReturnKeyword */:
- if (hasKind(node.parent, 212 /* ReturnStatement */)) {
+ if (hasKind(node.parent, 215 /* ReturnStatement */)) {
return getReturnOccurrences(node.parent);
}
break;
case 99 /* ThrowKeyword */:
- if (hasKind(node.parent, 216 /* ThrowStatement */)) {
+ if (hasKind(node.parent, 219 /* ThrowStatement */)) {
return getThrowOccurrences(node.parent);
}
break;
case 73 /* CatchKeyword */:
- if (hasKind(parent(parent(node)), 217 /* TryStatement */)) {
+ if (hasKind(parent(parent(node)), 220 /* TryStatement */)) {
return getTryCatchFinallyOccurrences(node.parent.parent);
}
break;
case 101 /* TryKeyword */:
case 86 /* FinallyKeyword */:
- if (hasKind(parent(node), 217 /* TryStatement */)) {
+ if (hasKind(parent(node), 220 /* TryStatement */)) {
return getTryCatchFinallyOccurrences(node.parent);
}
break;
case 97 /* SwitchKeyword */:
- if (hasKind(node.parent, 214 /* SwitchStatement */)) {
+ if (hasKind(node.parent, 217 /* SwitchStatement */)) {
return getSwitchCaseDefaultOccurrences(node.parent);
}
break;
case 72 /* CaseKeyword */:
case 78 /* DefaultKeyword */:
- if (hasKind(parent(parent(parent(node))), 214 /* SwitchStatement */)) {
+ if (hasKind(parent(parent(parent(node))), 217 /* SwitchStatement */)) {
return getSwitchCaseDefaultOccurrences(node.parent.parent.parent);
}
break;
case 71 /* BreakKeyword */:
case 76 /* ContinueKeyword */:
- if (hasKind(node.parent, 211 /* BreakStatement */) || hasKind(node.parent, 210 /* ContinueStatement */)) {
+ if (hasKind(node.parent, 214 /* BreakStatement */) || hasKind(node.parent, 213 /* ContinueStatement */)) {
return getBreakOrContinueStatementOccurrences(node.parent);
}
break;
case 87 /* ForKeyword */:
- if (hasKind(node.parent, 207 /* ForStatement */) ||
- hasKind(node.parent, 208 /* ForInStatement */) ||
- hasKind(node.parent, 209 /* ForOfStatement */)) {
+ if (hasKind(node.parent, 210 /* ForStatement */) ||
+ hasKind(node.parent, 211 /* ForInStatement */) ||
+ hasKind(node.parent, 212 /* ForOfStatement */)) {
return getLoopBreakContinueOccurrences(node.parent);
}
break;
case 105 /* WhileKeyword */:
case 80 /* DoKeyword */:
- if (hasKind(node.parent, 206 /* WhileStatement */) || hasKind(node.parent, 205 /* DoStatement */)) {
+ if (hasKind(node.parent, 209 /* WhileStatement */) || hasKind(node.parent, 208 /* DoStatement */)) {
return getLoopBreakContinueOccurrences(node.parent);
}
break;
case 122 /* ConstructorKeyword */:
- if (hasKind(node.parent, 149 /* Constructor */)) {
+ if (hasKind(node.parent, 150 /* Constructor */)) {
return getConstructorOccurrences(node.parent);
}
break;
case 124 /* GetKeyword */:
- case 132 /* SetKeyword */:
- if (hasKind(node.parent, 150 /* GetAccessor */) || hasKind(node.parent, 151 /* SetAccessor */)) {
+ case 133 /* SetKeyword */:
+ if (hasKind(node.parent, 151 /* GetAccessor */) || hasKind(node.parent, 152 /* SetAccessor */)) {
return getGetAndSetOccurrences(node.parent);
}
break;
default:
if (ts.isModifierKind(node.kind) && node.parent &&
- (ts.isDeclaration(node.parent) || node.parent.kind === 201 /* VariableStatement */)) {
+ (ts.isDeclaration(node.parent) || node.parent.kind === 204 /* VariableStatement */)) {
return getModifierOccurrences(node.kind, node.parent);
}
}
@@ -65666,10 +67702,10 @@ var ts;
aggregate(node);
return statementAccumulator;
function aggregate(node) {
- if (node.kind === 216 /* ThrowStatement */) {
+ if (node.kind === 219 /* ThrowStatement */) {
statementAccumulator.push(node);
}
- else if (node.kind === 217 /* TryStatement */) {
+ else if (node.kind === 220 /* TryStatement */) {
var tryStatement = node;
if (tryStatement.catchClause) {
aggregate(tryStatement.catchClause);
@@ -65696,19 +67732,19 @@ var ts;
function getThrowStatementOwner(throwStatement) {
var child = throwStatement;
while (child.parent) {
- var parent_20 = child.parent;
- if (ts.isFunctionBlock(parent_20) || parent_20.kind === 256 /* SourceFile */) {
- return parent_20;
+ var parent_19 = child.parent;
+ if (ts.isFunctionBlock(parent_19) || parent_19.kind === 260 /* SourceFile */) {
+ return parent_19;
}
// A throw-statement is only owned by a try-statement if the try-statement has
// a catch clause, and if the throw-statement occurs within the try block.
- if (parent_20.kind === 217 /* TryStatement */) {
- var tryStatement = parent_20;
+ if (parent_19.kind === 220 /* TryStatement */) {
+ var tryStatement = parent_19;
if (tryStatement.tryBlock === child && tryStatement.catchClause) {
return child;
}
}
- child = parent_20;
+ child = parent_19;
}
return undefined;
}
@@ -65717,7 +67753,7 @@ var ts;
aggregate(node);
return statementAccumulator;
function aggregate(node) {
- if (node.kind === 211 /* BreakStatement */ || node.kind === 210 /* ContinueStatement */) {
+ if (node.kind === 214 /* BreakStatement */ || node.kind === 213 /* ContinueStatement */) {
statementAccumulator.push(node);
}
else if (!ts.isFunctionLike(node)) {
@@ -65732,16 +67768,16 @@ var ts;
function getBreakOrContinueOwner(statement) {
for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) {
switch (node_1.kind) {
- case 214 /* SwitchStatement */:
- if (statement.kind === 210 /* ContinueStatement */) {
+ case 217 /* SwitchStatement */:
+ if (statement.kind === 213 /* ContinueStatement */) {
continue;
}
// Fall through.
- case 207 /* ForStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
- case 206 /* WhileStatement */:
- case 205 /* DoStatement */:
+ case 210 /* ForStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
+ case 209 /* WhileStatement */:
+ case 208 /* DoStatement */:
if (!statement.label || isLabeledBy(node_1, statement.label.text)) {
return node_1;
}
@@ -65760,24 +67796,24 @@ var ts;
var container = declaration.parent;
// Make sure we only highlight the keyword when it makes sense to do so.
if (ts.isAccessibilityModifier(modifier)) {
- if (!(container.kind === 222 /* ClassDeclaration */ ||
- container.kind === 193 /* ClassExpression */ ||
- (declaration.kind === 143 /* Parameter */ && hasKind(container, 149 /* Constructor */)))) {
+ if (!(container.kind === 225 /* ClassDeclaration */ ||
+ container.kind === 196 /* ClassExpression */ ||
+ (declaration.kind === 144 /* Parameter */ && hasKind(container, 150 /* Constructor */)))) {
return undefined;
}
}
else if (modifier === 114 /* StaticKeyword */) {
- if (!(container.kind === 222 /* ClassDeclaration */ || container.kind === 193 /* ClassExpression */)) {
+ if (!(container.kind === 225 /* ClassDeclaration */ || container.kind === 196 /* ClassExpression */)) {
return undefined;
}
}
else if (modifier === 83 /* ExportKeyword */ || modifier === 123 /* DeclareKeyword */) {
- if (!(container.kind === 227 /* ModuleBlock */ || container.kind === 256 /* SourceFile */)) {
+ if (!(container.kind === 230 /* ModuleBlock */ || container.kind === 260 /* SourceFile */)) {
return undefined;
}
}
else if (modifier === 116 /* AbstractKeyword */) {
- if (!(container.kind === 222 /* ClassDeclaration */ || declaration.kind === 222 /* ClassDeclaration */)) {
+ if (!(container.kind === 225 /* ClassDeclaration */ || declaration.kind === 225 /* ClassDeclaration */)) {
return undefined;
}
}
@@ -65789,8 +67825,8 @@ var ts;
var modifierFlag = getFlagFromModifier(modifier);
var nodes;
switch (container.kind) {
- case 227 /* ModuleBlock */:
- case 256 /* SourceFile */:
+ case 230 /* ModuleBlock */:
+ case 260 /* SourceFile */:
// Container is either a class declaration or the declaration is a classDeclaration
if (modifierFlag & 128 /* Abstract */) {
nodes = declaration.members.concat(declaration);
@@ -65799,17 +67835,17 @@ var ts;
nodes = container.statements;
}
break;
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
nodes = container.parameters.concat(container.parent.members);
break;
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
nodes = container.members;
// If we're an accessibility modifier, we're in an instance member and should search
// the constructor's parameter list for instance members as well.
if (modifierFlag & 28 /* AccessibilityModifier */) {
var constructor = ts.forEach(container.members, function (member) {
- return member.kind === 149 /* Constructor */ && member;
+ return member.kind === 150 /* Constructor */ && member;
});
if (constructor) {
nodes = nodes.concat(constructor.parameters);
@@ -65862,13 +67898,13 @@ var ts;
}
function getGetAndSetOccurrences(accessorDeclaration) {
var keywords = [];
- tryPushAccessorKeyword(accessorDeclaration.symbol, 150 /* GetAccessor */);
- tryPushAccessorKeyword(accessorDeclaration.symbol, 151 /* SetAccessor */);
+ tryPushAccessorKeyword(accessorDeclaration.symbol, 151 /* GetAccessor */);
+ tryPushAccessorKeyword(accessorDeclaration.symbol, 152 /* SetAccessor */);
return ts.map(keywords, getHighlightSpanForNode);
function tryPushAccessorKeyword(accessorSymbol, accessorKind) {
var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind);
if (accessor) {
- ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 124 /* GetKeyword */, 132 /* SetKeyword */); });
+ ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 124 /* GetKeyword */, 133 /* SetKeyword */); });
}
}
}
@@ -65886,7 +67922,7 @@ var ts;
var keywords = [];
if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87 /* ForKeyword */, 105 /* WhileKeyword */, 80 /* DoKeyword */)) {
// If we succeeded and got a do-while loop, then start looking for a 'while' keyword.
- if (loopNode.kind === 205 /* DoStatement */) {
+ if (loopNode.kind === 208 /* DoStatement */) {
var loopTokens = loopNode.getChildren();
for (var i = loopTokens.length - 1; i >= 0; i--) {
if (pushKeywordIf(keywords, loopTokens[i], 105 /* WhileKeyword */)) {
@@ -65907,13 +67943,13 @@ var ts;
var owner = getBreakOrContinueOwner(breakOrContinueStatement);
if (owner) {
switch (owner.kind) {
- case 207 /* ForStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
- case 205 /* DoStatement */:
- case 206 /* WhileStatement */:
+ case 210 /* ForStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
+ case 208 /* DoStatement */:
+ case 209 /* WhileStatement */:
return getLoopBreakContinueOccurrences(owner);
- case 214 /* SwitchStatement */:
+ case 217 /* SwitchStatement */:
return getSwitchCaseDefaultOccurrences(owner);
}
}
@@ -65967,7 +68003,7 @@ var ts;
function getReturnOccurrences(returnStatement) {
var func = ts.getContainingFunction(returnStatement);
// If we didn't find a containing function with a block body, bail out.
- if (!(func && hasKind(func.body, 200 /* Block */))) {
+ if (!(func && hasKind(func.body, 203 /* Block */))) {
return undefined;
}
var keywords = [];
@@ -65983,7 +68019,7 @@ var ts;
function getIfElseOccurrences(ifStatement) {
var keywords = [];
// Traverse upwards through all parent if-statements linked by their else-branches.
- while (hasKind(ifStatement.parent, 204 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) {
+ while (hasKind(ifStatement.parent, 207 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) {
ifStatement = ifStatement.parent;
}
// Now traverse back down through the else branches, aggregating if/else keywords of if-statements.
@@ -65996,7 +68032,7 @@ var ts;
break;
}
}
- if (!hasKind(ifStatement.elseStatement, 204 /* IfStatement */)) {
+ if (!hasKind(ifStatement.elseStatement, 207 /* IfStatement */)) {
break;
}
ifStatement = ifStatement.elseStatement;
@@ -66039,7 +68075,7 @@ var ts;
* Note: 'node' cannot be a SourceFile.
*/
function isLabeledBy(node, labelName) {
- for (var owner = node.parent; owner.kind === 215 /* LabeledStatement */; owner = owner.parent) {
+ for (var owner = node.parent; owner.kind === 218 /* LabeledStatement */; owner = owner.parent) {
if (owner.label.text === labelName) {
return true;
}
@@ -66273,12 +68309,12 @@ var ts;
function getAliasSymbolForPropertyNameSymbol(symbol, location) {
if (symbol.flags & 8388608 /* Alias */) {
// Default import get alias
- var defaultImport = ts.getDeclarationOfKind(symbol, 232 /* ImportClause */);
+ var defaultImport = ts.getDeclarationOfKind(symbol, 235 /* ImportClause */);
if (defaultImport) {
return typeChecker.getAliasedSymbol(symbol);
}
- var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 235 /* ImportSpecifier */ ||
- declaration.kind === 239 /* ExportSpecifier */) ? declaration : undefined; });
+ var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 238 /* ImportSpecifier */ ||
+ declaration.kind === 242 /* ExportSpecifier */) ? declaration : undefined; });
if (importOrExportSpecifier &&
// export { a }
(!importOrExportSpecifier.propertyName ||
@@ -66286,7 +68322,7 @@ var ts;
importOrExportSpecifier.propertyName === location)) {
// If Import specifier -> get alias
// else Export specifier -> get local target
- return importOrExportSpecifier.kind === 235 /* ImportSpecifier */ ?
+ return importOrExportSpecifier.kind === 238 /* ImportSpecifier */ ?
typeChecker.getAliasedSymbol(symbol) :
typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier);
}
@@ -66301,14 +68337,14 @@ var ts;
typeChecker.getPropertySymbolOfDestructuringAssignment(location);
}
function isObjectBindingPatternElementWithoutPropertyName(symbol) {
- var bindingElement = ts.getDeclarationOfKind(symbol, 170 /* BindingElement */);
+ var bindingElement = ts.getDeclarationOfKind(symbol, 173 /* BindingElement */);
return bindingElement &&
- bindingElement.parent.kind === 168 /* ObjectBindingPattern */ &&
+ bindingElement.parent.kind === 171 /* ObjectBindingPattern */ &&
!bindingElement.propertyName;
}
function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) {
if (isObjectBindingPatternElementWithoutPropertyName(symbol)) {
- var bindingElement = ts.getDeclarationOfKind(symbol, 170 /* BindingElement */);
+ var bindingElement = ts.getDeclarationOfKind(symbol, 173 /* BindingElement */);
var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent);
return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text);
}
@@ -66338,14 +68374,14 @@ var ts;
// If this is the symbol of a named function expression or named class expression,
// then named references are limited to its own scope.
var valueDeclaration = symbol.valueDeclaration;
- if (valueDeclaration && (valueDeclaration.kind === 180 /* FunctionExpression */ || valueDeclaration.kind === 193 /* ClassExpression */)) {
+ if (valueDeclaration && (valueDeclaration.kind === 183 /* FunctionExpression */ || valueDeclaration.kind === 196 /* ClassExpression */)) {
return valueDeclaration;
}
// If this is private property or method, the scope is the containing class
if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) {
var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8 /* Private */) ? d : undefined; });
if (privateDeclaration) {
- return ts.getAncestor(privateDeclaration, 222 /* ClassDeclaration */);
+ return ts.getAncestor(privateDeclaration, 225 /* ClassDeclaration */);
}
}
// If the symbol is an import we would like to find it if we are looking for what it imports.
@@ -66376,7 +68412,7 @@ var ts;
// Different declarations have different containers, bail out
return undefined;
}
- if (container.kind === 256 /* SourceFile */ && !ts.isExternalModule(container)) {
+ if (container.kind === 260 /* SourceFile */ && !ts.isExternalModule(container)) {
// This is a global variable and not an external module, any declaration defined
// within this scope is visible outside the file
return undefined;
@@ -66407,8 +68443,8 @@ var ts;
// We found a match. Make sure it's not part of a larger word (i.e. the char
// before and after it have to be a non-identifier char).
var endPosition = position + symbolNameLength;
- if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 4 /* Latest */)) &&
- (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 4 /* Latest */))) {
+ if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 5 /* Latest */)) &&
+ (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 5 /* Latest */))) {
// Found a real match. Keep searching.
positions.push(position);
}
@@ -66580,14 +68616,14 @@ var ts;
var result = [];
for (var _i = 0, _a = classSymbol.members["__constructor"].declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- ts.Debug.assert(decl.kind === 149 /* Constructor */);
+ ts.Debug.assert(decl.kind === 150 /* Constructor */);
var ctrKeyword = decl.getChildAt(0);
ts.Debug.assert(ctrKeyword.kind === 122 /* ConstructorKeyword */);
result.push(ctrKeyword);
}
ts.forEachProperty(classSymbol.exports, function (member) {
var decl = member.valueDeclaration;
- if (decl && decl.kind === 148 /* MethodDeclaration */) {
+ if (decl && decl.kind === 149 /* MethodDeclaration */) {
var body = decl.body;
if (body) {
forEachDescendantOfKind(body, 98 /* ThisKeyword */, function (thisKeyword) {
@@ -66610,7 +68646,7 @@ var ts;
var result = [];
for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- ts.Debug.assert(decl.kind === 149 /* Constructor */);
+ ts.Debug.assert(decl.kind === 150 /* Constructor */);
var body = decl.body;
if (body) {
forEachDescendantOfKind(body, 96 /* SuperKeyword */, function (node) {
@@ -66652,7 +68688,7 @@ var ts;
result.push(getReferenceEntryFromNode(refNode.parent));
}
else if (refNode.kind === 70 /* Identifier */) {
- if (refNode.parent.kind === 254 /* ShorthandPropertyAssignment */) {
+ if (refNode.parent.kind === 257 /* ShorthandPropertyAssignment */) {
// Go ahead and dereference the shorthand assignment by going to its definition
getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result);
}
@@ -66665,24 +68701,24 @@ var ts;
// If we got a type reference, try and see if the reference applies to any expressions that can implement an interface
var containingTypeReference = getContainingTypeReference(refNode);
if (containingTypeReference) {
- var parent_21 = containingTypeReference.parent;
- if (ts.isVariableLike(parent_21) && parent_21.type === containingTypeReference && parent_21.initializer && isImplementationExpression(parent_21.initializer)) {
- maybeAdd(getReferenceEntryFromNode(parent_21.initializer));
+ var parent_20 = containingTypeReference.parent;
+ if (ts.isVariableLike(parent_20) && parent_20.type === containingTypeReference && parent_20.initializer && isImplementationExpression(parent_20.initializer)) {
+ maybeAdd(getReferenceEntryFromNode(parent_20.initializer));
}
- else if (ts.isFunctionLike(parent_21) && parent_21.type === containingTypeReference && parent_21.body) {
- if (parent_21.body.kind === 200 /* Block */) {
- ts.forEachReturnStatement(parent_21.body, function (returnStatement) {
+ else if (ts.isFunctionLike(parent_20) && parent_20.type === containingTypeReference && parent_20.body) {
+ if (parent_20.body.kind === 203 /* Block */) {
+ ts.forEachReturnStatement(parent_20.body, function (returnStatement) {
if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) {
maybeAdd(getReferenceEntryFromNode(returnStatement.expression));
}
});
}
- else if (isImplementationExpression(parent_21.body)) {
- maybeAdd(getReferenceEntryFromNode(parent_21.body));
+ else if (isImplementationExpression(parent_20.body)) {
+ maybeAdd(getReferenceEntryFromNode(parent_20.body));
}
}
- else if (ts.isAssertionExpression(parent_21) && isImplementationExpression(parent_21.expression)) {
- maybeAdd(getReferenceEntryFromNode(parent_21.expression));
+ else if (ts.isAssertionExpression(parent_20) && isImplementationExpression(parent_20.expression)) {
+ maybeAdd(getReferenceEntryFromNode(parent_20.expression));
}
}
}
@@ -66722,12 +68758,12 @@ var ts;
}
function getContainingClassIfInHeritageClause(node) {
if (node && node.parent) {
- if (node.kind === 195 /* ExpressionWithTypeArguments */
- && node.parent.kind === 251 /* HeritageClause */
+ if (node.kind === 198 /* ExpressionWithTypeArguments */
+ && node.parent.kind === 254 /* HeritageClause */
&& ts.isClassLike(node.parent.parent)) {
return node.parent.parent;
}
- else if (node.kind === 70 /* Identifier */ || node.kind === 173 /* PropertyAccessExpression */) {
+ else if (node.kind === 70 /* Identifier */ || node.kind === 176 /* PropertyAccessExpression */) {
return getContainingClassIfInHeritageClause(node.parent);
}
}
@@ -66738,14 +68774,14 @@ var ts;
*/
function isImplementationExpression(node) {
// Unwrap parentheses
- if (node.kind === 179 /* ParenthesizedExpression */) {
+ if (node.kind === 182 /* ParenthesizedExpression */) {
return isImplementationExpression(node.expression);
}
- return node.kind === 181 /* ArrowFunction */ ||
- node.kind === 180 /* FunctionExpression */ ||
- node.kind === 172 /* ObjectLiteralExpression */ ||
- node.kind === 193 /* ClassExpression */ ||
- node.kind === 171 /* ArrayLiteralExpression */;
+ return node.kind === 184 /* ArrowFunction */ ||
+ node.kind === 183 /* FunctionExpression */ ||
+ node.kind === 175 /* ObjectLiteralExpression */ ||
+ node.kind === 196 /* ClassExpression */ ||
+ node.kind === 174 /* ArrayLiteralExpression */;
}
/**
* Determines if the parent symbol occurs somewhere in the child's ancestry. If the parent symbol
@@ -66794,7 +68830,7 @@ var ts;
}
return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration));
}
- else if (declaration.kind === 223 /* InterfaceDeclaration */) {
+ else if (declaration.kind === 226 /* InterfaceDeclaration */) {
if (parentIsInterface) {
return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference);
}
@@ -66822,13 +68858,13 @@ var ts;
// Whether 'super' occurs in a static context within a class.
var staticFlag = 32 /* Static */;
switch (searchSpaceNode.kind) {
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 149 /* Constructor */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 150 /* Constructor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
staticFlag &= ts.getModifierFlags(searchSpaceNode);
searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class
break;
@@ -66860,27 +68896,27 @@ var ts;
// Whether 'this' occurs in a static context within a class.
var staticFlag = 32 /* Static */;
switch (searchSpaceNode.kind) {
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
if (ts.isObjectLiteralMethod(searchSpaceNode)) {
break;
}
// fall through
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 149 /* Constructor */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 150 /* Constructor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
staticFlag &= ts.getModifierFlags(searchSpaceNode);
searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class
break;
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
if (ts.isExternalModule(searchSpaceNode)) {
return undefined;
}
// Fall through
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
break;
// Computed properties in classes are not handled here because references to this are illegal,
// so there is no point finding references to them.
@@ -66889,7 +68925,7 @@ var ts;
}
var references = [];
var possiblePositions;
- if (searchSpaceNode.kind === 256 /* SourceFile */) {
+ if (searchSpaceNode.kind === 260 /* SourceFile */) {
ts.forEach(sourceFiles, function (sourceFile) {
possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd());
getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references);
@@ -66923,28 +68959,28 @@ var ts;
}
var container = ts.getThisContainer(node, /* includeArrowFunctions */ false);
switch (searchSpaceNode.kind) {
- case 180 /* FunctionExpression */:
- case 221 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 224 /* FunctionDeclaration */:
if (searchSpaceNode.symbol === container.symbol) {
result.push(getReferenceEntryFromNode(node));
}
break;
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) {
result.push(getReferenceEntryFromNode(node));
}
break;
- case 193 /* ClassExpression */:
- case 222 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 225 /* ClassDeclaration */:
// Make sure the container belongs to the same class
// and has the appropriate static modifier from the original container.
if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag) {
result.push(getReferenceEntryFromNode(node));
}
break;
- case 256 /* SourceFile */:
- if (container.kind === 256 /* SourceFile */ && !ts.isExternalModule(container)) {
+ case 260 /* SourceFile */:
+ if (container.kind === 260 /* SourceFile */ && !ts.isExternalModule(container)) {
result.push(getReferenceEntryFromNode(node));
}
break;
@@ -66998,7 +69034,7 @@ var ts;
// Search the property symbol
// for ( { property: p2 } of elems) { }
var containingObjectLiteralElement = getContainingObjectLiteralElement(location);
- if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 254 /* ShorthandPropertyAssignment */) {
+ if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 257 /* ShorthandPropertyAssignment */) {
var propertySymbol = getPropertySymbolOfDestructuringAssignment(location);
if (propertySymbol) {
result.push(propertySymbol);
@@ -67046,7 +69082,7 @@ var ts;
// we should include both parameter declaration symbol and property declaration symbol
// Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals.
// Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members
- if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 143 /* Parameter */ &&
+ if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 144 /* Parameter */ &&
ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) {
result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name));
}
@@ -67101,7 +69137,7 @@ var ts;
getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration));
ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference);
}
- else if (declaration.kind === 223 /* InterfaceDeclaration */) {
+ else if (declaration.kind === 226 /* InterfaceDeclaration */) {
ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference);
}
});
@@ -67185,7 +69221,7 @@ var ts;
});
}
function getNameFromObjectLiteralElement(node) {
- if (node.name.kind === 141 /* ComputedPropertyName */) {
+ if (node.name.kind === 142 /* ComputedPropertyName */) {
var nameExpression = node.name.expression;
// treat computed property names where expression is string/numeric literal as just string/numeric literal
if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
@@ -67267,7 +69303,7 @@ var ts;
if (node.initializer) {
return true;
}
- else if (node.kind === 219 /* VariableDeclaration */) {
+ else if (node.kind === 222 /* VariableDeclaration */) {
var parentStatement = getParentStatementOfVariableDeclaration(node);
return parentStatement && ts.hasModifier(parentStatement, 2 /* Ambient */);
}
@@ -67277,18 +69313,18 @@ var ts;
}
else {
switch (node.kind) {
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 225 /* EnumDeclaration */:
- case 226 /* ModuleDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 228 /* EnumDeclaration */:
+ case 229 /* ModuleDeclaration */:
return true;
}
}
return false;
}
function getParentStatementOfVariableDeclaration(node) {
- if (node.parent && node.parent.parent && node.parent.parent.kind === 201 /* VariableStatement */) {
- ts.Debug.assert(node.parent.kind === 220 /* VariableDeclarationList */);
+ if (node.parent && node.parent.parent && node.parent.parent.kind === 204 /* VariableStatement */) {
+ ts.Debug.assert(node.parent.kind === 223 /* VariableDeclarationList */);
return node.parent.parent;
}
}
@@ -67327,10 +69363,10 @@ var ts;
}
var parent = node.parent;
if (parent) {
- if (parent.kind === 187 /* PostfixUnaryExpression */ || parent.kind === 186 /* PrefixUnaryExpression */) {
+ if (parent.kind === 190 /* PostfixUnaryExpression */ || parent.kind === 189 /* PrefixUnaryExpression */) {
return true;
}
- else if (parent.kind === 188 /* BinaryExpression */ && parent.left === node) {
+ else if (parent.kind === 191 /* BinaryExpression */ && parent.left === node) {
var operator = parent.operatorToken.kind;
return 57 /* FirstAssignment */ <= operator && operator <= 69 /* LastAssignment */;
}
@@ -67352,7 +69388,7 @@ var ts;
switch (node.kind) {
case 9 /* StringLiteral */:
case 8 /* NumericLiteral */:
- if (node.parent.kind === 141 /* ComputedPropertyName */) {
+ if (node.parent.kind === 142 /* ComputedPropertyName */) {
return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined;
}
// intential fall through
@@ -67363,11 +69399,11 @@ var ts;
}
function isObjectLiteralPropertyDeclaration(node) {
switch (node.kind) {
- case 253 /* PropertyAssignment */:
- case 254 /* ShorthandPropertyAssignment */:
- case 148 /* MethodDeclaration */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 256 /* PropertyAssignment */:
+ case 257 /* ShorthandPropertyAssignment */:
+ case 149 /* MethodDeclaration */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
return true;
}
return false;
@@ -67442,7 +69478,7 @@ var ts;
//
if (node.kind === 70 /* Identifier */ &&
(node.parent === declaration ||
- (declaration.kind === 235 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 234 /* NamedImports */))) {
+ (declaration.kind === 238 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 237 /* NamedImports */))) {
symbol = typeChecker.getAliasedSymbol(symbol);
}
}
@@ -67451,7 +69487,7 @@ var ts;
// go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition
// is performed at the location of property access, we would like to go to definition of the property in the short-hand
// assignment. This case and others are handled by the following code.
- if (node.parent.kind === 254 /* ShorthandPropertyAssignment */) {
+ if (node.parent.kind === 257 /* ShorthandPropertyAssignment */) {
var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
if (!shorthandSymbol) {
return [];
@@ -67534,8 +69570,8 @@ var ts;
var declarations = [];
var definition;
ts.forEach(signatureDeclarations, function (d) {
- if ((selectConstructors && d.kind === 149 /* Constructor */) ||
- (!selectConstructors && (d.kind === 221 /* FunctionDeclaration */ || d.kind === 148 /* MethodDeclaration */ || d.kind === 147 /* MethodSignature */))) {
+ if ((selectConstructors && d.kind === 150 /* Constructor */) ||
+ (!selectConstructors && (d.kind === 224 /* FunctionDeclaration */ || d.kind === 149 /* MethodDeclaration */ || d.kind === 148 /* MethodSignature */))) {
declarations.push(d);
if (d.body)
definition = d;
@@ -67615,7 +69651,7 @@ var ts;
function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) {
// If invoked directly on a shorthand property assignment, then return
// the declaration of the symbol being assigned (not the symbol being assigned to).
- if (node.parent.kind === 254 /* ShorthandPropertyAssignment */) {
+ if (node.parent.kind === 257 /* ShorthandPropertyAssignment */) {
var result = [];
ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result);
return result.length > 0 ? result : undefined;
@@ -67781,19 +69817,19 @@ var ts;
var commentOwner;
findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) {
switch (commentOwner.kind) {
- case 221 /* FunctionDeclaration */:
- case 148 /* MethodDeclaration */:
- case 149 /* Constructor */:
- case 222 /* ClassDeclaration */:
- case 201 /* VariableStatement */:
+ case 224 /* FunctionDeclaration */:
+ case 149 /* MethodDeclaration */:
+ case 150 /* Constructor */:
+ case 225 /* ClassDeclaration */:
+ case 204 /* VariableStatement */:
break findOwner;
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
return undefined;
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
// If in walking up the tree, we hit a a nested namespace declaration,
// then we must be somewhere within a dotted namespace name; however we don't
// want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'.
- if (commentOwner.parent.kind === 226 /* ModuleDeclaration */) {
+ if (commentOwner.parent.kind === 229 /* ModuleDeclaration */) {
return undefined;
}
break findOwner;
@@ -67834,7 +69870,7 @@ var ts;
if (ts.isFunctionLike(commentOwner)) {
return commentOwner.parameters;
}
- if (commentOwner.kind === 201 /* VariableStatement */) {
+ if (commentOwner.kind === 204 /* VariableStatement */) {
var varStatement = commentOwner;
var varDeclarations = varStatement.declarationList.declarations;
if (varDeclarations.length === 1 && varDeclarations[0].initializer) {
@@ -67852,17 +69888,17 @@ var ts;
* @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'.
*/
function getParametersFromRightHandSideOfAssignment(rightHandSide) {
- while (rightHandSide.kind === 179 /* ParenthesizedExpression */) {
+ while (rightHandSide.kind === 182 /* ParenthesizedExpression */) {
rightHandSide = rightHandSide.expression;
}
switch (rightHandSide.kind) {
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
return rightHandSide.parameters;
- case 193 /* ClassExpression */:
+ case 196 /* ClassExpression */:
for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 149 /* Constructor */) {
+ if (member.kind === 150 /* Constructor */) {
return member.parameters;
}
}
@@ -67929,7 +69965,7 @@ var ts;
mergeTypings(typingOptions.include);
exclude = typingOptions.exclude || [];
var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
- if (projectRootPath !== undefined) {
+ if (projectRootPath) {
possibleSearchDirs.push(projectRootPath);
}
searchDirs = ts.deduplicate(possibleSearchDirs);
@@ -67954,9 +69990,9 @@ var ts;
}
}
// Add the cached typing locations for inferred typings that are already installed
- for (var name_48 in packageNameToTypingLocation) {
- if (name_48 in inferredTypings && !inferredTypings[name_48]) {
- inferredTypings[name_48] = packageNameToTypingLocation[name_48];
+ for (var name_44 in packageNameToTypingLocation) {
+ if (name_44 in inferredTypings && !inferredTypings[name_44]) {
+ inferredTypings[name_44] = packageNameToTypingLocation[name_44];
}
}
// Remove typings that the user has added to the exclude list
@@ -68094,12 +70130,12 @@ var ts;
return;
}
var nameToDeclarations = sourceFile.getNamedDeclarations();
- for (var name_49 in nameToDeclarations) {
- var declarations = nameToDeclarations[name_49];
+ for (var name_45 in nameToDeclarations) {
+ var declarations = nameToDeclarations[name_45];
if (declarations) {
// First do a quick check to see if the name of the declaration matches the
// last portion of the (possibly) dotted name they're searching for.
- var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_49);
+ var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_45);
if (!matches) {
continue;
}
@@ -68112,14 +70148,14 @@ var ts;
if (!containers) {
return undefined;
}
- matches = patternMatcher.getMatches(containers, name_49);
+ matches = patternMatcher.getMatches(containers, name_45);
if (!matches) {
continue;
}
}
var fileName = sourceFile.fileName;
var matchKind = bestMatchKind(matches);
- rawItems.push({ name: name_49, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
+ rawItems.push({ name: name_45, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
}
}
}
@@ -68127,7 +70163,7 @@ var ts;
// Remove imports when the imported declaration is already in the list and has the same name.
rawItems = ts.filter(rawItems, function (item) {
var decl = item.declaration;
- if (decl.kind === 232 /* ImportClause */ || decl.kind === 235 /* ImportSpecifier */ || decl.kind === 230 /* ImportEqualsDeclaration */) {
+ if (decl.kind === 235 /* ImportClause */ || decl.kind === 238 /* ImportSpecifier */ || decl.kind === 233 /* ImportEqualsDeclaration */) {
var importer = checker.getSymbolAtLocation(decl.name);
var imported = checker.getAliasedSymbol(importer);
return importer.name !== imported.name;
@@ -68169,7 +70205,7 @@ var ts;
if (text !== undefined) {
containers.unshift(text);
}
- else if (declaration.name.kind === 141 /* ComputedPropertyName */) {
+ else if (declaration.name.kind === 142 /* ComputedPropertyName */) {
return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ true);
}
else {
@@ -68190,7 +70226,7 @@ var ts;
}
return true;
}
- if (expression.kind === 173 /* PropertyAccessExpression */) {
+ if (expression.kind === 176 /* PropertyAccessExpression */) {
var propertyAccess = expression;
if (includeLastPortion) {
containers.unshift(propertyAccess.name.text);
@@ -68203,7 +70239,7 @@ var ts;
var containers = [];
// First, if we started with a computed property name, then add all but the last
// portion into the container array.
- if (declaration.name.kind === 141 /* ComputedPropertyName */) {
+ if (declaration.name.kind === 142 /* ComputedPropertyName */) {
if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ false)) {
return undefined;
}
@@ -68356,7 +70392,7 @@ var ts;
return;
}
switch (node.kind) {
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
// Get parameter properties, and treat them as being on the *same* level as the constructor, not under it.
var ctr = node;
addNodeWithRecursiveChild(ctr, ctr.body);
@@ -68368,21 +70404,21 @@ var ts;
}
}
break;
- case 148 /* MethodDeclaration */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 147 /* MethodSignature */:
+ case 149 /* MethodDeclaration */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 148 /* MethodSignature */:
if (!ts.hasDynamicName(node)) {
addNodeWithRecursiveChild(node, node.body);
}
break;
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
if (!ts.hasDynamicName(node)) {
addLeafNode(node);
}
break;
- case 232 /* ImportClause */:
+ case 235 /* ImportClause */:
var importClause = node;
// Handle default import case e.g.:
// import d from "mod";
@@ -68394,7 +70430,7 @@ var ts;
// import {a, b as B} from "mod";
var namedBindings = importClause.namedBindings;
if (namedBindings) {
- if (namedBindings.kind === 233 /* NamespaceImport */) {
+ if (namedBindings.kind === 236 /* NamespaceImport */) {
addLeafNode(namedBindings);
}
else {
@@ -68405,12 +70441,12 @@ var ts;
}
}
break;
- case 170 /* BindingElement */:
- case 219 /* VariableDeclaration */:
+ case 173 /* BindingElement */:
+ case 222 /* VariableDeclaration */:
var decl = node;
- var name_50 = decl.name;
- if (ts.isBindingPattern(name_50)) {
- addChildrenRecursively(name_50);
+ var name_46 = decl.name;
+ if (ts.isBindingPattern(name_46)) {
+ addChildrenRecursively(name_46);
}
else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) {
// For `const x = function() {}`, just use the function node, not the const.
@@ -68420,12 +70456,12 @@ var ts;
addNodeWithRecursiveChild(decl, decl.initializer);
}
break;
- case 181 /* ArrowFunction */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
addNodeWithRecursiveChild(node, node.body);
break;
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
startNode(node);
for (var _d = 0, _e = node.members; _d < _e.length; _d++) {
var member = _e[_d];
@@ -68435,9 +70471,9 @@ var ts;
}
endNode();
break;
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 223 /* InterfaceDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 226 /* InterfaceDeclaration */:
startNode(node);
for (var _f = 0, _g = node.members; _f < _g.length; _f++) {
var member = _g[_f];
@@ -68445,21 +70481,21 @@ var ts;
}
endNode();
break;
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
addNodeWithRecursiveChild(node, getInteriorModule(node).body);
break;
- case 239 /* ExportSpecifier */:
- case 230 /* ImportEqualsDeclaration */:
- case 154 /* IndexSignature */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 224 /* TypeAliasDeclaration */:
+ case 242 /* ExportSpecifier */:
+ case 233 /* ImportEqualsDeclaration */:
+ case 155 /* IndexSignature */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 227 /* TypeAliasDeclaration */:
addLeafNode(node);
break;
default:
ts.forEach(node.jsDocComments, function (jsDocComment) {
ts.forEach(jsDocComment.tags, function (tag) {
- if (tag.kind === 279 /* JSDocTypedefTag */) {
+ if (tag.kind === 283 /* JSDocTypedefTag */) {
addLeafNode(tag);
}
});
@@ -68510,14 +70546,14 @@ var ts;
});
/** a and b have the same name, but they may not be mergeable. */
function shouldReallyMerge(a, b) {
- return a.kind === b.kind && (a.kind !== 226 /* ModuleDeclaration */ || areSameModule(a, b));
+ return a.kind === b.kind && (a.kind !== 229 /* ModuleDeclaration */ || areSameModule(a, b));
// We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes.
// Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'!
function areSameModule(a, b) {
if (a.body.kind !== b.body.kind) {
return false;
}
- if (a.body.kind !== 226 /* ModuleDeclaration */) {
+ if (a.body.kind !== 229 /* ModuleDeclaration */) {
return true;
}
return areSameModule(a.body, b.body);
@@ -68577,7 +70613,7 @@ var ts;
* So `new()` can still come before an `aardvark` method.
*/
function tryGetName(node) {
- if (node.kind === 226 /* ModuleDeclaration */) {
+ if (node.kind === 229 /* ModuleDeclaration */) {
return getModuleName(node);
}
var decl = node;
@@ -68585,18 +70621,18 @@ var ts;
return ts.getPropertyNameForPropertyNameNode(decl.name);
}
switch (node.kind) {
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
- case 193 /* ClassExpression */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 196 /* ClassExpression */:
return getFunctionOrClassName(node);
- case 279 /* JSDocTypedefTag */:
+ case 283 /* JSDocTypedefTag */:
return getJSDocTypedefTagName(node);
default:
return undefined;
}
}
function getItemName(node) {
- if (node.kind === 226 /* ModuleDeclaration */) {
+ if (node.kind === 229 /* ModuleDeclaration */) {
return getModuleName(node);
}
var name = node.name;
@@ -68607,16 +70643,16 @@ var ts;
}
}
switch (node.kind) {
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
var sourceFile = node;
return ts.isExternalModule(sourceFile)
? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\""
: "
";
- case 181 /* ArrowFunction */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
+ case 184 /* ArrowFunction */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
if (ts.getModifierFlags(node) & 512 /* Default */) {
return "default";
}
@@ -68624,15 +70660,15 @@ var ts;
// (eg: "app\n.onactivated"), so we should remove the whitespace for readabiltiy in the
// navigation bar.
return getFunctionOrClassName(node);
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
return "constructor";
- case 153 /* ConstructSignature */:
+ case 154 /* ConstructSignature */:
return "new()";
- case 152 /* CallSignature */:
+ case 153 /* CallSignature */:
return "()";
- case 154 /* IndexSignature */:
+ case 155 /* IndexSignature */:
return "[]";
- case 279 /* JSDocTypedefTag */:
+ case 283 /* JSDocTypedefTag */:
return getJSDocTypedefTagName(node);
default:
return "";
@@ -68644,7 +70680,7 @@ var ts;
}
else {
var parentNode = node.parent && node.parent.parent;
- if (parentNode && parentNode.kind === 201 /* VariableStatement */) {
+ if (parentNode && parentNode.kind === 204 /* VariableStatement */) {
if (parentNode.declarationList.declarations.length > 0) {
var nameIdentifier = parentNode.declarationList.declarations[0].name;
if (nameIdentifier.kind === 70 /* Identifier */) {
@@ -68673,24 +70709,24 @@ var ts;
return topLevel;
function isTopLevel(item) {
switch (navigationBarNodeKind(item)) {
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 225 /* EnumDeclaration */:
- case 223 /* InterfaceDeclaration */:
- case 226 /* ModuleDeclaration */:
- case 256 /* SourceFile */:
- case 224 /* TypeAliasDeclaration */:
- case 279 /* JSDocTypedefTag */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 228 /* EnumDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 229 /* ModuleDeclaration */:
+ case 260 /* SourceFile */:
+ case 227 /* TypeAliasDeclaration */:
+ case 283 /* JSDocTypedefTag */:
return true;
- case 149 /* Constructor */:
- case 148 /* MethodDeclaration */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 219 /* VariableDeclaration */:
+ case 150 /* Constructor */:
+ case 149 /* MethodDeclaration */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 222 /* VariableDeclaration */:
return hasSomeImportantChild(item);
- case 181 /* ArrowFunction */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
return isTopLevelFunctionDeclaration(item);
default:
return false;
@@ -68700,10 +70736,10 @@ var ts;
return false;
}
switch (navigationBarNodeKind(item.parent)) {
- case 227 /* ModuleBlock */:
- case 256 /* SourceFile */:
- case 148 /* MethodDeclaration */:
- case 149 /* Constructor */:
+ case 230 /* ModuleBlock */:
+ case 260 /* SourceFile */:
+ case 149 /* MethodDeclaration */:
+ case 150 /* Constructor */:
return true;
default:
return hasSomeImportantChild(item);
@@ -68712,7 +70748,7 @@ var ts;
function hasSomeImportantChild(item) {
return ts.forEach(item.children, function (child) {
var childKind = navigationBarNodeKind(child);
- return childKind !== 219 /* VariableDeclaration */ && childKind !== 170 /* BindingElement */;
+ return childKind !== 222 /* VariableDeclaration */ && childKind !== 173 /* BindingElement */;
});
}
}
@@ -68770,7 +70806,7 @@ var ts;
// Otherwise, we need to aggregate each identifier to build up the qualified name.
var result = [];
result.push(moduleDeclaration.name.text);
- while (moduleDeclaration.body && moduleDeclaration.body.kind === 226 /* ModuleDeclaration */) {
+ while (moduleDeclaration.body && moduleDeclaration.body.kind === 229 /* ModuleDeclaration */) {
moduleDeclaration = moduleDeclaration.body;
result.push(moduleDeclaration.name.text);
}
@@ -68781,13 +70817,13 @@ var ts;
* We store 'A' as associated with a NavNode, and use getModuleName to traverse down again.
*/
function getInteriorModule(decl) {
- return decl.body.kind === 226 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl;
+ return decl.body.kind === 229 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl;
}
function isComputedProperty(member) {
- return !member.name || member.name.kind === 141 /* ComputedPropertyName */;
+ return !member.name || member.name.kind === 142 /* ComputedPropertyName */;
}
function getNodeSpan(node) {
- return node.kind === 256 /* SourceFile */
+ return node.kind === 260 /* SourceFile */
? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd())
: ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd());
}
@@ -68795,14 +70831,14 @@ var ts;
if (node.name && ts.getFullWidth(node.name) > 0) {
return ts.declarationNameToString(node.name);
}
- else if (node.parent.kind === 219 /* VariableDeclaration */) {
+ else if (node.parent.kind === 222 /* VariableDeclaration */) {
return ts.declarationNameToString(node.parent.name);
}
- else if (node.parent.kind === 188 /* BinaryExpression */ &&
+ else if (node.parent.kind === 191 /* BinaryExpression */ &&
node.parent.operatorToken.kind === 57 /* EqualsToken */) {
return nodeText(node.parent.left).replace(whiteSpaceRegex, "");
}
- else if (node.parent.kind === 253 /* PropertyAssignment */ && node.parent.name) {
+ else if (node.parent.kind === 256 /* PropertyAssignment */ && node.parent.name) {
return nodeText(node.parent.name);
}
else if (ts.getModifierFlags(node) & 512 /* Default */) {
@@ -68813,7 +70849,7 @@ var ts;
}
}
function isFunctionOrClassExpression(node) {
- return node.kind === 180 /* FunctionExpression */ || node.kind === 181 /* ArrowFunction */ || node.kind === 193 /* ClassExpression */;
+ return node.kind === 183 /* FunctionExpression */ || node.kind === 184 /* ArrowFunction */ || node.kind === 196 /* ClassExpression */;
}
/**
* Matches all whitespace characters in a string. Eg:
@@ -68903,7 +70939,7 @@ var ts;
}
}
function autoCollapse(node) {
- return ts.isFunctionBlock(node) && node.parent.kind !== 181 /* ArrowFunction */;
+ return ts.isFunctionBlock(node) && node.parent.kind !== 184 /* ArrowFunction */;
}
var depth = 0;
var maxDepth = 20;
@@ -68915,30 +70951,30 @@ var ts;
addOutliningForLeadingCommentsForNode(n);
}
switch (n.kind) {
- case 200 /* Block */:
+ case 203 /* Block */:
if (!ts.isFunctionBlock(n)) {
- var parent_22 = n.parent;
+ var parent_21 = n.parent;
var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile);
var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile);
// Check if the block is standalone, or 'attached' to some parent statement.
// If the latter, we want to collapse the block, but consider its hint span
// to be the entire span of the parent.
- if (parent_22.kind === 205 /* DoStatement */ ||
- parent_22.kind === 208 /* ForInStatement */ ||
- parent_22.kind === 209 /* ForOfStatement */ ||
- parent_22.kind === 207 /* ForStatement */ ||
- parent_22.kind === 204 /* IfStatement */ ||
- parent_22.kind === 206 /* WhileStatement */ ||
- parent_22.kind === 213 /* WithStatement */ ||
- parent_22.kind === 252 /* CatchClause */) {
- addOutliningSpan(parent_22, openBrace, closeBrace, autoCollapse(n));
+ if (parent_21.kind === 208 /* DoStatement */ ||
+ parent_21.kind === 211 /* ForInStatement */ ||
+ parent_21.kind === 212 /* ForOfStatement */ ||
+ parent_21.kind === 210 /* ForStatement */ ||
+ parent_21.kind === 207 /* IfStatement */ ||
+ parent_21.kind === 209 /* WhileStatement */ ||
+ parent_21.kind === 216 /* WithStatement */ ||
+ parent_21.kind === 255 /* CatchClause */) {
+ addOutliningSpan(parent_21, openBrace, closeBrace, autoCollapse(n));
break;
}
- if (parent_22.kind === 217 /* TryStatement */) {
+ if (parent_21.kind === 220 /* TryStatement */) {
// Could be the try-block, or the finally-block.
- var tryStatement = parent_22;
+ var tryStatement = parent_21;
if (tryStatement.tryBlock === n) {
- addOutliningSpan(parent_22, openBrace, closeBrace, autoCollapse(n));
+ addOutliningSpan(parent_21, openBrace, closeBrace, autoCollapse(n));
break;
}
else if (tryStatement.finallyBlock === n) {
@@ -68961,23 +70997,23 @@ var ts;
break;
}
// Fallthrough.
- case 227 /* ModuleBlock */: {
+ case 230 /* ModuleBlock */: {
var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile);
var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile);
addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n));
break;
}
- case 222 /* ClassDeclaration */:
- case 223 /* InterfaceDeclaration */:
- case 225 /* EnumDeclaration */:
- case 172 /* ObjectLiteralExpression */:
- case 228 /* CaseBlock */: {
+ case 225 /* ClassDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 175 /* ObjectLiteralExpression */:
+ case 231 /* CaseBlock */: {
var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile);
var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile);
addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n));
break;
}
- case 171 /* ArrayLiteralExpression */:
+ case 174 /* ArrayLiteralExpression */:
var openBracket = ts.findChildOfKind(n, 20 /* OpenBracketToken */, sourceFile);
var closeBracket = ts.findChildOfKind(n, 21 /* CloseBracketToken */, sourceFile);
addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n));
@@ -68997,13 +71033,13 @@ var ts;
var ts;
(function (ts) {
// Note(cyrusn): this enum is ordered from strongest match type to weakest match type.
+ var PatternMatchKind;
(function (PatternMatchKind) {
PatternMatchKind[PatternMatchKind["exact"] = 0] = "exact";
PatternMatchKind[PatternMatchKind["prefix"] = 1] = "prefix";
PatternMatchKind[PatternMatchKind["substring"] = 2] = "substring";
PatternMatchKind[PatternMatchKind["camelCase"] = 3] = "camelCase";
- })(ts.PatternMatchKind || (ts.PatternMatchKind = {}));
- var PatternMatchKind = ts.PatternMatchKind;
+ })(PatternMatchKind = ts.PatternMatchKind || (ts.PatternMatchKind = {}));
function createPatternMatch(kind, punctuationStripped, isCaseSensitive, camelCaseWeight) {
return {
kind: kind,
@@ -69334,7 +71370,7 @@ var ts;
if (ch >= 65 /* A */ && ch <= 90 /* Z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 4 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 5 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -69347,7 +71383,7 @@ var ts;
if (ch >= 97 /* a */ && ch <= 122 /* z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 4 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 5 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -69625,7 +71661,7 @@ var ts;
if (token === 123 /* DeclareKeyword */) {
// declare module "mod"
token = nextToken();
- if (token === 126 /* ModuleKeyword */) {
+ if (token === 127 /* ModuleKeyword */) {
token = nextToken();
if (token === 9 /* StringLiteral */) {
recordAmbientExternalModule();
@@ -69650,7 +71686,7 @@ var ts;
else {
if (token === 70 /* Identifier */ || ts.isKeyword(token)) {
token = nextToken();
- if (token === 137 /* FromKeyword */) {
+ if (token === 138 /* FromKeyword */) {
token = nextToken();
if (token === 9 /* StringLiteral */) {
// import d from "mod";
@@ -69681,7 +71717,7 @@ var ts;
}
if (token === 17 /* CloseBraceToken */) {
token = nextToken();
- if (token === 137 /* FromKeyword */) {
+ if (token === 138 /* FromKeyword */) {
token = nextToken();
if (token === 9 /* StringLiteral */) {
// import {a as A} from "mod";
@@ -69697,7 +71733,7 @@ var ts;
token = nextToken();
if (token === 70 /* Identifier */ || ts.isKeyword(token)) {
token = nextToken();
- if (token === 137 /* FromKeyword */) {
+ if (token === 138 /* FromKeyword */) {
token = nextToken();
if (token === 9 /* StringLiteral */) {
// import * as NS from "mod"
@@ -69727,7 +71763,7 @@ var ts;
}
if (token === 17 /* CloseBraceToken */) {
token = nextToken();
- if (token === 137 /* FromKeyword */) {
+ if (token === 138 /* FromKeyword */) {
token = nextToken();
if (token === 9 /* StringLiteral */) {
// export {a as A} from "mod";
@@ -69739,7 +71775,7 @@ var ts;
}
else if (token === 38 /* AsteriskToken */) {
token = nextToken();
- if (token === 137 /* FromKeyword */) {
+ if (token === 138 /* FromKeyword */) {
token = nextToken();
if (token === 9 /* StringLiteral */) {
// export * from "mod"
@@ -69764,7 +71800,7 @@ var ts;
}
function tryConsumeRequireCall(skipCurrentToken) {
var token = skipCurrentToken ? nextToken() : ts.scanner.getToken();
- if (token === 130 /* RequireKeyword */) {
+ if (token === 131 /* RequireKeyword */) {
token = nextToken();
if (token === 18 /* OpenParenToken */) {
token = nextToken();
@@ -70119,12 +72155,12 @@ var ts;
// return null;
// }
var emptyArray = [];
+ var ArgumentListKind;
(function (ArgumentListKind) {
ArgumentListKind[ArgumentListKind["TypeArguments"] = 0] = "TypeArguments";
ArgumentListKind[ArgumentListKind["CallArguments"] = 1] = "CallArguments";
ArgumentListKind[ArgumentListKind["TaggedTemplateArguments"] = 2] = "TaggedTemplateArguments";
- })(SignatureHelp.ArgumentListKind || (SignatureHelp.ArgumentListKind = {}));
- var ArgumentListKind = SignatureHelp.ArgumentListKind;
+ })(ArgumentListKind = SignatureHelp.ArgumentListKind || (SignatureHelp.ArgumentListKind = {}));
function getSignatureHelpItems(program, sourceFile, position, cancellationToken) {
var typeChecker = program.getTypeChecker();
// Decide whether to show signature help
@@ -70155,7 +72191,7 @@ var ts;
}
SignatureHelp.getSignatureHelpItems = getSignatureHelpItems;
function createJavaScriptSignatureHelpItems(argumentInfo, program) {
- if (argumentInfo.invocation.kind !== 175 /* CallExpression */) {
+ if (argumentInfo.invocation.kind !== 178 /* CallExpression */) {
return undefined;
}
// See if we can find some symbol with the call expression name that has call signatures.
@@ -70163,7 +72199,7 @@ var ts;
var expression = callExpression.expression;
var name = expression.kind === 70 /* Identifier */
? expression
- : expression.kind === 173 /* PropertyAccessExpression */
+ : expression.kind === 176 /* PropertyAccessExpression */
? expression.name
: undefined;
if (!name || !name.text) {
@@ -70196,7 +72232,7 @@ var ts;
* in the argument of an invocation; returns undefined otherwise.
*/
function getImmediatelyContainingArgumentInfo(node, position, sourceFile) {
- if (node.parent.kind === 175 /* CallExpression */ || node.parent.kind === 176 /* NewExpression */) {
+ if (node.parent.kind === 178 /* CallExpression */ || node.parent.kind === 179 /* NewExpression */) {
var callExpression = node.parent;
// There are 3 cases to handle:
// 1. The token introduces a list, and should begin a sig help session
@@ -70250,25 +72286,25 @@ var ts;
}
return undefined;
}
- else if (node.kind === 12 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 177 /* TaggedTemplateExpression */) {
+ else if (node.kind === 12 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 180 /* TaggedTemplateExpression */) {
// Check if we're actually inside the template;
// otherwise we'll fall out and return undefined.
if (ts.isInsideTemplateLiteral(node, position)) {
return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0, sourceFile);
}
}
- else if (node.kind === 13 /* TemplateHead */ && node.parent.parent.kind === 177 /* TaggedTemplateExpression */) {
+ else if (node.kind === 13 /* TemplateHead */ && node.parent.parent.kind === 180 /* TaggedTemplateExpression */) {
var templateExpression = node.parent;
var tagExpression = templateExpression.parent;
- ts.Debug.assert(templateExpression.kind === 190 /* TemplateExpression */);
+ ts.Debug.assert(templateExpression.kind === 193 /* TemplateExpression */);
var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1;
return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile);
}
- else if (node.parent.kind === 198 /* TemplateSpan */ && node.parent.parent.parent.kind === 177 /* TaggedTemplateExpression */) {
+ else if (node.parent.kind === 201 /* TemplateSpan */ && node.parent.parent.parent.kind === 180 /* TaggedTemplateExpression */) {
var templateSpan = node.parent;
var templateExpression = templateSpan.parent;
var tagExpression = templateExpression.parent;
- ts.Debug.assert(templateExpression.kind === 190 /* TemplateExpression */);
+ ts.Debug.assert(templateExpression.kind === 193 /* TemplateExpression */);
// If we're just after a template tail, don't show signature help.
if (node.kind === 15 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) {
return undefined;
@@ -70386,7 +72422,7 @@ var ts;
//
// This is because a Missing node has no width. However, what we actually want is to include trivia
// leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail.
- if (template.kind === 190 /* TemplateExpression */) {
+ if (template.kind === 193 /* TemplateExpression */) {
var lastSpan = ts.lastOrUndefined(template.templateSpans);
if (lastSpan.literal.getFullWidth() === 0) {
applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false);
@@ -70395,7 +72431,7 @@ var ts;
return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
}
function getContainingArgumentInfo(node, position, sourceFile) {
- for (var n = node; n.kind !== 256 /* SourceFile */; n = n.parent) {
+ for (var n = node; n.kind !== 260 /* SourceFile */; n = n.parent) {
if (ts.isFunctionBlock(n)) {
return undefined;
}
@@ -70455,7 +72491,9 @@ var ts;
if (callTargetDisplayParts) {
ts.addRange(prefixDisplayParts, callTargetDisplayParts);
}
+ var isVariadic;
if (isTypeParameterList) {
+ isVariadic = false; // type parameter lists are not variadic
prefixDisplayParts.push(ts.punctuationPart(26 /* LessThanToken */));
var typeParameters = candidateSignature.typeParameters;
signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray;
@@ -70466,6 +72504,7 @@ var ts;
ts.addRange(suffixDisplayParts, parameterParts);
}
else {
+ isVariadic = candidateSignature.hasRestParameter;
var typeParameterParts = ts.mapToDisplayParts(function (writer) {
return typeChecker.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation);
});
@@ -70480,7 +72519,7 @@ var ts;
});
ts.addRange(suffixDisplayParts, returnTypeParts);
return {
- isVariadic: candidateSignature.hasRestParameter,
+ isVariadic: isVariadic,
prefixDisplayParts: prefixDisplayParts,
suffixDisplayParts: suffixDisplayParts,
separatorDisplayParts: [ts.punctuationPart(25 /* CommaToken */), ts.spacePart()],
@@ -70537,7 +72576,7 @@ var ts;
function getSymbolKind(typeChecker, symbol, location) {
var flags = symbol.getFlags();
if (flags & 32 /* Class */)
- return ts.getDeclarationOfKind(symbol, 193 /* ClassExpression */) ?
+ return ts.getDeclarationOfKind(symbol, 196 /* ClassExpression */) ?
ts.ScriptElementKind.localClassElement : ts.ScriptElementKind.classElement;
if (flags & 384 /* Enum */)
return ts.ScriptElementKind.enumElement;
@@ -70643,7 +72682,7 @@ var ts;
var signature = void 0;
type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
if (type) {
- if (location.parent && location.parent.kind === 173 /* PropertyAccessExpression */) {
+ if (location.parent && location.parent.kind === 176 /* PropertyAccessExpression */) {
var right = location.parent.name;
// Either the location is on the right of a property access, or on the left and the right is missing
if (right === location || (right && right.getFullWidth() === 0)) {
@@ -70652,7 +72691,7 @@ var ts;
}
// try get the call/construct signature from the type if it matches
var callExpression = void 0;
- if (location.kind === 175 /* CallExpression */ || location.kind === 176 /* NewExpression */) {
+ if (location.kind === 178 /* CallExpression */ || location.kind === 179 /* NewExpression */) {
callExpression = location;
}
else if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location)) {
@@ -70665,7 +72704,7 @@ var ts;
// Use the first candidate:
signature = candidateSignatures[0];
}
- var useConstructSignatures = callExpression.kind === 176 /* NewExpression */ || callExpression.expression.kind === 96 /* SuperKeyword */;
+ var useConstructSignatures = callExpression.kind === 179 /* NewExpression */ || callExpression.expression.kind === 96 /* SuperKeyword */;
var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();
if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) {
// Get the first signature if there is one -- allSignatures may contain
@@ -70718,24 +72757,24 @@ var ts;
}
}
else if ((ts.isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) ||
- (location.kind === 122 /* ConstructorKeyword */ && location.parent.kind === 149 /* Constructor */)) {
+ (location.kind === 122 /* ConstructorKeyword */ && location.parent.kind === 150 /* Constructor */)) {
// get the signature from the declaration and write it
var functionDeclaration = location.parent;
- var allSignatures = functionDeclaration.kind === 149 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();
+ var allSignatures = functionDeclaration.kind === 150 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();
if (!typeChecker.isImplementationOfOverload(functionDeclaration)) {
signature = typeChecker.getSignatureFromDeclaration(functionDeclaration);
}
else {
signature = allSignatures[0];
}
- if (functionDeclaration.kind === 149 /* Constructor */) {
+ if (functionDeclaration.kind === 150 /* Constructor */) {
// show (constructor) Type(...) signature
symbolKind = ts.ScriptElementKind.constructorImplementationElement;
addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);
}
else {
// (function/method) symbol(..signature)
- addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 152 /* CallSignature */ &&
+ addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 153 /* CallSignature */ &&
!(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind);
}
addSignatureDisplayParts(signature, allSignatures);
@@ -70744,7 +72783,7 @@ var ts;
}
}
if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) {
- if (ts.getDeclarationOfKind(symbol, 193 /* ClassExpression */)) {
+ if (ts.getDeclarationOfKind(symbol, 196 /* ClassExpression */)) {
// Special case for class expressions because we would like to indicate that
// the class name is local to the class body (similar to function expression)
// (local class) class
@@ -70767,7 +72806,7 @@ var ts;
}
if (symbolFlags & 524288 /* TypeAlias */) {
addNewLineIfDisplayPartsExist();
- displayParts.push(ts.keywordPart(135 /* TypeKeyword */));
+ displayParts.push(ts.keywordPart(136 /* TypeKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
writeTypeParametersOfSymbol(symbol, sourceFile);
@@ -70788,9 +72827,9 @@ var ts;
}
if (symbolFlags & 1536 /* Module */) {
addNewLineIfDisplayPartsExist();
- var declaration = ts.getDeclarationOfKind(symbol, 226 /* ModuleDeclaration */);
+ var declaration = ts.getDeclarationOfKind(symbol, 229 /* ModuleDeclaration */);
var isNamespace = declaration && declaration.name && declaration.name.kind === 70 /* Identifier */;
- displayParts.push(ts.keywordPart(isNamespace ? 127 /* NamespaceKeyword */ : 126 /* ModuleKeyword */));
+ displayParts.push(ts.keywordPart(isNamespace ? 128 /* NamespaceKeyword */ : 127 /* ModuleKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
}
@@ -70811,17 +72850,17 @@ var ts;
}
else {
// Method/function type parameter
- var declaration = ts.getDeclarationOfKind(symbol, 142 /* TypeParameter */);
+ var declaration = ts.getDeclarationOfKind(symbol, 143 /* TypeParameter */);
ts.Debug.assert(declaration !== undefined);
declaration = declaration.parent;
if (declaration) {
if (ts.isFunctionLikeKind(declaration.kind)) {
var signature = typeChecker.getSignatureFromDeclaration(declaration);
- if (declaration.kind === 153 /* ConstructSignature */) {
+ if (declaration.kind === 154 /* ConstructSignature */) {
displayParts.push(ts.keywordPart(93 /* NewKeyword */));
displayParts.push(ts.spacePart());
}
- else if (declaration.kind !== 152 /* CallSignature */ && declaration.name) {
+ else if (declaration.kind !== 153 /* CallSignature */ && declaration.name) {
addFullSymbolName(declaration.symbol);
}
ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */));
@@ -70830,7 +72869,7 @@ var ts;
// Type alias type parameter
// For example
// type list = T[]; // Both T will go through same code path
- displayParts.push(ts.keywordPart(135 /* TypeKeyword */));
+ displayParts.push(ts.keywordPart(136 /* TypeKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(declaration.symbol);
writeTypeParametersOfSymbol(declaration.symbol, sourceFile);
@@ -70841,7 +72880,7 @@ var ts;
if (symbolFlags & 8 /* EnumMember */) {
addPrefixForAnyFunctionOrVar(symbol, "enum member");
var declaration = symbol.declarations[0];
- if (declaration.kind === 255 /* EnumMember */) {
+ if (declaration.kind === 259 /* EnumMember */) {
var constantValue = typeChecker.getConstantValue(declaration);
if (constantValue !== undefined) {
displayParts.push(ts.spacePart());
@@ -70853,10 +72892,10 @@ var ts;
}
if (symbolFlags & 8388608 /* Alias */) {
addNewLineIfDisplayPartsExist();
- if (symbol.declarations[0].kind === 229 /* NamespaceExportDeclaration */) {
+ if (symbol.declarations[0].kind === 232 /* NamespaceExportDeclaration */) {
displayParts.push(ts.keywordPart(83 /* ExportKeyword */));
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(127 /* NamespaceKeyword */));
+ displayParts.push(ts.keywordPart(128 /* NamespaceKeyword */));
}
else {
displayParts.push(ts.keywordPart(90 /* ImportKeyword */));
@@ -70864,13 +72903,13 @@ var ts;
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
ts.forEach(symbol.declarations, function (declaration) {
- if (declaration.kind === 230 /* ImportEqualsDeclaration */) {
+ if (declaration.kind === 233 /* ImportEqualsDeclaration */) {
var importEqualsDeclaration = declaration;
if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) {
displayParts.push(ts.spacePart());
displayParts.push(ts.operatorPart(57 /* EqualsToken */));
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(130 /* RequireKeyword */));
+ displayParts.push(ts.keywordPart(131 /* RequireKeyword */));
displayParts.push(ts.punctuationPart(18 /* OpenParenToken */));
displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral));
displayParts.push(ts.punctuationPart(19 /* CloseParenToken */));
@@ -70937,10 +72976,10 @@ var ts;
// For some special property access expressions like `experts.foo = foo` or `module.exports.foo = foo`
// there documentation comments might be attached to the right hand side symbol of their declarations.
// The pattern of such special property access is that the parent symbol is the symbol of the file.
- if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 256 /* SourceFile */; })) {
+ if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 260 /* SourceFile */; })) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (!declaration.parent || declaration.parent.kind !== 188 /* BinaryExpression */) {
+ if (!declaration.parent || declaration.parent.kind !== 191 /* BinaryExpression */) {
continue;
}
var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right);
@@ -71016,16 +73055,16 @@ var ts;
}
return ts.forEach(symbol.declarations, function (declaration) {
// Function expressions are local
- if (declaration.kind === 180 /* FunctionExpression */) {
+ if (declaration.kind === 183 /* FunctionExpression */) {
return true;
}
- if (declaration.kind !== 219 /* VariableDeclaration */ && declaration.kind !== 221 /* FunctionDeclaration */) {
+ if (declaration.kind !== 222 /* VariableDeclaration */ && declaration.kind !== 224 /* FunctionDeclaration */) {
return false;
}
// If the parent is not sourceFile or module block it is local variable
- for (var parent_23 = declaration.parent; !ts.isFunctionBlock(parent_23); parent_23 = parent_23.parent) {
+ for (var parent_22 = declaration.parent; !ts.isFunctionBlock(parent_22); parent_22 = parent_22.parent) {
// Reached source file or module block
- if (parent_23.kind === 256 /* SourceFile */ || parent_23.kind === 227 /* ModuleBlock */) {
+ if (parent_22.kind === 260 /* SourceFile */ || parent_22.kind === 230 /* ModuleBlock */) {
return false;
}
}
@@ -71136,7 +73175,7 @@ var ts;
return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; });
});
options = ts.clone(options);
- var _loop_3 = function (opt) {
+ var _loop_4 = function (opt) {
if (!ts.hasProperty(options, opt.name)) {
return "continue";
}
@@ -71155,7 +73194,7 @@ var ts;
};
for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {
var opt = commandLineOptionsStringToEnum_1[_i];
- _loop_3(opt);
+ _loop_4(opt);
}
return options;
}
@@ -71167,8 +73206,8 @@ var ts;
(function (ts) {
var formatting;
(function (formatting) {
- var standardScanner = ts.createScanner(4 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
- var jsxScanner = ts.createScanner(4 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
+ var standardScanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
+ var jsxScanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
/**
* Scanner that is currently used for formatting
*/
@@ -71263,10 +73302,10 @@ var ts;
function shouldRescanJsxIdentifier(node) {
if (node.parent) {
switch (node.parent.kind) {
- case 246 /* JsxAttribute */:
- case 244 /* JsxOpeningElement */:
- case 245 /* JsxClosingElement */:
- case 243 /* JsxSelfClosingElement */:
+ case 249 /* JsxAttribute */:
+ case 247 /* JsxOpeningElement */:
+ case 248 /* JsxClosingElement */:
+ case 246 /* JsxSelfClosingElement */:
return node.kind === 70 /* Identifier */;
}
}
@@ -71501,14 +73540,14 @@ var ts;
(function (ts) {
var formatting;
(function (formatting) {
+ var FormattingRequestKind;
(function (FormattingRequestKind) {
FormattingRequestKind[FormattingRequestKind["FormatDocument"] = 0] = "FormatDocument";
FormattingRequestKind[FormattingRequestKind["FormatSelection"] = 1] = "FormatSelection";
FormattingRequestKind[FormattingRequestKind["FormatOnEnter"] = 2] = "FormatOnEnter";
FormattingRequestKind[FormattingRequestKind["FormatOnSemicolon"] = 3] = "FormatOnSemicolon";
FormattingRequestKind[FormattingRequestKind["FormatOnClosingCurlyBrace"] = 4] = "FormatOnClosingCurlyBrace";
- })(formatting.FormattingRequestKind || (formatting.FormattingRequestKind = {}));
- var FormattingRequestKind = formatting.FormattingRequestKind;
+ })(FormattingRequestKind = formatting.FormattingRequestKind || (formatting.FormattingRequestKind = {}));
})(formatting = ts.formatting || (ts.formatting = {}));
})(ts || (ts = {}));
///
@@ -71540,13 +73579,13 @@ var ts;
(function (ts) {
var formatting;
(function (formatting) {
+ var RuleAction;
(function (RuleAction) {
RuleAction[RuleAction["Ignore"] = 1] = "Ignore";
RuleAction[RuleAction["Space"] = 2] = "Space";
RuleAction[RuleAction["NewLine"] = 4] = "NewLine";
RuleAction[RuleAction["Delete"] = 8] = "Delete";
- })(formatting.RuleAction || (formatting.RuleAction = {}));
- var RuleAction = formatting.RuleAction;
+ })(RuleAction = formatting.RuleAction || (formatting.RuleAction = {}));
})(formatting = ts.formatting || (ts.formatting = {}));
})(ts || (ts = {}));
///
@@ -71587,11 +73626,11 @@ var ts;
(function (ts) {
var formatting;
(function (formatting) {
+ var RuleFlags;
(function (RuleFlags) {
RuleFlags[RuleFlags["None"] = 0] = "None";
RuleFlags[RuleFlags["CanDeleteNewLines"] = 1] = "CanDeleteNewLines";
- })(formatting.RuleFlags || (formatting.RuleFlags = {}));
- var RuleFlags = formatting.RuleFlags;
+ })(RuleFlags = formatting.RuleFlags || (formatting.RuleFlags = {}));
})(formatting = ts.formatting || (ts.formatting = {}));
})(ts || (ts = {}));
///
@@ -71742,7 +73781,7 @@ var ts;
this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([101 /* TryKeyword */, 86 /* FinallyKeyword */]), 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));
// get x() {}
// set x(val) {}
- this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124 /* GetKeyword */, 132 /* SetKeyword */]), 70 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */));
+ this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124 /* GetKeyword */, 133 /* SetKeyword */]), 70 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */));
// Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options.
this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */));
this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */));
@@ -71750,10 +73789,10 @@ var ts;
// Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses
this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122 /* ConstructorKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));
// Use of module as a function call. e.g.: import m2 = module("m2");
- this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([126 /* ModuleKeyword */, 130 /* RequireKeyword */]), 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));
+ this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([127 /* ModuleKeyword */, 131 /* RequireKeyword */]), 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));
// Add a space around certain TypeScript keywords
- this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 126 /* ModuleKeyword */, 127 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 132 /* SetKeyword */, 114 /* StaticKeyword */, 135 /* TypeKeyword */, 137 /* FromKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));
- this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84 /* ExtendsKeyword */, 107 /* ImplementsKeyword */, 137 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));
+ this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 127 /* ModuleKeyword */, 128 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 133 /* SetKeyword */, 114 /* StaticKeyword */, 136 /* TypeKeyword */, 138 /* FromKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));
+ this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84 /* ExtendsKeyword */, 107 /* ImplementsKeyword */, 138 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));
// Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {
this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */));
// Lambda expressions
@@ -71773,7 +73812,7 @@ var ts;
// decorators
this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 56 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));
this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(56 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));
- this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 70 /* Identifier */, 83 /* ExportKeyword */, 78 /* DefaultKeyword */, 74 /* ClassKeyword */, 114 /* StaticKeyword */, 113 /* PublicKeyword */, 111 /* PrivateKeyword */, 112 /* ProtectedKeyword */, 124 /* GetKeyword */, 132 /* SetKeyword */, 20 /* OpenBracketToken */, 38 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */));
+ this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 70 /* Identifier */, 83 /* ExportKeyword */, 78 /* DefaultKeyword */, 74 /* ClassKeyword */, 114 /* StaticKeyword */, 113 /* PublicKeyword */, 111 /* PrivateKeyword */, 112 /* ProtectedKeyword */, 124 /* GetKeyword */, 133 /* SetKeyword */, 20 /* OpenBracketToken */, 38 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */));
this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(88 /* FunctionKeyword */, 38 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */));
this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(38 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */));
this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(115 /* YieldKeyword */, 38 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */));
@@ -71901,9 +73940,9 @@ var ts;
}
Rules.prototype.getRuleName = function (rule) {
var o = this;
- for (var name_51 in o) {
- if (o[name_51] === rule) {
- return name_51;
+ for (var name_47 in o) {
+ if (o[name_47] === rule) {
+ return name_47;
}
}
throw new Error("Unknown rule");
@@ -71912,42 +73951,42 @@ var ts;
/// Contexts
///
Rules.IsForContext = function (context) {
- return context.contextNode.kind === 207 /* ForStatement */;
+ return context.contextNode.kind === 210 /* ForStatement */;
};
Rules.IsNotForContext = function (context) {
return !Rules.IsForContext(context);
};
Rules.IsBinaryOpContext = function (context) {
switch (context.contextNode.kind) {
- case 188 /* BinaryExpression */:
- case 189 /* ConditionalExpression */:
- case 196 /* AsExpression */:
- case 239 /* ExportSpecifier */:
- case 235 /* ImportSpecifier */:
- case 155 /* TypePredicate */:
- case 163 /* UnionType */:
- case 164 /* IntersectionType */:
+ case 191 /* BinaryExpression */:
+ case 192 /* ConditionalExpression */:
+ case 199 /* AsExpression */:
+ case 242 /* ExportSpecifier */:
+ case 238 /* ImportSpecifier */:
+ case 156 /* TypePredicate */:
+ case 164 /* UnionType */:
+ case 165 /* IntersectionType */:
return true;
// equals in binding elements: function foo([[x, y] = [1, 2]])
- case 170 /* BindingElement */:
+ case 173 /* BindingElement */:
// equals in type X = ...
- case 224 /* TypeAliasDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
// equal in import a = module('a');
- case 230 /* ImportEqualsDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
// equal in let a = 0;
- case 219 /* VariableDeclaration */:
+ case 222 /* VariableDeclaration */:
// equal in p = 0;
- case 143 /* Parameter */:
- case 255 /* EnumMember */:
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
+ case 144 /* Parameter */:
+ case 259 /* EnumMember */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
return context.currentTokenSpan.kind === 57 /* EqualsToken */ || context.nextTokenSpan.kind === 57 /* EqualsToken */;
// "in" keyword in for (let x in []) { }
- case 208 /* ForInStatement */:
+ case 211 /* ForInStatement */:
return context.currentTokenSpan.kind === 91 /* InKeyword */ || context.nextTokenSpan.kind === 91 /* InKeyword */;
// Technically, "of" is not a binary operator, but format it the same way as "in"
- case 209 /* ForOfStatement */:
- return context.currentTokenSpan.kind === 139 /* OfKeyword */ || context.nextTokenSpan.kind === 139 /* OfKeyword */;
+ case 212 /* ForOfStatement */:
+ return context.currentTokenSpan.kind === 140 /* OfKeyword */ || context.nextTokenSpan.kind === 140 /* OfKeyword */;
}
return false;
};
@@ -71955,7 +73994,7 @@ var ts;
return !Rules.IsBinaryOpContext(context);
};
Rules.IsConditionalOperatorContext = function (context) {
- return context.contextNode.kind === 189 /* ConditionalExpression */;
+ return context.contextNode.kind === 192 /* ConditionalExpression */;
};
Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) {
//// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction.
@@ -71999,97 +74038,97 @@ var ts;
return true;
}
switch (node.kind) {
- case 200 /* Block */:
- case 228 /* CaseBlock */:
- case 172 /* ObjectLiteralExpression */:
- case 227 /* ModuleBlock */:
+ case 203 /* Block */:
+ case 231 /* CaseBlock */:
+ case 175 /* ObjectLiteralExpression */:
+ case 230 /* ModuleBlock */:
return true;
}
return false;
};
Rules.IsFunctionDeclContext = function (context) {
switch (context.contextNode.kind) {
- case 221 /* FunctionDeclaration */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 224 /* FunctionDeclaration */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
// case SyntaxKind.MemberFunctionDeclaration:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
// case SyntaxKind.MethodSignature:
- case 152 /* CallSignature */:
- case 180 /* FunctionExpression */:
- case 149 /* Constructor */:
- case 181 /* ArrowFunction */:
+ case 153 /* CallSignature */:
+ case 183 /* FunctionExpression */:
+ case 150 /* Constructor */:
+ case 184 /* ArrowFunction */:
// case SyntaxKind.ConstructorDeclaration:
// case SyntaxKind.SimpleArrowFunctionExpression:
// case SyntaxKind.ParenthesizedArrowFunctionExpression:
- case 223 /* InterfaceDeclaration */:
+ case 226 /* InterfaceDeclaration */:
return true;
}
return false;
};
Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) {
- return context.contextNode.kind === 221 /* FunctionDeclaration */ || context.contextNode.kind === 180 /* FunctionExpression */;
+ return context.contextNode.kind === 224 /* FunctionDeclaration */ || context.contextNode.kind === 183 /* FunctionExpression */;
};
Rules.IsTypeScriptDeclWithBlockContext = function (context) {
return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode);
};
Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) {
switch (node.kind) {
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 223 /* InterfaceDeclaration */:
- case 225 /* EnumDeclaration */:
- case 160 /* TypeLiteral */:
- case 226 /* ModuleDeclaration */:
- case 237 /* ExportDeclaration */:
- case 238 /* NamedExports */:
- case 231 /* ImportDeclaration */:
- case 234 /* NamedImports */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 226 /* InterfaceDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 161 /* TypeLiteral */:
+ case 229 /* ModuleDeclaration */:
+ case 240 /* ExportDeclaration */:
+ case 241 /* NamedExports */:
+ case 234 /* ImportDeclaration */:
+ case 237 /* NamedImports */:
return true;
}
return false;
};
Rules.IsAfterCodeBlockContext = function (context) {
switch (context.currentTokenParent.kind) {
- case 222 /* ClassDeclaration */:
- case 226 /* ModuleDeclaration */:
- case 225 /* EnumDeclaration */:
- case 200 /* Block */:
- case 252 /* CatchClause */:
- case 227 /* ModuleBlock */:
- case 214 /* SwitchStatement */:
+ case 225 /* ClassDeclaration */:
+ case 229 /* ModuleDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 203 /* Block */:
+ case 255 /* CatchClause */:
+ case 230 /* ModuleBlock */:
+ case 217 /* SwitchStatement */:
return true;
}
return false;
};
Rules.IsControlDeclContext = function (context) {
switch (context.contextNode.kind) {
- case 204 /* IfStatement */:
- case 214 /* SwitchStatement */:
- case 207 /* ForStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
- case 206 /* WhileStatement */:
- case 217 /* TryStatement */:
- case 205 /* DoStatement */:
- case 213 /* WithStatement */:
+ case 207 /* IfStatement */:
+ case 217 /* SwitchStatement */:
+ case 210 /* ForStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
+ case 209 /* WhileStatement */:
+ case 220 /* TryStatement */:
+ case 208 /* DoStatement */:
+ case 216 /* WithStatement */:
// TODO
// case SyntaxKind.ElseClause:
- case 252 /* CatchClause */:
+ case 255 /* CatchClause */:
return true;
default:
return false;
}
};
Rules.IsObjectContext = function (context) {
- return context.contextNode.kind === 172 /* ObjectLiteralExpression */;
+ return context.contextNode.kind === 175 /* ObjectLiteralExpression */;
};
Rules.IsFunctionCallContext = function (context) {
- return context.contextNode.kind === 175 /* CallExpression */;
+ return context.contextNode.kind === 178 /* CallExpression */;
};
Rules.IsNewContext = function (context) {
- return context.contextNode.kind === 176 /* NewExpression */;
+ return context.contextNode.kind === 179 /* NewExpression */;
};
Rules.IsFunctionCallOrNewContext = function (context) {
return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context);
@@ -72101,25 +74140,25 @@ var ts;
return context.nextTokenSpan.kind !== 21 /* CloseBracketToken */;
};
Rules.IsArrowFunctionContext = function (context) {
- return context.contextNode.kind === 181 /* ArrowFunction */;
+ return context.contextNode.kind === 184 /* ArrowFunction */;
};
Rules.IsNonJsxSameLineTokenContext = function (context) {
return context.TokensAreOnSameLine() && context.contextNode.kind !== 10 /* JsxText */;
};
Rules.IsNonJsxElementContext = function (context) {
- return context.contextNode.kind !== 242 /* JsxElement */;
+ return context.contextNode.kind !== 245 /* JsxElement */;
};
Rules.IsJsxExpressionContext = function (context) {
- return context.contextNode.kind === 248 /* JsxExpression */;
+ return context.contextNode.kind === 251 /* JsxExpression */;
};
Rules.IsNextTokenParentJsxAttribute = function (context) {
- return context.nextTokenParent.kind === 246 /* JsxAttribute */;
+ return context.nextTokenParent.kind === 249 /* JsxAttribute */;
};
Rules.IsJsxAttributeContext = function (context) {
- return context.contextNode.kind === 246 /* JsxAttribute */;
+ return context.contextNode.kind === 249 /* JsxAttribute */;
};
Rules.IsJsxSelfClosingElementContext = function (context) {
- return context.contextNode.kind === 243 /* JsxSelfClosingElement */;
+ return context.contextNode.kind === 246 /* JsxSelfClosingElement */;
};
Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) {
return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context);
@@ -72134,41 +74173,41 @@ var ts;
while (ts.isPartOfExpression(node)) {
node = node.parent;
}
- return node.kind === 144 /* Decorator */;
+ return node.kind === 145 /* Decorator */;
};
Rules.IsStartOfVariableDeclarationList = function (context) {
- return context.currentTokenParent.kind === 220 /* VariableDeclarationList */ &&
+ return context.currentTokenParent.kind === 223 /* VariableDeclarationList */ &&
context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos;
};
Rules.IsNotFormatOnEnter = function (context) {
return context.formattingRequestKind !== 2 /* FormatOnEnter */;
};
Rules.IsModuleDeclContext = function (context) {
- return context.contextNode.kind === 226 /* ModuleDeclaration */;
+ return context.contextNode.kind === 229 /* ModuleDeclaration */;
};
Rules.IsObjectTypeContext = function (context) {
- return context.contextNode.kind === 160 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration;
+ return context.contextNode.kind === 161 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration;
};
Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) {
if (token.kind !== 26 /* LessThanToken */ && token.kind !== 28 /* GreaterThanToken */) {
return false;
}
switch (parent.kind) {
- case 156 /* TypeReference */:
- case 178 /* TypeAssertionExpression */:
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 223 /* InterfaceDeclaration */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
- case 195 /* ExpressionWithTypeArguments */:
+ case 157 /* TypeReference */:
+ case 181 /* TypeAssertionExpression */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 226 /* InterfaceDeclaration */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
+ case 198 /* ExpressionWithTypeArguments */:
return true;
default:
return false;
@@ -72179,13 +74218,13 @@ var ts;
Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent);
};
Rules.IsTypeAssertionContext = function (context) {
- return context.contextNode.kind === 178 /* TypeAssertionExpression */;
+ return context.contextNode.kind === 181 /* TypeAssertionExpression */;
};
Rules.IsVoidOpContext = function (context) {
- return context.currentTokenSpan.kind === 104 /* VoidKeyword */ && context.currentTokenParent.kind === 184 /* VoidExpression */;
+ return context.currentTokenSpan.kind === 104 /* VoidKeyword */ && context.currentTokenParent.kind === 187 /* VoidExpression */;
};
Rules.IsYieldOrYieldStarWithOperand = function (context) {
- return context.contextNode.kind === 191 /* YieldExpression */ && context.contextNode.expression !== undefined;
+ return context.contextNode.kind === 194 /* YieldExpression */ && context.contextNode.expression !== undefined;
};
return Rules;
}());
@@ -72209,7 +74248,7 @@ var ts;
return result;
};
RulesMap.prototype.Initialize = function (rules) {
- this.mapRowLength = 139 /* LastToken */ + 1;
+ this.mapRowLength = 140 /* LastToken */ + 1;
this.map = new Array(this.mapRowLength * this.mapRowLength); // new Array(this.mapRowLength * this.mapRowLength);
// This array is used only during construction of the rulesbucket in the map
var rulesBucketConstructionStateList = new Array(this.map.length); // new Array(this.map.length);
@@ -72223,7 +74262,7 @@ var ts;
});
};
RulesMap.prototype.GetRuleBucketIndex = function (row, column) {
- ts.Debug.assert(row <= 139 /* LastKeyword */ && column <= 139 /* LastKeyword */, "Must compute formatting context from tokens");
+ ts.Debug.assert(row <= 140 /* LastKeyword */ && column <= 140 /* LastKeyword */, "Must compute formatting context from tokens");
var rulesBucketIndex = (row * this.mapRowLength) + column;
return rulesBucketIndex;
};
@@ -72260,6 +74299,7 @@ var ts;
formatting.RulesMap = RulesMap;
var MaskBitSize = 5;
var Mask = 0x1f;
+ var RulesPosition;
(function (RulesPosition) {
RulesPosition[RulesPosition["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific";
RulesPosition[RulesPosition["IgnoreRulesAny"] = MaskBitSize * 1] = "IgnoreRulesAny";
@@ -72267,8 +74307,7 @@ var ts;
RulesPosition[RulesPosition["ContextRulesAny"] = MaskBitSize * 3] = "ContextRulesAny";
RulesPosition[RulesPosition["NoContextRulesSpecific"] = MaskBitSize * 4] = "NoContextRulesSpecific";
RulesPosition[RulesPosition["NoContextRulesAny"] = MaskBitSize * 5] = "NoContextRulesAny";
- })(formatting.RulesPosition || (formatting.RulesPosition = {}));
- var RulesPosition = formatting.RulesPosition;
+ })(RulesPosition = formatting.RulesPosition || (formatting.RulesPosition = {}));
var RulesBucketConstructionState = (function () {
function RulesBucketConstructionState() {
//// The Rules list contains all the inserted rules into a rulebucket in the following order:
@@ -72404,7 +74443,7 @@ var ts;
}
TokenAllAccess.prototype.GetTokens = function () {
var result = [];
- for (var token = 0 /* FirstToken */; token <= 139 /* LastToken */; token++) {
+ for (var token = 0 /* FirstToken */; token <= 140 /* LastToken */; token++) {
result.push(token);
}
return result;
@@ -72448,9 +74487,9 @@ var ts;
}());
TokenRange.Any = TokenRange.AllTokens();
TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */]));
- TokenRange.Keywords = TokenRange.FromRange(71 /* FirstKeyword */, 139 /* LastKeyword */);
+ TokenRange.Keywords = TokenRange.FromRange(71 /* FirstKeyword */, 140 /* LastKeyword */);
TokenRange.BinaryOperators = TokenRange.FromRange(26 /* FirstBinaryOperator */, 69 /* LastBinaryOperator */);
- TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91 /* InKeyword */, 92 /* InstanceOfKeyword */, 139 /* OfKeyword */, 117 /* AsKeyword */, 125 /* IsKeyword */]);
+ TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91 /* InKeyword */, 92 /* InstanceOfKeyword */, 140 /* OfKeyword */, 117 /* AsKeyword */, 125 /* IsKeyword */]);
TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([42 /* PlusPlusToken */, 43 /* MinusMinusToken */, 51 /* TildeToken */, 50 /* ExclamationToken */]);
TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 70 /* Identifier */, 18 /* OpenParenToken */, 20 /* OpenBracketToken */, 16 /* OpenBraceToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]);
TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]);
@@ -72458,7 +74497,7 @@ var ts;
TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]);
TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 19 /* CloseParenToken */, 21 /* CloseBracketToken */, 93 /* NewKeyword */]);
TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]);
- TokenRange.TypeNames = TokenRange.FromTokens([70 /* Identifier */, 131 /* NumberKeyword */, 133 /* StringKeyword */, 121 /* BooleanKeyword */, 134 /* SymbolKeyword */, 104 /* VoidKeyword */, 118 /* AnyKeyword */]);
+ TokenRange.TypeNames = TokenRange.FromTokens([70 /* Identifier */, 132 /* NumberKeyword */, 134 /* StringKeyword */, 121 /* BooleanKeyword */, 135 /* SymbolKeyword */, 104 /* VoidKeyword */, 118 /* AnyKeyword */]);
Shared.TokenRange = TokenRange;
})(Shared = formatting.Shared || (formatting.Shared = {}));
})(formatting = ts.formatting || (ts.formatting = {}));
@@ -72717,17 +74756,17 @@ var ts;
// i.e. parent is class declaration with the list of members and node is one of members.
function isListElement(parent, node) {
switch (parent.kind) {
- case 222 /* ClassDeclaration */:
- case 223 /* InterfaceDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 226 /* InterfaceDeclaration */:
return ts.rangeContainsRange(parent.members, node);
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
var body = parent.body;
- return body && body.kind === 227 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node);
- case 256 /* SourceFile */:
- case 200 /* Block */:
- case 227 /* ModuleBlock */:
+ return body && body.kind === 230 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node);
+ case 260 /* SourceFile */:
+ case 203 /* Block */:
+ case 230 /* ModuleBlock */:
return ts.rangeContainsRange(parent.statements, node);
- case 252 /* CatchClause */:
+ case 255 /* CatchClause */:
return ts.rangeContainsRange(parent.block.statements, node);
}
return false;
@@ -72932,20 +74971,20 @@ var ts;
return node.modifiers[0].kind;
}
switch (node.kind) {
- case 222 /* ClassDeclaration */: return 74 /* ClassKeyword */;
- case 223 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */;
- case 221 /* FunctionDeclaration */: return 88 /* FunctionKeyword */;
- case 225 /* EnumDeclaration */: return 225 /* EnumDeclaration */;
- case 150 /* GetAccessor */: return 124 /* GetKeyword */;
- case 151 /* SetAccessor */: return 132 /* SetKeyword */;
- case 148 /* MethodDeclaration */:
+ case 225 /* ClassDeclaration */: return 74 /* ClassKeyword */;
+ case 226 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */;
+ case 224 /* FunctionDeclaration */: return 88 /* FunctionKeyword */;
+ case 228 /* EnumDeclaration */: return 228 /* EnumDeclaration */;
+ case 151 /* GetAccessor */: return 124 /* GetKeyword */;
+ case 152 /* SetAccessor */: return 133 /* SetKeyword */;
+ case 149 /* MethodDeclaration */:
if (node.asteriskToken) {
return 38 /* AsteriskToken */;
} /*
fall-through
*/
- case 146 /* PropertyDeclaration */:
- case 143 /* Parameter */:
+ case 147 /* PropertyDeclaration */:
+ case 144 /* Parameter */:
return node.name.kind;
}
}
@@ -73089,11 +75128,11 @@ var ts;
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child);
return inheritedIndentation;
}
- var effectiveParentStartLine = child.kind === 144 /* Decorator */ ? childStartLine : undecoratedParentStartLine;
+ var effectiveParentStartLine = child.kind === 145 /* Decorator */ ? childStartLine : undecoratedParentStartLine;
var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine);
processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta);
childContextNode = node;
- if (isFirstListItem && parent.kind === 171 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) {
+ if (isFirstListItem && parent.kind === 174 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) {
inheritedIndentation = childIndentation.indentation;
}
return inheritedIndentation;
@@ -73438,12 +75477,12 @@ var ts;
}
function getOpenTokenForList(node, list) {
switch (node.kind) {
- case 149 /* Constructor */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 181 /* ArrowFunction */:
+ case 150 /* Constructor */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 184 /* ArrowFunction */:
if (node.typeParameters === list) {
return 26 /* LessThanToken */;
}
@@ -73451,8 +75490,8 @@ var ts;
return 18 /* OpenParenToken */;
}
break;
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
if (node.typeArguments === list) {
return 26 /* LessThanToken */;
}
@@ -73460,7 +75499,7 @@ var ts;
return 18 /* OpenParenToken */;
}
break;
- case 156 /* TypeReference */:
+ case 157 /* TypeReference */:
if (node.typeArguments === list) {
return 26 /* LessThanToken */;
}
@@ -73576,7 +75615,7 @@ var ts;
var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile);
return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options);
}
- if (precedingToken.kind === 25 /* CommaToken */ && precedingToken.parent.kind !== 188 /* BinaryExpression */) {
+ if (precedingToken.kind === 25 /* CommaToken */ && precedingToken.parent.kind !== 191 /* BinaryExpression */) {
// previous token is comma that separates items in list - find the previous item and try to derive indentation from it
var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options);
if (actualIndentation !== -1 /* Unknown */) {
@@ -73699,7 +75738,7 @@ var ts;
// - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually
// - parent and child are not on the same line
var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) &&
- (parent.kind === 256 /* SourceFile */ || !parentAndChildShareLine);
+ (parent.kind === 260 /* SourceFile */ || !parentAndChildShareLine);
if (!useActualIndentation) {
return -1 /* Unknown */;
}
@@ -73732,7 +75771,7 @@ var ts;
return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));
}
function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) {
- if (parent.kind === 204 /* IfStatement */ && parent.elseStatement === child) {
+ if (parent.kind === 207 /* IfStatement */ && parent.elseStatement === child) {
var elseKeyword = ts.findChildOfKind(parent, 81 /* ElseKeyword */, sourceFile);
ts.Debug.assert(elseKeyword !== undefined);
var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line;
@@ -73744,23 +75783,23 @@ var ts;
function getContainingList(node, sourceFile) {
if (node.parent) {
switch (node.parent.kind) {
- case 156 /* TypeReference */:
+ case 157 /* TypeReference */:
if (node.parent.typeArguments &&
ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) {
return node.parent.typeArguments;
}
break;
- case 172 /* ObjectLiteralExpression */:
+ case 175 /* ObjectLiteralExpression */:
return node.parent.properties;
- case 171 /* ArrayLiteralExpression */:
+ case 174 /* ArrayLiteralExpression */:
return node.parent.elements;
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */: {
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */: {
var start = node.getStart(sourceFile);
if (node.parent.typeParameters &&
ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) {
@@ -73771,8 +75810,8 @@ var ts;
}
break;
}
- case 176 /* NewExpression */:
- case 175 /* CallExpression */: {
+ case 179 /* NewExpression */:
+ case 178 /* CallExpression */: {
var start = node.getStart(sourceFile);
if (node.parent.typeArguments &&
ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) {
@@ -73802,8 +75841,8 @@ var ts;
if (node.kind === 19 /* CloseParenToken */) {
return -1 /* Unknown */;
}
- if (node.parent && (node.parent.kind === 175 /* CallExpression */ ||
- node.parent.kind === 176 /* NewExpression */) &&
+ if (node.parent && (node.parent.kind === 178 /* CallExpression */ ||
+ node.parent.kind === 179 /* NewExpression */) &&
node.parent.expression !== node) {
var fullCallOrNewExpression = node.parent.expression;
var startingExpression = getStartingExpression(fullCallOrNewExpression);
@@ -73821,10 +75860,10 @@ var ts;
function getStartingExpression(node) {
while (true) {
switch (node.kind) {
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
- case 173 /* PropertyAccessExpression */:
- case 174 /* ElementAccessExpression */:
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
+ case 176 /* PropertyAccessExpression */:
+ case 177 /* ElementAccessExpression */:
node = node.expression;
break;
default:
@@ -73888,48 +75927,48 @@ var ts;
SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn;
function nodeContentIsAlwaysIndented(kind) {
switch (kind) {
- case 203 /* ExpressionStatement */:
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 223 /* InterfaceDeclaration */:
- case 225 /* EnumDeclaration */:
- case 224 /* TypeAliasDeclaration */:
- case 171 /* ArrayLiteralExpression */:
- case 200 /* Block */:
- case 227 /* ModuleBlock */:
- case 172 /* ObjectLiteralExpression */:
- case 160 /* TypeLiteral */:
- case 162 /* TupleType */:
- case 228 /* CaseBlock */:
- case 250 /* DefaultClause */:
- case 249 /* CaseClause */:
- case 179 /* ParenthesizedExpression */:
- case 173 /* PropertyAccessExpression */:
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
- case 201 /* VariableStatement */:
- case 219 /* VariableDeclaration */:
- case 236 /* ExportAssignment */:
- case 212 /* ReturnStatement */:
- case 189 /* ConditionalExpression */:
- case 169 /* ArrayBindingPattern */:
- case 168 /* ObjectBindingPattern */:
- case 244 /* JsxOpeningElement */:
- case 243 /* JsxSelfClosingElement */:
- case 248 /* JsxExpression */:
- case 147 /* MethodSignature */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 143 /* Parameter */:
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
- case 165 /* ParenthesizedType */:
- case 177 /* TaggedTemplateExpression */:
- case 185 /* AwaitExpression */:
- case 238 /* NamedExports */:
- case 234 /* NamedImports */:
- case 239 /* ExportSpecifier */:
- case 235 /* ImportSpecifier */:
+ case 206 /* ExpressionStatement */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 226 /* InterfaceDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
+ case 174 /* ArrayLiteralExpression */:
+ case 203 /* Block */:
+ case 230 /* ModuleBlock */:
+ case 175 /* ObjectLiteralExpression */:
+ case 161 /* TypeLiteral */:
+ case 163 /* TupleType */:
+ case 231 /* CaseBlock */:
+ case 253 /* DefaultClause */:
+ case 252 /* CaseClause */:
+ case 182 /* ParenthesizedExpression */:
+ case 176 /* PropertyAccessExpression */:
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
+ case 204 /* VariableStatement */:
+ case 222 /* VariableDeclaration */:
+ case 239 /* ExportAssignment */:
+ case 215 /* ReturnStatement */:
+ case 192 /* ConditionalExpression */:
+ case 172 /* ArrayBindingPattern */:
+ case 171 /* ObjectBindingPattern */:
+ case 247 /* JsxOpeningElement */:
+ case 246 /* JsxSelfClosingElement */:
+ case 251 /* JsxExpression */:
+ case 148 /* MethodSignature */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 144 /* Parameter */:
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
+ case 166 /* ParenthesizedType */:
+ case 180 /* TaggedTemplateExpression */:
+ case 188 /* AwaitExpression */:
+ case 241 /* NamedExports */:
+ case 237 /* NamedImports */:
+ case 242 /* ExportSpecifier */:
+ case 238 /* ImportSpecifier */:
return true;
}
return false;
@@ -73938,27 +75977,27 @@ var ts;
function nodeWillIndentChild(parent, child, indentByDefault) {
var childKind = child ? child.kind : 0 /* Unknown */;
switch (parent.kind) {
- case 205 /* DoStatement */:
- case 206 /* WhileStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
- case 207 /* ForStatement */:
- case 204 /* IfStatement */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 148 /* MethodDeclaration */:
- case 181 /* ArrowFunction */:
- case 149 /* Constructor */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- return childKind !== 200 /* Block */;
- case 237 /* ExportDeclaration */:
- return childKind !== 238 /* NamedExports */;
- case 231 /* ImportDeclaration */:
- return childKind !== 232 /* ImportClause */ ||
- (child.namedBindings && child.namedBindings.kind !== 234 /* NamedImports */);
- case 242 /* JsxElement */:
- return childKind !== 245 /* JsxClosingElement */;
+ case 208 /* DoStatement */:
+ case 209 /* WhileStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
+ case 210 /* ForStatement */:
+ case 207 /* IfStatement */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 149 /* MethodDeclaration */:
+ case 184 /* ArrowFunction */:
+ case 150 /* Constructor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ return childKind !== 203 /* Block */;
+ case 240 /* ExportDeclaration */:
+ return childKind !== 241 /* NamedExports */;
+ case 234 /* ImportDeclaration */:
+ return childKind !== 235 /* ImportClause */ ||
+ (child.namedBindings && child.namedBindings.kind !== 237 /* NamedImports */);
+ case 245 /* JsxElement */:
+ return childKind !== 248 /* JsxClosingElement */;
}
// No explicit rule for given nodes so the result will follow the default value argument
return indentByDefault;
@@ -74048,7 +76087,7 @@ var ts;
}
// figure out if the this access is actuall inside the supercall
// i.e. super(this.a), since in that case we won't suggest a fix
- if (superCall.expression && superCall.expression.kind == 175 /* CallExpression */) {
+ if (superCall.expression && superCall.expression.kind == 178 /* CallExpression */) {
var arguments_1 = superCall.expression.arguments;
for (var i = 0; i < arguments_1.length; i++) {
if (arguments_1[i].expression === token) {
@@ -74072,7 +76111,7 @@ var ts;
changes: changes
}];
function findSuperCall(n) {
- if (n.kind === 203 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) {
+ if (n.kind === 206 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) {
return n;
}
if (ts.isFunctionLike(n)) {
@@ -74117,7 +76156,7 @@ var ts;
/** The version of the language service API */
ts.servicesVersion = "0.5";
function createNode(kind, pos, end, parent) {
- var node = kind >= 140 /* FirstNode */ ? new NodeObject(kind, pos, end) :
+ var node = kind >= 141 /* FirstNode */ ? new NodeObject(kind, pos, end) :
kind === 70 /* Identifier */ ? new IdentifierObject(70 /* Identifier */, pos, end) :
new TokenObject(kind, pos, end);
node.parent = parent;
@@ -74175,11 +76214,11 @@ var ts;
return pos;
};
NodeObject.prototype.createSyntaxList = function (nodes) {
- var list = createNode(286 /* SyntaxList */, nodes.pos, nodes.end, this);
+ var list = createNode(290 /* SyntaxList */, nodes.pos, nodes.end, this);
list._children = [];
var pos = nodes.pos;
- for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
- var node = nodes_4[_i];
+ for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) {
+ var node = nodes_5[_i];
if (pos < node.pos) {
pos = this.addSyntheticNodes(list._children, pos, node.pos);
}
@@ -74194,11 +76233,11 @@ var ts;
NodeObject.prototype.createChildren = function (sourceFile) {
var _this = this;
var children;
- if (this.kind >= 140 /* FirstNode */) {
+ if (this.kind >= 141 /* FirstNode */) {
ts.scanner.setText((sourceFile || this.getSourceFile()).text);
children = [];
var pos_3 = this.pos;
- var useJSDocScanner_1 = this.kind >= 273 /* FirstJSDocTagNode */ && this.kind <= 285 /* LastJSDocTagNode */;
+ var useJSDocScanner_1 = this.kind >= 277 /* FirstJSDocTagNode */ && this.kind <= 289 /* LastJSDocTagNode */;
var processNode = function (node) {
var isJSDocTagNode = ts.isJSDocTag(node);
if (!isJSDocTagNode && pos_3 < node.pos) {
@@ -74256,7 +76295,7 @@ var ts;
return undefined;
}
var child = children[0];
- return child.kind < 140 /* FirstNode */ ? child : child.getFirstToken(sourceFile);
+ return child.kind < 141 /* FirstNode */ ? child : child.getFirstToken(sourceFile);
};
NodeObject.prototype.getLastToken = function (sourceFile) {
var children = this.getChildren(sourceFile);
@@ -74264,7 +76303,7 @@ var ts;
if (!child) {
return undefined;
}
- return child.kind < 140 /* FirstNode */ ? child : child.getLastToken(sourceFile);
+ return child.kind < 141 /* FirstNode */ ? child : child.getLastToken(sourceFile);
};
return NodeObject;
}());
@@ -74467,9 +76506,9 @@ var ts;
if (result_6 !== undefined) {
return result_6;
}
- if (declaration.name.kind === 141 /* ComputedPropertyName */) {
+ if (declaration.name.kind === 142 /* ComputedPropertyName */) {
var expr = declaration.name.expression;
- if (expr.kind === 173 /* PropertyAccessExpression */) {
+ if (expr.kind === 176 /* PropertyAccessExpression */) {
return expr.name.text;
}
return getTextOfIdentifierOrLiteral(expr);
@@ -74489,10 +76528,10 @@ var ts;
}
function visit(node) {
switch (node.kind) {
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
var functionDeclaration = node;
var declarationName = getDeclarationName(functionDeclaration);
if (declarationName) {
@@ -74512,32 +76551,32 @@ var ts;
ts.forEachChild(node, visit);
}
break;
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 223 /* InterfaceDeclaration */:
- case 224 /* TypeAliasDeclaration */:
- case 225 /* EnumDeclaration */:
- case 226 /* ModuleDeclaration */:
- case 230 /* ImportEqualsDeclaration */:
- case 239 /* ExportSpecifier */:
- case 235 /* ImportSpecifier */:
- case 230 /* ImportEqualsDeclaration */:
- case 232 /* ImportClause */:
- case 233 /* NamespaceImport */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 160 /* TypeLiteral */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 226 /* InterfaceDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 229 /* ModuleDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
+ case 242 /* ExportSpecifier */:
+ case 238 /* ImportSpecifier */:
+ case 233 /* ImportEqualsDeclaration */:
+ case 235 /* ImportClause */:
+ case 236 /* NamespaceImport */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 161 /* TypeLiteral */:
addDeclaration(node);
ts.forEachChild(node, visit);
break;
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
// Only consider parameter properties
if (!ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) {
break;
}
// fall through
- case 219 /* VariableDeclaration */:
- case 170 /* BindingElement */: {
+ case 222 /* VariableDeclaration */:
+ case 173 /* BindingElement */: {
var decl = node;
if (ts.isBindingPattern(decl.name)) {
ts.forEachChild(decl.name, visit);
@@ -74546,19 +76585,19 @@ var ts;
if (decl.initializer)
visit(decl.initializer);
}
- case 255 /* EnumMember */:
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
+ case 259 /* EnumMember */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
addDeclaration(node);
break;
- case 237 /* ExportDeclaration */:
+ case 240 /* ExportDeclaration */:
// Handle named exports case e.g.:
// export {a, b as B} from "mod";
if (node.exportClause) {
ts.forEach(node.exportClause.elements, visit);
}
break;
- case 231 /* ImportDeclaration */:
+ case 234 /* ImportDeclaration */:
var importClause = node.importClause;
if (importClause) {
// Handle default import case e.g.:
@@ -74570,7 +76609,7 @@ var ts;
// import * as NS from "mod";
// import {a, b as B} from "mod";
if (importClause.namedBindings) {
- if (importClause.namedBindings.kind === 233 /* NamespaceImport */) {
+ if (importClause.namedBindings.kind === 236 /* NamespaceImport */) {
addDeclaration(importClause.namedBindings);
}
else {
@@ -74725,7 +76764,7 @@ var ts;
var sourceFile;
if (this.currentFileName !== fileName) {
// This is a new file, just parse it
- sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 4 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
+ sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 5 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
}
else if (this.currentFileVersion !== version) {
// This is the same file, just a newer version. Incrementally parse the file.
@@ -75100,10 +77139,10 @@ var ts;
// Try getting just type at this position and show
switch (node.kind) {
case 70 /* Identifier */:
- case 173 /* PropertyAccessExpression */:
- case 140 /* QualifiedName */:
+ case 176 /* PropertyAccessExpression */:
+ case 141 /* QualifiedName */:
case 98 /* ThisKeyword */:
- case 166 /* ThisType */:
+ case 167 /* ThisType */:
case 96 /* SuperKeyword */:
// For the identifiers/this/super etc get the type at position
var type = typeChecker.getTypeAtLocation(node);
@@ -75246,15 +77285,15 @@ var ts;
return;
}
switch (node.kind) {
- case 173 /* PropertyAccessExpression */:
- case 140 /* QualifiedName */:
+ case 176 /* PropertyAccessExpression */:
+ case 141 /* QualifiedName */:
case 9 /* StringLiteral */:
case 85 /* FalseKeyword */:
case 100 /* TrueKeyword */:
case 94 /* NullKeyword */:
case 96 /* SuperKeyword */:
case 98 /* ThisKeyword */:
- case 166 /* ThisType */:
+ case 167 /* ThisType */:
case 70 /* Identifier */:
break;
// Cant create the text span
@@ -75271,7 +77310,7 @@ var ts;
// If this is name of a module declarations, check if this is right side of dotted module name
// If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of
// Then this name is name from dotted module
- if (nodeForStartPos.parent.parent.kind === 226 /* ModuleDeclaration */ &&
+ if (nodeForStartPos.parent.parent.kind === 229 /* ModuleDeclaration */ &&
nodeForStartPos.parent.parent.body === nodeForStartPos.parent) {
// Use parent module declarations name for start pos
nodeForStartPos = nodeForStartPos.parent.parent.name;
@@ -75655,7 +77694,7 @@ var ts;
// then we want 'something' to be in the name table. Similarly, if we have
// "a['propname']" then we want to store "propname" in the name table.
if (ts.isDeclarationName(node) ||
- node.parent.kind === 241 /* ExternalModuleReference */ ||
+ node.parent.kind === 244 /* ExternalModuleReference */ ||
isArgumentOfElementAccessExpression(node) ||
ts.isLiteralComputedPropertyDeclarationName(node)) {
nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1;
@@ -75675,7 +77714,7 @@ var ts;
function isArgumentOfElementAccessExpression(node) {
return node &&
node.parent &&
- node.parent.kind === 174 /* ElementAccessExpression */ &&
+ node.parent.kind === 177 /* ElementAccessExpression */ &&
node.parent.argumentExpression === node;
}
/**
@@ -75759,113 +77798,113 @@ var ts;
function spanInNode(node) {
if (node) {
switch (node.kind) {
- case 201 /* VariableStatement */:
+ case 204 /* VariableStatement */:
// Span on first variable declaration
return spanInVariableDeclaration(node.declarationList.declarations[0]);
- case 219 /* VariableDeclaration */:
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
+ case 222 /* VariableDeclaration */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
return spanInVariableDeclaration(node);
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
return spanInParameterDeclaration(node);
- case 221 /* FunctionDeclaration */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 149 /* Constructor */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
+ case 224 /* FunctionDeclaration */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 150 /* Constructor */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
return spanInFunctionDeclaration(node);
- case 200 /* Block */:
+ case 203 /* Block */:
if (ts.isFunctionBlock(node)) {
return spanInFunctionBlock(node);
}
// Fall through
- case 227 /* ModuleBlock */:
+ case 230 /* ModuleBlock */:
return spanInBlock(node);
- case 252 /* CatchClause */:
+ case 255 /* CatchClause */:
return spanInBlock(node.block);
- case 203 /* ExpressionStatement */:
+ case 206 /* ExpressionStatement */:
// span on the expression
return textSpan(node.expression);
- case 212 /* ReturnStatement */:
+ case 215 /* ReturnStatement */:
// span on return keyword and expression if present
return textSpan(node.getChildAt(0), node.expression);
- case 206 /* WhileStatement */:
+ case 209 /* WhileStatement */:
// Span on while(...)
return textSpanEndingAtNextToken(node, node.expression);
- case 205 /* DoStatement */:
+ case 208 /* DoStatement */:
// span in statement of the do statement
return spanInNode(node.statement);
- case 218 /* DebuggerStatement */:
+ case 221 /* DebuggerStatement */:
// span on debugger keyword
return textSpan(node.getChildAt(0));
- case 204 /* IfStatement */:
+ case 207 /* IfStatement */:
// set on if(..) span
return textSpanEndingAtNextToken(node, node.expression);
- case 215 /* LabeledStatement */:
+ case 218 /* LabeledStatement */:
// span in statement
return spanInNode(node.statement);
- case 211 /* BreakStatement */:
- case 210 /* ContinueStatement */:
+ case 214 /* BreakStatement */:
+ case 213 /* ContinueStatement */:
// On break or continue keyword and label if present
return textSpan(node.getChildAt(0), node.label);
- case 207 /* ForStatement */:
+ case 210 /* ForStatement */:
return spanInForStatement(node);
- case 208 /* ForInStatement */:
+ case 211 /* ForInStatement */:
// span of for (a in ...)
return textSpanEndingAtNextToken(node, node.expression);
- case 209 /* ForOfStatement */:
+ case 212 /* ForOfStatement */:
// span in initializer
return spanInInitializerOfForLike(node);
- case 214 /* SwitchStatement */:
+ case 217 /* SwitchStatement */:
// span on switch(...)
return textSpanEndingAtNextToken(node, node.expression);
- case 249 /* CaseClause */:
- case 250 /* DefaultClause */:
+ case 252 /* CaseClause */:
+ case 253 /* DefaultClause */:
// span in first statement of the clause
return spanInNode(node.statements[0]);
- case 217 /* TryStatement */:
+ case 220 /* TryStatement */:
// span in try block
return spanInBlock(node.tryBlock);
- case 216 /* ThrowStatement */:
+ case 219 /* ThrowStatement */:
// span in throw ...
return textSpan(node, node.expression);
- case 236 /* ExportAssignment */:
+ case 239 /* ExportAssignment */:
// span on export = id
return textSpan(node, node.expression);
- case 230 /* ImportEqualsDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleReference);
- case 231 /* ImportDeclaration */:
+ case 234 /* ImportDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleSpecifier);
- case 237 /* ExportDeclaration */:
+ case 240 /* ExportDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleSpecifier);
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
// span on complete module if it is instantiated
if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) {
return undefined;
}
- case 222 /* ClassDeclaration */:
- case 225 /* EnumDeclaration */:
- case 255 /* EnumMember */:
- case 170 /* BindingElement */:
+ case 225 /* ClassDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 259 /* EnumMember */:
+ case 173 /* BindingElement */:
// span on complete node
return textSpan(node);
- case 213 /* WithStatement */:
+ case 216 /* WithStatement */:
// span in statement
return spanInNode(node.statement);
- case 144 /* Decorator */:
+ case 145 /* Decorator */:
return spanInNodeArray(node.parent.decorators);
- case 168 /* ObjectBindingPattern */:
- case 169 /* ArrayBindingPattern */:
+ case 171 /* ObjectBindingPattern */:
+ case 172 /* ArrayBindingPattern */:
return spanInBindingPattern(node);
// No breakpoint in interface, type alias
- case 223 /* InterfaceDeclaration */:
- case 224 /* TypeAliasDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
return undefined;
// Tokens:
case 24 /* SemicolonToken */:
@@ -75895,7 +77934,7 @@ var ts;
case 73 /* CatchKeyword */:
case 86 /* FinallyKeyword */:
return spanInNextNode(node);
- case 139 /* OfKeyword */:
+ case 140 /* OfKeyword */:
return spanInOfKeyword(node);
default:
// Destructuring pattern in destructuring assignment
@@ -75908,13 +77947,13 @@ var ts;
// a or ...c or d: x from
// [a, b, ...c] or { a, b } or { d: x } from destructuring pattern
if ((node.kind === 70 /* Identifier */ ||
- node.kind == 192 /* SpreadElementExpression */ ||
- node.kind === 253 /* PropertyAssignment */ ||
- node.kind === 254 /* ShorthandPropertyAssignment */) &&
+ node.kind == 195 /* SpreadElement */ ||
+ node.kind === 256 /* PropertyAssignment */ ||
+ node.kind === 257 /* ShorthandPropertyAssignment */) &&
ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
return textSpan(node);
}
- if (node.kind === 188 /* BinaryExpression */) {
+ if (node.kind === 191 /* BinaryExpression */) {
var binaryExpression = node;
// Set breakpoint in destructuring pattern if its destructuring assignment
// [a, b, c] or {a, b, c} of
@@ -75937,22 +77976,22 @@ var ts;
}
if (ts.isPartOfExpression(node)) {
switch (node.parent.kind) {
- case 205 /* DoStatement */:
+ case 208 /* DoStatement */:
// Set span as if on while keyword
return spanInPreviousNode(node);
- case 144 /* Decorator */:
+ case 145 /* Decorator */:
// Set breakpoint on the decorator emit
return spanInNode(node.parent);
- case 207 /* ForStatement */:
- case 209 /* ForOfStatement */:
+ case 210 /* ForStatement */:
+ case 212 /* ForOfStatement */:
return textSpan(node);
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
if (node.parent.operatorToken.kind === 25 /* CommaToken */) {
// If this is a comma expression, the breakpoint is possible in this expression
return textSpan(node);
}
break;
- case 181 /* ArrowFunction */:
+ case 184 /* ArrowFunction */:
if (node.parent.body === node) {
// If this is body of arrow function, it is allowed to have the breakpoint
return textSpan(node);
@@ -75961,13 +78000,13 @@ var ts;
}
}
// If this is name of property assignment, set breakpoint in the initializer
- if (node.parent.kind === 253 /* PropertyAssignment */ &&
+ if (node.parent.kind === 256 /* PropertyAssignment */ &&
node.parent.name === node &&
!ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) {
return spanInNode(node.parent.initializer);
}
// Breakpoint in type assertion goes to its operand
- if (node.parent.kind === 178 /* TypeAssertionExpression */ && node.parent.type === node) {
+ if (node.parent.kind === 181 /* TypeAssertionExpression */ && node.parent.type === node) {
return spanInNextNode(node.parent.type);
}
// return type of function go to previous token
@@ -75975,8 +78014,8 @@ var ts;
return spanInPreviousNode(node);
}
// initializer of variable/parameter declaration go to previous node
- if ((node.parent.kind === 219 /* VariableDeclaration */ ||
- node.parent.kind === 143 /* Parameter */)) {
+ if ((node.parent.kind === 222 /* VariableDeclaration */ ||
+ node.parent.kind === 144 /* Parameter */)) {
var paramOrVarDecl = node.parent;
if (paramOrVarDecl.initializer === node ||
paramOrVarDecl.type === node ||
@@ -75984,7 +78023,7 @@ var ts;
return spanInPreviousNode(node);
}
}
- if (node.parent.kind === 188 /* BinaryExpression */) {
+ if (node.parent.kind === 191 /* BinaryExpression */) {
var binaryExpression = node.parent;
if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) &&
(binaryExpression.right === node ||
@@ -76010,7 +78049,7 @@ var ts;
}
function spanInVariableDeclaration(variableDeclaration) {
// If declaration of for in statement, just set the span in parent
- if (variableDeclaration.parent.parent.kind === 208 /* ForInStatement */) {
+ if (variableDeclaration.parent.parent.kind === 211 /* ForInStatement */) {
return spanInNode(variableDeclaration.parent.parent);
}
// If this is a destructuring pattern, set breakpoint in binding pattern
@@ -76021,7 +78060,7 @@ var ts;
// or its declaration from 'for of'
if (variableDeclaration.initializer ||
ts.hasModifier(variableDeclaration, 1 /* Export */) ||
- variableDeclaration.parent.parent.kind === 209 /* ForOfStatement */) {
+ variableDeclaration.parent.parent.kind === 212 /* ForOfStatement */) {
return textSpanFromVariableDeclaration(variableDeclaration);
}
var declarations = variableDeclaration.parent.declarations;
@@ -76061,7 +78100,7 @@ var ts;
}
function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) {
return ts.hasModifier(functionDeclaration, 1 /* Export */) ||
- (functionDeclaration.parent.kind === 222 /* ClassDeclaration */ && functionDeclaration.kind !== 149 /* Constructor */);
+ (functionDeclaration.parent.kind === 225 /* ClassDeclaration */ && functionDeclaration.kind !== 150 /* Constructor */);
}
function spanInFunctionDeclaration(functionDeclaration) {
// No breakpoints in the function signature
@@ -76084,25 +78123,25 @@ var ts;
}
function spanInBlock(block) {
switch (block.parent.kind) {
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) {
return undefined;
}
// Set on parent if on same line otherwise on first statement
- case 206 /* WhileStatement */:
- case 204 /* IfStatement */:
- case 208 /* ForInStatement */:
+ case 209 /* WhileStatement */:
+ case 207 /* IfStatement */:
+ case 211 /* ForInStatement */:
return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]);
// Set span on previous token if it starts on same line otherwise on the first statement of the block
- case 207 /* ForStatement */:
- case 209 /* ForOfStatement */:
+ case 210 /* ForStatement */:
+ case 212 /* ForOfStatement */:
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]);
}
// Default action is to set on first statement
return spanInNode(block.statements[0]);
}
function spanInInitializerOfForLike(forLikeStatement) {
- if (forLikeStatement.initializer.kind === 220 /* VariableDeclarationList */) {
+ if (forLikeStatement.initializer.kind === 223 /* VariableDeclarationList */) {
// Declaration list - set breakpoint in first declaration
var variableDeclarationList = forLikeStatement.initializer;
if (variableDeclarationList.declarations.length > 0) {
@@ -76127,23 +78166,23 @@ var ts;
}
function spanInBindingPattern(bindingPattern) {
// Set breakpoint in first binding element
- var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 194 /* OmittedExpression */ ? element : undefined; });
+ var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 197 /* OmittedExpression */ ? element : undefined; });
if (firstBindingElement) {
return spanInNode(firstBindingElement);
}
// Empty binding pattern of binding element, set breakpoint on binding element
- if (bindingPattern.parent.kind === 170 /* BindingElement */) {
+ if (bindingPattern.parent.kind === 173 /* BindingElement */) {
return textSpan(bindingPattern.parent);
}
// Variable declaration is used as the span
return textSpanFromVariableDeclaration(bindingPattern.parent);
}
function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) {
- ts.Debug.assert(node.kind !== 169 /* ArrayBindingPattern */ && node.kind !== 168 /* ObjectBindingPattern */);
- var elements = node.kind === 171 /* ArrayLiteralExpression */ ?
+ ts.Debug.assert(node.kind !== 172 /* ArrayBindingPattern */ && node.kind !== 171 /* ObjectBindingPattern */);
+ var elements = node.kind === 174 /* ArrayLiteralExpression */ ?
node.elements :
node.properties;
- var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 194 /* OmittedExpression */ ? element : undefined; });
+ var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 197 /* OmittedExpression */ ? element : undefined; });
if (firstBindingElement) {
return spanInNode(firstBindingElement);
}
@@ -76151,18 +78190,18 @@ var ts;
// just nested element in another destructuring assignment
// set breakpoint on assignment when parent is destructuring assignment
// Otherwise set breakpoint for this element
- return textSpan(node.parent.kind === 188 /* BinaryExpression */ ? node.parent : node);
+ return textSpan(node.parent.kind === 191 /* BinaryExpression */ ? node.parent : node);
}
// Tokens:
function spanInOpenBraceToken(node) {
switch (node.parent.kind) {
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
var enumDeclaration = node.parent;
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile));
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
var classDeclaration = node.parent;
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile));
- case 228 /* CaseBlock */:
+ case 231 /* CaseBlock */:
return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]);
}
// Default to parent node
@@ -76170,24 +78209,24 @@ var ts;
}
function spanInCloseBraceToken(node) {
switch (node.parent.kind) {
- case 227 /* ModuleBlock */:
+ case 230 /* ModuleBlock */:
// If this is not an instantiated module block, no bp span
if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) {
return undefined;
}
- case 225 /* EnumDeclaration */:
- case 222 /* ClassDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 225 /* ClassDeclaration */:
// Span on close brace token
return textSpan(node);
- case 200 /* Block */:
+ case 203 /* Block */:
if (ts.isFunctionBlock(node.parent)) {
// Span on close brace token
return textSpan(node);
}
// fall through
- case 252 /* CatchClause */:
+ case 255 /* CatchClause */:
return spanInNode(ts.lastOrUndefined(node.parent.statements));
- case 228 /* CaseBlock */:
+ case 231 /* CaseBlock */:
// breakpoint in last statement of the last clause
var caseBlock = node.parent;
var lastClause = ts.lastOrUndefined(caseBlock.clauses);
@@ -76195,7 +78234,7 @@ var ts;
return spanInNode(ts.lastOrUndefined(lastClause.statements));
}
return undefined;
- case 168 /* ObjectBindingPattern */:
+ case 171 /* ObjectBindingPattern */:
// Breakpoint in last binding element or binding pattern if it contains no elements
var bindingPattern = node.parent;
return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);
@@ -76211,7 +78250,7 @@ var ts;
}
function spanInCloseBracketToken(node) {
switch (node.parent.kind) {
- case 169 /* ArrayBindingPattern */:
+ case 172 /* ArrayBindingPattern */:
// Breakpoint in last binding element or binding pattern if it contains no elements
var bindingPattern = node.parent;
return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);
@@ -76226,12 +78265,12 @@ var ts;
}
}
function spanInOpenParenToken(node) {
- if (node.parent.kind === 205 /* DoStatement */ ||
- node.parent.kind === 175 /* CallExpression */ ||
- node.parent.kind === 176 /* NewExpression */) {
+ if (node.parent.kind === 208 /* DoStatement */ ||
+ node.parent.kind === 178 /* CallExpression */ ||
+ node.parent.kind === 179 /* NewExpression */) {
return spanInPreviousNode(node);
}
- if (node.parent.kind === 179 /* ParenthesizedExpression */) {
+ if (node.parent.kind === 182 /* ParenthesizedExpression */) {
return spanInNextNode(node);
}
// Default to parent node
@@ -76240,21 +78279,21 @@ var ts;
function spanInCloseParenToken(node) {
// Is this close paren token of parameter list, set span in previous token
switch (node.parent.kind) {
- case 180 /* FunctionExpression */:
- case 221 /* FunctionDeclaration */:
- case 181 /* ArrowFunction */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 149 /* Constructor */:
- case 206 /* WhileStatement */:
- case 205 /* DoStatement */:
- case 207 /* ForStatement */:
- case 209 /* ForOfStatement */:
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
- case 179 /* ParenthesizedExpression */:
+ case 183 /* FunctionExpression */:
+ case 224 /* FunctionDeclaration */:
+ case 184 /* ArrowFunction */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 150 /* Constructor */:
+ case 209 /* WhileStatement */:
+ case 208 /* DoStatement */:
+ case 210 /* ForStatement */:
+ case 212 /* ForOfStatement */:
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
+ case 182 /* ParenthesizedExpression */:
return spanInPreviousNode(node);
// Default to parent node
default:
@@ -76264,20 +78303,20 @@ var ts;
function spanInColonToken(node) {
// Is this : specifying return annotation of the function declaration
if (ts.isFunctionLike(node.parent) ||
- node.parent.kind === 253 /* PropertyAssignment */ ||
- node.parent.kind === 143 /* Parameter */) {
+ node.parent.kind === 256 /* PropertyAssignment */ ||
+ node.parent.kind === 144 /* Parameter */) {
return spanInPreviousNode(node);
}
return spanInNode(node.parent);
}
function spanInGreaterThanOrLessThanToken(node) {
- if (node.parent.kind === 178 /* TypeAssertionExpression */) {
+ if (node.parent.kind === 181 /* TypeAssertionExpression */) {
return spanInNextNode(node);
}
return spanInNode(node.parent);
}
function spanInWhileKeyword(node) {
- if (node.parent.kind === 205 /* DoStatement */) {
+ if (node.parent.kind === 208 /* DoStatement */) {
// Set span on while expression
return textSpanEndingAtNextToken(node, node.parent.expression);
}
@@ -76285,7 +78324,7 @@ var ts;
return spanInNode(node.parent);
}
function spanInOfKeyword(node) {
- if (node.parent.kind === 209 /* ForOfStatement */) {
+ if (node.parent.kind === 212 /* ForOfStatement */) {
// Set using next token
return spanInNextNode(node);
}
@@ -76367,7 +78406,7 @@ var ts;
var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile));
return ts.map(moduleNames, function (name) {
var result = ts.getProperty(resolutionsInFile, name);
- return result ? { resolvedFileName: result } : undefined;
+ return result ? { resolvedFileName: result, extension: ts.extensionFromPath(result), isExternalLibraryImport: false } : undefined;
});
};
}
diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts
index e8bb08ee96c..94a710ae867 100644
--- a/lib/typescriptServices.d.ts
+++ b/lib/typescriptServices.d.ts
@@ -163,170 +163,176 @@ declare namespace ts {
DeclareKeyword = 123,
GetKeyword = 124,
IsKeyword = 125,
- ModuleKeyword = 126,
- NamespaceKeyword = 127,
- NeverKeyword = 128,
- ReadonlyKeyword = 129,
- RequireKeyword = 130,
- NumberKeyword = 131,
- SetKeyword = 132,
- StringKeyword = 133,
- SymbolKeyword = 134,
- TypeKeyword = 135,
- UndefinedKeyword = 136,
- FromKeyword = 137,
- GlobalKeyword = 138,
- OfKeyword = 139,
- QualifiedName = 140,
- ComputedPropertyName = 141,
- TypeParameter = 142,
- Parameter = 143,
- Decorator = 144,
- PropertySignature = 145,
- PropertyDeclaration = 146,
- MethodSignature = 147,
- MethodDeclaration = 148,
- Constructor = 149,
- GetAccessor = 150,
- SetAccessor = 151,
- CallSignature = 152,
- ConstructSignature = 153,
- IndexSignature = 154,
- TypePredicate = 155,
- TypeReference = 156,
- FunctionType = 157,
- ConstructorType = 158,
- TypeQuery = 159,
- TypeLiteral = 160,
- ArrayType = 161,
- TupleType = 162,
- UnionType = 163,
- IntersectionType = 164,
- ParenthesizedType = 165,
- ThisType = 166,
- LiteralType = 167,
- ObjectBindingPattern = 168,
- ArrayBindingPattern = 169,
- BindingElement = 170,
- ArrayLiteralExpression = 171,
- ObjectLiteralExpression = 172,
- PropertyAccessExpression = 173,
- ElementAccessExpression = 174,
- CallExpression = 175,
- NewExpression = 176,
- TaggedTemplateExpression = 177,
- TypeAssertionExpression = 178,
- ParenthesizedExpression = 179,
- FunctionExpression = 180,
- ArrowFunction = 181,
- DeleteExpression = 182,
- TypeOfExpression = 183,
- VoidExpression = 184,
- AwaitExpression = 185,
- PrefixUnaryExpression = 186,
- PostfixUnaryExpression = 187,
- BinaryExpression = 188,
- ConditionalExpression = 189,
- TemplateExpression = 190,
- YieldExpression = 191,
- SpreadElementExpression = 192,
- ClassExpression = 193,
- OmittedExpression = 194,
- ExpressionWithTypeArguments = 195,
- AsExpression = 196,
- NonNullExpression = 197,
- TemplateSpan = 198,
- SemicolonClassElement = 199,
- Block = 200,
- VariableStatement = 201,
- EmptyStatement = 202,
- ExpressionStatement = 203,
- IfStatement = 204,
- DoStatement = 205,
- WhileStatement = 206,
- ForStatement = 207,
- ForInStatement = 208,
- ForOfStatement = 209,
- ContinueStatement = 210,
- BreakStatement = 211,
- ReturnStatement = 212,
- WithStatement = 213,
- SwitchStatement = 214,
- LabeledStatement = 215,
- ThrowStatement = 216,
- TryStatement = 217,
- DebuggerStatement = 218,
- VariableDeclaration = 219,
- VariableDeclarationList = 220,
- FunctionDeclaration = 221,
- ClassDeclaration = 222,
- InterfaceDeclaration = 223,
- TypeAliasDeclaration = 224,
- EnumDeclaration = 225,
- ModuleDeclaration = 226,
- ModuleBlock = 227,
- CaseBlock = 228,
- NamespaceExportDeclaration = 229,
- ImportEqualsDeclaration = 230,
- ImportDeclaration = 231,
- ImportClause = 232,
- NamespaceImport = 233,
- NamedImports = 234,
- ImportSpecifier = 235,
- ExportAssignment = 236,
- ExportDeclaration = 237,
- NamedExports = 238,
- ExportSpecifier = 239,
- MissingDeclaration = 240,
- ExternalModuleReference = 241,
- JsxElement = 242,
- JsxSelfClosingElement = 243,
- JsxOpeningElement = 244,
- JsxClosingElement = 245,
- JsxAttribute = 246,
- JsxSpreadAttribute = 247,
- JsxExpression = 248,
- CaseClause = 249,
- DefaultClause = 250,
- HeritageClause = 251,
- CatchClause = 252,
- PropertyAssignment = 253,
- ShorthandPropertyAssignment = 254,
- EnumMember = 255,
- SourceFile = 256,
- JSDocTypeExpression = 257,
- JSDocAllType = 258,
- JSDocUnknownType = 259,
- JSDocArrayType = 260,
- JSDocUnionType = 261,
- JSDocTupleType = 262,
- JSDocNullableType = 263,
- JSDocNonNullableType = 264,
- JSDocRecordType = 265,
- JSDocRecordMember = 266,
- JSDocTypeReference = 267,
- JSDocOptionalType = 268,
- JSDocFunctionType = 269,
- JSDocVariadicType = 270,
- JSDocConstructorType = 271,
- JSDocThisType = 272,
- JSDocComment = 273,
- JSDocTag = 274,
- JSDocParameterTag = 275,
- JSDocReturnTag = 276,
- JSDocTypeTag = 277,
- JSDocTemplateTag = 278,
- JSDocTypedefTag = 279,
- JSDocPropertyTag = 280,
- JSDocTypeLiteral = 281,
- JSDocLiteralType = 282,
- JSDocNullKeyword = 283,
- JSDocUndefinedKeyword = 284,
- JSDocNeverKeyword = 285,
- SyntaxList = 286,
- NotEmittedStatement = 287,
- PartiallyEmittedExpression = 288,
- Count = 289,
+ KeyOfKeyword = 126,
+ ModuleKeyword = 127,
+ NamespaceKeyword = 128,
+ NeverKeyword = 129,
+ ReadonlyKeyword = 130,
+ RequireKeyword = 131,
+ NumberKeyword = 132,
+ SetKeyword = 133,
+ StringKeyword = 134,
+ SymbolKeyword = 135,
+ TypeKeyword = 136,
+ UndefinedKeyword = 137,
+ FromKeyword = 138,
+ GlobalKeyword = 139,
+ OfKeyword = 140,
+ QualifiedName = 141,
+ ComputedPropertyName = 142,
+ TypeParameter = 143,
+ Parameter = 144,
+ Decorator = 145,
+ PropertySignature = 146,
+ PropertyDeclaration = 147,
+ MethodSignature = 148,
+ MethodDeclaration = 149,
+ Constructor = 150,
+ GetAccessor = 151,
+ SetAccessor = 152,
+ CallSignature = 153,
+ ConstructSignature = 154,
+ IndexSignature = 155,
+ TypePredicate = 156,
+ TypeReference = 157,
+ FunctionType = 158,
+ ConstructorType = 159,
+ TypeQuery = 160,
+ TypeLiteral = 161,
+ ArrayType = 162,
+ TupleType = 163,
+ UnionType = 164,
+ IntersectionType = 165,
+ ParenthesizedType = 166,
+ ThisType = 167,
+ TypeOperator = 168,
+ IndexedAccessType = 169,
+ LiteralType = 170,
+ ObjectBindingPattern = 171,
+ ArrayBindingPattern = 172,
+ BindingElement = 173,
+ ArrayLiteralExpression = 174,
+ ObjectLiteralExpression = 175,
+ PropertyAccessExpression = 176,
+ ElementAccessExpression = 177,
+ CallExpression = 178,
+ NewExpression = 179,
+ TaggedTemplateExpression = 180,
+ TypeAssertionExpression = 181,
+ ParenthesizedExpression = 182,
+ FunctionExpression = 183,
+ ArrowFunction = 184,
+ DeleteExpression = 185,
+ TypeOfExpression = 186,
+ VoidExpression = 187,
+ AwaitExpression = 188,
+ PrefixUnaryExpression = 189,
+ PostfixUnaryExpression = 190,
+ BinaryExpression = 191,
+ ConditionalExpression = 192,
+ TemplateExpression = 193,
+ YieldExpression = 194,
+ SpreadElement = 195,
+ ClassExpression = 196,
+ OmittedExpression = 197,
+ ExpressionWithTypeArguments = 198,
+ AsExpression = 199,
+ NonNullExpression = 200,
+ TemplateSpan = 201,
+ SemicolonClassElement = 202,
+ Block = 203,
+ VariableStatement = 204,
+ EmptyStatement = 205,
+ ExpressionStatement = 206,
+ IfStatement = 207,
+ DoStatement = 208,
+ WhileStatement = 209,
+ ForStatement = 210,
+ ForInStatement = 211,
+ ForOfStatement = 212,
+ ContinueStatement = 213,
+ BreakStatement = 214,
+ ReturnStatement = 215,
+ WithStatement = 216,
+ SwitchStatement = 217,
+ LabeledStatement = 218,
+ ThrowStatement = 219,
+ TryStatement = 220,
+ DebuggerStatement = 221,
+ VariableDeclaration = 222,
+ VariableDeclarationList = 223,
+ FunctionDeclaration = 224,
+ ClassDeclaration = 225,
+ InterfaceDeclaration = 226,
+ TypeAliasDeclaration = 227,
+ EnumDeclaration = 228,
+ ModuleDeclaration = 229,
+ ModuleBlock = 230,
+ CaseBlock = 231,
+ NamespaceExportDeclaration = 232,
+ ImportEqualsDeclaration = 233,
+ ImportDeclaration = 234,
+ ImportClause = 235,
+ NamespaceImport = 236,
+ NamedImports = 237,
+ ImportSpecifier = 238,
+ ExportAssignment = 239,
+ ExportDeclaration = 240,
+ NamedExports = 241,
+ ExportSpecifier = 242,
+ MissingDeclaration = 243,
+ ExternalModuleReference = 244,
+ JsxElement = 245,
+ JsxSelfClosingElement = 246,
+ JsxOpeningElement = 247,
+ JsxClosingElement = 248,
+ JsxAttribute = 249,
+ JsxSpreadAttribute = 250,
+ JsxExpression = 251,
+ CaseClause = 252,
+ DefaultClause = 253,
+ HeritageClause = 254,
+ CatchClause = 255,
+ PropertyAssignment = 256,
+ ShorthandPropertyAssignment = 257,
+ SpreadAssignment = 258,
+ EnumMember = 259,
+ SourceFile = 260,
+ JSDocTypeExpression = 261,
+ JSDocAllType = 262,
+ JSDocUnknownType = 263,
+ JSDocArrayType = 264,
+ JSDocUnionType = 265,
+ JSDocTupleType = 266,
+ JSDocNullableType = 267,
+ JSDocNonNullableType = 268,
+ JSDocRecordType = 269,
+ JSDocRecordMember = 270,
+ JSDocTypeReference = 271,
+ JSDocOptionalType = 272,
+ JSDocFunctionType = 273,
+ JSDocVariadicType = 274,
+ JSDocConstructorType = 275,
+ JSDocThisType = 276,
+ JSDocComment = 277,
+ JSDocTag = 278,
+ JSDocParameterTag = 279,
+ JSDocReturnTag = 280,
+ JSDocTypeTag = 281,
+ JSDocTemplateTag = 282,
+ JSDocTypedefTag = 283,
+ JSDocPropertyTag = 284,
+ JSDocTypeLiteral = 285,
+ JSDocLiteralType = 286,
+ JSDocNullKeyword = 287,
+ JSDocUndefinedKeyword = 288,
+ JSDocNeverKeyword = 289,
+ SyntaxList = 290,
+ NotEmittedStatement = 291,
+ PartiallyEmittedExpression = 292,
+ MergeDeclarationMarker = 293,
+ EndOfDeclarationMarker = 294,
+ Count = 295,
FirstAssignment = 57,
LastAssignment = 69,
FirstCompoundAssignment = 58,
@@ -334,15 +340,15 @@ declare namespace ts {
FirstReservedWord = 71,
LastReservedWord = 106,
FirstKeyword = 71,
- LastKeyword = 139,
+ LastKeyword = 140,
FirstFutureReservedWord = 107,
LastFutureReservedWord = 115,
- FirstTypeNode = 155,
- LastTypeNode = 167,
+ FirstTypeNode = 156,
+ LastTypeNode = 170,
FirstPunctuation = 16,
LastPunctuation = 69,
FirstToken = 0,
- LastToken = 139,
+ LastToken = 140,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
@@ -351,11 +357,11 @@ declare namespace ts {
LastTemplateToken = 15,
FirstBinaryOperator = 26,
LastBinaryOperator = 69,
- FirstNode = 140,
- FirstJSDocNode = 257,
- LastJSDocNode = 282,
- FirstJSDocTagNode = 273,
- LastJSDocTagNode = 285,
+ FirstNode = 141,
+ FirstJSDocNode = 261,
+ LastJSDocNode = 286,
+ FirstJSDocTagNode = 277,
+ LastJSDocTagNode = 289,
}
enum NodeFlags {
None = 0,
@@ -373,21 +379,22 @@ declare namespace ts {
HasDecorators = 2048,
HasParamDecorators = 4096,
HasAsyncFunctions = 8192,
- HasJsxSpreadAttributes = 16384,
- DisallowInContext = 32768,
- YieldContext = 65536,
- DecoratorContext = 131072,
- AwaitContext = 262144,
- ThisNodeHasError = 524288,
- JavaScriptFile = 1048576,
- ThisNodeOrAnySubNodesHasError = 2097152,
- HasAggregatedChildData = 4194304,
+ HasSpreadAttribute = 16384,
+ HasRestAttribute = 32768,
+ DisallowInContext = 65536,
+ YieldContext = 131072,
+ DecoratorContext = 262144,
+ AwaitContext = 524288,
+ ThisNodeHasError = 1048576,
+ JavaScriptFile = 2097152,
+ ThisNodeOrAnySubNodesHasError = 4194304,
+ HasAggregatedChildData = 8388608,
BlockScoped = 3,
ReachabilityCheckFlags = 384,
- EmitHelperFlags = 31744,
- ReachabilityAndEmitFlags = 32128,
- ContextFlags = 1540096,
- TypeExcludesFlags = 327680,
+ EmitHelperFlags = 64512,
+ ReachabilityAndEmitFlags = 64896,
+ ContextFlags = 3080192,
+ TypeExcludesFlags = 655360,
}
enum ModifierFlags {
None = 0,
@@ -407,6 +414,7 @@ declare namespace ts {
ParameterPropertyModifier = 92,
NonPublicAccessibilityModifier = 24,
TypeScriptModifier = 2270,
+ ExportDefault = 513,
}
enum JsxFlags {
None = 0,
@@ -534,7 +542,7 @@ declare namespace ts {
_objectLiteralBrandBrand: any;
name?: PropertyName;
}
- type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | MethodDeclaration | AccessorDeclaration;
+ type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | MethodDeclaration | AccessorDeclaration | SpreadAssignment;
interface PropertyAssignment extends ObjectLiteralElement {
kind: SyntaxKind.PropertyAssignment;
name: PropertyName;
@@ -548,6 +556,10 @@ declare namespace ts {
equalsToken?: Token;
objectAssignmentInitializer?: Expression;
}
+ interface SpreadAssignment extends ObjectLiteralElement {
+ kind: SyntaxKind.SpreadAssignment;
+ expression: Expression;
+ }
interface VariableLikeDeclaration extends Declaration {
propertyName?: PropertyName;
dotDotDotToken?: DotDotDotToken;
@@ -678,6 +690,16 @@ declare namespace ts {
kind: SyntaxKind.ParenthesizedType;
type: TypeNode;
}
+ interface TypeOperatorNode extends TypeNode {
+ kind: SyntaxKind.TypeOperator;
+ operator: SyntaxKind.KeyOfKeyword;
+ type: TypeNode;
+ }
+ interface IndexedAccessTypeNode extends TypeNode {
+ kind: SyntaxKind.IndexedAccessType;
+ objectType: TypeNode;
+ indexType: TypeNode;
+ }
interface LiteralTypeNode extends TypeNode {
kind: SyntaxKind.LiteralType;
literal: Expression;
@@ -710,9 +732,6 @@ declare namespace ts {
operand: LeftHandSideExpression;
operator: PostfixUnaryOperator;
}
- interface PostfixExpression extends UnaryExpression {
- _postfixExpressionBrand: any;
- }
interface LeftHandSideExpression extends IncrementExpression {
_leftHandSideExpressionBrand: any;
}
@@ -781,6 +800,17 @@ declare namespace ts {
operatorToken: BinaryOperatorToken;
right: Expression;
}
+ interface AssignmentExpression extends BinaryExpression {
+ left: LeftHandSideExpression;
+ operatorToken: Token;
+ }
+ interface ObjectDestructuringAssignment extends AssignmentExpression {
+ left: ObjectLiteralExpression;
+ }
+ interface ArrayDestructuringAssignment extends AssignmentExpression {
+ left: ArrayLiteralExpression;
+ }
+ type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment;
interface ConditionalExpression extends Expression {
kind: SyntaxKind.ConditionalExpression;
condition: Expression;
@@ -847,8 +877,8 @@ declare namespace ts {
kind: SyntaxKind.ArrayLiteralExpression;
elements: NodeArray;
}
- interface SpreadElementExpression extends Expression {
- kind: SyntaxKind.SpreadElementExpression;
+ interface SpreadElement extends Expression {
+ kind: SyntaxKind.SpreadElement;
expression: Expression;
}
/**
@@ -1717,6 +1747,8 @@ declare namespace ts {
Object = 32768,
Union = 65536,
Intersection = 131072,
+ Index = 262144,
+ IndexedAccess = 524288,
Literal = 480,
StringOrNumberLiteral = 96,
PossiblyFalsy = 7406,
@@ -1726,8 +1758,8 @@ declare namespace ts {
EnumLike = 272,
UnionOrIntersection = 196608,
StructuredType = 229376,
- StructuredOrTypeParameter = 245760,
- Narrowable = 246783,
+ StructuredOrTypeParameter = 507904,
+ Narrowable = 1033215,
NotUnionOrUnit = 33281,
}
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
@@ -1798,6 +1830,13 @@ declare namespace ts {
interface TypeParameter extends Type {
constraint: Type;
}
+ interface IndexType extends Type {
+ type: TypeParameter;
+ }
+ interface IndexedAccessType extends Type {
+ objectType: Type;
+ indexType: TypeParameter;
+ }
enum SignatureKind {
Call = 0,
Construct = 1,
@@ -1899,6 +1938,7 @@ declare namespace ts {
preserveConstEnums?: boolean;
project?: string;
reactNamespace?: string;
+ jsxFactory?: string;
removeComments?: boolean;
rootDir?: string;
rootDirs?: string[];
@@ -1965,12 +2005,14 @@ declare namespace ts {
ES2015 = 2,
ES2016 = 3,
ES2017 = 4,
- Latest = 4,
+ ESNext = 5,
+ Latest = 5,
}
enum LanguageVariant {
Standard = 0,
JSX = 1,
}
+ /** Either a parsed command line or a parsed tsconfig.json */
interface ParsedCommandLine {
options: CompilerOptions;
typingOptions?: TypingOptions;
@@ -1997,12 +2039,45 @@ declare namespace ts {
getCurrentDirectory?(): string;
getDirectories?(path: string): string[];
}
+ /**
+ * Represents the result of module resolution.
+ * Module resolution will pick up tsx/jsx/js files even if '--jsx' and '--allowJs' are turned off.
+ * The Program will then filter results based on these flags.
+ *
+ * Prefer to return a `ResolvedModuleFull` so that the file type does not have to be inferred.
+ */
interface ResolvedModule {
+ /** Path of the file the module was resolved to. */
resolvedFileName: string;
+ /**
+ * Denotes if 'resolvedFileName' is isExternalLibraryImport and thus should be a proper external module:
+ * - be a .d.ts file
+ * - use top level imports\exports
+ * - don't use tripleslash references
+ */
isExternalLibraryImport?: boolean;
}
+ /**
+ * ResolvedModule with an explicitly provided `extension` property.
+ * Prefer this over `ResolvedModule`.
+ */
+ interface ResolvedModuleFull extends ResolvedModule {
+ /**
+ * Extension of resolvedFileName. This must match what's at the end of resolvedFileName.
+ * This is optional for backwards-compatibility, but will be added if not provided.
+ */
+ extension: Extension;
+ }
+ enum Extension {
+ Ts = 0,
+ Tsx = 1,
+ Dts = 2,
+ Js = 3,
+ Jsx = 4,
+ LastTypeScriptExtension = 2,
+ }
interface ResolvedModuleWithFailedLookupLocations {
- resolvedModule: ResolvedModule;
+ resolvedModule: ResolvedModuleFull | undefined;
failedLookupLocations: string[];
}
interface ResolvedTypeReferenceDirective {
@@ -2060,7 +2135,11 @@ declare namespace ts {
readFile(path: string, encoding?: string): string;
getFileSize?(path: string): number;
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
- watchFile?(path: string, callback: FileWatcherCallback): FileWatcher;
+ /**
+ * @pollingInterval - this parameter is used in polling-based watchers and ignored in watchers that
+ * use native OS file watching
+ */
+ watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher;
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
resolvePath(path: string): string;
fileExists(path: string): boolean;
@@ -2179,6 +2258,7 @@ declare namespace ts {
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile;
+ function parseIsolatedEntityName(text: string, languageVersion: ScriptTarget): EntityName;
function isExternalModule(file: SourceFile): boolean;
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
}
@@ -2192,7 +2272,7 @@ declare namespace ts {
* This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups
* is assumed to be the same as root directory of the project.
*/
- function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations;
+ function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations;
/**
* Given a set of options, returns the set of type directive names
* that should be included for this program automatically.
@@ -2208,7 +2288,7 @@ declare namespace ts {
}
declare namespace ts {
/** The version of the TypeScript compiler release */
- const version = "2.1.2";
+ const version = "2.1.3";
function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string;
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js
index fd0da3fb87f..23bd3d859c1 100644
--- a/lib/typescriptServices.js
+++ b/lib/typescriptServices.js
@@ -22,6 +22,7 @@ var ts;
(function (ts) {
// token > SyntaxKind.Identifer => token is a keyword
// Also, If you add a new SyntaxKind be sure to keep the `Markers` section at the bottom in sync
+ var SyntaxKind;
(function (SyntaxKind) {
SyntaxKind[SyntaxKind["Unknown"] = 0] = "Unknown";
SyntaxKind[SyntaxKind["EndOfFileToken"] = 1] = "EndOfFileToken";
@@ -160,191 +161,197 @@ var ts;
SyntaxKind[SyntaxKind["DeclareKeyword"] = 123] = "DeclareKeyword";
SyntaxKind[SyntaxKind["GetKeyword"] = 124] = "GetKeyword";
SyntaxKind[SyntaxKind["IsKeyword"] = 125] = "IsKeyword";
- SyntaxKind[SyntaxKind["ModuleKeyword"] = 126] = "ModuleKeyword";
- SyntaxKind[SyntaxKind["NamespaceKeyword"] = 127] = "NamespaceKeyword";
- SyntaxKind[SyntaxKind["NeverKeyword"] = 128] = "NeverKeyword";
- SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 129] = "ReadonlyKeyword";
- SyntaxKind[SyntaxKind["RequireKeyword"] = 130] = "RequireKeyword";
- SyntaxKind[SyntaxKind["NumberKeyword"] = 131] = "NumberKeyword";
- SyntaxKind[SyntaxKind["SetKeyword"] = 132] = "SetKeyword";
- SyntaxKind[SyntaxKind["StringKeyword"] = 133] = "StringKeyword";
- SyntaxKind[SyntaxKind["SymbolKeyword"] = 134] = "SymbolKeyword";
- SyntaxKind[SyntaxKind["TypeKeyword"] = 135] = "TypeKeyword";
- SyntaxKind[SyntaxKind["UndefinedKeyword"] = 136] = "UndefinedKeyword";
- SyntaxKind[SyntaxKind["FromKeyword"] = 137] = "FromKeyword";
- SyntaxKind[SyntaxKind["GlobalKeyword"] = 138] = "GlobalKeyword";
- SyntaxKind[SyntaxKind["OfKeyword"] = 139] = "OfKeyword";
+ SyntaxKind[SyntaxKind["KeyOfKeyword"] = 126] = "KeyOfKeyword";
+ SyntaxKind[SyntaxKind["ModuleKeyword"] = 127] = "ModuleKeyword";
+ SyntaxKind[SyntaxKind["NamespaceKeyword"] = 128] = "NamespaceKeyword";
+ SyntaxKind[SyntaxKind["NeverKeyword"] = 129] = "NeverKeyword";
+ SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 130] = "ReadonlyKeyword";
+ SyntaxKind[SyntaxKind["RequireKeyword"] = 131] = "RequireKeyword";
+ SyntaxKind[SyntaxKind["NumberKeyword"] = 132] = "NumberKeyword";
+ SyntaxKind[SyntaxKind["SetKeyword"] = 133] = "SetKeyword";
+ SyntaxKind[SyntaxKind["StringKeyword"] = 134] = "StringKeyword";
+ SyntaxKind[SyntaxKind["SymbolKeyword"] = 135] = "SymbolKeyword";
+ SyntaxKind[SyntaxKind["TypeKeyword"] = 136] = "TypeKeyword";
+ SyntaxKind[SyntaxKind["UndefinedKeyword"] = 137] = "UndefinedKeyword";
+ SyntaxKind[SyntaxKind["FromKeyword"] = 138] = "FromKeyword";
+ SyntaxKind[SyntaxKind["GlobalKeyword"] = 139] = "GlobalKeyword";
+ SyntaxKind[SyntaxKind["OfKeyword"] = 140] = "OfKeyword";
// Parse tree nodes
// Names
- SyntaxKind[SyntaxKind["QualifiedName"] = 140] = "QualifiedName";
- SyntaxKind[SyntaxKind["ComputedPropertyName"] = 141] = "ComputedPropertyName";
+ SyntaxKind[SyntaxKind["QualifiedName"] = 141] = "QualifiedName";
+ SyntaxKind[SyntaxKind["ComputedPropertyName"] = 142] = "ComputedPropertyName";
// Signature elements
- SyntaxKind[SyntaxKind["TypeParameter"] = 142] = "TypeParameter";
- SyntaxKind[SyntaxKind["Parameter"] = 143] = "Parameter";
- SyntaxKind[SyntaxKind["Decorator"] = 144] = "Decorator";
+ SyntaxKind[SyntaxKind["TypeParameter"] = 143] = "TypeParameter";
+ SyntaxKind[SyntaxKind["Parameter"] = 144] = "Parameter";
+ SyntaxKind[SyntaxKind["Decorator"] = 145] = "Decorator";
// TypeMember
- SyntaxKind[SyntaxKind["PropertySignature"] = 145] = "PropertySignature";
- SyntaxKind[SyntaxKind["PropertyDeclaration"] = 146] = "PropertyDeclaration";
- SyntaxKind[SyntaxKind["MethodSignature"] = 147] = "MethodSignature";
- SyntaxKind[SyntaxKind["MethodDeclaration"] = 148] = "MethodDeclaration";
- SyntaxKind[SyntaxKind["Constructor"] = 149] = "Constructor";
- SyntaxKind[SyntaxKind["GetAccessor"] = 150] = "GetAccessor";
- SyntaxKind[SyntaxKind["SetAccessor"] = 151] = "SetAccessor";
- SyntaxKind[SyntaxKind["CallSignature"] = 152] = "CallSignature";
- SyntaxKind[SyntaxKind["ConstructSignature"] = 153] = "ConstructSignature";
- SyntaxKind[SyntaxKind["IndexSignature"] = 154] = "IndexSignature";
+ SyntaxKind[SyntaxKind["PropertySignature"] = 146] = "PropertySignature";
+ SyntaxKind[SyntaxKind["PropertyDeclaration"] = 147] = "PropertyDeclaration";
+ SyntaxKind[SyntaxKind["MethodSignature"] = 148] = "MethodSignature";
+ SyntaxKind[SyntaxKind["MethodDeclaration"] = 149] = "MethodDeclaration";
+ SyntaxKind[SyntaxKind["Constructor"] = 150] = "Constructor";
+ SyntaxKind[SyntaxKind["GetAccessor"] = 151] = "GetAccessor";
+ SyntaxKind[SyntaxKind["SetAccessor"] = 152] = "SetAccessor";
+ SyntaxKind[SyntaxKind["CallSignature"] = 153] = "CallSignature";
+ SyntaxKind[SyntaxKind["ConstructSignature"] = 154] = "ConstructSignature";
+ SyntaxKind[SyntaxKind["IndexSignature"] = 155] = "IndexSignature";
// Type
- SyntaxKind[SyntaxKind["TypePredicate"] = 155] = "TypePredicate";
- SyntaxKind[SyntaxKind["TypeReference"] = 156] = "TypeReference";
- SyntaxKind[SyntaxKind["FunctionType"] = 157] = "FunctionType";
- SyntaxKind[SyntaxKind["ConstructorType"] = 158] = "ConstructorType";
- SyntaxKind[SyntaxKind["TypeQuery"] = 159] = "TypeQuery";
- SyntaxKind[SyntaxKind["TypeLiteral"] = 160] = "TypeLiteral";
- SyntaxKind[SyntaxKind["ArrayType"] = 161] = "ArrayType";
- SyntaxKind[SyntaxKind["TupleType"] = 162] = "TupleType";
- SyntaxKind[SyntaxKind["UnionType"] = 163] = "UnionType";
- SyntaxKind[SyntaxKind["IntersectionType"] = 164] = "IntersectionType";
- SyntaxKind[SyntaxKind["ParenthesizedType"] = 165] = "ParenthesizedType";
- SyntaxKind[SyntaxKind["ThisType"] = 166] = "ThisType";
- SyntaxKind[SyntaxKind["LiteralType"] = 167] = "LiteralType";
+ SyntaxKind[SyntaxKind["TypePredicate"] = 156] = "TypePredicate";
+ SyntaxKind[SyntaxKind["TypeReference"] = 157] = "TypeReference";
+ SyntaxKind[SyntaxKind["FunctionType"] = 158] = "FunctionType";
+ SyntaxKind[SyntaxKind["ConstructorType"] = 159] = "ConstructorType";
+ SyntaxKind[SyntaxKind["TypeQuery"] = 160] = "TypeQuery";
+ SyntaxKind[SyntaxKind["TypeLiteral"] = 161] = "TypeLiteral";
+ SyntaxKind[SyntaxKind["ArrayType"] = 162] = "ArrayType";
+ SyntaxKind[SyntaxKind["TupleType"] = 163] = "TupleType";
+ SyntaxKind[SyntaxKind["UnionType"] = 164] = "UnionType";
+ SyntaxKind[SyntaxKind["IntersectionType"] = 165] = "IntersectionType";
+ SyntaxKind[SyntaxKind["ParenthesizedType"] = 166] = "ParenthesizedType";
+ SyntaxKind[SyntaxKind["ThisType"] = 167] = "ThisType";
+ SyntaxKind[SyntaxKind["TypeOperator"] = 168] = "TypeOperator";
+ SyntaxKind[SyntaxKind["IndexedAccessType"] = 169] = "IndexedAccessType";
+ SyntaxKind[SyntaxKind["LiteralType"] = 170] = "LiteralType";
// Binding patterns
- SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 168] = "ObjectBindingPattern";
- SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 169] = "ArrayBindingPattern";
- SyntaxKind[SyntaxKind["BindingElement"] = 170] = "BindingElement";
+ SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 171] = "ObjectBindingPattern";
+ SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 172] = "ArrayBindingPattern";
+ SyntaxKind[SyntaxKind["BindingElement"] = 173] = "BindingElement";
// Expression
- SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 171] = "ArrayLiteralExpression";
- SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 172] = "ObjectLiteralExpression";
- SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 173] = "PropertyAccessExpression";
- SyntaxKind[SyntaxKind["ElementAccessExpression"] = 174] = "ElementAccessExpression";
- SyntaxKind[SyntaxKind["CallExpression"] = 175] = "CallExpression";
- SyntaxKind[SyntaxKind["NewExpression"] = 176] = "NewExpression";
- SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 177] = "TaggedTemplateExpression";
- SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 178] = "TypeAssertionExpression";
- SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 179] = "ParenthesizedExpression";
- SyntaxKind[SyntaxKind["FunctionExpression"] = 180] = "FunctionExpression";
- SyntaxKind[SyntaxKind["ArrowFunction"] = 181] = "ArrowFunction";
- SyntaxKind[SyntaxKind["DeleteExpression"] = 182] = "DeleteExpression";
- SyntaxKind[SyntaxKind["TypeOfExpression"] = 183] = "TypeOfExpression";
- SyntaxKind[SyntaxKind["VoidExpression"] = 184] = "VoidExpression";
- SyntaxKind[SyntaxKind["AwaitExpression"] = 185] = "AwaitExpression";
- SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 186] = "PrefixUnaryExpression";
- SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 187] = "PostfixUnaryExpression";
- SyntaxKind[SyntaxKind["BinaryExpression"] = 188] = "BinaryExpression";
- SyntaxKind[SyntaxKind["ConditionalExpression"] = 189] = "ConditionalExpression";
- SyntaxKind[SyntaxKind["TemplateExpression"] = 190] = "TemplateExpression";
- SyntaxKind[SyntaxKind["YieldExpression"] = 191] = "YieldExpression";
- SyntaxKind[SyntaxKind["SpreadElementExpression"] = 192] = "SpreadElementExpression";
- SyntaxKind[SyntaxKind["ClassExpression"] = 193] = "ClassExpression";
- SyntaxKind[SyntaxKind["OmittedExpression"] = 194] = "OmittedExpression";
- SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 195] = "ExpressionWithTypeArguments";
- SyntaxKind[SyntaxKind["AsExpression"] = 196] = "AsExpression";
- SyntaxKind[SyntaxKind["NonNullExpression"] = 197] = "NonNullExpression";
+ SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 174] = "ArrayLiteralExpression";
+ SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 175] = "ObjectLiteralExpression";
+ SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 176] = "PropertyAccessExpression";
+ SyntaxKind[SyntaxKind["ElementAccessExpression"] = 177] = "ElementAccessExpression";
+ SyntaxKind[SyntaxKind["CallExpression"] = 178] = "CallExpression";
+ SyntaxKind[SyntaxKind["NewExpression"] = 179] = "NewExpression";
+ SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 180] = "TaggedTemplateExpression";
+ SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 181] = "TypeAssertionExpression";
+ SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 182] = "ParenthesizedExpression";
+ SyntaxKind[SyntaxKind["FunctionExpression"] = 183] = "FunctionExpression";
+ SyntaxKind[SyntaxKind["ArrowFunction"] = 184] = "ArrowFunction";
+ SyntaxKind[SyntaxKind["DeleteExpression"] = 185] = "DeleteExpression";
+ SyntaxKind[SyntaxKind["TypeOfExpression"] = 186] = "TypeOfExpression";
+ SyntaxKind[SyntaxKind["VoidExpression"] = 187] = "VoidExpression";
+ SyntaxKind[SyntaxKind["AwaitExpression"] = 188] = "AwaitExpression";
+ SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 189] = "PrefixUnaryExpression";
+ SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 190] = "PostfixUnaryExpression";
+ SyntaxKind[SyntaxKind["BinaryExpression"] = 191] = "BinaryExpression";
+ SyntaxKind[SyntaxKind["ConditionalExpression"] = 192] = "ConditionalExpression";
+ SyntaxKind[SyntaxKind["TemplateExpression"] = 193] = "TemplateExpression";
+ SyntaxKind[SyntaxKind["YieldExpression"] = 194] = "YieldExpression";
+ SyntaxKind[SyntaxKind["SpreadElement"] = 195] = "SpreadElement";
+ SyntaxKind[SyntaxKind["ClassExpression"] = 196] = "ClassExpression";
+ SyntaxKind[SyntaxKind["OmittedExpression"] = 197] = "OmittedExpression";
+ SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 198] = "ExpressionWithTypeArguments";
+ SyntaxKind[SyntaxKind["AsExpression"] = 199] = "AsExpression";
+ SyntaxKind[SyntaxKind["NonNullExpression"] = 200] = "NonNullExpression";
// Misc
- SyntaxKind[SyntaxKind["TemplateSpan"] = 198] = "TemplateSpan";
- SyntaxKind[SyntaxKind["SemicolonClassElement"] = 199] = "SemicolonClassElement";
+ SyntaxKind[SyntaxKind["TemplateSpan"] = 201] = "TemplateSpan";
+ SyntaxKind[SyntaxKind["SemicolonClassElement"] = 202] = "SemicolonClassElement";
// Element
- SyntaxKind[SyntaxKind["Block"] = 200] = "Block";
- SyntaxKind[SyntaxKind["VariableStatement"] = 201] = "VariableStatement";
- SyntaxKind[SyntaxKind["EmptyStatement"] = 202] = "EmptyStatement";
- SyntaxKind[SyntaxKind["ExpressionStatement"] = 203] = "ExpressionStatement";
- SyntaxKind[SyntaxKind["IfStatement"] = 204] = "IfStatement";
- SyntaxKind[SyntaxKind["DoStatement"] = 205] = "DoStatement";
- SyntaxKind[SyntaxKind["WhileStatement"] = 206] = "WhileStatement";
- SyntaxKind[SyntaxKind["ForStatement"] = 207] = "ForStatement";
- SyntaxKind[SyntaxKind["ForInStatement"] = 208] = "ForInStatement";
- SyntaxKind[SyntaxKind["ForOfStatement"] = 209] = "ForOfStatement";
- SyntaxKind[SyntaxKind["ContinueStatement"] = 210] = "ContinueStatement";
- SyntaxKind[SyntaxKind["BreakStatement"] = 211] = "BreakStatement";
- SyntaxKind[SyntaxKind["ReturnStatement"] = 212] = "ReturnStatement";
- SyntaxKind[SyntaxKind["WithStatement"] = 213] = "WithStatement";
- SyntaxKind[SyntaxKind["SwitchStatement"] = 214] = "SwitchStatement";
- SyntaxKind[SyntaxKind["LabeledStatement"] = 215] = "LabeledStatement";
- SyntaxKind[SyntaxKind["ThrowStatement"] = 216] = "ThrowStatement";
- SyntaxKind[SyntaxKind["TryStatement"] = 217] = "TryStatement";
- SyntaxKind[SyntaxKind["DebuggerStatement"] = 218] = "DebuggerStatement";
- SyntaxKind[SyntaxKind["VariableDeclaration"] = 219] = "VariableDeclaration";
- SyntaxKind[SyntaxKind["VariableDeclarationList"] = 220] = "VariableDeclarationList";
- SyntaxKind[SyntaxKind["FunctionDeclaration"] = 221] = "FunctionDeclaration";
- SyntaxKind[SyntaxKind["ClassDeclaration"] = 222] = "ClassDeclaration";
- SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 223] = "InterfaceDeclaration";
- SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 224] = "TypeAliasDeclaration";
- SyntaxKind[SyntaxKind["EnumDeclaration"] = 225] = "EnumDeclaration";
- SyntaxKind[SyntaxKind["ModuleDeclaration"] = 226] = "ModuleDeclaration";
- SyntaxKind[SyntaxKind["ModuleBlock"] = 227] = "ModuleBlock";
- SyntaxKind[SyntaxKind["CaseBlock"] = 228] = "CaseBlock";
- SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 229] = "NamespaceExportDeclaration";
- SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 230] = "ImportEqualsDeclaration";
- SyntaxKind[SyntaxKind["ImportDeclaration"] = 231] = "ImportDeclaration";
- SyntaxKind[SyntaxKind["ImportClause"] = 232] = "ImportClause";
- SyntaxKind[SyntaxKind["NamespaceImport"] = 233] = "NamespaceImport";
- SyntaxKind[SyntaxKind["NamedImports"] = 234] = "NamedImports";
- SyntaxKind[SyntaxKind["ImportSpecifier"] = 235] = "ImportSpecifier";
- SyntaxKind[SyntaxKind["ExportAssignment"] = 236] = "ExportAssignment";
- SyntaxKind[SyntaxKind["ExportDeclaration"] = 237] = "ExportDeclaration";
- SyntaxKind[SyntaxKind["NamedExports"] = 238] = "NamedExports";
- SyntaxKind[SyntaxKind["ExportSpecifier"] = 239] = "ExportSpecifier";
- SyntaxKind[SyntaxKind["MissingDeclaration"] = 240] = "MissingDeclaration";
+ SyntaxKind[SyntaxKind["Block"] = 203] = "Block";
+ SyntaxKind[SyntaxKind["VariableStatement"] = 204] = "VariableStatement";
+ SyntaxKind[SyntaxKind["EmptyStatement"] = 205] = "EmptyStatement";
+ SyntaxKind[SyntaxKind["ExpressionStatement"] = 206] = "ExpressionStatement";
+ SyntaxKind[SyntaxKind["IfStatement"] = 207] = "IfStatement";
+ SyntaxKind[SyntaxKind["DoStatement"] = 208] = "DoStatement";
+ SyntaxKind[SyntaxKind["WhileStatement"] = 209] = "WhileStatement";
+ SyntaxKind[SyntaxKind["ForStatement"] = 210] = "ForStatement";
+ SyntaxKind[SyntaxKind["ForInStatement"] = 211] = "ForInStatement";
+ SyntaxKind[SyntaxKind["ForOfStatement"] = 212] = "ForOfStatement";
+ SyntaxKind[SyntaxKind["ContinueStatement"] = 213] = "ContinueStatement";
+ SyntaxKind[SyntaxKind["BreakStatement"] = 214] = "BreakStatement";
+ SyntaxKind[SyntaxKind["ReturnStatement"] = 215] = "ReturnStatement";
+ SyntaxKind[SyntaxKind["WithStatement"] = 216] = "WithStatement";
+ SyntaxKind[SyntaxKind["SwitchStatement"] = 217] = "SwitchStatement";
+ SyntaxKind[SyntaxKind["LabeledStatement"] = 218] = "LabeledStatement";
+ SyntaxKind[SyntaxKind["ThrowStatement"] = 219] = "ThrowStatement";
+ SyntaxKind[SyntaxKind["TryStatement"] = 220] = "TryStatement";
+ SyntaxKind[SyntaxKind["DebuggerStatement"] = 221] = "DebuggerStatement";
+ SyntaxKind[SyntaxKind["VariableDeclaration"] = 222] = "VariableDeclaration";
+ SyntaxKind[SyntaxKind["VariableDeclarationList"] = 223] = "VariableDeclarationList";
+ SyntaxKind[SyntaxKind["FunctionDeclaration"] = 224] = "FunctionDeclaration";
+ SyntaxKind[SyntaxKind["ClassDeclaration"] = 225] = "ClassDeclaration";
+ SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 226] = "InterfaceDeclaration";
+ SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 227] = "TypeAliasDeclaration";
+ SyntaxKind[SyntaxKind["EnumDeclaration"] = 228] = "EnumDeclaration";
+ SyntaxKind[SyntaxKind["ModuleDeclaration"] = 229] = "ModuleDeclaration";
+ SyntaxKind[SyntaxKind["ModuleBlock"] = 230] = "ModuleBlock";
+ SyntaxKind[SyntaxKind["CaseBlock"] = 231] = "CaseBlock";
+ SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 232] = "NamespaceExportDeclaration";
+ SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 233] = "ImportEqualsDeclaration";
+ SyntaxKind[SyntaxKind["ImportDeclaration"] = 234] = "ImportDeclaration";
+ SyntaxKind[SyntaxKind["ImportClause"] = 235] = "ImportClause";
+ SyntaxKind[SyntaxKind["NamespaceImport"] = 236] = "NamespaceImport";
+ SyntaxKind[SyntaxKind["NamedImports"] = 237] = "NamedImports";
+ SyntaxKind[SyntaxKind["ImportSpecifier"] = 238] = "ImportSpecifier";
+ SyntaxKind[SyntaxKind["ExportAssignment"] = 239] = "ExportAssignment";
+ SyntaxKind[SyntaxKind["ExportDeclaration"] = 240] = "ExportDeclaration";
+ SyntaxKind[SyntaxKind["NamedExports"] = 241] = "NamedExports";
+ SyntaxKind[SyntaxKind["ExportSpecifier"] = 242] = "ExportSpecifier";
+ SyntaxKind[SyntaxKind["MissingDeclaration"] = 243] = "MissingDeclaration";
// Module references
- SyntaxKind[SyntaxKind["ExternalModuleReference"] = 241] = "ExternalModuleReference";
+ SyntaxKind[SyntaxKind["ExternalModuleReference"] = 244] = "ExternalModuleReference";
// JSX
- SyntaxKind[SyntaxKind["JsxElement"] = 242] = "JsxElement";
- SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 243] = "JsxSelfClosingElement";
- SyntaxKind[SyntaxKind["JsxOpeningElement"] = 244] = "JsxOpeningElement";
- SyntaxKind[SyntaxKind["JsxClosingElement"] = 245] = "JsxClosingElement";
- SyntaxKind[SyntaxKind["JsxAttribute"] = 246] = "JsxAttribute";
- SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 247] = "JsxSpreadAttribute";
- SyntaxKind[SyntaxKind["JsxExpression"] = 248] = "JsxExpression";
+ SyntaxKind[SyntaxKind["JsxElement"] = 245] = "JsxElement";
+ SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 246] = "JsxSelfClosingElement";
+ SyntaxKind[SyntaxKind["JsxOpeningElement"] = 247] = "JsxOpeningElement";
+ SyntaxKind[SyntaxKind["JsxClosingElement"] = 248] = "JsxClosingElement";
+ SyntaxKind[SyntaxKind["JsxAttribute"] = 249] = "JsxAttribute";
+ SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 250] = "JsxSpreadAttribute";
+ SyntaxKind[SyntaxKind["JsxExpression"] = 251] = "JsxExpression";
// Clauses
- SyntaxKind[SyntaxKind["CaseClause"] = 249] = "CaseClause";
- SyntaxKind[SyntaxKind["DefaultClause"] = 250] = "DefaultClause";
- SyntaxKind[SyntaxKind["HeritageClause"] = 251] = "HeritageClause";
- SyntaxKind[SyntaxKind["CatchClause"] = 252] = "CatchClause";
+ SyntaxKind[SyntaxKind["CaseClause"] = 252] = "CaseClause";
+ SyntaxKind[SyntaxKind["DefaultClause"] = 253] = "DefaultClause";
+ SyntaxKind[SyntaxKind["HeritageClause"] = 254] = "HeritageClause";
+ SyntaxKind[SyntaxKind["CatchClause"] = 255] = "CatchClause";
// Property assignments
- SyntaxKind[SyntaxKind["PropertyAssignment"] = 253] = "PropertyAssignment";
- SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 254] = "ShorthandPropertyAssignment";
+ SyntaxKind[SyntaxKind["PropertyAssignment"] = 256] = "PropertyAssignment";
+ SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 257] = "ShorthandPropertyAssignment";
+ SyntaxKind[SyntaxKind["SpreadAssignment"] = 258] = "SpreadAssignment";
// Enum
- SyntaxKind[SyntaxKind["EnumMember"] = 255] = "EnumMember";
+ SyntaxKind[SyntaxKind["EnumMember"] = 259] = "EnumMember";
// Top-level nodes
- SyntaxKind[SyntaxKind["SourceFile"] = 256] = "SourceFile";
+ SyntaxKind[SyntaxKind["SourceFile"] = 260] = "SourceFile";
// JSDoc nodes
- SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 257] = "JSDocTypeExpression";
+ SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 261] = "JSDocTypeExpression";
// The * type
- SyntaxKind[SyntaxKind["JSDocAllType"] = 258] = "JSDocAllType";
+ SyntaxKind[SyntaxKind["JSDocAllType"] = 262] = "JSDocAllType";
// The ? type
- SyntaxKind[SyntaxKind["JSDocUnknownType"] = 259] = "JSDocUnknownType";
- SyntaxKind[SyntaxKind["JSDocArrayType"] = 260] = "JSDocArrayType";
- SyntaxKind[SyntaxKind["JSDocUnionType"] = 261] = "JSDocUnionType";
- SyntaxKind[SyntaxKind["JSDocTupleType"] = 262] = "JSDocTupleType";
- SyntaxKind[SyntaxKind["JSDocNullableType"] = 263] = "JSDocNullableType";
- SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 264] = "JSDocNonNullableType";
- SyntaxKind[SyntaxKind["JSDocRecordType"] = 265] = "JSDocRecordType";
- SyntaxKind[SyntaxKind["JSDocRecordMember"] = 266] = "JSDocRecordMember";
- SyntaxKind[SyntaxKind["JSDocTypeReference"] = 267] = "JSDocTypeReference";
- SyntaxKind[SyntaxKind["JSDocOptionalType"] = 268] = "JSDocOptionalType";
- SyntaxKind[SyntaxKind["JSDocFunctionType"] = 269] = "JSDocFunctionType";
- SyntaxKind[SyntaxKind["JSDocVariadicType"] = 270] = "JSDocVariadicType";
- SyntaxKind[SyntaxKind["JSDocConstructorType"] = 271] = "JSDocConstructorType";
- SyntaxKind[SyntaxKind["JSDocThisType"] = 272] = "JSDocThisType";
- SyntaxKind[SyntaxKind["JSDocComment"] = 273] = "JSDocComment";
- SyntaxKind[SyntaxKind["JSDocTag"] = 274] = "JSDocTag";
- SyntaxKind[SyntaxKind["JSDocParameterTag"] = 275] = "JSDocParameterTag";
- SyntaxKind[SyntaxKind["JSDocReturnTag"] = 276] = "JSDocReturnTag";
- SyntaxKind[SyntaxKind["JSDocTypeTag"] = 277] = "JSDocTypeTag";
- SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 278] = "JSDocTemplateTag";
- SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 279] = "JSDocTypedefTag";
- SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 280] = "JSDocPropertyTag";
- SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 281] = "JSDocTypeLiteral";
- SyntaxKind[SyntaxKind["JSDocLiteralType"] = 282] = "JSDocLiteralType";
- SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 283] = "JSDocNullKeyword";
- SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 284] = "JSDocUndefinedKeyword";
- SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 285] = "JSDocNeverKeyword";
+ SyntaxKind[SyntaxKind["JSDocUnknownType"] = 263] = "JSDocUnknownType";
+ SyntaxKind[SyntaxKind["JSDocArrayType"] = 264] = "JSDocArrayType";
+ SyntaxKind[SyntaxKind["JSDocUnionType"] = 265] = "JSDocUnionType";
+ SyntaxKind[SyntaxKind["JSDocTupleType"] = 266] = "JSDocTupleType";
+ SyntaxKind[SyntaxKind["JSDocNullableType"] = 267] = "JSDocNullableType";
+ SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 268] = "JSDocNonNullableType";
+ SyntaxKind[SyntaxKind["JSDocRecordType"] = 269] = "JSDocRecordType";
+ SyntaxKind[SyntaxKind["JSDocRecordMember"] = 270] = "JSDocRecordMember";
+ SyntaxKind[SyntaxKind["JSDocTypeReference"] = 271] = "JSDocTypeReference";
+ SyntaxKind[SyntaxKind["JSDocOptionalType"] = 272] = "JSDocOptionalType";
+ SyntaxKind[SyntaxKind["JSDocFunctionType"] = 273] = "JSDocFunctionType";
+ SyntaxKind[SyntaxKind["JSDocVariadicType"] = 274] = "JSDocVariadicType";
+ SyntaxKind[SyntaxKind["JSDocConstructorType"] = 275] = "JSDocConstructorType";
+ SyntaxKind[SyntaxKind["JSDocThisType"] = 276] = "JSDocThisType";
+ SyntaxKind[SyntaxKind["JSDocComment"] = 277] = "JSDocComment";
+ SyntaxKind[SyntaxKind["JSDocTag"] = 278] = "JSDocTag";
+ SyntaxKind[SyntaxKind["JSDocParameterTag"] = 279] = "JSDocParameterTag";
+ SyntaxKind[SyntaxKind["JSDocReturnTag"] = 280] = "JSDocReturnTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 281] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 282] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 283] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 284] = "JSDocPropertyTag";
+ SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 285] = "JSDocTypeLiteral";
+ SyntaxKind[SyntaxKind["JSDocLiteralType"] = 286] = "JSDocLiteralType";
+ SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 287] = "JSDocNullKeyword";
+ SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 288] = "JSDocUndefinedKeyword";
+ SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 289] = "JSDocNeverKeyword";
// Synthesized list
- SyntaxKind[SyntaxKind["SyntaxList"] = 286] = "SyntaxList";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 290] = "SyntaxList";
// Transformation nodes
- SyntaxKind[SyntaxKind["NotEmittedStatement"] = 287] = "NotEmittedStatement";
- SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 288] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 291] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 292] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 293] = "MergeDeclarationMarker";
+ SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 294] = "EndOfDeclarationMarker";
// Enum value count
- SyntaxKind[SyntaxKind["Count"] = 289] = "Count";
+ SyntaxKind[SyntaxKind["Count"] = 295] = "Count";
// Markers
SyntaxKind[SyntaxKind["FirstAssignment"] = 57] = "FirstAssignment";
SyntaxKind[SyntaxKind["LastAssignment"] = 69] = "LastAssignment";
@@ -353,15 +360,15 @@ var ts;
SyntaxKind[SyntaxKind["FirstReservedWord"] = 71] = "FirstReservedWord";
SyntaxKind[SyntaxKind["LastReservedWord"] = 106] = "LastReservedWord";
SyntaxKind[SyntaxKind["FirstKeyword"] = 71] = "FirstKeyword";
- SyntaxKind[SyntaxKind["LastKeyword"] = 139] = "LastKeyword";
+ SyntaxKind[SyntaxKind["LastKeyword"] = 140] = "LastKeyword";
SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 107] = "FirstFutureReservedWord";
SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 115] = "LastFutureReservedWord";
- SyntaxKind[SyntaxKind["FirstTypeNode"] = 155] = "FirstTypeNode";
- SyntaxKind[SyntaxKind["LastTypeNode"] = 167] = "LastTypeNode";
+ SyntaxKind[SyntaxKind["FirstTypeNode"] = 156] = "FirstTypeNode";
+ SyntaxKind[SyntaxKind["LastTypeNode"] = 170] = "LastTypeNode";
SyntaxKind[SyntaxKind["FirstPunctuation"] = 16] = "FirstPunctuation";
SyntaxKind[SyntaxKind["LastPunctuation"] = 69] = "LastPunctuation";
SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken";
- SyntaxKind[SyntaxKind["LastToken"] = 139] = "LastToken";
+ SyntaxKind[SyntaxKind["LastToken"] = 140] = "LastToken";
SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken";
SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken";
SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken";
@@ -370,13 +377,13 @@ var ts;
SyntaxKind[SyntaxKind["LastTemplateToken"] = 15] = "LastTemplateToken";
SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 26] = "FirstBinaryOperator";
SyntaxKind[SyntaxKind["LastBinaryOperator"] = 69] = "LastBinaryOperator";
- SyntaxKind[SyntaxKind["FirstNode"] = 140] = "FirstNode";
- SyntaxKind[SyntaxKind["FirstJSDocNode"] = 257] = "FirstJSDocNode";
- SyntaxKind[SyntaxKind["LastJSDocNode"] = 282] = "LastJSDocNode";
- SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 273] = "FirstJSDocTagNode";
- SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 285] = "LastJSDocTagNode";
- })(ts.SyntaxKind || (ts.SyntaxKind = {}));
- var SyntaxKind = ts.SyntaxKind;
+ SyntaxKind[SyntaxKind["FirstNode"] = 141] = "FirstNode";
+ SyntaxKind[SyntaxKind["FirstJSDocNode"] = 261] = "FirstJSDocNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 286] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 277] = "FirstJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 289] = "LastJSDocTagNode";
+ })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
+ var NodeFlags;
(function (NodeFlags) {
NodeFlags[NodeFlags["None"] = 0] = "None";
NodeFlags[NodeFlags["Let"] = 1] = "Let";
@@ -393,25 +400,26 @@ var ts;
NodeFlags[NodeFlags["HasDecorators"] = 2048] = "HasDecorators";
NodeFlags[NodeFlags["HasParamDecorators"] = 4096] = "HasParamDecorators";
NodeFlags[NodeFlags["HasAsyncFunctions"] = 8192] = "HasAsyncFunctions";
- NodeFlags[NodeFlags["HasJsxSpreadAttributes"] = 16384] = "HasJsxSpreadAttributes";
- NodeFlags[NodeFlags["DisallowInContext"] = 32768] = "DisallowInContext";
- NodeFlags[NodeFlags["YieldContext"] = 65536] = "YieldContext";
- NodeFlags[NodeFlags["DecoratorContext"] = 131072] = "DecoratorContext";
- NodeFlags[NodeFlags["AwaitContext"] = 262144] = "AwaitContext";
- NodeFlags[NodeFlags["ThisNodeHasError"] = 524288] = "ThisNodeHasError";
- NodeFlags[NodeFlags["JavaScriptFile"] = 1048576] = "JavaScriptFile";
- NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 2097152] = "ThisNodeOrAnySubNodesHasError";
- NodeFlags[NodeFlags["HasAggregatedChildData"] = 4194304] = "HasAggregatedChildData";
+ NodeFlags[NodeFlags["HasSpreadAttribute"] = 16384] = "HasSpreadAttribute";
+ NodeFlags[NodeFlags["HasRestAttribute"] = 32768] = "HasRestAttribute";
+ NodeFlags[NodeFlags["DisallowInContext"] = 65536] = "DisallowInContext";
+ NodeFlags[NodeFlags["YieldContext"] = 131072] = "YieldContext";
+ NodeFlags[NodeFlags["DecoratorContext"] = 262144] = "DecoratorContext";
+ NodeFlags[NodeFlags["AwaitContext"] = 524288] = "AwaitContext";
+ NodeFlags[NodeFlags["ThisNodeHasError"] = 1048576] = "ThisNodeHasError";
+ NodeFlags[NodeFlags["JavaScriptFile"] = 2097152] = "JavaScriptFile";
+ NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 4194304] = "ThisNodeOrAnySubNodesHasError";
+ NodeFlags[NodeFlags["HasAggregatedChildData"] = 8388608] = "HasAggregatedChildData";
NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped";
NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 384] = "ReachabilityCheckFlags";
- NodeFlags[NodeFlags["EmitHelperFlags"] = 31744] = "EmitHelperFlags";
- NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 32128] = "ReachabilityAndEmitFlags";
+ NodeFlags[NodeFlags["EmitHelperFlags"] = 64512] = "EmitHelperFlags";
+ NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 64896] = "ReachabilityAndEmitFlags";
// Parsing context flags
- NodeFlags[NodeFlags["ContextFlags"] = 1540096] = "ContextFlags";
+ NodeFlags[NodeFlags["ContextFlags"] = 3080192] = "ContextFlags";
// Exclude these flags when parsing a Type
- NodeFlags[NodeFlags["TypeExcludesFlags"] = 327680] = "TypeExcludesFlags";
- })(ts.NodeFlags || (ts.NodeFlags = {}));
- var NodeFlags = ts.NodeFlags;
+ NodeFlags[NodeFlags["TypeExcludesFlags"] = 655360] = "TypeExcludesFlags";
+ })(NodeFlags = ts.NodeFlags || (ts.NodeFlags = {}));
+ var ModifierFlags;
(function (ModifierFlags) {
ModifierFlags[ModifierFlags["None"] = 0] = "None";
ModifierFlags[ModifierFlags["Export"] = 1] = "Export";
@@ -431,8 +439,9 @@ var ts;
ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 92] = "ParameterPropertyModifier";
ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier";
ModifierFlags[ModifierFlags["TypeScriptModifier"] = 2270] = "TypeScriptModifier";
- })(ts.ModifierFlags || (ts.ModifierFlags = {}));
- var ModifierFlags = ts.ModifierFlags;
+ ModifierFlags[ModifierFlags["ExportDefault"] = 513] = "ExportDefault";
+ })(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {}));
+ var JsxFlags;
(function (JsxFlags) {
JsxFlags[JsxFlags["None"] = 0] = "None";
/** An element from a named property of the JSX.IntrinsicElements interface */
@@ -440,24 +449,24 @@ var ts;
/** An element inferred from the string index signature of the JSX.IntrinsicElements interface */
JsxFlags[JsxFlags["IntrinsicIndexedElement"] = 2] = "IntrinsicIndexedElement";
JsxFlags[JsxFlags["IntrinsicElement"] = 3] = "IntrinsicElement";
- })(ts.JsxFlags || (ts.JsxFlags = {}));
- var JsxFlags = ts.JsxFlags;
+ })(JsxFlags = ts.JsxFlags || (ts.JsxFlags = {}));
/* @internal */
+ var RelationComparisonResult;
(function (RelationComparisonResult) {
RelationComparisonResult[RelationComparisonResult["Succeeded"] = 1] = "Succeeded";
RelationComparisonResult[RelationComparisonResult["Failed"] = 2] = "Failed";
RelationComparisonResult[RelationComparisonResult["FailedAndReported"] = 3] = "FailedAndReported";
- })(ts.RelationComparisonResult || (ts.RelationComparisonResult = {}));
- var RelationComparisonResult = ts.RelationComparisonResult;
+ })(RelationComparisonResult = ts.RelationComparisonResult || (ts.RelationComparisonResult = {}));
/*@internal*/
+ var GeneratedIdentifierKind;
(function (GeneratedIdentifierKind) {
GeneratedIdentifierKind[GeneratedIdentifierKind["None"] = 0] = "None";
GeneratedIdentifierKind[GeneratedIdentifierKind["Auto"] = 1] = "Auto";
GeneratedIdentifierKind[GeneratedIdentifierKind["Loop"] = 2] = "Loop";
GeneratedIdentifierKind[GeneratedIdentifierKind["Unique"] = 3] = "Unique";
GeneratedIdentifierKind[GeneratedIdentifierKind["Node"] = 4] = "Node";
- })(ts.GeneratedIdentifierKind || (ts.GeneratedIdentifierKind = {}));
- var GeneratedIdentifierKind = ts.GeneratedIdentifierKind;
+ })(GeneratedIdentifierKind = ts.GeneratedIdentifierKind || (ts.GeneratedIdentifierKind = {}));
+ var FlowFlags;
(function (FlowFlags) {
FlowFlags[FlowFlags["Unreachable"] = 1] = "Unreachable";
FlowFlags[FlowFlags["Start"] = 2] = "Start";
@@ -472,8 +481,7 @@ var ts;
FlowFlags[FlowFlags["Shared"] = 1024] = "Shared";
FlowFlags[FlowFlags["Label"] = 12] = "Label";
FlowFlags[FlowFlags["Condition"] = 96] = "Condition";
- })(ts.FlowFlags || (ts.FlowFlags = {}));
- var FlowFlags = ts.FlowFlags;
+ })(FlowFlags = ts.FlowFlags || (ts.FlowFlags = {}));
var OperationCanceledException = (function () {
function OperationCanceledException() {
}
@@ -481,6 +489,7 @@ var ts;
}());
ts.OperationCanceledException = OperationCanceledException;
/** Return code used by getEmitOutput function to indicate status of the function */
+ var ExitStatus;
(function (ExitStatus) {
// Compiler ran successfully. Either this was a simple do-nothing compilation (for example,
// when -version or -help was provided, or this was a normal compilation, no diagnostics
@@ -490,8 +499,8 @@ var ts;
ExitStatus[ExitStatus["DiagnosticsPresent_OutputsSkipped"] = 1] = "DiagnosticsPresent_OutputsSkipped";
// Diagnostics were produced and outputs were generated in spite of them.
ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated";
- })(ts.ExitStatus || (ts.ExitStatus = {}));
- var ExitStatus = ts.ExitStatus;
+ })(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {}));
+ var TypeFormatFlags;
(function (TypeFormatFlags) {
TypeFormatFlags[TypeFormatFlags["None"] = 0] = "None";
TypeFormatFlags[TypeFormatFlags["WriteArrayAsGenericType"] = 1] = "WriteArrayAsGenericType";
@@ -505,8 +514,8 @@ var ts;
TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 256] = "InFirstTypeArgument";
TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 512] = "InTypeAlias";
TypeFormatFlags[TypeFormatFlags["UseTypeAliasValue"] = 1024] = "UseTypeAliasValue";
- })(ts.TypeFormatFlags || (ts.TypeFormatFlags = {}));
- var TypeFormatFlags = ts.TypeFormatFlags;
+ })(TypeFormatFlags = ts.TypeFormatFlags || (ts.TypeFormatFlags = {}));
+ var SymbolFormatFlags;
(function (SymbolFormatFlags) {
SymbolFormatFlags[SymbolFormatFlags["None"] = 0] = "None";
// Write symbols's type argument if it is instantiated symbol
@@ -518,23 +527,29 @@ var ts;
// eg. module m { export class c { } } import x = m.c;
// When this flag is specified m.c will be used to refer to the class instead of alias symbol x
SymbolFormatFlags[SymbolFormatFlags["UseOnlyExternalAliasing"] = 2] = "UseOnlyExternalAliasing";
- })(ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {}));
- var SymbolFormatFlags = ts.SymbolFormatFlags;
+ })(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {}));
/* @internal */
+ var SymbolAccessibility;
(function (SymbolAccessibility) {
SymbolAccessibility[SymbolAccessibility["Accessible"] = 0] = "Accessible";
SymbolAccessibility[SymbolAccessibility["NotAccessible"] = 1] = "NotAccessible";
SymbolAccessibility[SymbolAccessibility["CannotBeNamed"] = 2] = "CannotBeNamed";
- })(ts.SymbolAccessibility || (ts.SymbolAccessibility = {}));
- var SymbolAccessibility = ts.SymbolAccessibility;
+ })(SymbolAccessibility = ts.SymbolAccessibility || (ts.SymbolAccessibility = {}));
+ /* @internal */
+ var SyntheticSymbolKind;
+ (function (SyntheticSymbolKind) {
+ SyntheticSymbolKind[SyntheticSymbolKind["UnionOrIntersection"] = 0] = "UnionOrIntersection";
+ SyntheticSymbolKind[SyntheticSymbolKind["Spread"] = 1] = "Spread";
+ })(SyntheticSymbolKind = ts.SyntheticSymbolKind || (ts.SyntheticSymbolKind = {}));
+ var TypePredicateKind;
(function (TypePredicateKind) {
TypePredicateKind[TypePredicateKind["This"] = 0] = "This";
TypePredicateKind[TypePredicateKind["Identifier"] = 1] = "Identifier";
- })(ts.TypePredicateKind || (ts.TypePredicateKind = {}));
- var TypePredicateKind = ts.TypePredicateKind;
+ })(TypePredicateKind = ts.TypePredicateKind || (ts.TypePredicateKind = {}));
/** Indicates how to serialize the name for a TypeReferenceNode when emitting decorator
* metadata */
/* @internal */
+ var TypeReferenceSerializationKind;
(function (TypeReferenceSerializationKind) {
TypeReferenceSerializationKind[TypeReferenceSerializationKind["Unknown"] = 0] = "Unknown";
// should be emitted using a safe fallback.
@@ -552,8 +567,8 @@ var ts;
TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithCallSignature"] = 9] = "TypeWithCallSignature";
// with call signatures.
TypeReferenceSerializationKind[TypeReferenceSerializationKind["ObjectType"] = 10] = "ObjectType";
- })(ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {}));
- var TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind;
+ })(TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {}));
+ var SymbolFlags;
(function (SymbolFlags) {
SymbolFlags[SymbolFlags["None"] = 0] = "None";
SymbolFlags[SymbolFlags["FunctionScopedVariable"] = 1] = "FunctionScopedVariable";
@@ -628,9 +643,9 @@ var ts;
// The set of things we consider semantically classifiable. Used to speed up the LS during
// classification.
SymbolFlags[SymbolFlags["Classifiable"] = 788448] = "Classifiable";
- })(ts.SymbolFlags || (ts.SymbolFlags = {}));
- var SymbolFlags = ts.SymbolFlags;
+ })(SymbolFlags = ts.SymbolFlags || (ts.SymbolFlags = {}));
/* @internal */
+ var NodeCheckFlags;
(function (NodeCheckFlags) {
NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked";
NodeCheckFlags[NodeCheckFlags["LexicalThis"] = 2] = "LexicalThis";
@@ -652,8 +667,8 @@ var ts;
NodeCheckFlags[NodeCheckFlags["AssignmentsMarked"] = 4194304] = "AssignmentsMarked";
NodeCheckFlags[NodeCheckFlags["ClassWithConstructorReference"] = 8388608] = "ClassWithConstructorReference";
NodeCheckFlags[NodeCheckFlags["ConstructorReferenceInClass"] = 16777216] = "ConstructorReferenceInClass";
- })(ts.NodeCheckFlags || (ts.NodeCheckFlags = {}));
- var NodeCheckFlags = ts.NodeCheckFlags;
+ })(NodeCheckFlags = ts.NodeCheckFlags || (ts.NodeCheckFlags = {}));
+ var TypeFlags;
(function (TypeFlags) {
TypeFlags[TypeFlags["Any"] = 1] = "Any";
TypeFlags[TypeFlags["String"] = 2] = "String";
@@ -673,14 +688,16 @@ var ts;
TypeFlags[TypeFlags["Object"] = 32768] = "Object";
TypeFlags[TypeFlags["Union"] = 65536] = "Union";
TypeFlags[TypeFlags["Intersection"] = 131072] = "Intersection";
+ TypeFlags[TypeFlags["Index"] = 262144] = "Index";
+ TypeFlags[TypeFlags["IndexedAccess"] = 524288] = "IndexedAccess";
/* @internal */
- TypeFlags[TypeFlags["FreshLiteral"] = 262144] = "FreshLiteral";
+ TypeFlags[TypeFlags["FreshLiteral"] = 1048576] = "FreshLiteral";
/* @internal */
- TypeFlags[TypeFlags["ContainsWideningType"] = 524288] = "ContainsWideningType";
+ TypeFlags[TypeFlags["ContainsWideningType"] = 2097152] = "ContainsWideningType";
/* @internal */
- TypeFlags[TypeFlags["ContainsObjectLiteral"] = 1048576] = "ContainsObjectLiteral";
+ TypeFlags[TypeFlags["ContainsObjectLiteral"] = 4194304] = "ContainsObjectLiteral";
/* @internal */
- TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 2097152] = "ContainsAnyFunctionType";
+ TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 8388608] = "ContainsAnyFunctionType";
/* @internal */
TypeFlags[TypeFlags["Nullable"] = 6144] = "Nullable";
TypeFlags[TypeFlags["Literal"] = 480] = "Literal";
@@ -698,17 +715,17 @@ var ts;
TypeFlags[TypeFlags["EnumLike"] = 272] = "EnumLike";
TypeFlags[TypeFlags["UnionOrIntersection"] = 196608] = "UnionOrIntersection";
TypeFlags[TypeFlags["StructuredType"] = 229376] = "StructuredType";
- TypeFlags[TypeFlags["StructuredOrTypeParameter"] = 245760] = "StructuredOrTypeParameter";
+ TypeFlags[TypeFlags["StructuredOrTypeParameter"] = 507904] = "StructuredOrTypeParameter";
// 'Narrowable' types are types where narrowing actually narrows.
// This *should* be every type other than null, undefined, void, and never
- TypeFlags[TypeFlags["Narrowable"] = 246783] = "Narrowable";
+ TypeFlags[TypeFlags["Narrowable"] = 1033215] = "Narrowable";
TypeFlags[TypeFlags["NotUnionOrUnit"] = 33281] = "NotUnionOrUnit";
/* @internal */
- TypeFlags[TypeFlags["RequiresWidening"] = 1572864] = "RequiresWidening";
+ TypeFlags[TypeFlags["RequiresWidening"] = 6291456] = "RequiresWidening";
/* @internal */
- TypeFlags[TypeFlags["PropagatingFlags"] = 3670016] = "PropagatingFlags";
- })(ts.TypeFlags || (ts.TypeFlags = {}));
- var TypeFlags = ts.TypeFlags;
+ TypeFlags[TypeFlags["PropagatingFlags"] = 14680064] = "PropagatingFlags";
+ })(TypeFlags = ts.TypeFlags || (ts.TypeFlags = {}));
+ var ObjectFlags;
(function (ObjectFlags) {
ObjectFlags[ObjectFlags["Class"] = 1] = "Class";
ObjectFlags[ObjectFlags["Interface"] = 2] = "Interface";
@@ -720,19 +737,19 @@ var ts;
ObjectFlags[ObjectFlags["EvolvingArray"] = 128] = "EvolvingArray";
ObjectFlags[ObjectFlags["ObjectLiteralPatternWithComputedProperties"] = 256] = "ObjectLiteralPatternWithComputedProperties";
ObjectFlags[ObjectFlags["ClassOrInterface"] = 3] = "ClassOrInterface";
- })(ts.ObjectFlags || (ts.ObjectFlags = {}));
- var ObjectFlags = ts.ObjectFlags;
+ })(ObjectFlags = ts.ObjectFlags || (ts.ObjectFlags = {}));
+ var SignatureKind;
(function (SignatureKind) {
SignatureKind[SignatureKind["Call"] = 0] = "Call";
SignatureKind[SignatureKind["Construct"] = 1] = "Construct";
- })(ts.SignatureKind || (ts.SignatureKind = {}));
- var SignatureKind = ts.SignatureKind;
+ })(SignatureKind = ts.SignatureKind || (ts.SignatureKind = {}));
+ var IndexKind;
(function (IndexKind) {
IndexKind[IndexKind["String"] = 0] = "String";
IndexKind[IndexKind["Number"] = 1] = "Number";
- })(ts.IndexKind || (ts.IndexKind = {}));
- var IndexKind = ts.IndexKind;
+ })(IndexKind = ts.IndexKind || (ts.IndexKind = {}));
/* @internal */
+ var SpecialPropertyAssignmentKind;
(function (SpecialPropertyAssignmentKind) {
SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["None"] = 0] = "None";
/// exports.name = expr
@@ -743,19 +760,19 @@ var ts;
SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["PrototypeProperty"] = 3] = "PrototypeProperty";
/// this.name = expr
SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ThisProperty"] = 4] = "ThisProperty";
- })(ts.SpecialPropertyAssignmentKind || (ts.SpecialPropertyAssignmentKind = {}));
- var SpecialPropertyAssignmentKind = ts.SpecialPropertyAssignmentKind;
+ })(SpecialPropertyAssignmentKind = ts.SpecialPropertyAssignmentKind || (ts.SpecialPropertyAssignmentKind = {}));
+ var DiagnosticCategory;
(function (DiagnosticCategory) {
DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning";
DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
DiagnosticCategory[DiagnosticCategory["Message"] = 2] = "Message";
- })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {}));
- var DiagnosticCategory = ts.DiagnosticCategory;
+ })(DiagnosticCategory = ts.DiagnosticCategory || (ts.DiagnosticCategory = {}));
+ var ModuleResolutionKind;
(function (ModuleResolutionKind) {
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
- })(ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
- var ModuleResolutionKind = ts.ModuleResolutionKind;
+ })(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
+ var ModuleKind;
(function (ModuleKind) {
ModuleKind[ModuleKind["None"] = 0] = "None";
ModuleKind[ModuleKind["CommonJS"] = 1] = "CommonJS";
@@ -763,53 +780,54 @@ var ts;
ModuleKind[ModuleKind["UMD"] = 3] = "UMD";
ModuleKind[ModuleKind["System"] = 4] = "System";
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
- })(ts.ModuleKind || (ts.ModuleKind = {}));
- var ModuleKind = ts.ModuleKind;
+ })(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
+ var JsxEmit;
(function (JsxEmit) {
JsxEmit[JsxEmit["None"] = 0] = "None";
JsxEmit[JsxEmit["Preserve"] = 1] = "Preserve";
JsxEmit[JsxEmit["React"] = 2] = "React";
- })(ts.JsxEmit || (ts.JsxEmit = {}));
- var JsxEmit = ts.JsxEmit;
+ })(JsxEmit = ts.JsxEmit || (ts.JsxEmit = {}));
+ var NewLineKind;
(function (NewLineKind) {
NewLineKind[NewLineKind["CarriageReturnLineFeed"] = 0] = "CarriageReturnLineFeed";
NewLineKind[NewLineKind["LineFeed"] = 1] = "LineFeed";
- })(ts.NewLineKind || (ts.NewLineKind = {}));
- var NewLineKind = ts.NewLineKind;
+ })(NewLineKind = ts.NewLineKind || (ts.NewLineKind = {}));
+ var ScriptKind;
(function (ScriptKind) {
ScriptKind[ScriptKind["Unknown"] = 0] = "Unknown";
ScriptKind[ScriptKind["JS"] = 1] = "JS";
ScriptKind[ScriptKind["JSX"] = 2] = "JSX";
ScriptKind[ScriptKind["TS"] = 3] = "TS";
ScriptKind[ScriptKind["TSX"] = 4] = "TSX";
- })(ts.ScriptKind || (ts.ScriptKind = {}));
- var ScriptKind = ts.ScriptKind;
+ })(ScriptKind = ts.ScriptKind || (ts.ScriptKind = {}));
+ var ScriptTarget;
(function (ScriptTarget) {
ScriptTarget[ScriptTarget["ES3"] = 0] = "ES3";
ScriptTarget[ScriptTarget["ES5"] = 1] = "ES5";
ScriptTarget[ScriptTarget["ES2015"] = 2] = "ES2015";
ScriptTarget[ScriptTarget["ES2016"] = 3] = "ES2016";
ScriptTarget[ScriptTarget["ES2017"] = 4] = "ES2017";
- ScriptTarget[ScriptTarget["Latest"] = 4] = "Latest";
- })(ts.ScriptTarget || (ts.ScriptTarget = {}));
- var ScriptTarget = ts.ScriptTarget;
+ ScriptTarget[ScriptTarget["ESNext"] = 5] = "ESNext";
+ ScriptTarget[ScriptTarget["Latest"] = 5] = "Latest";
+ })(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {}));
+ var LanguageVariant;
(function (LanguageVariant) {
LanguageVariant[LanguageVariant["Standard"] = 0] = "Standard";
LanguageVariant[LanguageVariant["JSX"] = 1] = "JSX";
- })(ts.LanguageVariant || (ts.LanguageVariant = {}));
- var LanguageVariant = ts.LanguageVariant;
+ })(LanguageVariant = ts.LanguageVariant || (ts.LanguageVariant = {}));
/* @internal */
+ var DiagnosticStyle;
(function (DiagnosticStyle) {
DiagnosticStyle[DiagnosticStyle["Simple"] = 0] = "Simple";
DiagnosticStyle[DiagnosticStyle["Pretty"] = 1] = "Pretty";
- })(ts.DiagnosticStyle || (ts.DiagnosticStyle = {}));
- var DiagnosticStyle = ts.DiagnosticStyle;
+ })(DiagnosticStyle = ts.DiagnosticStyle || (ts.DiagnosticStyle = {}));
+ var WatchDirectoryFlags;
(function (WatchDirectoryFlags) {
WatchDirectoryFlags[WatchDirectoryFlags["None"] = 0] = "None";
WatchDirectoryFlags[WatchDirectoryFlags["Recursive"] = 1] = "Recursive";
- })(ts.WatchDirectoryFlags || (ts.WatchDirectoryFlags = {}));
- var WatchDirectoryFlags = ts.WatchDirectoryFlags;
+ })(WatchDirectoryFlags = ts.WatchDirectoryFlags || (ts.WatchDirectoryFlags = {}));
/* @internal */
+ var CharacterCodes;
(function (CharacterCodes) {
CharacterCodes[CharacterCodes["nullCharacter"] = 0] = "nullCharacter";
CharacterCodes[CharacterCodes["maxAsciiCharacter"] = 127] = "maxAsciiCharacter";
@@ -936,9 +954,18 @@ var ts;
CharacterCodes[CharacterCodes["byteOrderMark"] = 65279] = "byteOrderMark";
CharacterCodes[CharacterCodes["tab"] = 9] = "tab";
CharacterCodes[CharacterCodes["verticalTab"] = 11] = "verticalTab";
- })(ts.CharacterCodes || (ts.CharacterCodes = {}));
- var CharacterCodes = ts.CharacterCodes;
+ })(CharacterCodes = ts.CharacterCodes || (ts.CharacterCodes = {}));
+ var Extension;
+ (function (Extension) {
+ Extension[Extension["Ts"] = 0] = "Ts";
+ Extension[Extension["Tsx"] = 1] = "Tsx";
+ Extension[Extension["Dts"] = 2] = "Dts";
+ Extension[Extension["Js"] = 3] = "Js";
+ Extension[Extension["Jsx"] = 4] = "Jsx";
+ Extension[Extension["LastTypeScriptExtension"] = 2] = "LastTypeScriptExtension";
+ })(Extension = ts.Extension || (ts.Extension = {}));
/* @internal */
+ var TransformFlags;
(function (TransformFlags) {
TransformFlags[TransformFlags["None"] = 0] = "None";
// Facts
@@ -947,61 +974,66 @@ var ts;
TransformFlags[TransformFlags["ContainsTypeScript"] = 2] = "ContainsTypeScript";
TransformFlags[TransformFlags["Jsx"] = 4] = "Jsx";
TransformFlags[TransformFlags["ContainsJsx"] = 8] = "ContainsJsx";
- TransformFlags[TransformFlags["ES2017"] = 16] = "ES2017";
- TransformFlags[TransformFlags["ContainsES2017"] = 32] = "ContainsES2017";
- TransformFlags[TransformFlags["ES2016"] = 64] = "ES2016";
- TransformFlags[TransformFlags["ContainsES2016"] = 128] = "ContainsES2016";
- TransformFlags[TransformFlags["ES2015"] = 256] = "ES2015";
- TransformFlags[TransformFlags["ContainsES2015"] = 512] = "ContainsES2015";
- TransformFlags[TransformFlags["DestructuringAssignment"] = 1024] = "DestructuringAssignment";
- TransformFlags[TransformFlags["Generator"] = 2048] = "Generator";
- TransformFlags[TransformFlags["ContainsGenerator"] = 4096] = "ContainsGenerator";
+ TransformFlags[TransformFlags["ESNext"] = 16] = "ESNext";
+ TransformFlags[TransformFlags["ContainsESNext"] = 32] = "ContainsESNext";
+ TransformFlags[TransformFlags["ES2017"] = 64] = "ES2017";
+ TransformFlags[TransformFlags["ContainsES2017"] = 128] = "ContainsES2017";
+ TransformFlags[TransformFlags["ES2016"] = 256] = "ES2016";
+ TransformFlags[TransformFlags["ContainsES2016"] = 512] = "ContainsES2016";
+ TransformFlags[TransformFlags["ES2015"] = 1024] = "ES2015";
+ TransformFlags[TransformFlags["ContainsES2015"] = 2048] = "ContainsES2015";
+ TransformFlags[TransformFlags["Generator"] = 4096] = "Generator";
+ TransformFlags[TransformFlags["ContainsGenerator"] = 8192] = "ContainsGenerator";
+ TransformFlags[TransformFlags["DestructuringAssignment"] = 16384] = "DestructuringAssignment";
+ TransformFlags[TransformFlags["ContainsDestructuringAssignment"] = 32768] = "ContainsDestructuringAssignment";
// Markers
// - Flags used to indicate that a subtree contains a specific transformation.
- TransformFlags[TransformFlags["ContainsDecorators"] = 8192] = "ContainsDecorators";
- TransformFlags[TransformFlags["ContainsPropertyInitializer"] = 16384] = "ContainsPropertyInitializer";
- TransformFlags[TransformFlags["ContainsLexicalThis"] = 32768] = "ContainsLexicalThis";
- TransformFlags[TransformFlags["ContainsCapturedLexicalThis"] = 65536] = "ContainsCapturedLexicalThis";
- TransformFlags[TransformFlags["ContainsLexicalThisInComputedPropertyName"] = 131072] = "ContainsLexicalThisInComputedPropertyName";
- TransformFlags[TransformFlags["ContainsDefaultValueAssignments"] = 262144] = "ContainsDefaultValueAssignments";
- TransformFlags[TransformFlags["ContainsParameterPropertyAssignments"] = 524288] = "ContainsParameterPropertyAssignments";
- TransformFlags[TransformFlags["ContainsSpreadElementExpression"] = 1048576] = "ContainsSpreadElementExpression";
- TransformFlags[TransformFlags["ContainsComputedPropertyName"] = 2097152] = "ContainsComputedPropertyName";
- TransformFlags[TransformFlags["ContainsBlockScopedBinding"] = 4194304] = "ContainsBlockScopedBinding";
- TransformFlags[TransformFlags["ContainsBindingPattern"] = 8388608] = "ContainsBindingPattern";
- TransformFlags[TransformFlags["ContainsYield"] = 16777216] = "ContainsYield";
- TransformFlags[TransformFlags["ContainsHoistedDeclarationOrCompletion"] = 33554432] = "ContainsHoistedDeclarationOrCompletion";
+ TransformFlags[TransformFlags["ContainsDecorators"] = 65536] = "ContainsDecorators";
+ TransformFlags[TransformFlags["ContainsPropertyInitializer"] = 131072] = "ContainsPropertyInitializer";
+ TransformFlags[TransformFlags["ContainsLexicalThis"] = 262144] = "ContainsLexicalThis";
+ TransformFlags[TransformFlags["ContainsCapturedLexicalThis"] = 524288] = "ContainsCapturedLexicalThis";
+ TransformFlags[TransformFlags["ContainsLexicalThisInComputedPropertyName"] = 1048576] = "ContainsLexicalThisInComputedPropertyName";
+ TransformFlags[TransformFlags["ContainsDefaultValueAssignments"] = 2097152] = "ContainsDefaultValueAssignments";
+ TransformFlags[TransformFlags["ContainsParameterPropertyAssignments"] = 4194304] = "ContainsParameterPropertyAssignments";
+ TransformFlags[TransformFlags["ContainsSpreadExpression"] = 8388608] = "ContainsSpreadExpression";
+ TransformFlags[TransformFlags["ContainsComputedPropertyName"] = 16777216] = "ContainsComputedPropertyName";
+ TransformFlags[TransformFlags["ContainsBlockScopedBinding"] = 33554432] = "ContainsBlockScopedBinding";
+ TransformFlags[TransformFlags["ContainsBindingPattern"] = 67108864] = "ContainsBindingPattern";
+ TransformFlags[TransformFlags["ContainsYield"] = 134217728] = "ContainsYield";
+ TransformFlags[TransformFlags["ContainsHoistedDeclarationOrCompletion"] = 268435456] = "ContainsHoistedDeclarationOrCompletion";
TransformFlags[TransformFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags";
// Assertions
// - Bitmasks that are used to assert facts about the syntax of a node and its subtree.
TransformFlags[TransformFlags["AssertTypeScript"] = 3] = "AssertTypeScript";
TransformFlags[TransformFlags["AssertJsx"] = 12] = "AssertJsx";
- TransformFlags[TransformFlags["AssertES2017"] = 48] = "AssertES2017";
- TransformFlags[TransformFlags["AssertES2016"] = 192] = "AssertES2016";
- TransformFlags[TransformFlags["AssertES2015"] = 768] = "AssertES2015";
- TransformFlags[TransformFlags["AssertGenerator"] = 6144] = "AssertGenerator";
+ TransformFlags[TransformFlags["AssertESNext"] = 48] = "AssertESNext";
+ TransformFlags[TransformFlags["AssertES2017"] = 192] = "AssertES2017";
+ TransformFlags[TransformFlags["AssertES2016"] = 768] = "AssertES2016";
+ TransformFlags[TransformFlags["AssertES2015"] = 3072] = "AssertES2015";
+ TransformFlags[TransformFlags["AssertGenerator"] = 12288] = "AssertGenerator";
+ TransformFlags[TransformFlags["AssertDestructuringAssignment"] = 49152] = "AssertDestructuringAssignment";
// Scope Exclusions
// - Bitmasks that exclude flags from propagating out of a specific context
// into the subtree flags of their container.
- TransformFlags[TransformFlags["NodeExcludes"] = 536874325] = "NodeExcludes";
- TransformFlags[TransformFlags["ArrowFunctionExcludes"] = 592227669] = "ArrowFunctionExcludes";
- TransformFlags[TransformFlags["FunctionExcludes"] = 592293205] = "FunctionExcludes";
- TransformFlags[TransformFlags["ConstructorExcludes"] = 591760725] = "ConstructorExcludes";
- TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = 591760725] = "MethodOrAccessorExcludes";
- TransformFlags[TransformFlags["ClassExcludes"] = 539749717] = "ClassExcludes";
- TransformFlags[TransformFlags["ModuleExcludes"] = 574729557] = "ModuleExcludes";
+ TransformFlags[TransformFlags["NodeExcludes"] = 536892757] = "NodeExcludes";
+ TransformFlags[TransformFlags["ArrowFunctionExcludes"] = 979719509] = "ArrowFunctionExcludes";
+ TransformFlags[TransformFlags["FunctionExcludes"] = 980243797] = "FunctionExcludes";
+ TransformFlags[TransformFlags["ConstructorExcludes"] = 975983957] = "ConstructorExcludes";
+ TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = 975983957] = "MethodOrAccessorExcludes";
+ TransformFlags[TransformFlags["ClassExcludes"] = 559895893] = "ClassExcludes";
+ TransformFlags[TransformFlags["ModuleExcludes"] = 839734613] = "ModuleExcludes";
TransformFlags[TransformFlags["TypeExcludes"] = -3] = "TypeExcludes";
- TransformFlags[TransformFlags["ObjectLiteralExcludes"] = 539110741] = "ObjectLiteralExcludes";
- TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = 537922901] = "ArrayLiteralOrCallOrNewExcludes";
- TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = 545262933] = "VariableDeclarationListExcludes";
- TransformFlags[TransformFlags["ParameterExcludes"] = 545262933] = "ParameterExcludes";
+ TransformFlags[TransformFlags["ObjectLiteralExcludes"] = 554784085] = "ObjectLiteralExcludes";
+ TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = 545281365] = "ArrayLiteralOrCallOrNewExcludes";
+ TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = 604001621] = "VariableDeclarationListExcludes";
+ TransformFlags[TransformFlags["ParameterExcludes"] = 604001621] = "ParameterExcludes";
// Masks
// - Additional bitmasks
- TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 548864] = "TypeScriptClassSyntaxMask";
- TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 327680] = "ES2015FunctionSyntaxMask";
- })(ts.TransformFlags || (ts.TransformFlags = {}));
- var TransformFlags = ts.TransformFlags;
+ TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 4390912] = "TypeScriptClassSyntaxMask";
+ TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 2621440] = "ES2015FunctionSyntaxMask";
+ })(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {}));
/* @internal */
+ var EmitFlags;
(function (EmitFlags) {
EmitFlags[EmitFlags["EmitEmitHelpers"] = 1] = "EmitEmitHelpers";
EmitFlags[EmitFlags["EmitExportStar"] = 2] = "EmitExportStar";
@@ -1030,16 +1062,17 @@ var ts;
EmitFlags[EmitFlags["AsyncFunctionBody"] = 2097152] = "AsyncFunctionBody";
EmitFlags[EmitFlags["ReuseTempVariableScope"] = 4194304] = "ReuseTempVariableScope";
EmitFlags[EmitFlags["CustomPrologue"] = 8388608] = "CustomPrologue";
- })(ts.EmitFlags || (ts.EmitFlags = {}));
- var EmitFlags = ts.EmitFlags;
+ EmitFlags[EmitFlags["NoHoisting"] = 16777216] = "NoHoisting";
+ EmitFlags[EmitFlags["HasEndOfDeclarationMarker"] = 33554432] = "HasEndOfDeclarationMarker";
+ })(EmitFlags = ts.EmitFlags || (ts.EmitFlags = {}));
/* @internal */
+ var EmitContext;
(function (EmitContext) {
EmitContext[EmitContext["SourceFile"] = 0] = "SourceFile";
EmitContext[EmitContext["Expression"] = 1] = "Expression";
EmitContext[EmitContext["IdentifierName"] = 2] = "IdentifierName";
EmitContext[EmitContext["Unspecified"] = 3] = "Unspecified";
- })(ts.EmitContext || (ts.EmitContext = {}));
- var EmitContext = ts.EmitContext;
+ })(EmitContext = ts.EmitContext || (ts.EmitContext = {}));
})(ts || (ts = {}));
/*@internal*/
var ts;
@@ -1149,12 +1182,12 @@ var ts;
* x | y is Maybe if either x or y is Maybe, but neither x or y is True.
* x | y is True if either x or y is True.
*/
+ var Ternary;
(function (Ternary) {
Ternary[Ternary["False"] = 0] = "False";
Ternary[Ternary["Maybe"] = 1] = "Maybe";
Ternary[Ternary["True"] = -1] = "True";
- })(ts.Ternary || (ts.Ternary = {}));
- var Ternary = ts.Ternary;
+ })(Ternary = ts.Ternary || (ts.Ternary = {}));
var createObject = Object.create;
// More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times.
ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
@@ -1226,12 +1259,12 @@ var ts;
return getCanonicalFileName(nonCanonicalizedPath);
}
ts.toPath = toPath;
+ var Comparison;
(function (Comparison) {
Comparison[Comparison["LessThan"] = -1] = "LessThan";
Comparison[Comparison["EqualTo"] = 0] = "EqualTo";
Comparison[Comparison["GreaterThan"] = 1] = "GreaterThan";
- })(ts.Comparison || (ts.Comparison = {}));
- var Comparison = ts.Comparison;
+ })(Comparison = ts.Comparison || (ts.Comparison = {}));
/**
* Iterates through 'array' by index and performs the callback on each element of array until the callback
* returns a truthy value, then returns that value.
@@ -1249,6 +1282,13 @@ var ts;
return undefined;
}
ts.forEach = forEach;
+ function zipWith(arrayA, arrayB, callback) {
+ Debug.assert(arrayA.length === arrayB.length);
+ for (var i = 0; i < arrayA.length; i++) {
+ callback(arrayA[i], arrayB[i], i);
+ }
+ }
+ ts.zipWith = zipWith;
/**
* Iterates through `array` by index and performs the callback on each element of array until the callback
* returns a falsey value, then returns false.
@@ -1541,20 +1581,25 @@ var ts;
ts.mapObject = mapObject;
function some(array, predicate) {
if (array) {
- for (var _i = 0, array_5 = array; _i < array_5.length; _i++) {
- var v = array_5[_i];
- if (!predicate || predicate(v)) {
- return true;
+ if (predicate) {
+ for (var _i = 0, array_5 = array; _i < array_5.length; _i++) {
+ var v = array_5[_i];
+ if (predicate(v)) {
+ return true;
+ }
}
}
+ else {
+ return array.length > 0;
+ }
}
return false;
}
ts.some = some;
function concatenate(array1, array2) {
- if (!array2 || !array2.length)
+ if (!some(array2))
return array1;
- if (!array1 || !array1.length)
+ if (!some(array1))
return array2;
return array1.concat(array2);
}
@@ -1634,6 +1679,31 @@ var ts;
return result || array;
}
ts.compact = compact;
+ /**
+ * Gets the relative complement of `arrayA` with respect to `b`, returning the elements that
+ * are not present in `arrayA` but are present in `arrayB`. Assumes both arrays are sorted
+ * based on the provided comparer.
+ */
+ function relativeComplement(arrayA, arrayB, comparer, offsetA, offsetB) {
+ if (comparer === void 0) { comparer = compareValues; }
+ if (offsetA === void 0) { offsetA = 0; }
+ if (offsetB === void 0) { offsetB = 0; }
+ if (!arrayB || !arrayA || arrayB.length === 0 || arrayA.length === 0)
+ return arrayB;
+ var result = [];
+ outer: for (; offsetB < arrayB.length; offsetB++) {
+ inner: for (; offsetA < arrayA.length; offsetA++) {
+ switch (comparer(arrayB[offsetB], arrayA[offsetA])) {
+ case -1 /* LessThan */: break inner;
+ case 0 /* EqualTo */: continue outer;
+ case 1 /* GreaterThan */: continue inner;
+ }
+ }
+ result.push(arrayB[offsetB]);
+ }
+ return result;
+ }
+ ts.relativeComplement = relativeComplement;
function sum(array, prop) {
var result = 0;
for (var _i = 0, array_7 = array; _i < array_7.length; _i++) {
@@ -1643,15 +1713,39 @@ var ts;
return result;
}
ts.sum = sum;
+ /**
+ * Appends a value to an array, returning the array.
+ *
+ * @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array
+ * is created if `value` was appended.
+ * @param value The value to append to the array. If `value` is `undefined`, nothing is
+ * appended.
+ */
+ function append(to, value) {
+ if (value === undefined)
+ return to;
+ if (to === undefined)
+ to = [];
+ to.push(value);
+ return to;
+ }
+ ts.append = append;
+ /**
+ * Appends a range of value to an array, returning the array.
+ *
+ * @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array
+ * is created if `value` was appended.
+ * @param from The values to append to the array. If `from` is `undefined`, nothing is
+ * appended. If an element of `from` is `undefined`, that element is not appended.
+ */
function addRange(to, from) {
- if (to && from) {
- for (var _i = 0, from_1 = from; _i < from_1.length; _i++) {
- var v = from_1[_i];
- if (v !== undefined) {
- to.push(v);
- }
- }
+ if (from === undefined)
+ return to;
+ for (var _i = 0, from_1 = from; _i < from_1.length; _i++) {
+ var v = from_1[_i];
+ to = append(to, v);
}
+ return to;
}
ts.addRange = addRange;
function rangeEquals(array1, array2, pos, end) {
@@ -1664,26 +1758,17 @@ var ts;
return true;
}
ts.rangeEquals = rangeEquals;
+ /**
+ * Returns the first element of an array if non-empty, `undefined` otherwise.
+ */
function firstOrUndefined(array) {
return array && array.length > 0
? array[0]
: undefined;
}
ts.firstOrUndefined = firstOrUndefined;
- function singleOrUndefined(array) {
- return array && array.length === 1
- ? array[0]
- : undefined;
- }
- ts.singleOrUndefined = singleOrUndefined;
- function singleOrMany(array) {
- return array && array.length === 1
- ? array[0]
- : array;
- }
- ts.singleOrMany = singleOrMany;
/**
- * Returns the last element of an array if non-empty, undefined otherwise.
+ * Returns the last element of an array if non-empty, `undefined` otherwise.
*/
function lastOrUndefined(array) {
return array && array.length > 0
@@ -1691,6 +1776,25 @@ var ts;
: undefined;
}
ts.lastOrUndefined = lastOrUndefined;
+ /**
+ * Returns the only element of an array if it contains only one element, `undefined` otherwise.
+ */
+ function singleOrUndefined(array) {
+ return array && array.length === 1
+ ? array[0]
+ : undefined;
+ }
+ ts.singleOrUndefined = singleOrUndefined;
+ /**
+ * Returns the only element of an array if it contains only one element; otheriwse, returns the
+ * array.
+ */
+ function singleOrMany(array) {
+ return array && array.length === 1
+ ? array[0]
+ : array;
+ }
+ ts.singleOrMany = singleOrMany;
function replaceElement(array, index, value) {
var result = array.slice(0);
result[index] = value;
@@ -1704,11 +1808,11 @@ var ts;
* @param array A sorted array whose first element must be no larger than number
* @param number The value to be searched for in the array.
*/
- function binarySearch(array, value, comparer) {
+ function binarySearch(array, value, comparer, offset) {
if (!array || array.length === 0) {
return -1;
}
- var low = 0;
+ var low = offset || 0;
var high = array.length - 1;
comparer = comparer !== undefined
? comparer
@@ -2606,6 +2710,10 @@ var ts;
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
}
ts.endsWith = endsWith;
+ function hasExtension(fileName) {
+ return getBaseFileName(fileName).indexOf(".") >= 0;
+ }
+ ts.hasExtension = hasExtension;
function fileExtensionIs(path, extension) {
return path.length > extension.length && endsWith(path, extension);
}
@@ -2646,73 +2754,93 @@ var ts;
var doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?";
var pattern = "";
var hasWrittenSubpattern = false;
- spec: for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
+ for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
var spec = specs_1[_i];
if (!spec) {
continue;
}
- var subpattern = "";
- var hasRecursiveDirectoryWildcard = false;
- var hasWrittenComponent = false;
- var components = getNormalizedPathComponents(spec, basePath);
- if (usage !== "exclude" && components[components.length - 1] === "**") {
- continue spec;
- }
- // getNormalizedPathComponents includes the separator for the root component.
- // We need to remove to create our regex correctly.
- components[0] = removeTrailingDirectorySeparator(components[0]);
- var optionalCount = 0;
- for (var _a = 0, components_1 = components; _a < components_1.length; _a++) {
- var component = components_1[_a];
- if (component === "**") {
- if (hasRecursiveDirectoryWildcard) {
- continue spec;
- }
- subpattern += doubleAsteriskRegexFragment;
- hasRecursiveDirectoryWildcard = true;
- hasWrittenComponent = true;
- }
- else {
- if (usage === "directories") {
- subpattern += "(";
- optionalCount++;
- }
- if (hasWrittenComponent) {
- subpattern += ts.directorySeparator;
- }
- if (usage !== "exclude") {
- // The * and ? wildcards should not match directories or files that start with . if they
- // appear first in a component. Dotted directories and files can be included explicitly
- // like so: **/.*/.*
- if (component.charCodeAt(0) === 42 /* asterisk */) {
- subpattern += "([^./]" + singleAsteriskRegexFragment + ")?";
- component = component.substr(1);
- }
- else if (component.charCodeAt(0) === 63 /* question */) {
- subpattern += "[^./]";
- component = component.substr(1);
- }
- }
- subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter);
- hasWrittenComponent = true;
- }
- }
- while (optionalCount > 0) {
- subpattern += ")?";
- optionalCount--;
+ var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter);
+ if (subPattern === undefined) {
+ continue;
}
if (hasWrittenSubpattern) {
pattern += "|";
}
- pattern += "(" + subpattern + ")";
+ pattern += "(" + subPattern + ")";
hasWrittenSubpattern = true;
}
if (!pattern) {
return undefined;
}
- return "^(" + pattern + (usage === "exclude" ? ")($|/)" : ")$");
+ // If excluding, match "foo/bar/baz...", but if including, only allow "foo".
+ var terminator = usage === "exclude" ? "($|/)" : "$";
+ return "^(" + pattern + ")" + terminator;
}
ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard;
+ /**
+ * An "includes" path "foo" is implicitly a glob "foo/** /*" (without the space) if its last component has no extension,
+ * and does not contain any glob characters itself.
+ */
+ function isImplicitGlob(lastPathComponent) {
+ return !/[.*?]/.test(lastPathComponent);
+ }
+ ts.isImplicitGlob = isImplicitGlob;
+ function getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter) {
+ var subpattern = "";
+ var hasRecursiveDirectoryWildcard = false;
+ var hasWrittenComponent = false;
+ var components = getNormalizedPathComponents(spec, basePath);
+ var lastComponent = lastOrUndefined(components);
+ if (usage !== "exclude" && lastComponent === "**") {
+ return undefined;
+ }
+ // getNormalizedPathComponents includes the separator for the root component.
+ // We need to remove to create our regex correctly.
+ components[0] = removeTrailingDirectorySeparator(components[0]);
+ if (isImplicitGlob(lastComponent)) {
+ components.push("**", "*");
+ }
+ var optionalCount = 0;
+ for (var _i = 0, components_1 = components; _i < components_1.length; _i++) {
+ var component = components_1[_i];
+ if (component === "**") {
+ if (hasRecursiveDirectoryWildcard) {
+ return undefined;
+ }
+ subpattern += doubleAsteriskRegexFragment;
+ hasRecursiveDirectoryWildcard = true;
+ }
+ else {
+ if (usage === "directories") {
+ subpattern += "(";
+ optionalCount++;
+ }
+ if (hasWrittenComponent) {
+ subpattern += ts.directorySeparator;
+ }
+ if (usage !== "exclude") {
+ // The * and ? wildcards should not match directories or files that start with . if they
+ // appear first in a component. Dotted directories and files can be included explicitly
+ // like so: **/.*/.*
+ if (component.charCodeAt(0) === 42 /* asterisk */) {
+ subpattern += "([^./]" + singleAsteriskRegexFragment + ")?";
+ component = component.substr(1);
+ }
+ else if (component.charCodeAt(0) === 63 /* question */) {
+ subpattern += "[^./]";
+ component = component.substr(1);
+ }
+ }
+ subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter);
+ }
+ hasWrittenComponent = true;
+ }
+ while (optionalCount > 0) {
+ subpattern += ")?";
+ optionalCount--;
+ }
+ return subpattern;
+ }
function replaceWildCardCharacterFiles(match) {
return replaceWildcardCharacter(match, singleAsteriskRegexFragmentFiles);
}
@@ -2786,29 +2914,35 @@ var ts;
// We also need to check the relative paths by converting them to absolute and normalizing
// in case they escape the base path (e.g "..\somedirectory")
var absolute = isRootedDiskPath(include) ? include : normalizePath(combinePaths(path, include));
- var wildcardOffset = indexOfAnyCharCode(absolute, wildcardCharCodes);
- var includeBasePath = wildcardOffset < 0
- ? removeTrailingDirectorySeparator(getDirectoryPath(absolute))
- : absolute.substring(0, absolute.lastIndexOf(ts.directorySeparator, wildcardOffset));
// Append the literal and canonical candidate base paths.
- includeBasePaths.push(includeBasePath);
+ includeBasePaths.push(getIncludeBasePath(absolute));
}
// Sort the offsets array using either the literal or canonical path representations.
includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive);
+ var _loop_1 = function (includeBasePath) {
+ if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) {
+ basePaths.push(includeBasePath);
+ }
+ };
// Iterate over each include base path and include unique base paths that are not a
// subpath of an existing base path
- include: for (var i = 0; i < includeBasePaths.length; i++) {
- var includeBasePath = includeBasePaths[i];
- for (var j = 0; j < basePaths.length; j++) {
- if (containsPath(basePaths[j], includeBasePath, path, !useCaseSensitiveFileNames)) {
- continue include;
- }
- }
- basePaths.push(includeBasePath);
+ for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) {
+ var includeBasePath = includeBasePaths_1[_a];
+ _loop_1(includeBasePath);
}
}
return basePaths;
}
+ function getIncludeBasePath(absolute) {
+ var wildcardOffset = indexOfAnyCharCode(absolute, wildcardCharCodes);
+ if (wildcardOffset < 0) {
+ // No "*" or "?" in the path
+ return !hasExtension(absolute)
+ ? absolute
+ : removeTrailingDirectorySeparator(getDirectoryPath(absolute));
+ }
+ return absolute.substring(0, absolute.lastIndexOf(ts.directorySeparator, wildcardOffset));
+ }
function ensureScriptKind(fileName, scriptKind) {
// Using scriptKind as a condition handles both:
// - 'scriptKind' is unspecified and thus it is `undefined`
@@ -2873,14 +3007,14 @@ var ts;
* aligned to the offset of the highest priority extension in the
* allSupportedExtensions array.
*/
+ var ExtensionPriority;
(function (ExtensionPriority) {
ExtensionPriority[ExtensionPriority["TypeScriptFiles"] = 0] = "TypeScriptFiles";
ExtensionPriority[ExtensionPriority["DeclarationAndJavaScriptFiles"] = 2] = "DeclarationAndJavaScriptFiles";
ExtensionPriority[ExtensionPriority["Limit"] = 5] = "Limit";
ExtensionPriority[ExtensionPriority["Highest"] = 0] = "Highest";
ExtensionPriority[ExtensionPriority["Lowest"] = 2] = "Lowest";
- })(ts.ExtensionPriority || (ts.ExtensionPriority = {}));
- var ExtensionPriority = ts.ExtensionPriority;
+ })(ExtensionPriority = ts.ExtensionPriority || (ts.ExtensionPriority = {}));
function getExtensionPriority(path, supportedExtensions) {
for (var i = supportedExtensions.length - 1; i >= 0; i--) {
if (fileExtensionIs(path, supportedExtensions[i])) {
@@ -2939,10 +3073,6 @@ var ts;
return path.substring(0, path.length - extension.length);
}
ts.removeExtension = removeExtension;
- function isJsxOrTsxExtension(ext) {
- return ext === ".jsx" || ext === ".tsx";
- }
- ts.isJsxOrTsxExtension = isJsxOrTsxExtension;
function changeExtension(path, newExtension) {
return (removeFileExtension(path) + newExtension);
}
@@ -2977,13 +3107,13 @@ var ts;
getTypeConstructor: function () { return Type; },
getSignatureConstructor: function () { return Signature; }
};
+ var AssertionLevel;
(function (AssertionLevel) {
AssertionLevel[AssertionLevel["None"] = 0] = "None";
AssertionLevel[AssertionLevel["Normal"] = 1] = "Normal";
AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive";
AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive";
- })(ts.AssertionLevel || (ts.AssertionLevel = {}));
- var AssertionLevel = ts.AssertionLevel;
+ })(AssertionLevel = ts.AssertionLevel || (ts.AssertionLevel = {}));
var Debug;
(function (Debug) {
Debug.currentAssertionLevel = 0 /* None */;
@@ -3120,6 +3250,35 @@ var ts;
return !(pos >= 0);
}
ts.positionIsSynthesized = positionIsSynthesized;
+ /** True if an extension is one of the supported TypeScript extensions. */
+ function extensionIsTypeScript(ext) {
+ return ext <= ts.Extension.LastTypeScriptExtension;
+ }
+ ts.extensionIsTypeScript = extensionIsTypeScript;
+ /**
+ * Gets the extension from a path.
+ * Path must have a valid extension.
+ */
+ function extensionFromPath(path) {
+ if (fileExtensionIs(path, ".d.ts")) {
+ return ts.Extension.Dts;
+ }
+ if (fileExtensionIs(path, ".ts")) {
+ return ts.Extension.Ts;
+ }
+ if (fileExtensionIs(path, ".tsx")) {
+ return ts.Extension.Tsx;
+ }
+ if (fileExtensionIs(path, ".js")) {
+ return ts.Extension.Js;
+ }
+ if (fileExtensionIs(path, ".jsx")) {
+ return ts.Extension.Jsx;
+ }
+ Debug.fail("File " + path + " has unknown extension.");
+ return ts.Extension.Js;
+ }
+ ts.extensionFromPath = extensionFromPath;
})(ts || (ts = {}));
///
var ts;
@@ -3441,6 +3600,7 @@ var ts;
function getDirectories(path) {
return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1 /* Directory */); });
}
+ var noOpFileWatcher = { close: ts.noop };
var nodeSystem = {
args: process.argv.slice(2),
newLine: _os.EOL,
@@ -3450,7 +3610,7 @@ var ts;
},
readFile: readFile,
writeFile: writeFile,
- watchFile: function (fileName, callback) {
+ watchFile: function (fileName, callback, pollingInterval) {
if (useNonPollingWatchers) {
var watchedFile_1 = watchedFileSet.addFile(fileName, callback);
return {
@@ -3458,7 +3618,7 @@ var ts;
};
}
else {
- _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged);
+ _fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);
return {
close: function () { return _fs.unwatchFile(fileName, fileChanged); }
};
@@ -3475,7 +3635,7 @@ var ts;
// (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
var options;
if (!directoryExists(directoryName)) {
- return;
+ return noOpFileWatcher;
}
if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) {
options = { persistent: true, recursive: !!recursive };
@@ -3684,7 +3844,7 @@ var ts;
A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: ts.DiagnosticCategory.Error, key: "A_set_accessor_parameter_cannot_have_an_initializer_1052", message: "A 'set' accessor parameter cannot have an initializer." },
A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: ts.DiagnosticCategory.Error, key: "A_set_accessor_cannot_have_rest_parameter_1053", message: "A 'set' accessor cannot have rest parameter." },
A_get_accessor_cannot_have_parameters: { code: 1054, category: ts.DiagnosticCategory.Error, key: "A_get_accessor_cannot_have_parameters_1054", message: "A 'get' accessor cannot have parameters." },
- Type_0_is_not_a_valid_async_function_return_type: { code: 1055, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_valid_async_function_return_type_1055", message: "Type '{0}' is not a valid async function return type." },
+ Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: { code: 1055, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055", message: "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value." },
Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056", message: "Accessors are only available when targeting ECMAScript 5 and higher." },
An_async_function_or_method_must_have_a_valid_awaitable_return_type: { code: 1057, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057", message: "An async function or method must have a valid awaitable return type." },
Operand_for_await_does_not_have_a_valid_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "Operand_for_await_does_not_have_a_valid_callable_then_member_1058", message: "Operand for 'await' does not have a valid callable 'then' member." },
@@ -3911,14 +4071,14 @@ var ts;
Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." },
A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." },
An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." },
- The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer_2357", message: "The operand of an increment or decrement operator must be a variable, property or indexer." },
+ The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." },
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", message: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." },
The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", message: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." },
The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360", message: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." },
The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" },
The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362", message: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." },
The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", message: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." },
- Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_of_assignment_expression_2364", message: "Invalid left-hand side of assignment expression." },
+ The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: { code: 2364, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", message: "The left-hand side of an assignment expression must be a variable or a property access." },
Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: "Operator_0_cannot_be_applied_to_types_1_and_2_2365", message: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." },
Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", message: "Function lacks ending return statement and return type does not include 'undefined'." },
Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'" },
@@ -3958,7 +4118,7 @@ var ts;
Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: ts.DiagnosticCategory.Error, key: "Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403", message: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." },
The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", message: "The left-hand side of a 'for...in' statement cannot use a type annotation." },
The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405", message: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." },
- Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_in_for_in_statement_2406", message: "Invalid left-hand side in 'for...in' statement." },
+ The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: { code: 2406, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", message: "The left-hand side of a 'for...in' statement must be a variable or a property access." },
The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", message: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." },
Setters_cannot_return_a_value: { code: 2408, category: ts.DiagnosticCategory.Error, key: "Setters_cannot_return_a_value_2408", message: "Setters cannot return a value." },
Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class" },
@@ -3996,8 +4156,6 @@ var ts;
Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", message: "Property '{0}' is protected and only accessible through an instance of class '{1}'." },
The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", message: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." },
Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: "Block_scoped_variable_0_used_before_its_declaration_2448", message: "Block-scoped variable '{0}' used before its declaration." },
- The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property: { code: 2449, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property_2449", message: "The operand of an increment or decrement operator cannot be a constant or a read-only property." },
- Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property_2450", message: "Left-hand side of assignment expression cannot be a constant or a read-only property." },
Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_block_scoped_variable_0_2451", message: "Cannot redeclare block-scoped variable '{0}'." },
An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: "An_enum_member_cannot_have_a_numeric_name_2452", message: "An enum member cannot have a numeric name." },
The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", message: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." },
@@ -4009,7 +4167,7 @@ var ts;
Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_and_no_string_index_signature_2459", message: "Type '{0}' has no property '{1}' and no string index signature." },
Type_0_has_no_property_1: { code: 2460, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_2460", message: "Type '{0}' has no property '{1}'." },
Type_0_is_not_an_array_type: { code: 2461, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_2461", message: "Type '{0}' is not an array type." },
- A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_an_array_destructuring_pattern_2462", message: "A rest element must be last in an array destructuring pattern" },
+ A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", message: "A rest element must be last in a destructuring pattern" },
A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: ts.DiagnosticCategory.Error, key: "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463", message: "A binding pattern parameter cannot be optional in an implementation signature." },
A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464", message: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." },
this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_a_computed_property_name_2465", message: "'this' cannot be referenced in a computed property name." },
@@ -4031,9 +4189,7 @@ var ts;
Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", message: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." },
The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", message: "The left-hand side of a 'for...of' statement cannot use a type annotation." },
Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'" },
- The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property: { code: 2485, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property_2485", message: "The left-hand side of a 'for...of' statement cannot be a constant or a read-only property." },
- The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property: { code: 2486, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property_2486", message: "The left-hand side of a 'for...in' statement cannot be a constant or a read-only property." },
- Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_in_for_of_statement_2487", message: "Invalid left-hand side in 'for...of' statement." },
+ The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: { code: 2487, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", message: "The left-hand side of a 'for...of' statement must be a variable or a property access." },
Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", message: "Type must have a '[Symbol.iterator]()' method that returns an iterator." },
An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: "An_iterator_must_have_a_next_method_2489", message: "An iterator must have a 'next()' method." },
The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", message: "The type returned by the 'next()' method of an iterator must have a 'value' property." },
@@ -4080,6 +4236,13 @@ var ts;
Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." },
A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." },
Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." },
+ Type_0_is_not_constrained_to_keyof_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_constrained_to_keyof_1_2536", message: "Type '{0}' is not constrained to 'keyof {1}'." },
+ Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." },
+ Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." },
+ Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." },
+ Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." },
+ The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." },
+ Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." },
JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." },
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." },
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." },
@@ -4103,6 +4266,7 @@ var ts;
Cannot_find_name_0_Did_you_mean_the_static_member_1_0: { code: 2662, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662", message: "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?" },
Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: { code: 2663, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663", message: "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?" },
Invalid_module_name_in_augmentation_module_0_cannot_be_found: { code: 2664, category: ts.DiagnosticCategory.Error, key: "Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664", message: "Invalid module name in augmentation, module '{0}' cannot be found." },
+ Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented: { code: 2665, category: ts.DiagnosticCategory.Error, key: "Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augm_2665", message: "Invalid module name in augmentation. Module '{0}' resolves to an untyped module at '{1}', which cannot be augmented." },
Exports_and_export_assignments_are_not_permitted_in_module_augmentations: { code: 2666, category: ts.DiagnosticCategory.Error, key: "Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666", message: "Exports and export assignments are not permitted in module augmentations." },
Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: { code: 2667, category: ts.DiagnosticCategory.Error, key: "Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667", message: "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module." },
export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: { code: 2668, category: ts.DiagnosticCategory.Error, key: "export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668", message: "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible." },
@@ -4134,6 +4298,9 @@ var ts;
Namespace_0_has_no_exported_member_1: { code: 2694, category: ts.DiagnosticCategory.Error, key: "Namespace_0_has_no_exported_member_1_2694", message: "Namespace '{0}' has no exported member '{1}'." },
Left_side_of_comma_operator_is_unused_and_has_no_side_effects: { code: 2695, category: ts.DiagnosticCategory.Error, key: "Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695", message: "Left side of comma operator is unused and has no side effects." },
The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", message: "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" },
+ An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." },
+ Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." },
+ Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -4233,6 +4400,7 @@ var ts;
Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", message: "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'." },
File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5065, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065", message: "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'." },
Substitutions_for_pattern_0_shouldn_t_be_an_empty_array: { code: 5066, category: ts.DiagnosticCategory.Error, key: "Substitutions_for_pattern_0_shouldn_t_be_an_empty_array_5066", message: "Substitutions for pattern '{0}' shouldn't be an empty array." },
+ Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name: { code: 5067, category: ts.DiagnosticCategory.Error, key: "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067", message: "Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name." },
Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate_and_emit_output_to_single_file_6001", message: "Concatenate and emit output to single file." },
Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_d_ts_file_6002", message: "Generates corresponding '.d.ts' file." },
Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specify the location where debugger should locate map files instead of generated locations." },
@@ -4316,7 +4484,7 @@ var ts;
File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." },
Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." },
Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." },
- package_json_does_not_have_types_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_types_field_6100", message: "'package.json' does not have 'types' field." },
+ package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." },
package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." },
Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: "Allow_javascript_files_to_be_compiled_6102", message: "Allow javascript files to be compiled." },
Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: "Option_0_should_have_array_of_strings_as_a_value_6103", message: "Option '{0}' should have array of strings as a value." },
@@ -4353,11 +4521,16 @@ var ts;
Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_locals_6134", message: "Report errors on unused locals." },
Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_parameters_6135", message: "Report errors on unused parameters." },
The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files" },
- No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json' but 'allowJs' is set, so returning 'main' value of '{0}'" },
+ No_types_specified_in_package_json_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json', so returning 'main' value of '{0}'" },
Property_0_is_declared_but_never_used: { code: 6138, category: ts.DiagnosticCategory.Error, key: "Property_0_is_declared_but_never_used_6138", message: "Property '{0}' is declared but never used." },
Import_emit_helpers_from_tslib: { code: 6139, category: ts.DiagnosticCategory.Message, key: "Import_emit_helpers_from_tslib_6139", message: "Import emit helpers from 'tslib'." },
Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { code: 6140, category: ts.DiagnosticCategory.Error, key: "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", message: "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'." },
Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", message: "Parse in strict mode and emit \"use strict\" for each source file" },
+ Module_0_was_resolved_to_1_but_jsx_is_not_set: { code: 6142, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", message: "Module '{0}' was resolved to '{1}', but '--jsx' is not set." },
+ Module_0_was_resolved_to_1_but_allowJs_is_not_set: { code: 6143, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143", message: "Module '{0}' was resolved to '{1}', but '--allowJs' is not set." },
+ Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." },
+ Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." },
+ Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." },
@@ -4366,7 +4539,8 @@ var ts;
Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: ts.DiagnosticCategory.Error, key: "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", message: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." },
Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: ts.DiagnosticCategory.Error, key: "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", message: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." },
Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: { code: 7015, category: ts.DiagnosticCategory.Error, key: "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", message: "Element implicitly has an 'any' type because index expression is not of type 'number'." },
- Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: ts.DiagnosticCategory.Error, key: "Index_signature_of_object_type_implicitly_has_an_any_type_7017", message: "Index signature of object type implicitly has an 'any' type." },
+ Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type: { code: 7016, category: ts.DiagnosticCategory.Error, key: "Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type_7016", message: "Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type." },
+ Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature: { code: 7017, category: ts.DiagnosticCategory.Error, key: "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017", message: "Element implicitly has an 'any' type because type '{0}' has no index signature." },
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object_literal_s_property_0_implicitly_has_an_1_type_7018", message: "Object literal's property '{0}' implicitly has an '{1}' type." },
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest_parameter_0_implicitly_has_an_any_type_7019", message: "Rest parameter '{0}' implicitly has an 'any[]' type." },
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020", message: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
@@ -4423,6 +4597,7 @@ var ts;
Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" },
Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" },
Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" },
+ Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
};
})(ts || (ts = {}));
///
@@ -4458,7 +4633,7 @@ var ts;
"false": 85 /* FalseKeyword */,
"finally": 86 /* FinallyKeyword */,
"for": 87 /* ForKeyword */,
- "from": 137 /* FromKeyword */,
+ "from": 138 /* FromKeyword */,
"function": 88 /* FunctionKeyword */,
"get": 124 /* GetKeyword */,
"if": 89 /* IfKeyword */,
@@ -4468,34 +4643,35 @@ var ts;
"instanceof": 92 /* InstanceOfKeyword */,
"interface": 108 /* InterfaceKeyword */,
"is": 125 /* IsKeyword */,
+ "keyof": 126 /* KeyOfKeyword */,
"let": 109 /* LetKeyword */,
- "module": 126 /* ModuleKeyword */,
- "namespace": 127 /* NamespaceKeyword */,
- "never": 128 /* NeverKeyword */,
+ "module": 127 /* ModuleKeyword */,
+ "namespace": 128 /* NamespaceKeyword */,
+ "never": 129 /* NeverKeyword */,
"new": 93 /* NewKeyword */,
"null": 94 /* NullKeyword */,
- "number": 131 /* NumberKeyword */,
+ "number": 132 /* NumberKeyword */,
"package": 110 /* PackageKeyword */,
"private": 111 /* PrivateKeyword */,
"protected": 112 /* ProtectedKeyword */,
"public": 113 /* PublicKeyword */,
- "readonly": 129 /* ReadonlyKeyword */,
- "require": 130 /* RequireKeyword */,
- "global": 138 /* GlobalKeyword */,
+ "readonly": 130 /* ReadonlyKeyword */,
+ "require": 131 /* RequireKeyword */,
+ "global": 139 /* GlobalKeyword */,
"return": 95 /* ReturnKeyword */,
- "set": 132 /* SetKeyword */,
+ "set": 133 /* SetKeyword */,
"static": 114 /* StaticKeyword */,
- "string": 133 /* StringKeyword */,
+ "string": 134 /* StringKeyword */,
"super": 96 /* SuperKeyword */,
"switch": 97 /* SwitchKeyword */,
- "symbol": 134 /* SymbolKeyword */,
+ "symbol": 135 /* SymbolKeyword */,
"this": 98 /* ThisKeyword */,
"throw": 99 /* ThrowKeyword */,
"true": 100 /* TrueKeyword */,
"try": 101 /* TryKeyword */,
- "type": 135 /* TypeKeyword */,
+ "type": 136 /* TypeKeyword */,
"typeof": 102 /* TypeOfKeyword */,
- "undefined": 136 /* UndefinedKeyword */,
+ "undefined": 137 /* UndefinedKeyword */,
"var": 103 /* VarKeyword */,
"void": 104 /* VoidKeyword */,
"while": 105 /* WhileKeyword */,
@@ -4503,7 +4679,7 @@ var ts;
"yield": 115 /* YieldKeyword */,
"async": 119 /* AsyncKeyword */,
"await": 120 /* AwaitKeyword */,
- "of": 139 /* OfKeyword */,
+ "of": 140 /* OfKeyword */,
"{": 16 /* OpenBraceToken */,
"}": 17 /* CloseBraceToken */,
"(": 18 /* OpenParenToken */,
@@ -6057,9 +6233,9 @@ var ts;
pos++;
return token = 22 /* DotToken */;
}
- if (isIdentifierStart(ch, 4 /* Latest */)) {
+ if (isIdentifierStart(ch, 5 /* Latest */)) {
pos++;
- while (isIdentifierPart(text.charCodeAt(pos), 4 /* Latest */) && pos < end) {
+ while (isIdentifierPart(text.charCodeAt(pos), 5 /* Latest */) && pos < end) {
pos++;
}
return token = 70 /* Identifier */;
@@ -6227,7 +6403,9 @@ var ts;
ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;
/* @internal */
function moduleResolutionIsEqualTo(oldResolution, newResolution) {
- return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport;
+ return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport &&
+ oldResolution.extension === newResolution.extension &&
+ oldResolution.resolvedFileName === newResolution.resolvedFileName;
}
ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo;
/* @internal */
@@ -6256,28 +6434,28 @@ var ts;
// Returns true if this node contains a parse error anywhere underneath it.
function containsParseError(node) {
aggregateChildData(node);
- return (node.flags & 2097152 /* ThisNodeOrAnySubNodesHasError */) !== 0;
+ return (node.flags & 4194304 /* ThisNodeOrAnySubNodesHasError */) !== 0;
}
ts.containsParseError = containsParseError;
function aggregateChildData(node) {
- if (!(node.flags & 4194304 /* HasAggregatedChildData */)) {
+ if (!(node.flags & 8388608 /* HasAggregatedChildData */)) {
// A node is considered to contain a parse error if:
// a) the parser explicitly marked that it had an error
// b) any of it's children reported that it had an error.
- var thisNodeOrAnySubNodesHasError = ((node.flags & 524288 /* ThisNodeHasError */) !== 0) ||
+ var thisNodeOrAnySubNodesHasError = ((node.flags & 1048576 /* ThisNodeHasError */) !== 0) ||
ts.forEachChild(node, containsParseError);
// If so, mark ourselves accordingly.
if (thisNodeOrAnySubNodesHasError) {
- node.flags |= 2097152 /* ThisNodeOrAnySubNodesHasError */;
+ node.flags |= 4194304 /* ThisNodeOrAnySubNodesHasError */;
}
// Also mark that we've propagated the child information to this node. This way we can
// always consult the bit directly on this node without needing to check its children
// again.
- node.flags |= 4194304 /* HasAggregatedChildData */;
+ node.flags |= 8388608 /* HasAggregatedChildData */;
}
}
function getSourceFileOfNode(node) {
- while (node && node.kind !== 256 /* SourceFile */) {
+ while (node && node.kind !== 260 /* SourceFile */) {
node = node.parent;
}
return node;
@@ -6285,11 +6463,11 @@ var ts;
ts.getSourceFileOfNode = getSourceFileOfNode;
function isStatementWithLocals(node) {
switch (node.kind) {
- case 200 /* Block */:
- case 228 /* CaseBlock */:
- case 207 /* ForStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
+ case 203 /* Block */:
+ case 231 /* CaseBlock */:
+ case 210 /* ForStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
return true;
}
return false;
@@ -6380,18 +6558,18 @@ var ts;
// the syntax list itself considers them as normal trivia. Therefore if we simply skip
// trivia for the list, we may have skipped the JSDocComment as well. So we should process its
// first child to determine the actual position of its first token.
- if (node.kind === 286 /* SyntaxList */ && node._children.length > 0) {
+ if (node.kind === 290 /* SyntaxList */ && node._children.length > 0) {
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDocComment);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
}
ts.getTokenPosOfNode = getTokenPosOfNode;
function isJSDocNode(node) {
- return node.kind >= 257 /* FirstJSDocNode */ && node.kind <= 282 /* LastJSDocNode */;
+ return node.kind >= 261 /* FirstJSDocNode */ && node.kind <= 286 /* LastJSDocNode */;
}
ts.isJSDocNode = isJSDocNode;
function isJSDocTag(node) {
- return node.kind >= 273 /* FirstJSDocTagNode */ && node.kind <= 285 /* LastJSDocTagNode */;
+ return node.kind >= 277 /* FirstJSDocTagNode */ && node.kind <= 289 /* LastJSDocTagNode */;
}
ts.isJSDocTag = isJSDocTag;
function getNonDecoratorTokenPosOfNode(node, sourceFile) {
@@ -6495,25 +6673,26 @@ var ts;
ts.isBlockOrCatchScoped = isBlockOrCatchScoped;
function isCatchClauseVariableDeclarationOrBindingElement(declaration) {
var node = getRootDeclaration(declaration);
- return node.kind === 219 /* VariableDeclaration */ && node.parent.kind === 252 /* CatchClause */;
+ return node.kind === 222 /* VariableDeclaration */ && node.parent.kind === 255 /* CatchClause */;
}
ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement;
function isAmbientModule(node) {
- return node && node.kind === 226 /* ModuleDeclaration */ &&
+ return node && node.kind === 229 /* ModuleDeclaration */ &&
(node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node));
}
ts.isAmbientModule = isAmbientModule;
+ /** Given a symbol for a module, checks that it is either an untyped import or a shorthand ambient module. */
function isShorthandAmbientModuleSymbol(moduleSymbol) {
return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
}
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
function isShorthandAmbientModule(node) {
// The only kind of module that can be missing a body is a shorthand ambient module.
- return node.kind === 226 /* ModuleDeclaration */ && (!node.body);
+ return node.kind === 229 /* ModuleDeclaration */ && (!node.body);
}
function isBlockScopedContainerTopLevel(node) {
- return node.kind === 256 /* SourceFile */ ||
- node.kind === 226 /* ModuleDeclaration */ ||
+ return node.kind === 260 /* SourceFile */ ||
+ node.kind === 229 /* ModuleDeclaration */ ||
isFunctionLike(node);
}
ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel;
@@ -6529,9 +6708,9 @@ var ts;
return false;
}
switch (node.parent.kind) {
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
return ts.isExternalModule(node.parent);
- case 227 /* ModuleBlock */:
+ case 230 /* ModuleBlock */:
return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent);
}
return false;
@@ -6539,22 +6718,22 @@ var ts;
ts.isExternalModuleAugmentation = isExternalModuleAugmentation;
function isBlockScope(node, parentNode) {
switch (node.kind) {
- case 256 /* SourceFile */:
- case 228 /* CaseBlock */:
- case 252 /* CatchClause */:
- case 226 /* ModuleDeclaration */:
- case 207 /* ForStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
- case 149 /* Constructor */:
- case 148 /* MethodDeclaration */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
+ case 260 /* SourceFile */:
+ case 231 /* CaseBlock */:
+ case 255 /* CatchClause */:
+ case 229 /* ModuleDeclaration */:
+ case 210 /* ForStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
+ case 150 /* Constructor */:
+ case 149 /* MethodDeclaration */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
return true;
- case 200 /* Block */:
+ case 203 /* Block */:
// function block is not considered block-scope container
// see comment in binder.ts: bind(...), case for SyntaxKind.Block
return parentNode && !isFunctionLike(parentNode);
@@ -6581,12 +6760,42 @@ var ts;
return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name);
}
ts.declarationNameToString = declarationNameToString;
+ function getTextOfPropertyName(name) {
+ switch (name.kind) {
+ case 70 /* Identifier */:
+ return name.text;
+ case 9 /* StringLiteral */:
+ case 8 /* NumericLiteral */:
+ return name.text;
+ case 142 /* ComputedPropertyName */:
+ if (isStringOrNumericLiteral(name.expression.kind)) {
+ return name.expression.text;
+ }
+ }
+ return undefined;
+ }
+ ts.getTextOfPropertyName = getTextOfPropertyName;
+ function entityNameToString(name) {
+ switch (name.kind) {
+ case 70 /* Identifier */:
+ return getFullWidth(name) === 0 ? unescapeIdentifier(name.text) : getTextOfNode(name);
+ case 141 /* QualifiedName */:
+ return entityNameToString(name.left) + "." + entityNameToString(name.right);
+ case 176 /* PropertyAccessExpression */:
+ return entityNameToString(name.expression) + "." + entityNameToString(name.name);
+ }
+ }
+ ts.entityNameToString = entityNameToString;
function createDiagnosticForNode(node, message, arg0, arg1, arg2) {
var sourceFile = getSourceFileOfNode(node);
+ return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2);
+ }
+ ts.createDiagnosticForNode = createDiagnosticForNode;
+ function createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2) {
var span = getErrorSpanForNode(sourceFile, node);
return ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2);
}
- ts.createDiagnosticForNode = createDiagnosticForNode;
+ ts.createDiagnosticForNodeInSourceFile = createDiagnosticForNodeInSourceFile;
function createDiagnosticForNodeFromMessageChain(node, messageChain) {
var sourceFile = getSourceFileOfNode(node);
var span = getErrorSpanForNode(sourceFile, node);
@@ -6609,7 +6818,7 @@ var ts;
ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition;
function getErrorSpanForArrowFunction(sourceFile, node) {
var pos = ts.skipTrivia(sourceFile.text, node.pos);
- if (node.body && node.body.kind === 200 /* Block */) {
+ if (node.body && node.body.kind === 203 /* Block */) {
var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line;
var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line;
if (startLine < endLine) {
@@ -6623,7 +6832,7 @@ var ts;
function getErrorSpanForNode(sourceFile, node) {
var errorNode = node;
switch (node.kind) {
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false);
if (pos_1 === sourceFile.text.length) {
// file is empty - return span for the beginning of the file
@@ -6632,23 +6841,23 @@ var ts;
return getSpanOfTokenAtPosition(sourceFile, pos_1);
// This list is a work in progress. Add missing node kinds to improve their error
// spans.
- case 219 /* VariableDeclaration */:
- case 170 /* BindingElement */:
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 223 /* InterfaceDeclaration */:
- case 226 /* ModuleDeclaration */:
- case 225 /* EnumDeclaration */:
- case 255 /* EnumMember */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 148 /* MethodDeclaration */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 224 /* TypeAliasDeclaration */:
+ case 222 /* VariableDeclaration */:
+ case 173 /* BindingElement */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 226 /* InterfaceDeclaration */:
+ case 229 /* ModuleDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 259 /* EnumMember */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 149 /* MethodDeclaration */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 227 /* TypeAliasDeclaration */:
errorNode = node.name;
break;
- case 181 /* ArrowFunction */:
+ case 184 /* ArrowFunction */:
return getErrorSpanForArrowFunction(sourceFile, node);
}
if (errorNode === undefined) {
@@ -6671,7 +6880,7 @@ var ts;
}
ts.isDeclarationFile = isDeclarationFile;
function isConstEnumDeclaration(node) {
- return node.kind === 225 /* EnumDeclaration */ && isConst(node);
+ return node.kind === 228 /* EnumDeclaration */ && isConst(node);
}
ts.isConstEnumDeclaration = isConstEnumDeclaration;
function isConst(node) {
@@ -6684,11 +6893,11 @@ var ts;
}
ts.isLet = isLet;
function isSuperCall(n) {
- return n.kind === 175 /* CallExpression */ && n.expression.kind === 96 /* SuperKeyword */;
+ return n.kind === 178 /* CallExpression */ && n.expression.kind === 96 /* SuperKeyword */;
}
ts.isSuperCall = isSuperCall;
function isPrologueDirective(node) {
- return node.kind === 203 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */;
+ return node.kind === 206 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */;
}
ts.isPrologueDirective = isPrologueDirective;
function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {
@@ -6704,10 +6913,10 @@ var ts;
}
ts.getJsDocComments = getJsDocComments;
function getJsDocCommentsFromText(node, text) {
- var commentRanges = (node.kind === 143 /* Parameter */ ||
- node.kind === 142 /* TypeParameter */ ||
- node.kind === 180 /* FunctionExpression */ ||
- node.kind === 181 /* ArrowFunction */) ?
+ var commentRanges = (node.kind === 144 /* Parameter */ ||
+ node.kind === 143 /* TypeParameter */ ||
+ node.kind === 183 /* FunctionExpression */ ||
+ node.kind === 184 /* ArrowFunction */) ?
ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
getLeadingCommentRangesOfNodeFromText(node, text);
return ts.filter(commentRanges, isJsDocComment);
@@ -6723,39 +6932,39 @@ var ts;
ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/;
ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/;
function isPartOfTypeNode(node) {
- if (155 /* FirstTypeNode */ <= node.kind && node.kind <= 167 /* LastTypeNode */) {
+ if (156 /* FirstTypeNode */ <= node.kind && node.kind <= 170 /* LastTypeNode */) {
return true;
}
switch (node.kind) {
case 118 /* AnyKeyword */:
- case 131 /* NumberKeyword */:
- case 133 /* StringKeyword */:
+ case 132 /* NumberKeyword */:
+ case 134 /* StringKeyword */:
case 121 /* BooleanKeyword */:
- case 134 /* SymbolKeyword */:
- case 136 /* UndefinedKeyword */:
- case 128 /* NeverKeyword */:
+ case 135 /* SymbolKeyword */:
+ case 137 /* UndefinedKeyword */:
+ case 129 /* NeverKeyword */:
return true;
case 104 /* VoidKeyword */:
- return node.parent.kind !== 184 /* VoidExpression */;
- case 195 /* ExpressionWithTypeArguments */:
+ return node.parent.kind !== 187 /* VoidExpression */;
+ case 198 /* ExpressionWithTypeArguments */:
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
// Identifiers and qualified names may be type nodes, depending on their context. Climb
// above them to find the lowest container
case 70 /* Identifier */:
// If the identifier is the RHS of a qualified name, then it's a type iff its parent is.
- if (node.parent.kind === 140 /* QualifiedName */ && node.parent.right === node) {
+ if (node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node) {
node = node.parent;
}
- else if (node.parent.kind === 173 /* PropertyAccessExpression */ && node.parent.name === node) {
+ else if (node.parent.kind === 176 /* PropertyAccessExpression */ && node.parent.name === node) {
node = node.parent;
}
// At this point, node is either a qualified name or an identifier
- ts.Debug.assert(node.kind === 70 /* Identifier */ || node.kind === 140 /* QualifiedName */ || node.kind === 173 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
- case 140 /* QualifiedName */:
- case 173 /* PropertyAccessExpression */:
+ ts.Debug.assert(node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */ || node.kind === 176 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
+ case 141 /* QualifiedName */:
+ case 176 /* PropertyAccessExpression */:
case 98 /* ThisKeyword */:
var parent_1 = node.parent;
- if (parent_1.kind === 159 /* TypeQuery */) {
+ if (parent_1.kind === 160 /* TypeQuery */) {
return false;
}
// Do not recursively call isPartOfTypeNode on the parent. In the example:
@@ -6764,38 +6973,38 @@ var ts;
//
// Calling isPartOfTypeNode would consider the qualified name A.B a type node. Only C or
// A.B.C is a type node.
- if (155 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 167 /* LastTypeNode */) {
+ if (156 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 170 /* LastTypeNode */) {
return true;
}
switch (parent_1.kind) {
- case 195 /* ExpressionWithTypeArguments */:
+ case 198 /* ExpressionWithTypeArguments */:
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1);
- case 142 /* TypeParameter */:
+ case 143 /* TypeParameter */:
return node === parent_1.constraint;
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 143 /* Parameter */:
- case 219 /* VariableDeclaration */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 144 /* Parameter */:
+ case 222 /* VariableDeclaration */:
return node === parent_1.type;
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
- case 149 /* Constructor */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 150 /* Constructor */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
return node === parent_1.type;
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 154 /* IndexSignature */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 155 /* IndexSignature */:
return node === parent_1.type;
- case 178 /* TypeAssertionExpression */:
+ case 181 /* TypeAssertionExpression */:
return node === parent_1.type;
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0;
- case 177 /* TaggedTemplateExpression */:
+ case 180 /* TaggedTemplateExpression */:
// TODO (drosen): TaggedTemplateExpressions may eventually support type arguments.
return false;
}
@@ -6809,23 +7018,23 @@ var ts;
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 212 /* ReturnStatement */:
+ case 215 /* ReturnStatement */:
return visitor(node);
- case 228 /* CaseBlock */:
- case 200 /* Block */:
- case 204 /* IfStatement */:
- case 205 /* DoStatement */:
- case 206 /* WhileStatement */:
- case 207 /* ForStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
- case 213 /* WithStatement */:
- case 214 /* SwitchStatement */:
- case 249 /* CaseClause */:
- case 250 /* DefaultClause */:
- case 215 /* LabeledStatement */:
- case 217 /* TryStatement */:
- case 252 /* CatchClause */:
+ case 231 /* CaseBlock */:
+ case 203 /* Block */:
+ case 207 /* IfStatement */:
+ case 208 /* DoStatement */:
+ case 209 /* WhileStatement */:
+ case 210 /* ForStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
+ case 216 /* WithStatement */:
+ case 217 /* SwitchStatement */:
+ case 252 /* CaseClause */:
+ case 253 /* DefaultClause */:
+ case 218 /* LabeledStatement */:
+ case 220 /* TryStatement */:
+ case 255 /* CatchClause */:
return ts.forEachChild(node, traverse);
}
}
@@ -6835,18 +7044,18 @@ var ts;
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 191 /* YieldExpression */:
+ case 194 /* YieldExpression */:
visitor(node);
var operand = node.expression;
if (operand) {
traverse(operand);
}
- case 225 /* EnumDeclaration */:
- case 223 /* InterfaceDeclaration */:
- case 226 /* ModuleDeclaration */:
- case 224 /* TypeAliasDeclaration */:
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
+ case 228 /* EnumDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 229 /* ModuleDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
// These are not allowed inside a generator now, but eventually they may be allowed
// as local types. Regardless, any yield statements contained within them should be
// skipped in this traversal.
@@ -6854,7 +7063,7 @@ var ts;
default:
if (isFunctionLike(node)) {
var name_5 = node.name;
- if (name_5 && name_5.kind === 141 /* ComputedPropertyName */) {
+ if (name_5 && name_5.kind === 142 /* ComputedPropertyName */) {
// Note that we will not include methods/accessors of a class because they would require
// first descending into the class. This is by design.
traverse(name_5.expression);
@@ -6873,14 +7082,14 @@ var ts;
function isVariableLike(node) {
if (node) {
switch (node.kind) {
- case 170 /* BindingElement */:
- case 255 /* EnumMember */:
- case 143 /* Parameter */:
- case 253 /* PropertyAssignment */:
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 254 /* ShorthandPropertyAssignment */:
- case 219 /* VariableDeclaration */:
+ case 173 /* BindingElement */:
+ case 259 /* EnumMember */:
+ case 144 /* Parameter */:
+ case 256 /* PropertyAssignment */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 257 /* ShorthandPropertyAssignment */:
+ case 222 /* VariableDeclaration */:
return true;
}
}
@@ -6888,11 +7097,11 @@ var ts;
}
ts.isVariableLike = isVariableLike;
function isAccessor(node) {
- return node && (node.kind === 150 /* GetAccessor */ || node.kind === 151 /* SetAccessor */);
+ return node && (node.kind === 151 /* GetAccessor */ || node.kind === 152 /* SetAccessor */);
}
ts.isAccessor = isAccessor;
function isClassLike(node) {
- return node && (node.kind === 222 /* ClassDeclaration */ || node.kind === 193 /* ClassExpression */);
+ return node && (node.kind === 225 /* ClassDeclaration */ || node.kind === 196 /* ClassExpression */);
}
ts.isClassLike = isClassLike;
function isFunctionLike(node) {
@@ -6901,19 +7110,19 @@ var ts;
ts.isFunctionLike = isFunctionLike;
function isFunctionLikeKind(kind) {
switch (kind) {
- case 149 /* Constructor */:
- case 180 /* FunctionExpression */:
- case 221 /* FunctionDeclaration */:
- case 181 /* ArrowFunction */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 154 /* IndexSignature */:
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
+ case 150 /* Constructor */:
+ case 183 /* FunctionExpression */:
+ case 224 /* FunctionDeclaration */:
+ case 184 /* ArrowFunction */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 155 /* IndexSignature */:
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
return true;
}
return false;
@@ -6921,13 +7130,13 @@ var ts;
ts.isFunctionLikeKind = isFunctionLikeKind;
function introducesArgumentsExoticObject(node) {
switch (node.kind) {
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 149 /* Constructor */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 150 /* Constructor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
return true;
}
return false;
@@ -6935,30 +7144,30 @@ var ts;
ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject;
function isIterationStatement(node, lookInLabeledStatements) {
switch (node.kind) {
- case 207 /* ForStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
- case 205 /* DoStatement */:
- case 206 /* WhileStatement */:
+ case 210 /* ForStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
+ case 208 /* DoStatement */:
+ case 209 /* WhileStatement */:
return true;
- case 215 /* LabeledStatement */:
+ case 218 /* LabeledStatement */:
return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements);
}
return false;
}
ts.isIterationStatement = isIterationStatement;
function isFunctionBlock(node) {
- return node && node.kind === 200 /* Block */ && isFunctionLike(node.parent);
+ return node && node.kind === 203 /* Block */ && isFunctionLike(node.parent);
}
ts.isFunctionBlock = isFunctionBlock;
function isObjectLiteralMethod(node) {
- return node && node.kind === 148 /* MethodDeclaration */ && node.parent.kind === 172 /* ObjectLiteralExpression */;
+ return node && node.kind === 149 /* MethodDeclaration */ && node.parent.kind === 175 /* ObjectLiteralExpression */;
}
ts.isObjectLiteralMethod = isObjectLiteralMethod;
function isObjectLiteralOrClassExpressionMethod(node) {
- return node.kind === 148 /* MethodDeclaration */ &&
- (node.parent.kind === 172 /* ObjectLiteralExpression */ ||
- node.parent.kind === 193 /* ClassExpression */);
+ return node.kind === 149 /* MethodDeclaration */ &&
+ (node.parent.kind === 175 /* ObjectLiteralExpression */ ||
+ node.parent.kind === 196 /* ClassExpression */);
}
ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod;
function isIdentifierTypePredicate(predicate) {
@@ -6994,7 +7203,7 @@ var ts;
return undefined;
}
switch (node.kind) {
- case 141 /* ComputedPropertyName */:
+ case 142 /* ComputedPropertyName */:
// If the grandparent node is an object literal (as opposed to a class),
// then the computed property is not a 'this' container.
// A computed property name in a class needs to be a this container
@@ -7009,9 +7218,9 @@ var ts;
// the *body* of the container.
node = node.parent;
break;
- case 144 /* Decorator */:
+ case 145 /* Decorator */:
// Decorators are always applied outside of the body of a class or method.
- if (node.parent.kind === 143 /* Parameter */ && isClassElement(node.parent.parent)) {
+ if (node.parent.kind === 144 /* Parameter */ && isClassElement(node.parent.parent)) {
// If the decorator's parent is a Parameter, we resolve the this container from
// the grandparent class declaration.
node = node.parent.parent;
@@ -7022,26 +7231,26 @@ var ts;
node = node.parent;
}
break;
- case 181 /* ArrowFunction */:
+ case 184 /* ArrowFunction */:
if (!includeArrowFunctions) {
continue;
}
// Fall through
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 226 /* ModuleDeclaration */:
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 149 /* Constructor */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 154 /* IndexSignature */:
- case 225 /* EnumDeclaration */:
- case 256 /* SourceFile */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 229 /* ModuleDeclaration */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 150 /* Constructor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 155 /* IndexSignature */:
+ case 228 /* EnumDeclaration */:
+ case 260 /* SourceFile */:
return node;
}
}
@@ -7062,26 +7271,26 @@ var ts;
return node;
}
switch (node.kind) {
- case 141 /* ComputedPropertyName */:
+ case 142 /* ComputedPropertyName */:
node = node.parent;
break;
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
if (!stopOnFunctions) {
continue;
}
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 149 /* Constructor */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 150 /* Constructor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
return node;
- case 144 /* Decorator */:
+ case 145 /* Decorator */:
// Decorators are always applied outside of the body of a class or method.
- if (node.parent.kind === 143 /* Parameter */ && isClassElement(node.parent.parent)) {
+ if (node.parent.kind === 144 /* Parameter */ && isClassElement(node.parent.parent)) {
// If the decorator's parent is a Parameter, we resolve the this container from
// the grandparent class declaration.
node = node.parent.parent;
@@ -7097,14 +7306,14 @@ var ts;
}
ts.getSuperContainer = getSuperContainer;
function getImmediatelyInvokedFunctionExpression(func) {
- if (func.kind === 180 /* FunctionExpression */ || func.kind === 181 /* ArrowFunction */) {
+ if (func.kind === 183 /* FunctionExpression */ || func.kind === 184 /* ArrowFunction */) {
var prev = func;
var parent_2 = func.parent;
- while (parent_2.kind === 179 /* ParenthesizedExpression */) {
+ while (parent_2.kind === 182 /* ParenthesizedExpression */) {
prev = parent_2;
parent_2 = parent_2.parent;
}
- if (parent_2.kind === 175 /* CallExpression */ && parent_2.expression === prev) {
+ if (parent_2.kind === 178 /* CallExpression */ && parent_2.expression === prev) {
return parent_2;
}
}
@@ -7115,32 +7324,32 @@ var ts;
*/
function isSuperProperty(node) {
var kind = node.kind;
- return (kind === 173 /* PropertyAccessExpression */ || kind === 174 /* ElementAccessExpression */)
+ return (kind === 176 /* PropertyAccessExpression */ || kind === 177 /* ElementAccessExpression */)
&& node.expression.kind === 96 /* SuperKeyword */;
}
ts.isSuperProperty = isSuperProperty;
function getEntityNameFromTypeNode(node) {
- if (node) {
- switch (node.kind) {
- case 156 /* TypeReference */:
- return node.typeName;
- case 195 /* ExpressionWithTypeArguments */:
- ts.Debug.assert(isEntityNameExpression(node.expression));
- return node.expression;
- case 70 /* Identifier */:
- case 140 /* QualifiedName */:
- return node;
- }
+ switch (node.kind) {
+ case 157 /* TypeReference */:
+ case 271 /* JSDocTypeReference */:
+ return node.typeName;
+ case 198 /* ExpressionWithTypeArguments */:
+ return isEntityNameExpression(node.expression)
+ ? node.expression
+ : undefined;
+ case 70 /* Identifier */:
+ case 141 /* QualifiedName */:
+ return node;
}
return undefined;
}
ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode;
function isCallLikeExpression(node) {
switch (node.kind) {
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
- case 177 /* TaggedTemplateExpression */:
- case 144 /* Decorator */:
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
+ case 180 /* TaggedTemplateExpression */:
+ case 145 /* Decorator */:
return true;
default:
return false;
@@ -7148,7 +7357,7 @@ var ts;
}
ts.isCallLikeExpression = isCallLikeExpression;
function getInvokedExpression(node) {
- if (node.kind === 177 /* TaggedTemplateExpression */) {
+ if (node.kind === 180 /* TaggedTemplateExpression */) {
return node.tag;
}
// Will either be a CallExpression, NewExpression, or Decorator.
@@ -7157,25 +7366,25 @@ var ts;
ts.getInvokedExpression = getInvokedExpression;
function nodeCanBeDecorated(node) {
switch (node.kind) {
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
// classes are valid targets
return true;
- case 146 /* PropertyDeclaration */:
+ case 147 /* PropertyDeclaration */:
// property declarations are valid if their parent is a class declaration.
- return node.parent.kind === 222 /* ClassDeclaration */;
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 148 /* MethodDeclaration */:
+ return node.parent.kind === 225 /* ClassDeclaration */;
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 149 /* MethodDeclaration */:
// if this method has a body and its parent is a class declaration, this is a valid target.
return node.body !== undefined
- && node.parent.kind === 222 /* ClassDeclaration */;
- case 143 /* Parameter */:
+ && node.parent.kind === 225 /* ClassDeclaration */;
+ case 144 /* Parameter */:
// if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;
return node.parent.body !== undefined
- && (node.parent.kind === 149 /* Constructor */
- || node.parent.kind === 148 /* MethodDeclaration */
- || node.parent.kind === 151 /* SetAccessor */)
- && node.parent.parent.kind === 222 /* ClassDeclaration */;
+ && (node.parent.kind === 150 /* Constructor */
+ || node.parent.kind === 149 /* MethodDeclaration */
+ || node.parent.kind === 152 /* SetAccessor */)
+ && node.parent.parent.kind === 225 /* ClassDeclaration */;
}
return false;
}
@@ -7191,19 +7400,19 @@ var ts;
ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated;
function childIsDecorated(node) {
switch (node.kind) {
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
return ts.forEach(node.members, nodeOrChildIsDecorated);
- case 148 /* MethodDeclaration */:
- case 151 /* SetAccessor */:
+ case 149 /* MethodDeclaration */:
+ case 152 /* SetAccessor */:
return ts.forEach(node.parameters, nodeIsDecorated);
}
}
ts.childIsDecorated = childIsDecorated;
function isJSXTagName(node) {
var parent = node.parent;
- if (parent.kind === 244 /* JsxOpeningElement */ ||
- parent.kind === 243 /* JsxSelfClosingElement */ ||
- parent.kind === 245 /* JsxClosingElement */) {
+ if (parent.kind === 247 /* JsxOpeningElement */ ||
+ parent.kind === 246 /* JsxSelfClosingElement */ ||
+ parent.kind === 248 /* JsxClosingElement */) {
return parent.tagName === node;
}
return false;
@@ -7217,43 +7426,43 @@ var ts;
case 100 /* TrueKeyword */:
case 85 /* FalseKeyword */:
case 11 /* RegularExpressionLiteral */:
- case 171 /* ArrayLiteralExpression */:
- case 172 /* ObjectLiteralExpression */:
- case 173 /* PropertyAccessExpression */:
- case 174 /* ElementAccessExpression */:
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
- case 177 /* TaggedTemplateExpression */:
- case 196 /* AsExpression */:
- case 178 /* TypeAssertionExpression */:
- case 197 /* NonNullExpression */:
- case 179 /* ParenthesizedExpression */:
- case 180 /* FunctionExpression */:
- case 193 /* ClassExpression */:
- case 181 /* ArrowFunction */:
- case 184 /* VoidExpression */:
- case 182 /* DeleteExpression */:
- case 183 /* TypeOfExpression */:
- case 186 /* PrefixUnaryExpression */:
- case 187 /* PostfixUnaryExpression */:
- case 188 /* BinaryExpression */:
- case 189 /* ConditionalExpression */:
- case 192 /* SpreadElementExpression */:
- case 190 /* TemplateExpression */:
+ case 174 /* ArrayLiteralExpression */:
+ case 175 /* ObjectLiteralExpression */:
+ case 176 /* PropertyAccessExpression */:
+ case 177 /* ElementAccessExpression */:
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
+ case 180 /* TaggedTemplateExpression */:
+ case 199 /* AsExpression */:
+ case 181 /* TypeAssertionExpression */:
+ case 200 /* NonNullExpression */:
+ case 182 /* ParenthesizedExpression */:
+ case 183 /* FunctionExpression */:
+ case 196 /* ClassExpression */:
+ case 184 /* ArrowFunction */:
+ case 187 /* VoidExpression */:
+ case 185 /* DeleteExpression */:
+ case 186 /* TypeOfExpression */:
+ case 189 /* PrefixUnaryExpression */:
+ case 190 /* PostfixUnaryExpression */:
+ case 191 /* BinaryExpression */:
+ case 192 /* ConditionalExpression */:
+ case 195 /* SpreadElement */:
+ case 193 /* TemplateExpression */:
case 12 /* NoSubstitutionTemplateLiteral */:
- case 194 /* OmittedExpression */:
- case 242 /* JsxElement */:
- case 243 /* JsxSelfClosingElement */:
- case 191 /* YieldExpression */:
- case 185 /* AwaitExpression */:
+ case 197 /* OmittedExpression */:
+ case 245 /* JsxElement */:
+ case 246 /* JsxSelfClosingElement */:
+ case 194 /* YieldExpression */:
+ case 188 /* AwaitExpression */:
return true;
- case 140 /* QualifiedName */:
- while (node.parent.kind === 140 /* QualifiedName */) {
+ case 141 /* QualifiedName */:
+ while (node.parent.kind === 141 /* QualifiedName */) {
node = node.parent;
}
- return node.parent.kind === 159 /* TypeQuery */ || isJSXTagName(node);
+ return node.parent.kind === 160 /* TypeQuery */ || isJSXTagName(node);
case 70 /* Identifier */:
- if (node.parent.kind === 159 /* TypeQuery */ || isJSXTagName(node)) {
+ if (node.parent.kind === 160 /* TypeQuery */ || isJSXTagName(node)) {
return true;
}
// fall through
@@ -7262,47 +7471,47 @@ var ts;
case 98 /* ThisKeyword */:
var parent_3 = node.parent;
switch (parent_3.kind) {
- case 219 /* VariableDeclaration */:
- case 143 /* Parameter */:
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 255 /* EnumMember */:
- case 253 /* PropertyAssignment */:
- case 170 /* BindingElement */:
+ case 222 /* VariableDeclaration */:
+ case 144 /* Parameter */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 259 /* EnumMember */:
+ case 256 /* PropertyAssignment */:
+ case 173 /* BindingElement */:
return parent_3.initializer === node;
- case 203 /* ExpressionStatement */:
- case 204 /* IfStatement */:
- case 205 /* DoStatement */:
- case 206 /* WhileStatement */:
- case 212 /* ReturnStatement */:
- case 213 /* WithStatement */:
- case 214 /* SwitchStatement */:
- case 249 /* CaseClause */:
- case 216 /* ThrowStatement */:
- case 214 /* SwitchStatement */:
+ case 206 /* ExpressionStatement */:
+ case 207 /* IfStatement */:
+ case 208 /* DoStatement */:
+ case 209 /* WhileStatement */:
+ case 215 /* ReturnStatement */:
+ case 216 /* WithStatement */:
+ case 217 /* SwitchStatement */:
+ case 252 /* CaseClause */:
+ case 219 /* ThrowStatement */:
+ case 217 /* SwitchStatement */:
return parent_3.expression === node;
- case 207 /* ForStatement */:
+ case 210 /* ForStatement */:
var forStatement = parent_3;
- return (forStatement.initializer === node && forStatement.initializer.kind !== 220 /* VariableDeclarationList */) ||
+ return (forStatement.initializer === node && forStatement.initializer.kind !== 223 /* VariableDeclarationList */) ||
forStatement.condition === node ||
forStatement.incrementor === node;
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
var forInStatement = parent_3;
- return (forInStatement.initializer === node && forInStatement.initializer.kind !== 220 /* VariableDeclarationList */) ||
+ return (forInStatement.initializer === node && forInStatement.initializer.kind !== 223 /* VariableDeclarationList */) ||
forInStatement.expression === node;
- case 178 /* TypeAssertionExpression */:
- case 196 /* AsExpression */:
+ case 181 /* TypeAssertionExpression */:
+ case 199 /* AsExpression */:
return node === parent_3.expression;
- case 198 /* TemplateSpan */:
+ case 201 /* TemplateSpan */:
return node === parent_3.expression;
- case 141 /* ComputedPropertyName */:
+ case 142 /* ComputedPropertyName */:
return node === parent_3.expression;
- case 144 /* Decorator */:
- case 248 /* JsxExpression */:
- case 247 /* JsxSpreadAttribute */:
+ case 145 /* Decorator */:
+ case 251 /* JsxExpression */:
+ case 250 /* JsxSpreadAttribute */:
return true;
- case 195 /* ExpressionWithTypeArguments */:
+ case 198 /* ExpressionWithTypeArguments */:
return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3);
default:
if (isPartOfExpression(parent_3)) {
@@ -7320,7 +7529,7 @@ var ts;
}
ts.isInstantiatedModule = isInstantiatedModule;
function isExternalModuleImportEqualsDeclaration(node) {
- return node.kind === 230 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 241 /* ExternalModuleReference */;
+ return node.kind === 233 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 244 /* ExternalModuleReference */;
}
ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration;
function getExternalModuleImportEqualsDeclarationExpression(node) {
@@ -7329,7 +7538,7 @@ var ts;
}
ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
function isInternalModuleImportEqualsDeclaration(node) {
- return node.kind === 230 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 241 /* ExternalModuleReference */;
+ return node.kind === 233 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 244 /* ExternalModuleReference */;
}
ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration;
function isSourceFileJavaScript(file) {
@@ -7337,7 +7546,7 @@ var ts;
}
ts.isSourceFileJavaScript = isSourceFileJavaScript;
function isInJavaScriptFile(node) {
- return node && !!(node.flags & 1048576 /* JavaScriptFile */);
+ return node && !!(node.flags & 2097152 /* JavaScriptFile */);
}
ts.isInJavaScriptFile = isInJavaScriptFile;
/**
@@ -7347,7 +7556,7 @@ var ts;
*/
function isRequireCall(expression, checkArgumentIsStringLiteral) {
// of the form 'require("name")'
- var isRequire = expression.kind === 175 /* CallExpression */ &&
+ var isRequire = expression.kind === 178 /* CallExpression */ &&
expression.expression.kind === 70 /* Identifier */ &&
expression.expression.text === "require" &&
expression.arguments.length === 1;
@@ -7363,9 +7572,9 @@ var ts;
* This function does not test if the node is in a JavaScript file or not.
*/
function isDeclarationOfFunctionExpression(s) {
- if (s.valueDeclaration && s.valueDeclaration.kind === 219 /* VariableDeclaration */) {
+ if (s.valueDeclaration && s.valueDeclaration.kind === 222 /* VariableDeclaration */) {
var declaration = s.valueDeclaration;
- return declaration.initializer && declaration.initializer.kind === 180 /* FunctionExpression */;
+ return declaration.initializer && declaration.initializer.kind === 183 /* FunctionExpression */;
}
return false;
}
@@ -7376,11 +7585,11 @@ var ts;
if (!isInJavaScriptFile(expression)) {
return 0 /* None */;
}
- if (expression.kind !== 188 /* BinaryExpression */) {
+ if (expression.kind !== 191 /* BinaryExpression */) {
return 0 /* None */;
}
var expr = expression;
- if (expr.operatorToken.kind !== 57 /* EqualsToken */ || expr.left.kind !== 173 /* PropertyAccessExpression */) {
+ if (expr.operatorToken.kind !== 57 /* EqualsToken */ || expr.left.kind !== 176 /* PropertyAccessExpression */) {
return 0 /* None */;
}
var lhs = expr.left;
@@ -7398,7 +7607,7 @@ var ts;
else if (lhs.expression.kind === 98 /* ThisKeyword */) {
return 4 /* ThisProperty */;
}
- else if (lhs.expression.kind === 173 /* PropertyAccessExpression */) {
+ else if (lhs.expression.kind === 176 /* PropertyAccessExpression */) {
// chained dot, e.g. x.y.z = expr; this var is the 'x.y' part
var innerPropertyAccess = lhs.expression;
if (innerPropertyAccess.expression.kind === 70 /* Identifier */) {
@@ -7416,35 +7625,35 @@ var ts;
}
ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind;
function getExternalModuleName(node) {
- if (node.kind === 231 /* ImportDeclaration */) {
+ if (node.kind === 234 /* ImportDeclaration */) {
return node.moduleSpecifier;
}
- if (node.kind === 230 /* ImportEqualsDeclaration */) {
+ if (node.kind === 233 /* ImportEqualsDeclaration */) {
var reference = node.moduleReference;
- if (reference.kind === 241 /* ExternalModuleReference */) {
+ if (reference.kind === 244 /* ExternalModuleReference */) {
return reference.expression;
}
}
- if (node.kind === 237 /* ExportDeclaration */) {
+ if (node.kind === 240 /* ExportDeclaration */) {
return node.moduleSpecifier;
}
- if (node.kind === 226 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) {
+ if (node.kind === 229 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) {
return node.name;
}
}
ts.getExternalModuleName = getExternalModuleName;
function getNamespaceDeclarationNode(node) {
- if (node.kind === 230 /* ImportEqualsDeclaration */) {
+ if (node.kind === 233 /* ImportEqualsDeclaration */) {
return node;
}
var importClause = node.importClause;
- if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 233 /* NamespaceImport */) {
+ if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 236 /* NamespaceImport */) {
return importClause.namedBindings;
}
}
ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode;
function isDefaultImport(node) {
- return node.kind === 231 /* ImportDeclaration */
+ return node.kind === 234 /* ImportDeclaration */
&& node.importClause
&& !!node.importClause.name;
}
@@ -7452,13 +7661,13 @@ var ts;
function hasQuestionToken(node) {
if (node) {
switch (node.kind) {
- case 143 /* Parameter */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 254 /* ShorthandPropertyAssignment */:
- case 253 /* PropertyAssignment */:
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
+ case 144 /* Parameter */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 257 /* ShorthandPropertyAssignment */:
+ case 256 /* PropertyAssignment */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
return node.questionToken !== undefined;
}
}
@@ -7466,9 +7675,9 @@ var ts;
}
ts.hasQuestionToken = hasQuestionToken;
function isJSDocConstructSignature(node) {
- return node.kind === 269 /* JSDocFunctionType */ &&
+ return node.kind === 273 /* JSDocFunctionType */ &&
node.parameters.length > 0 &&
- node.parameters[0].type.kind === 271 /* JSDocConstructorType */;
+ node.parameters[0].type.kind === 275 /* JSDocConstructorType */;
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
function getJSDocTag(node, kind, checkParentVariableStatement) {
@@ -7528,34 +7737,34 @@ var ts;
// var x = function(name) { return name.length; }
var isInitializerOfVariableDeclarationInStatement = isVariableLike(node.parent) &&
(node.parent).initializer === node &&
- node.parent.parent.parent.kind === 201 /* VariableStatement */;
+ node.parent.parent.parent.kind === 204 /* VariableStatement */;
var isVariableOfVariableDeclarationStatement = isVariableLike(node) &&
- node.parent.parent.kind === 201 /* VariableStatement */;
+ node.parent.parent.kind === 204 /* VariableStatement */;
var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent :
isVariableOfVariableDeclarationStatement ? node.parent.parent :
undefined;
if (variableStatementNode) {
result = append(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags));
}
- if (node.kind === 226 /* ModuleDeclaration */ &&
- node.parent && node.parent.kind === 226 /* ModuleDeclaration */) {
+ if (node.kind === 229 /* ModuleDeclaration */ &&
+ node.parent && node.parent.kind === 229 /* ModuleDeclaration */) {
result = append(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags));
}
// Also recognize when the node is the RHS of an assignment expression
var parent_4 = node.parent;
var isSourceOfAssignmentExpressionStatement = parent_4 && parent_4.parent &&
- parent_4.kind === 188 /* BinaryExpression */ &&
+ parent_4.kind === 191 /* BinaryExpression */ &&
parent_4.operatorToken.kind === 57 /* EqualsToken */ &&
- parent_4.parent.kind === 203 /* ExpressionStatement */;
+ parent_4.parent.kind === 206 /* ExpressionStatement */;
if (isSourceOfAssignmentExpressionStatement) {
result = append(result, getJSDocs(parent_4.parent, checkParentVariableStatement, getDocs, getTags));
}
- var isPropertyAssignmentExpression = parent_4 && parent_4.kind === 253 /* PropertyAssignment */;
+ var isPropertyAssignmentExpression = parent_4 && parent_4.kind === 256 /* PropertyAssignment */;
if (isPropertyAssignmentExpression) {
result = append(result, getJSDocs(parent_4, checkParentVariableStatement, getDocs, getTags));
}
// Pull parameter comments from declaring function as well
- if (node.kind === 143 /* Parameter */) {
+ if (node.kind === 144 /* Parameter */) {
var paramTags = getJSDocParameterTag(node, checkParentVariableStatement);
if (paramTags) {
result = append(result, getTags(paramTags));
@@ -7581,14 +7790,14 @@ var ts;
if (!param.name) {
// this is an anonymous jsdoc param from a `function(type1, type2): type3` specification
var i = func.parameters.indexOf(param);
- var paramTags = ts.filter(tags, function (tag) { return tag.kind === 275 /* JSDocParameterTag */; });
+ var paramTags = ts.filter(tags, function (tag) { return tag.kind === 279 /* JSDocParameterTag */; });
if (paramTags && 0 <= i && i < paramTags.length) {
return [paramTags[i]];
}
}
else if (param.name.kind === 70 /* Identifier */) {
var name_6 = param.name.text;
- var paramTags = ts.filter(tags, function (tag) { return tag.kind === 275 /* JSDocParameterTag */ && tag.parameterName.text === name_6; });
+ var paramTags = ts.filter(tags, function (tag) { return tag.kind === 279 /* JSDocParameterTag */ && tag.parameterName.text === name_6; });
if (paramTags) {
return paramTags;
}
@@ -7600,15 +7809,15 @@ var ts;
}
}
function getJSDocTypeTag(node) {
- return getJSDocTag(node, 277 /* JSDocTypeTag */, /*checkParentVariableStatement*/ false);
+ return getJSDocTag(node, 281 /* JSDocTypeTag */, /*checkParentVariableStatement*/ false);
}
ts.getJSDocTypeTag = getJSDocTypeTag;
function getJSDocReturnTag(node) {
- return getJSDocTag(node, 276 /* JSDocReturnTag */, /*checkParentVariableStatement*/ true);
+ return getJSDocTag(node, 280 /* JSDocReturnTag */, /*checkParentVariableStatement*/ true);
}
ts.getJSDocReturnTag = getJSDocReturnTag;
function getJSDocTemplateTag(node) {
- return getJSDocTag(node, 278 /* JSDocTemplateTag */, /*checkParentVariableStatement*/ false);
+ return getJSDocTag(node, 282 /* JSDocTemplateTag */, /*checkParentVariableStatement*/ false);
}
ts.getJSDocTemplateTag = getJSDocTemplateTag;
function getCorrespondingJSDocParameterTag(parameter) {
@@ -7622,7 +7831,7 @@ var ts;
}
for (var _i = 0, jsDocTags_2 = jsDocTags; _i < jsDocTags_2.length; _i++) {
var tag = jsDocTags_2[_i];
- if (tag.kind === 275 /* JSDocParameterTag */) {
+ if (tag.kind === 279 /* JSDocParameterTag */) {
var parameterTag = tag;
if (parameterTag.parameterName.text === parameterName) {
return parameterTag;
@@ -7642,13 +7851,13 @@ var ts;
}
ts.hasDeclaredRestParameter = hasDeclaredRestParameter;
function isRestParameter(node) {
- if (node && (node.flags & 1048576 /* JavaScriptFile */)) {
- if (node.type && node.type.kind === 270 /* JSDocVariadicType */) {
+ if (node && (node.flags & 2097152 /* JavaScriptFile */)) {
+ if (node.type && node.type.kind === 274 /* JSDocVariadicType */) {
return true;
}
var paramTag = getCorrespondingJSDocParameterTag(node);
if (paramTag && paramTag.typeExpression) {
- return paramTag.typeExpression.type.kind === 270 /* JSDocVariadicType */;
+ return paramTag.typeExpression.type.kind === 274 /* JSDocVariadicType */;
}
}
return isDeclaredRestParam(node);
@@ -7658,29 +7867,53 @@ var ts;
return node && node.dotDotDotToken !== undefined;
}
ts.isDeclaredRestParam = isDeclaredRestParam;
+ var AssignmentKind;
+ (function (AssignmentKind) {
+ AssignmentKind[AssignmentKind["None"] = 0] = "None";
+ AssignmentKind[AssignmentKind["Definite"] = 1] = "Definite";
+ AssignmentKind[AssignmentKind["Compound"] = 2] = "Compound";
+ })(AssignmentKind = ts.AssignmentKind || (ts.AssignmentKind = {}));
+ function getAssignmentTargetKind(node) {
+ var parent = node.parent;
+ while (true) {
+ switch (parent.kind) {
+ case 191 /* BinaryExpression */:
+ var binaryOperator = parent.operatorToken.kind;
+ return isAssignmentOperator(binaryOperator) && parent.left === node ?
+ binaryOperator === 57 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ :
+ 0 /* None */;
+ case 189 /* PrefixUnaryExpression */:
+ case 190 /* PostfixUnaryExpression */:
+ var unaryOperator = parent.operator;
+ return unaryOperator === 42 /* PlusPlusToken */ || unaryOperator === 43 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */;
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
+ return parent.initializer === node ? 1 /* Definite */ : 0 /* None */;
+ case 182 /* ParenthesizedExpression */:
+ case 174 /* ArrayLiteralExpression */:
+ case 195 /* SpreadElement */:
+ node = parent;
+ break;
+ case 257 /* ShorthandPropertyAssignment */:
+ if (parent.name !== node) {
+ return 0 /* None */;
+ }
+ // Fall through
+ case 256 /* PropertyAssignment */:
+ node = parent.parent;
+ break;
+ default:
+ return 0 /* None */;
+ }
+ parent = node.parent;
+ }
+ }
+ ts.getAssignmentTargetKind = getAssignmentTargetKind;
// A node is an assignment target if it is on the left hand side of an '=' token, if it is parented by a property
// assignment in an object literal that is an assignment target, or if it is parented by an array literal that is
// an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'.
function isAssignmentTarget(node) {
- while (node.parent.kind === 179 /* ParenthesizedExpression */) {
- node = node.parent;
- }
- while (true) {
- var parent_5 = node.parent;
- if (parent_5.kind === 171 /* ArrayLiteralExpression */ || parent_5.kind === 192 /* SpreadElementExpression */) {
- node = parent_5;
- continue;
- }
- if (parent_5.kind === 253 /* PropertyAssignment */ || parent_5.kind === 254 /* ShorthandPropertyAssignment */) {
- node = parent_5.parent;
- continue;
- }
- return parent_5.kind === 188 /* BinaryExpression */ &&
- isAssignmentOperator(parent_5.operatorToken.kind) &&
- parent_5.left === node ||
- (parent_5.kind === 208 /* ForInStatement */ || parent_5.kind === 209 /* ForOfStatement */) &&
- parent_5.initializer === node;
- }
+ return getAssignmentTargetKind(node) !== 0 /* None */;
}
ts.isAssignmentTarget = isAssignmentTarget;
function isNodeDescendantOf(node, ancestor) {
@@ -7694,7 +7927,7 @@ var ts;
ts.isNodeDescendantOf = isNodeDescendantOf;
function isInAmbientContext(node) {
while (node) {
- if (hasModifier(node, 2 /* Ambient */) || (node.kind === 256 /* SourceFile */ && node.isDeclarationFile)) {
+ if (hasModifier(node, 2 /* Ambient */) || (node.kind === 260 /* SourceFile */ && node.isDeclarationFile)) {
return true;
}
node = node.parent;
@@ -7708,7 +7941,7 @@ var ts;
return false;
}
var parent = name.parent;
- if (parent.kind === 235 /* ImportSpecifier */ || parent.kind === 239 /* ExportSpecifier */) {
+ if (parent.kind === 238 /* ImportSpecifier */ || parent.kind === 242 /* ExportSpecifier */) {
if (parent.propertyName) {
return true;
}
@@ -7721,7 +7954,7 @@ var ts;
ts.isDeclarationName = isDeclarationName;
function isLiteralComputedPropertyDeclarationName(node) {
return (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) &&
- node.parent.kind === 141 /* ComputedPropertyName */ &&
+ node.parent.kind === 142 /* ComputedPropertyName */ &&
isDeclaration(node.parent.parent);
}
ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName;
@@ -7729,31 +7962,31 @@ var ts;
function isIdentifierName(node) {
var parent = node.parent;
switch (parent.kind) {
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 255 /* EnumMember */:
- case 253 /* PropertyAssignment */:
- case 173 /* PropertyAccessExpression */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 259 /* EnumMember */:
+ case 256 /* PropertyAssignment */:
+ case 176 /* PropertyAccessExpression */:
// Name in member declaration or property name in property access
return parent.name === node;
- case 140 /* QualifiedName */:
+ case 141 /* QualifiedName */:
// Name on right hand side of dot in a type query
if (parent.right === node) {
- while (parent.kind === 140 /* QualifiedName */) {
+ while (parent.kind === 141 /* QualifiedName */) {
parent = parent.parent;
}
- return parent.kind === 159 /* TypeQuery */;
+ return parent.kind === 160 /* TypeQuery */;
}
return false;
- case 170 /* BindingElement */:
- case 235 /* ImportSpecifier */:
+ case 173 /* BindingElement */:
+ case 238 /* ImportSpecifier */:
// Property name in binding element or import specifier
return parent.propertyName === node;
- case 239 /* ExportSpecifier */:
+ case 242 /* ExportSpecifier */:
// Any name in an export specifier
return true;
}
@@ -7769,13 +8002,13 @@ var ts;
// export =
// export default
function isAliasSymbolDeclaration(node) {
- return node.kind === 230 /* ImportEqualsDeclaration */ ||
- node.kind === 229 /* NamespaceExportDeclaration */ ||
- node.kind === 232 /* ImportClause */ && !!node.name ||
- node.kind === 233 /* NamespaceImport */ ||
- node.kind === 235 /* ImportSpecifier */ ||
- node.kind === 239 /* ExportSpecifier */ ||
- node.kind === 236 /* ExportAssignment */ && exportAssignmentIsAlias(node);
+ return node.kind === 233 /* ImportEqualsDeclaration */ ||
+ node.kind === 232 /* NamespaceExportDeclaration */ ||
+ node.kind === 235 /* ImportClause */ && !!node.name ||
+ node.kind === 236 /* NamespaceImport */ ||
+ node.kind === 238 /* ImportSpecifier */ ||
+ node.kind === 242 /* ExportSpecifier */ ||
+ node.kind === 239 /* ExportAssignment */ && exportAssignmentIsAlias(node);
}
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
function exportAssignmentIsAlias(node) {
@@ -7861,7 +8094,7 @@ var ts;
}
ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath;
function isKeyword(token) {
- return 71 /* FirstKeyword */ <= token && token <= 139 /* LastKeyword */;
+ return 71 /* FirstKeyword */ <= token && token <= 140 /* LastKeyword */;
}
ts.isKeyword = isKeyword;
function isTrivia(token) {
@@ -7888,7 +8121,7 @@ var ts;
}
ts.hasDynamicName = hasDynamicName;
function isDynamicName(name) {
- return name.kind === 141 /* ComputedPropertyName */ &&
+ return name.kind === 142 /* ComputedPropertyName */ &&
!isStringOrNumericLiteral(name.expression.kind) &&
!isWellKnownSymbolSyntactically(name.expression);
}
@@ -7903,10 +8136,10 @@ var ts;
}
ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically;
function getPropertyNameForPropertyNameNode(name) {
- if (name.kind === 70 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */ || name.kind === 143 /* Parameter */) {
+ if (name.kind === 70 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */ || name.kind === 144 /* Parameter */) {
return name.text;
}
- if (name.kind === 141 /* ComputedPropertyName */) {
+ if (name.kind === 142 /* ComputedPropertyName */) {
var nameExpression = name.expression;
if (isWellKnownSymbolSyntactically(nameExpression)) {
var rightHandSideName = nameExpression.name.text;
@@ -7945,7 +8178,7 @@ var ts;
case 113 /* PublicKeyword */:
case 111 /* PrivateKeyword */:
case 112 /* ProtectedKeyword */:
- case 129 /* ReadonlyKeyword */:
+ case 130 /* ReadonlyKeyword */:
case 114 /* StaticKeyword */:
return true;
}
@@ -7954,11 +8187,11 @@ var ts;
ts.isModifierKind = isModifierKind;
function isParameterDeclaration(node) {
var root = getRootDeclaration(node);
- return root.kind === 143 /* Parameter */;
+ return root.kind === 144 /* Parameter */;
}
ts.isParameterDeclaration = isParameterDeclaration;
function getRootDeclaration(node) {
- while (node.kind === 170 /* BindingElement */) {
+ while (node.kind === 173 /* BindingElement */) {
node = node.parent.parent;
}
return node;
@@ -7966,15 +8199,15 @@ var ts;
ts.getRootDeclaration = getRootDeclaration;
function nodeStartsNewLexicalEnvironment(node) {
var kind = node.kind;
- return kind === 149 /* Constructor */
- || kind === 180 /* FunctionExpression */
- || kind === 221 /* FunctionDeclaration */
- || kind === 181 /* ArrowFunction */
- || kind === 148 /* MethodDeclaration */
- || kind === 150 /* GetAccessor */
- || kind === 151 /* SetAccessor */
- || kind === 226 /* ModuleDeclaration */
- || kind === 256 /* SourceFile */;
+ return kind === 150 /* Constructor */
+ || kind === 183 /* FunctionExpression */
+ || kind === 224 /* FunctionDeclaration */
+ || kind === 184 /* ArrowFunction */
+ || kind === 149 /* MethodDeclaration */
+ || kind === 151 /* GetAccessor */
+ || kind === 152 /* SetAccessor */
+ || kind === 229 /* ModuleDeclaration */
+ || kind === 260 /* SourceFile */;
}
ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment;
function nodeIsSynthesized(node) {
@@ -7982,13 +8215,13 @@ var ts;
|| ts.positionIsSynthesized(node.end);
}
ts.nodeIsSynthesized = nodeIsSynthesized;
- function getOriginalNode(node) {
+ function getOriginalNode(node, nodeTest) {
if (node) {
while (node.original !== undefined) {
node = node.original;
}
}
- return node;
+ return !nodeTest || nodeTest(node) ? node : undefined;
}
ts.getOriginalNode = getOriginalNode;
/**
@@ -8028,30 +8261,30 @@ var ts;
return node ? ts.getNodeId(node) : 0;
}
ts.getOriginalNodeId = getOriginalNodeId;
+ var Associativity;
(function (Associativity) {
Associativity[Associativity["Left"] = 0] = "Left";
Associativity[Associativity["Right"] = 1] = "Right";
- })(ts.Associativity || (ts.Associativity = {}));
- var Associativity = ts.Associativity;
+ })(Associativity = ts.Associativity || (ts.Associativity = {}));
function getExpressionAssociativity(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 176 /* NewExpression */ && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 179 /* NewExpression */ && expression.arguments !== undefined;
return getOperatorAssociativity(expression.kind, operator, hasArguments);
}
ts.getExpressionAssociativity = getExpressionAssociativity;
function getOperatorAssociativity(kind, operator, hasArguments) {
switch (kind) {
- case 176 /* NewExpression */:
+ case 179 /* NewExpression */:
return hasArguments ? 0 /* Left */ : 1 /* Right */;
- case 186 /* PrefixUnaryExpression */:
- case 183 /* TypeOfExpression */:
- case 184 /* VoidExpression */:
- case 182 /* DeleteExpression */:
- case 185 /* AwaitExpression */:
- case 189 /* ConditionalExpression */:
- case 191 /* YieldExpression */:
+ case 189 /* PrefixUnaryExpression */:
+ case 186 /* TypeOfExpression */:
+ case 187 /* VoidExpression */:
+ case 185 /* DeleteExpression */:
+ case 188 /* AwaitExpression */:
+ case 192 /* ConditionalExpression */:
+ case 194 /* YieldExpression */:
return 1 /* Right */;
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
switch (operator) {
case 39 /* AsteriskAsteriskToken */:
case 57 /* EqualsToken */:
@@ -8075,15 +8308,15 @@ var ts;
ts.getOperatorAssociativity = getOperatorAssociativity;
function getExpressionPrecedence(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 176 /* NewExpression */ && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 179 /* NewExpression */ && expression.arguments !== undefined;
return getOperatorPrecedence(expression.kind, operator, hasArguments);
}
ts.getExpressionPrecedence = getExpressionPrecedence;
function getOperator(expression) {
- if (expression.kind === 188 /* BinaryExpression */) {
+ if (expression.kind === 191 /* BinaryExpression */) {
return expression.operatorToken.kind;
}
- else if (expression.kind === 186 /* PrefixUnaryExpression */ || expression.kind === 187 /* PostfixUnaryExpression */) {
+ else if (expression.kind === 189 /* PrefixUnaryExpression */ || expression.kind === 190 /* PostfixUnaryExpression */) {
return expression.operator;
}
else {
@@ -8101,36 +8334,36 @@ var ts;
case 85 /* FalseKeyword */:
case 8 /* NumericLiteral */:
case 9 /* StringLiteral */:
- case 171 /* ArrayLiteralExpression */:
- case 172 /* ObjectLiteralExpression */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
- case 193 /* ClassExpression */:
- case 242 /* JsxElement */:
- case 243 /* JsxSelfClosingElement */:
+ case 174 /* ArrayLiteralExpression */:
+ case 175 /* ObjectLiteralExpression */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 196 /* ClassExpression */:
+ case 245 /* JsxElement */:
+ case 246 /* JsxSelfClosingElement */:
case 11 /* RegularExpressionLiteral */:
case 12 /* NoSubstitutionTemplateLiteral */:
- case 190 /* TemplateExpression */:
- case 179 /* ParenthesizedExpression */:
- case 194 /* OmittedExpression */:
+ case 193 /* TemplateExpression */:
+ case 182 /* ParenthesizedExpression */:
+ case 197 /* OmittedExpression */:
return 19;
- case 177 /* TaggedTemplateExpression */:
- case 173 /* PropertyAccessExpression */:
- case 174 /* ElementAccessExpression */:
+ case 180 /* TaggedTemplateExpression */:
+ case 176 /* PropertyAccessExpression */:
+ case 177 /* ElementAccessExpression */:
return 18;
- case 176 /* NewExpression */:
+ case 179 /* NewExpression */:
return hasArguments ? 18 : 17;
- case 175 /* CallExpression */:
+ case 178 /* CallExpression */:
return 17;
- case 187 /* PostfixUnaryExpression */:
+ case 190 /* PostfixUnaryExpression */:
return 16;
- case 186 /* PrefixUnaryExpression */:
- case 183 /* TypeOfExpression */:
- case 184 /* VoidExpression */:
- case 182 /* DeleteExpression */:
- case 185 /* AwaitExpression */:
+ case 189 /* PrefixUnaryExpression */:
+ case 186 /* TypeOfExpression */:
+ case 187 /* VoidExpression */:
+ case 185 /* DeleteExpression */:
+ case 188 /* AwaitExpression */:
return 15;
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
switch (operatorKind) {
case 50 /* ExclamationToken */:
case 51 /* TildeToken */:
@@ -8188,11 +8421,11 @@ var ts;
default:
return -1;
}
- case 189 /* ConditionalExpression */:
+ case 192 /* ConditionalExpression */:
return 4;
- case 191 /* YieldExpression */:
+ case 194 /* YieldExpression */:
return 2;
- case 192 /* SpreadElementExpression */:
+ case 195 /* SpreadElement */:
return 1;
default:
return -1;
@@ -8462,14 +8695,17 @@ var ts;
if (options.outFile || options.out) {
var moduleKind = ts.getEmitModuleKind(options);
var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System;
- var sourceFiles = host.getSourceFiles();
+ var sourceFiles = getAllEmittableSourceFiles();
// Can emit only sources that are not declaration file and are either non module code or module with --module or --target es6 specified
return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule);
}
else {
- var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile];
+ var sourceFiles = targetSourceFile === undefined ? getAllEmittableSourceFiles() : [targetSourceFile];
return ts.filter(sourceFiles, isNonDeclarationFile);
}
+ function getAllEmittableSourceFiles() {
+ return options.noEmitForJsFiles ? ts.filter(host.getSourceFiles(), function (sourceFile) { return !isSourceFileJavaScript(sourceFile); }) : host.getSourceFiles();
+ }
}
ts.getSourceFilesToEmit = getSourceFilesToEmit;
function isNonDeclarationFile(sourceFile) {
@@ -8554,7 +8790,7 @@ var ts;
onBundledEmit(host);
}
else {
- var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile];
+ var sourceFiles = targetSourceFile === undefined ? getSourceFilesToEmit(host) : [targetSourceFile];
for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) {
var sourceFile = sourceFiles_3[_i];
// Don't emit if source file is a declaration file, or was located under node_modules
@@ -8591,7 +8827,7 @@ var ts;
function onBundledEmit(host) {
// Can emit only sources that are not declaration file and are either non module code or module with
// --module or --target es6 specified. Files included by searching under node_modules are also not emitted.
- var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { return !isDeclarationFile(sourceFile) &&
+ var bundledSources = ts.filter(getSourceFilesToEmit(host), function (sourceFile) { return !isDeclarationFile(sourceFile) &&
!host.isSourceFileFromExternalLibrary(sourceFile) &&
(!ts.isExternalModule(sourceFile) ||
!!ts.getEmitModuleKind(options)); });
@@ -8631,7 +8867,7 @@ var ts;
ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap;
function getFirstConstructorWithBody(node) {
return ts.forEach(node.members, function (member) {
- if (member.kind === 149 /* Constructor */ && nodeIsPresent(member.body)) {
+ if (member.kind === 150 /* Constructor */ && nodeIsPresent(member.body)) {
return member;
}
});
@@ -8673,10 +8909,10 @@ var ts;
var setAccessor;
if (hasDynamicName(accessor)) {
firstAccessor = accessor;
- if (accessor.kind === 150 /* GetAccessor */) {
+ if (accessor.kind === 151 /* GetAccessor */) {
getAccessor = accessor;
}
- else if (accessor.kind === 151 /* SetAccessor */) {
+ else if (accessor.kind === 152 /* SetAccessor */) {
setAccessor = accessor;
}
else {
@@ -8685,7 +8921,7 @@ var ts;
}
else {
ts.forEach(declarations, function (member) {
- if ((member.kind === 150 /* GetAccessor */ || member.kind === 151 /* SetAccessor */)
+ if ((member.kind === 151 /* GetAccessor */ || member.kind === 152 /* SetAccessor */)
&& hasModifier(member, 32 /* Static */) === hasModifier(accessor, 32 /* Static */)) {
var memberName = getPropertyNameForPropertyNameNode(member.name);
var accessorName = getPropertyNameForPropertyNameNode(accessor.name);
@@ -8696,10 +8932,10 @@ var ts;
else if (!secondAccessor) {
secondAccessor = member;
}
- if (member.kind === 150 /* GetAccessor */ && !getAccessor) {
+ if (member.kind === 151 /* GetAccessor */ && !getAccessor) {
getAccessor = member;
}
- if (member.kind === 151 /* SetAccessor */ && !setAccessor) {
+ if (member.kind === 152 /* SetAccessor */ && !setAccessor) {
setAccessor = member;
}
}
@@ -8945,7 +9181,7 @@ var ts;
case 75 /* ConstKeyword */: return 2048 /* Const */;
case 78 /* DefaultKeyword */: return 512 /* Default */;
case 119 /* AsyncKeyword */: return 256 /* Async */;
- case 129 /* ReadonlyKeyword */: return 64 /* Readonly */;
+ case 130 /* ReadonlyKeyword */: return 64 /* Readonly */;
}
return 0 /* None */;
}
@@ -8962,19 +9198,25 @@ var ts;
ts.isAssignmentOperator = isAssignmentOperator;
/** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */
function tryGetClassExtendingExpressionWithTypeArguments(node) {
- if (node.kind === 195 /* ExpressionWithTypeArguments */ &&
+ if (node.kind === 198 /* ExpressionWithTypeArguments */ &&
node.parent.token === 84 /* ExtendsKeyword */ &&
isClassLike(node.parent.parent)) {
return node.parent.parent;
}
}
ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments;
+ function isAssignmentExpression(node) {
+ return isBinaryExpression(node)
+ && isAssignmentOperator(node.operatorToken.kind)
+ && isLeftHandSideExpression(node.left);
+ }
+ ts.isAssignmentExpression = isAssignmentExpression;
function isDestructuringAssignment(node) {
if (isBinaryExpression(node)) {
if (node.operatorToken.kind === 57 /* EqualsToken */) {
var kind = node.left.kind;
- return kind === 172 /* ObjectLiteralExpression */
- || kind === 171 /* ArrayLiteralExpression */;
+ return kind === 175 /* ObjectLiteralExpression */
+ || kind === 174 /* ArrayLiteralExpression */;
}
}
return false;
@@ -9003,20 +9245,20 @@ var ts;
ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;
function isEntityNameExpression(node) {
return node.kind === 70 /* Identifier */ ||
- node.kind === 173 /* PropertyAccessExpression */ && isEntityNameExpression(node.expression);
+ node.kind === 176 /* PropertyAccessExpression */ && isEntityNameExpression(node.expression);
}
ts.isEntityNameExpression = isEntityNameExpression;
function isRightSideOfQualifiedNameOrPropertyAccess(node) {
- return (node.parent.kind === 140 /* QualifiedName */ && node.parent.right === node) ||
- (node.parent.kind === 173 /* PropertyAccessExpression */ && node.parent.name === node);
+ return (node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node) ||
+ (node.parent.kind === 176 /* PropertyAccessExpression */ && node.parent.name === node);
}
ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
function isEmptyObjectLiteralOrArrayLiteral(expression) {
var kind = expression.kind;
- if (kind === 172 /* ObjectLiteralExpression */) {
+ if (kind === 175 /* ObjectLiteralExpression */) {
return expression.properties.length === 0;
}
- if (kind === 171 /* ArrayLiteralExpression */) {
+ if (kind === 174 /* ArrayLiteralExpression */) {
return expression.elements.length === 0;
}
return false;
@@ -9178,39 +9420,39 @@ var ts;
|| kind === 94 /* NullKeyword */) {
return true;
}
- else if (kind === 173 /* PropertyAccessExpression */) {
+ else if (kind === 176 /* PropertyAccessExpression */) {
return isSimpleExpressionWorker(node.expression, depth + 1);
}
- else if (kind === 174 /* ElementAccessExpression */) {
+ else if (kind === 177 /* ElementAccessExpression */) {
return isSimpleExpressionWorker(node.expression, depth + 1)
&& isSimpleExpressionWorker(node.argumentExpression, depth + 1);
}
- else if (kind === 186 /* PrefixUnaryExpression */
- || kind === 187 /* PostfixUnaryExpression */) {
+ else if (kind === 189 /* PrefixUnaryExpression */
+ || kind === 190 /* PostfixUnaryExpression */) {
return isSimpleExpressionWorker(node.operand, depth + 1);
}
- else if (kind === 188 /* BinaryExpression */) {
+ else if (kind === 191 /* BinaryExpression */) {
return node.operatorToken.kind !== 39 /* AsteriskAsteriskToken */
&& isSimpleExpressionWorker(node.left, depth + 1)
&& isSimpleExpressionWorker(node.right, depth + 1);
}
- else if (kind === 189 /* ConditionalExpression */) {
+ else if (kind === 192 /* ConditionalExpression */) {
return isSimpleExpressionWorker(node.condition, depth + 1)
&& isSimpleExpressionWorker(node.whenTrue, depth + 1)
&& isSimpleExpressionWorker(node.whenFalse, depth + 1);
}
- else if (kind === 184 /* VoidExpression */
- || kind === 183 /* TypeOfExpression */
- || kind === 182 /* DeleteExpression */) {
+ else if (kind === 187 /* VoidExpression */
+ || kind === 186 /* TypeOfExpression */
+ || kind === 185 /* DeleteExpression */) {
return isSimpleExpressionWorker(node.expression, depth + 1);
}
- else if (kind === 171 /* ArrayLiteralExpression */) {
+ else if (kind === 174 /* ArrayLiteralExpression */) {
return node.elements.length === 0;
}
- else if (kind === 172 /* ObjectLiteralExpression */) {
+ else if (kind === 175 /* ObjectLiteralExpression */) {
return node.properties.length === 0;
}
- else if (kind === 175 /* CallExpression */) {
+ else if (kind === 178 /* CallExpression */) {
if (!isSimpleExpressionWorker(node.expression, depth + 1)) {
return false;
}
@@ -9369,28 +9611,31 @@ var ts;
return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos);
}
ts.getStartPositionOfRange = getStartPositionOfRange;
- function collectExternalModuleInfo(sourceFile) {
+ function collectExternalModuleInfo(sourceFile, resolver) {
var externalImports = [];
var exportSpecifiers = ts.createMap();
+ var exportedBindings = ts.createMap();
+ var uniqueExports = ts.createMap();
+ var hasExportDefault = false;
var exportEquals = undefined;
var hasExportStarsToExportValues = false;
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var node = _a[_i];
switch (node.kind) {
- case 231 /* ImportDeclaration */:
+ case 234 /* ImportDeclaration */:
// import "mod"
// import x from "mod"
// import * as x from "mod"
// import { x, y } from "mod"
externalImports.push(node);
break;
- case 230 /* ImportEqualsDeclaration */:
- if (node.moduleReference.kind === 241 /* ExternalModuleReference */) {
+ case 233 /* ImportEqualsDeclaration */:
+ if (node.moduleReference.kind === 244 /* ExternalModuleReference */) {
// import x = require("mod")
externalImports.push(node);
}
break;
- case 237 /* ExportDeclaration */:
+ case 240 /* ExportDeclaration */:
if (node.moduleSpecifier) {
if (!node.exportClause) {
// export * from "mod"
@@ -9406,22 +9651,111 @@ var ts;
// export { x, y }
for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) {
var specifier = _c[_b];
- var name_8 = (specifier.propertyName || specifier.name).text;
- (exportSpecifiers[name_8] || (exportSpecifiers[name_8] = [])).push(specifier);
+ if (!uniqueExports[specifier.name.text]) {
+ var name_8 = specifier.propertyName || specifier.name;
+ ts.multiMapAdd(exportSpecifiers, name_8.text, specifier);
+ var decl = resolver.getReferencedImportDeclaration(name_8)
+ || resolver.getReferencedValueDeclaration(name_8);
+ if (decl) {
+ ts.multiMapAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
+ }
+ uniqueExports[specifier.name.text] = specifier.name;
+ }
}
}
break;
- case 236 /* ExportAssignment */:
+ case 239 /* ExportAssignment */:
if (node.isExportEquals && !exportEquals) {
// export = x
exportEquals = node;
}
break;
+ case 204 /* VariableStatement */:
+ if (hasModifier(node, 1 /* Export */)) {
+ for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
+ var decl = _e[_d];
+ collectExportedVariableInfo(decl, uniqueExports);
+ }
+ }
+ break;
+ case 224 /* FunctionDeclaration */:
+ if (hasModifier(node, 1 /* Export */)) {
+ if (hasModifier(node, 512 /* Default */)) {
+ // export default function() { }
+ if (!hasExportDefault) {
+ ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node));
+ hasExportDefault = true;
+ }
+ }
+ else {
+ // export function x() { }
+ var name_9 = node.name;
+ if (!uniqueExports[name_9.text]) {
+ ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_9);
+ uniqueExports[name_9.text] = name_9;
+ }
+ }
+ }
+ break;
+ case 225 /* ClassDeclaration */:
+ if (hasModifier(node, 1 /* Export */)) {
+ if (hasModifier(node, 512 /* Default */)) {
+ // export default class { }
+ if (!hasExportDefault) {
+ ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node));
+ hasExportDefault = true;
+ }
+ }
+ else {
+ // export class x { }
+ var name_10 = node.name;
+ if (!uniqueExports[name_10.text]) {
+ ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_10);
+ uniqueExports[name_10.text] = name_10;
+ }
+ }
+ }
+ break;
}
}
- return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues };
+ var exportedNames;
+ for (var key in uniqueExports) {
+ exportedNames = ts.append(exportedNames, uniqueExports[key]);
+ }
+ return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames };
}
ts.collectExternalModuleInfo = collectExternalModuleInfo;
+ function collectExportedVariableInfo(decl, uniqueExports) {
+ if (isBindingPattern(decl.name)) {
+ for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {
+ var element = _a[_i];
+ if (!isOmittedExpression(element)) {
+ collectExportedVariableInfo(element, uniqueExports);
+ }
+ }
+ }
+ else if (!isGeneratedIdentifier(decl.name)) {
+ if (!uniqueExports[decl.name.text]) {
+ uniqueExports[decl.name.text] = decl.name;
+ }
+ }
+ }
+ /**
+ * Determines whether a name was originally the declaration name of an enum or namespace
+ * declaration.
+ */
+ function isDeclarationNameOfEnumOrNamespace(node) {
+ var parseNode = getParseTreeNode(node);
+ if (parseNode) {
+ switch (parseNode.parent.kind) {
+ case 228 /* EnumDeclaration */:
+ case 229 /* ModuleDeclaration */:
+ return parseNode === parseNode.parent.name;
+ }
+ }
+ return false;
+ }
+ ts.isDeclarationNameOfEnumOrNamespace = isDeclarationNameOfEnumOrNamespace;
function getInitializedVariables(node) {
return ts.filter(node.declarations, isInitializedVariable);
}
@@ -9436,7 +9770,7 @@ var ts;
if (node.symbol) {
for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 222 /* ClassDeclaration */ && declaration !== node) {
+ if (declaration.kind === 225 /* ClassDeclaration */ && declaration !== node) {
return true;
}
}
@@ -9513,16 +9847,16 @@ var ts;
ts.isModifier = isModifier;
// Names
function isQualifiedName(node) {
- return node.kind === 140 /* QualifiedName */;
+ return node.kind === 141 /* QualifiedName */;
}
ts.isQualifiedName = isQualifiedName;
function isComputedPropertyName(node) {
- return node.kind === 141 /* ComputedPropertyName */;
+ return node.kind === 142 /* ComputedPropertyName */;
}
ts.isComputedPropertyName = isComputedPropertyName;
function isEntityName(node) {
var kind = node.kind;
- return kind === 140 /* QualifiedName */
+ return kind === 141 /* QualifiedName */
|| kind === 70 /* Identifier */;
}
ts.isEntityName = isEntityName;
@@ -9531,7 +9865,7 @@ var ts;
return kind === 70 /* Identifier */
|| kind === 9 /* StringLiteral */
|| kind === 8 /* NumericLiteral */
- || kind === 141 /* ComputedPropertyName */;
+ || kind === 142 /* ComputedPropertyName */;
}
ts.isPropertyName = isPropertyName;
function isModuleName(node) {
@@ -9543,60 +9877,61 @@ var ts;
function isBindingName(node) {
var kind = node.kind;
return kind === 70 /* Identifier */
- || kind === 168 /* ObjectBindingPattern */
- || kind === 169 /* ArrayBindingPattern */;
+ || kind === 171 /* ObjectBindingPattern */
+ || kind === 172 /* ArrayBindingPattern */;
}
ts.isBindingName = isBindingName;
// Signature elements
function isTypeParameter(node) {
- return node.kind === 142 /* TypeParameter */;
+ return node.kind === 143 /* TypeParameter */;
}
ts.isTypeParameter = isTypeParameter;
function isParameter(node) {
- return node.kind === 143 /* Parameter */;
+ return node.kind === 144 /* Parameter */;
}
ts.isParameter = isParameter;
function isDecorator(node) {
- return node.kind === 144 /* Decorator */;
+ return node.kind === 145 /* Decorator */;
}
ts.isDecorator = isDecorator;
// Type members
function isMethodDeclaration(node) {
- return node.kind === 148 /* MethodDeclaration */;
+ return node.kind === 149 /* MethodDeclaration */;
}
ts.isMethodDeclaration = isMethodDeclaration;
function isClassElement(node) {
var kind = node.kind;
- return kind === 149 /* Constructor */
- || kind === 146 /* PropertyDeclaration */
- || kind === 148 /* MethodDeclaration */
- || kind === 150 /* GetAccessor */
- || kind === 151 /* SetAccessor */
- || kind === 154 /* IndexSignature */
- || kind === 199 /* SemicolonClassElement */;
+ return kind === 150 /* Constructor */
+ || kind === 147 /* PropertyDeclaration */
+ || kind === 149 /* MethodDeclaration */
+ || kind === 151 /* GetAccessor */
+ || kind === 152 /* SetAccessor */
+ || kind === 155 /* IndexSignature */
+ || kind === 202 /* SemicolonClassElement */;
}
ts.isClassElement = isClassElement;
function isObjectLiteralElementLike(node) {
var kind = node.kind;
- return kind === 253 /* PropertyAssignment */
- || kind === 254 /* ShorthandPropertyAssignment */
- || kind === 148 /* MethodDeclaration */
- || kind === 150 /* GetAccessor */
- || kind === 151 /* SetAccessor */
- || kind === 240 /* MissingDeclaration */;
+ return kind === 256 /* PropertyAssignment */
+ || kind === 257 /* ShorthandPropertyAssignment */
+ || kind === 258 /* SpreadAssignment */
+ || kind === 149 /* MethodDeclaration */
+ || kind === 151 /* GetAccessor */
+ || kind === 152 /* SetAccessor */
+ || kind === 243 /* MissingDeclaration */;
}
ts.isObjectLiteralElementLike = isObjectLiteralElementLike;
// Type
function isTypeNodeKind(kind) {
- return (kind >= 155 /* FirstTypeNode */ && kind <= 167 /* LastTypeNode */)
+ return (kind >= 156 /* FirstTypeNode */ && kind <= 170 /* LastTypeNode */)
|| kind === 118 /* AnyKeyword */
- || kind === 131 /* NumberKeyword */
+ || kind === 132 /* NumberKeyword */
|| kind === 121 /* BooleanKeyword */
- || kind === 133 /* StringKeyword */
- || kind === 134 /* SymbolKeyword */
+ || kind === 134 /* StringKeyword */
+ || kind === 135 /* SymbolKeyword */
|| kind === 104 /* VoidKeyword */
- || kind === 128 /* NeverKeyword */
- || kind === 195 /* ExpressionWithTypeArguments */;
+ || kind === 129 /* NeverKeyword */
+ || kind === 198 /* ExpressionWithTypeArguments */;
}
/**
* Node test that determines whether a node is a valid type node.
@@ -9611,95 +9946,103 @@ var ts;
function isBindingPattern(node) {
if (node) {
var kind = node.kind;
- return kind === 169 /* ArrayBindingPattern */
- || kind === 168 /* ObjectBindingPattern */;
+ return kind === 172 /* ArrayBindingPattern */
+ || kind === 171 /* ObjectBindingPattern */;
}
return false;
}
ts.isBindingPattern = isBindingPattern;
function isBindingElement(node) {
- return node.kind === 170 /* BindingElement */;
+ return node.kind === 173 /* BindingElement */;
}
ts.isBindingElement = isBindingElement;
function isArrayBindingElement(node) {
var kind = node.kind;
- return kind === 170 /* BindingElement */
- || kind === 194 /* OmittedExpression */;
+ return kind === 173 /* BindingElement */
+ || kind === 197 /* OmittedExpression */;
}
ts.isArrayBindingElement = isArrayBindingElement;
// Expression
+ function isArrayLiteralExpression(node) {
+ return node.kind === 174 /* ArrayLiteralExpression */;
+ }
+ ts.isArrayLiteralExpression = isArrayLiteralExpression;
+ function isObjectLiteralExpression(node) {
+ return node.kind === 175 /* ObjectLiteralExpression */;
+ }
+ ts.isObjectLiteralExpression = isObjectLiteralExpression;
function isPropertyAccessExpression(node) {
- return node.kind === 173 /* PropertyAccessExpression */;
+ return node.kind === 176 /* PropertyAccessExpression */;
}
ts.isPropertyAccessExpression = isPropertyAccessExpression;
function isElementAccessExpression(node) {
- return node.kind === 174 /* ElementAccessExpression */;
+ return node.kind === 177 /* ElementAccessExpression */;
}
ts.isElementAccessExpression = isElementAccessExpression;
function isBinaryExpression(node) {
- return node.kind === 188 /* BinaryExpression */;
+ return node.kind === 191 /* BinaryExpression */;
}
ts.isBinaryExpression = isBinaryExpression;
function isConditionalExpression(node) {
- return node.kind === 189 /* ConditionalExpression */;
+ return node.kind === 192 /* ConditionalExpression */;
}
ts.isConditionalExpression = isConditionalExpression;
function isCallExpression(node) {
- return node.kind === 175 /* CallExpression */;
+ return node.kind === 178 /* CallExpression */;
}
ts.isCallExpression = isCallExpression;
function isTemplateLiteral(node) {
var kind = node.kind;
- return kind === 190 /* TemplateExpression */
+ return kind === 193 /* TemplateExpression */
|| kind === 12 /* NoSubstitutionTemplateLiteral */;
}
ts.isTemplateLiteral = isTemplateLiteral;
- function isSpreadElementExpression(node) {
- return node.kind === 192 /* SpreadElementExpression */;
+ function isSpreadExpression(node) {
+ return node.kind === 195 /* SpreadElement */;
}
- ts.isSpreadElementExpression = isSpreadElementExpression;
+ ts.isSpreadExpression = isSpreadExpression;
function isExpressionWithTypeArguments(node) {
- return node.kind === 195 /* ExpressionWithTypeArguments */;
+ return node.kind === 198 /* ExpressionWithTypeArguments */;
}
ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments;
function isLeftHandSideExpressionKind(kind) {
- return kind === 173 /* PropertyAccessExpression */
- || kind === 174 /* ElementAccessExpression */
- || kind === 176 /* NewExpression */
- || kind === 175 /* CallExpression */
- || kind === 242 /* JsxElement */
- || kind === 243 /* JsxSelfClosingElement */
- || kind === 177 /* TaggedTemplateExpression */
- || kind === 171 /* ArrayLiteralExpression */
- || kind === 179 /* ParenthesizedExpression */
- || kind === 172 /* ObjectLiteralExpression */
- || kind === 193 /* ClassExpression */
- || kind === 180 /* FunctionExpression */
+ return kind === 176 /* PropertyAccessExpression */
+ || kind === 177 /* ElementAccessExpression */
+ || kind === 179 /* NewExpression */
+ || kind === 178 /* CallExpression */
+ || kind === 245 /* JsxElement */
+ || kind === 246 /* JsxSelfClosingElement */
+ || kind === 180 /* TaggedTemplateExpression */
+ || kind === 174 /* ArrayLiteralExpression */
+ || kind === 182 /* ParenthesizedExpression */
+ || kind === 175 /* ObjectLiteralExpression */
+ || kind === 196 /* ClassExpression */
+ || kind === 183 /* FunctionExpression */
|| kind === 70 /* Identifier */
|| kind === 11 /* RegularExpressionLiteral */
|| kind === 8 /* NumericLiteral */
|| kind === 9 /* StringLiteral */
|| kind === 12 /* NoSubstitutionTemplateLiteral */
- || kind === 190 /* TemplateExpression */
+ || kind === 193 /* TemplateExpression */
|| kind === 85 /* FalseKeyword */
|| kind === 94 /* NullKeyword */
|| kind === 98 /* ThisKeyword */
|| kind === 100 /* TrueKeyword */
|| kind === 96 /* SuperKeyword */
- || kind === 197 /* NonNullExpression */;
+ || kind === 200 /* NonNullExpression */;
}
function isLeftHandSideExpression(node) {
return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);
}
ts.isLeftHandSideExpression = isLeftHandSideExpression;
function isUnaryExpressionKind(kind) {
- return kind === 186 /* PrefixUnaryExpression */
- || kind === 187 /* PostfixUnaryExpression */
- || kind === 182 /* DeleteExpression */
- || kind === 183 /* TypeOfExpression */
- || kind === 184 /* VoidExpression */
- || kind === 185 /* AwaitExpression */
- || kind === 178 /* TypeAssertionExpression */
+ return kind === 189 /* PrefixUnaryExpression */
+ || kind === 190 /* PostfixUnaryExpression */
+ || kind === 185 /* DeleteExpression */
+ || kind === 186 /* TypeOfExpression */
+ || kind === 187 /* VoidExpression */
+ || kind === 188 /* AwaitExpression */
+ || kind === 181 /* TypeAssertionExpression */
|| isLeftHandSideExpressionKind(kind);
}
function isUnaryExpression(node) {
@@ -9707,13 +10050,13 @@ var ts;
}
ts.isUnaryExpression = isUnaryExpression;
function isExpressionKind(kind) {
- return kind === 189 /* ConditionalExpression */
- || kind === 191 /* YieldExpression */
- || kind === 181 /* ArrowFunction */
- || kind === 188 /* BinaryExpression */
- || kind === 192 /* SpreadElementExpression */
- || kind === 196 /* AsExpression */
- || kind === 194 /* OmittedExpression */
+ return kind === 192 /* ConditionalExpression */
+ || kind === 194 /* YieldExpression */
+ || kind === 184 /* ArrowFunction */
+ || kind === 191 /* BinaryExpression */
+ || kind === 195 /* SpreadElement */
+ || kind === 199 /* AsExpression */
+ || kind === 197 /* OmittedExpression */
|| isUnaryExpressionKind(kind);
}
function isExpression(node) {
@@ -9722,16 +10065,16 @@ var ts;
ts.isExpression = isExpression;
function isAssertionExpression(node) {
var kind = node.kind;
- return kind === 178 /* TypeAssertionExpression */
- || kind === 196 /* AsExpression */;
+ return kind === 181 /* TypeAssertionExpression */
+ || kind === 199 /* AsExpression */;
}
ts.isAssertionExpression = isAssertionExpression;
function isPartiallyEmittedExpression(node) {
- return node.kind === 288 /* PartiallyEmittedExpression */;
+ return node.kind === 292 /* PartiallyEmittedExpression */;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
function isNotEmittedStatement(node) {
- return node.kind === 287 /* NotEmittedStatement */;
+ return node.kind === 291 /* NotEmittedStatement */;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
function isNotEmittedOrPartiallyEmittedNode(node) {
@@ -9740,17 +10083,17 @@ var ts;
}
ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode;
function isOmittedExpression(node) {
- return node.kind === 194 /* OmittedExpression */;
+ return node.kind === 197 /* OmittedExpression */;
}
ts.isOmittedExpression = isOmittedExpression;
// Misc
function isTemplateSpan(node) {
- return node.kind === 198 /* TemplateSpan */;
+ return node.kind === 201 /* TemplateSpan */;
}
ts.isTemplateSpan = isTemplateSpan;
// Element
function isBlock(node) {
- return node.kind === 200 /* Block */;
+ return node.kind === 203 /* Block */;
}
ts.isBlock = isBlock;
function isConciseBody(node) {
@@ -9768,119 +10111,121 @@ var ts;
}
ts.isForInitializer = isForInitializer;
function isVariableDeclaration(node) {
- return node.kind === 219 /* VariableDeclaration */;
+ return node.kind === 222 /* VariableDeclaration */;
}
ts.isVariableDeclaration = isVariableDeclaration;
function isVariableDeclarationList(node) {
- return node.kind === 220 /* VariableDeclarationList */;
+ return node.kind === 223 /* VariableDeclarationList */;
}
ts.isVariableDeclarationList = isVariableDeclarationList;
function isCaseBlock(node) {
- return node.kind === 228 /* CaseBlock */;
+ return node.kind === 231 /* CaseBlock */;
}
ts.isCaseBlock = isCaseBlock;
function isModuleBody(node) {
var kind = node.kind;
- return kind === 227 /* ModuleBlock */
- || kind === 226 /* ModuleDeclaration */;
+ return kind === 230 /* ModuleBlock */
+ || kind === 229 /* ModuleDeclaration */;
}
ts.isModuleBody = isModuleBody;
function isImportEqualsDeclaration(node) {
- return node.kind === 230 /* ImportEqualsDeclaration */;
+ return node.kind === 233 /* ImportEqualsDeclaration */;
}
ts.isImportEqualsDeclaration = isImportEqualsDeclaration;
function isImportClause(node) {
- return node.kind === 232 /* ImportClause */;
+ return node.kind === 235 /* ImportClause */;
}
ts.isImportClause = isImportClause;
function isNamedImportBindings(node) {
var kind = node.kind;
- return kind === 234 /* NamedImports */
- || kind === 233 /* NamespaceImport */;
+ return kind === 237 /* NamedImports */
+ || kind === 236 /* NamespaceImport */;
}
ts.isNamedImportBindings = isNamedImportBindings;
function isImportSpecifier(node) {
- return node.kind === 235 /* ImportSpecifier */;
+ return node.kind === 238 /* ImportSpecifier */;
}
ts.isImportSpecifier = isImportSpecifier;
function isNamedExports(node) {
- return node.kind === 238 /* NamedExports */;
+ return node.kind === 241 /* NamedExports */;
}
ts.isNamedExports = isNamedExports;
function isExportSpecifier(node) {
- return node.kind === 239 /* ExportSpecifier */;
+ return node.kind === 242 /* ExportSpecifier */;
}
ts.isExportSpecifier = isExportSpecifier;
function isModuleOrEnumDeclaration(node) {
- return node.kind === 226 /* ModuleDeclaration */ || node.kind === 225 /* EnumDeclaration */;
+ return node.kind === 229 /* ModuleDeclaration */ || node.kind === 228 /* EnumDeclaration */;
}
ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration;
function isDeclarationKind(kind) {
- return kind === 181 /* ArrowFunction */
- || kind === 170 /* BindingElement */
- || kind === 222 /* ClassDeclaration */
- || kind === 193 /* ClassExpression */
- || kind === 149 /* Constructor */
- || kind === 225 /* EnumDeclaration */
- || kind === 255 /* EnumMember */
- || kind === 239 /* ExportSpecifier */
- || kind === 221 /* FunctionDeclaration */
- || kind === 180 /* FunctionExpression */
- || kind === 150 /* GetAccessor */
- || kind === 232 /* ImportClause */
- || kind === 230 /* ImportEqualsDeclaration */
- || kind === 235 /* ImportSpecifier */
- || kind === 223 /* InterfaceDeclaration */
- || kind === 148 /* MethodDeclaration */
- || kind === 147 /* MethodSignature */
- || kind === 226 /* ModuleDeclaration */
- || kind === 229 /* NamespaceExportDeclaration */
- || kind === 233 /* NamespaceImport */
- || kind === 143 /* Parameter */
- || kind === 253 /* PropertyAssignment */
- || kind === 146 /* PropertyDeclaration */
- || kind === 145 /* PropertySignature */
- || kind === 151 /* SetAccessor */
- || kind === 254 /* ShorthandPropertyAssignment */
- || kind === 224 /* TypeAliasDeclaration */
- || kind === 142 /* TypeParameter */
- || kind === 219 /* VariableDeclaration */
- || kind === 279 /* JSDocTypedefTag */;
+ return kind === 184 /* ArrowFunction */
+ || kind === 173 /* BindingElement */
+ || kind === 225 /* ClassDeclaration */
+ || kind === 196 /* ClassExpression */
+ || kind === 150 /* Constructor */
+ || kind === 228 /* EnumDeclaration */
+ || kind === 259 /* EnumMember */
+ || kind === 242 /* ExportSpecifier */
+ || kind === 224 /* FunctionDeclaration */
+ || kind === 183 /* FunctionExpression */
+ || kind === 151 /* GetAccessor */
+ || kind === 235 /* ImportClause */
+ || kind === 233 /* ImportEqualsDeclaration */
+ || kind === 238 /* ImportSpecifier */
+ || kind === 226 /* InterfaceDeclaration */
+ || kind === 149 /* MethodDeclaration */
+ || kind === 148 /* MethodSignature */
+ || kind === 229 /* ModuleDeclaration */
+ || kind === 232 /* NamespaceExportDeclaration */
+ || kind === 236 /* NamespaceImport */
+ || kind === 144 /* Parameter */
+ || kind === 256 /* PropertyAssignment */
+ || kind === 147 /* PropertyDeclaration */
+ || kind === 146 /* PropertySignature */
+ || kind === 152 /* SetAccessor */
+ || kind === 257 /* ShorthandPropertyAssignment */
+ || kind === 227 /* TypeAliasDeclaration */
+ || kind === 143 /* TypeParameter */
+ || kind === 222 /* VariableDeclaration */
+ || kind === 283 /* JSDocTypedefTag */;
}
function isDeclarationStatementKind(kind) {
- return kind === 221 /* FunctionDeclaration */
- || kind === 240 /* MissingDeclaration */
- || kind === 222 /* ClassDeclaration */
- || kind === 223 /* InterfaceDeclaration */
- || kind === 224 /* TypeAliasDeclaration */
- || kind === 225 /* EnumDeclaration */
- || kind === 226 /* ModuleDeclaration */
- || kind === 231 /* ImportDeclaration */
- || kind === 230 /* ImportEqualsDeclaration */
- || kind === 237 /* ExportDeclaration */
- || kind === 236 /* ExportAssignment */
- || kind === 229 /* NamespaceExportDeclaration */;
+ return kind === 224 /* FunctionDeclaration */
+ || kind === 243 /* MissingDeclaration */
+ || kind === 225 /* ClassDeclaration */
+ || kind === 226 /* InterfaceDeclaration */
+ || kind === 227 /* TypeAliasDeclaration */
+ || kind === 228 /* EnumDeclaration */
+ || kind === 229 /* ModuleDeclaration */
+ || kind === 234 /* ImportDeclaration */
+ || kind === 233 /* ImportEqualsDeclaration */
+ || kind === 240 /* ExportDeclaration */
+ || kind === 239 /* ExportAssignment */
+ || kind === 232 /* NamespaceExportDeclaration */;
}
function isStatementKindButNotDeclarationKind(kind) {
- return kind === 211 /* BreakStatement */
- || kind === 210 /* ContinueStatement */
- || kind === 218 /* DebuggerStatement */
- || kind === 205 /* DoStatement */
- || kind === 203 /* ExpressionStatement */
- || kind === 202 /* EmptyStatement */
- || kind === 208 /* ForInStatement */
- || kind === 209 /* ForOfStatement */
- || kind === 207 /* ForStatement */
- || kind === 204 /* IfStatement */
- || kind === 215 /* LabeledStatement */
- || kind === 212 /* ReturnStatement */
- || kind === 214 /* SwitchStatement */
- || kind === 216 /* ThrowStatement */
- || kind === 217 /* TryStatement */
- || kind === 201 /* VariableStatement */
- || kind === 206 /* WhileStatement */
- || kind === 213 /* WithStatement */
- || kind === 287 /* NotEmittedStatement */;
+ return kind === 214 /* BreakStatement */
+ || kind === 213 /* ContinueStatement */
+ || kind === 221 /* DebuggerStatement */
+ || kind === 208 /* DoStatement */
+ || kind === 206 /* ExpressionStatement */
+ || kind === 205 /* EmptyStatement */
+ || kind === 211 /* ForInStatement */
+ || kind === 212 /* ForOfStatement */
+ || kind === 210 /* ForStatement */
+ || kind === 207 /* IfStatement */
+ || kind === 218 /* LabeledStatement */
+ || kind === 215 /* ReturnStatement */
+ || kind === 217 /* SwitchStatement */
+ || kind === 219 /* ThrowStatement */
+ || kind === 220 /* TryStatement */
+ || kind === 204 /* VariableStatement */
+ || kind === 209 /* WhileStatement */
+ || kind === 216 /* WithStatement */
+ || kind === 291 /* NotEmittedStatement */
+ || kind === 294 /* EndOfDeclarationMarker */
+ || kind === 293 /* MergeDeclarationMarker */;
}
function isDeclaration(node) {
return isDeclarationKind(node.kind);
@@ -9901,93 +10246,93 @@ var ts;
var kind = node.kind;
return isStatementKindButNotDeclarationKind(kind)
|| isDeclarationStatementKind(kind)
- || kind === 200 /* Block */;
+ || kind === 203 /* Block */;
}
ts.isStatement = isStatement;
// Module references
function isModuleReference(node) {
var kind = node.kind;
- return kind === 241 /* ExternalModuleReference */
- || kind === 140 /* QualifiedName */
+ return kind === 244 /* ExternalModuleReference */
+ || kind === 141 /* QualifiedName */
|| kind === 70 /* Identifier */;
}
ts.isModuleReference = isModuleReference;
// JSX
function isJsxOpeningElement(node) {
- return node.kind === 244 /* JsxOpeningElement */;
+ return node.kind === 247 /* JsxOpeningElement */;
}
ts.isJsxOpeningElement = isJsxOpeningElement;
function isJsxClosingElement(node) {
- return node.kind === 245 /* JsxClosingElement */;
+ return node.kind === 248 /* JsxClosingElement */;
}
ts.isJsxClosingElement = isJsxClosingElement;
function isJsxTagNameExpression(node) {
var kind = node.kind;
return kind === 98 /* ThisKeyword */
|| kind === 70 /* Identifier */
- || kind === 173 /* PropertyAccessExpression */;
+ || kind === 176 /* PropertyAccessExpression */;
}
ts.isJsxTagNameExpression = isJsxTagNameExpression;
function isJsxChild(node) {
var kind = node.kind;
- return kind === 242 /* JsxElement */
- || kind === 248 /* JsxExpression */
- || kind === 243 /* JsxSelfClosingElement */
+ return kind === 245 /* JsxElement */
+ || kind === 251 /* JsxExpression */
+ || kind === 246 /* JsxSelfClosingElement */
|| kind === 10 /* JsxText */;
}
ts.isJsxChild = isJsxChild;
function isJsxAttributeLike(node) {
var kind = node.kind;
- return kind === 246 /* JsxAttribute */
- || kind === 247 /* JsxSpreadAttribute */;
+ return kind === 249 /* JsxAttribute */
+ || kind === 250 /* JsxSpreadAttribute */;
}
ts.isJsxAttributeLike = isJsxAttributeLike;
function isJsxSpreadAttribute(node) {
- return node.kind === 247 /* JsxSpreadAttribute */;
+ return node.kind === 250 /* JsxSpreadAttribute */;
}
ts.isJsxSpreadAttribute = isJsxSpreadAttribute;
function isJsxAttribute(node) {
- return node.kind === 246 /* JsxAttribute */;
+ return node.kind === 249 /* JsxAttribute */;
}
ts.isJsxAttribute = isJsxAttribute;
function isStringLiteralOrJsxExpression(node) {
var kind = node.kind;
return kind === 9 /* StringLiteral */
- || kind === 248 /* JsxExpression */;
+ || kind === 251 /* JsxExpression */;
}
ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression;
// Clauses
function isCaseOrDefaultClause(node) {
var kind = node.kind;
- return kind === 249 /* CaseClause */
- || kind === 250 /* DefaultClause */;
+ return kind === 252 /* CaseClause */
+ || kind === 253 /* DefaultClause */;
}
ts.isCaseOrDefaultClause = isCaseOrDefaultClause;
function isHeritageClause(node) {
- return node.kind === 251 /* HeritageClause */;
+ return node.kind === 254 /* HeritageClause */;
}
ts.isHeritageClause = isHeritageClause;
function isCatchClause(node) {
- return node.kind === 252 /* CatchClause */;
+ return node.kind === 255 /* CatchClause */;
}
ts.isCatchClause = isCatchClause;
// Property assignments
function isPropertyAssignment(node) {
- return node.kind === 253 /* PropertyAssignment */;
+ return node.kind === 256 /* PropertyAssignment */;
}
ts.isPropertyAssignment = isPropertyAssignment;
function isShorthandPropertyAssignment(node) {
- return node.kind === 254 /* ShorthandPropertyAssignment */;
+ return node.kind === 257 /* ShorthandPropertyAssignment */;
}
ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment;
// Enum
function isEnumMember(node) {
- return node.kind === 255 /* EnumMember */;
+ return node.kind === 259 /* EnumMember */;
}
ts.isEnumMember = isEnumMember;
// Top-level nodes
function isSourceFile(node) {
- return node.kind === 256 /* SourceFile */;
+ return node.kind === 260 /* SourceFile */;
}
ts.isSourceFile = isSourceFile;
function isWatchSet(options) {
@@ -9999,6 +10344,7 @@ var ts;
(function (ts) {
function getDefaultLibFileName(options) {
switch (options.target) {
+ case 5 /* ESNext */:
case 4 /* ES2017 */:
return "lib.es2017.d.ts";
case 3 /* ES2016 */:
@@ -10216,9 +10562,9 @@ var ts;
}
ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions;
function getTypeParameterOwner(d) {
- if (d && d.kind === 142 /* TypeParameter */) {
+ if (d && d.kind === 143 /* TypeParameter */) {
for (var current = d; current; current = current.parent) {
- if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 223 /* InterfaceDeclaration */) {
+ if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 226 /* InterfaceDeclaration */) {
return current;
}
}
@@ -10226,11 +10572,11 @@ var ts;
}
ts.getTypeParameterOwner = getTypeParameterOwner;
function isParameterPropertyDeclaration(node) {
- return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 149 /* Constructor */ && ts.isClassLike(node.parent.parent);
+ return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 150 /* Constructor */ && ts.isClassLike(node.parent.parent);
}
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
function walkUpBindingElementsAndPatterns(node) {
- while (node && (node.kind === 170 /* BindingElement */ || ts.isBindingPattern(node))) {
+ while (node && (node.kind === 173 /* BindingElement */ || ts.isBindingPattern(node))) {
node = node.parent;
}
return node;
@@ -10238,14 +10584,14 @@ var ts;
function getCombinedModifierFlags(node) {
node = walkUpBindingElementsAndPatterns(node);
var flags = ts.getModifierFlags(node);
- if (node.kind === 219 /* VariableDeclaration */) {
+ if (node.kind === 222 /* VariableDeclaration */) {
node = node.parent;
}
- if (node && node.kind === 220 /* VariableDeclarationList */) {
+ if (node && node.kind === 223 /* VariableDeclarationList */) {
flags |= ts.getModifierFlags(node);
node = node.parent;
}
- if (node && node.kind === 201 /* VariableStatement */) {
+ if (node && node.kind === 204 /* VariableStatement */) {
flags |= ts.getModifierFlags(node);
}
return flags;
@@ -10261,14 +10607,14 @@ var ts;
function getCombinedNodeFlags(node) {
node = walkUpBindingElementsAndPatterns(node);
var flags = node.flags;
- if (node.kind === 219 /* VariableDeclaration */) {
+ if (node.kind === 222 /* VariableDeclaration */) {
node = node.parent;
}
- if (node && node.kind === 220 /* VariableDeclarationList */) {
+ if (node && node.kind === 223 /* VariableDeclarationList */) {
flags |= node.flags;
node = node.parent;
}
- if (node && node.kind === 201 /* VariableStatement */) {
+ if (node && node.kind === 204 /* VariableStatement */) {
flags |= node.flags;
}
return flags;
@@ -10283,7 +10629,7 @@ var ts;
var NodeConstructor;
var SourceFileConstructor;
function createNode(kind, location, flags) {
- var ConstructorForKind = kind === 256 /* SourceFile */
+ var ConstructorForKind = kind === 260 /* SourceFile */
? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))
: (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()));
var node = location
@@ -10466,7 +10812,7 @@ var ts;
ts.createNull = createNull;
// Names
function createComputedPropertyName(expression, location) {
- var node = createNode(141 /* ComputedPropertyName */, location);
+ var node = createNode(142 /* ComputedPropertyName */, location);
node.expression = expression;
return node;
}
@@ -10479,17 +10825,8 @@ var ts;
}
ts.updateComputedPropertyName = updateComputedPropertyName;
// Signature elements
- function createParameter(name, initializer, location) {
- return createParameterDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined,
- /*dotDotDotToken*/ undefined, name,
- /*questionToken*/ undefined,
- /*type*/ undefined, initializer, location);
- }
- ts.createParameter = createParameter;
- function createParameterDeclaration(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) {
- var node = createNode(143 /* Parameter */, location, flags);
+ function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) {
+ var node = createNode(144 /* Parameter */, location, flags);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.dotDotDotToken = dotDotDotToken;
@@ -10499,17 +10836,17 @@ var ts;
node.initializer = initializer ? parenthesizeExpressionForList(initializer) : undefined;
return node;
}
- ts.createParameterDeclaration = createParameterDeclaration;
- function updateParameterDeclaration(node, decorators, modifiers, name, type, initializer) {
+ ts.createParameter = createParameter;
+ function updateParameter(node, decorators, modifiers, name, type, initializer) {
if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) {
- return updateNode(createParameterDeclaration(decorators, modifiers, node.dotDotDotToken, name, node.questionToken, type, initializer, /*location*/ node, /*flags*/ node.flags), node);
+ return updateNode(createParameter(decorators, modifiers, node.dotDotDotToken, name, node.questionToken, type, initializer, /*location*/ node, /*flags*/ node.flags), node);
}
return node;
}
- ts.updateParameterDeclaration = updateParameterDeclaration;
+ ts.updateParameter = updateParameter;
// Type members
function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) {
- var node = createNode(146 /* PropertyDeclaration */, location);
+ var node = createNode(147 /* PropertyDeclaration */, location);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.name = typeof name === "string" ? createIdentifier(name) : name;
@@ -10527,7 +10864,7 @@ var ts;
}
ts.updateProperty = updateProperty;
function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {
- var node = createNode(148 /* MethodDeclaration */, location, flags);
+ var node = createNode(149 /* MethodDeclaration */, location, flags);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.asteriskToken = asteriskToken;
@@ -10547,7 +10884,7 @@ var ts;
}
ts.updateMethod = updateMethod;
function createConstructor(decorators, modifiers, parameters, body, location, flags) {
- var node = createNode(149 /* Constructor */, location, flags);
+ var node = createNode(150 /* Constructor */, location, flags);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.typeParameters = undefined;
@@ -10565,7 +10902,7 @@ var ts;
}
ts.updateConstructor = updateConstructor;
function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) {
- var node = createNode(150 /* GetAccessor */, location, flags);
+ var node = createNode(151 /* GetAccessor */, location, flags);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.name = typeof name === "string" ? createIdentifier(name) : name;
@@ -10584,7 +10921,7 @@ var ts;
}
ts.updateGetAccessor = updateGetAccessor;
function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) {
- var node = createNode(151 /* SetAccessor */, location, flags);
+ var node = createNode(152 /* SetAccessor */, location, flags);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.name = typeof name === "string" ? createIdentifier(name) : name;
@@ -10603,7 +10940,7 @@ var ts;
ts.updateSetAccessor = updateSetAccessor;
// Binding Patterns
function createObjectBindingPattern(elements, location) {
- var node = createNode(168 /* ObjectBindingPattern */, location);
+ var node = createNode(171 /* ObjectBindingPattern */, location);
node.elements = createNodeArray(elements);
return node;
}
@@ -10616,7 +10953,7 @@ var ts;
}
ts.updateObjectBindingPattern = updateObjectBindingPattern;
function createArrayBindingPattern(elements, location) {
- var node = createNode(169 /* ArrayBindingPattern */, location);
+ var node = createNode(172 /* ArrayBindingPattern */, location);
node.elements = createNodeArray(elements);
return node;
}
@@ -10629,7 +10966,7 @@ var ts;
}
ts.updateArrayBindingPattern = updateArrayBindingPattern;
function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) {
- var node = createNode(170 /* BindingElement */, location);
+ var node = createNode(173 /* BindingElement */, location);
node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName;
node.dotDotDotToken = dotDotDotToken;
node.name = typeof name === "string" ? createIdentifier(name) : name;
@@ -10646,7 +10983,7 @@ var ts;
ts.updateBindingElement = updateBindingElement;
// Expression
function createArrayLiteral(elements, location, multiLine) {
- var node = createNode(171 /* ArrayLiteralExpression */, location);
+ var node = createNode(174 /* ArrayLiteralExpression */, location);
node.elements = parenthesizeListElements(createNodeArray(elements));
if (multiLine) {
node.multiLine = true;
@@ -10662,7 +10999,7 @@ var ts;
}
ts.updateArrayLiteral = updateArrayLiteral;
function createObjectLiteral(properties, location, multiLine) {
- var node = createNode(172 /* ObjectLiteralExpression */, location);
+ var node = createNode(175 /* ObjectLiteralExpression */, location);
node.properties = createNodeArray(properties);
if (multiLine) {
node.multiLine = true;
@@ -10678,7 +11015,7 @@ var ts;
}
ts.updateObjectLiteral = updateObjectLiteral;
function createPropertyAccess(expression, name, location, flags) {
- var node = createNode(173 /* PropertyAccessExpression */, location, flags);
+ var node = createNode(176 /* PropertyAccessExpression */, location, flags);
node.expression = parenthesizeForAccess(expression);
(node.emitNode || (node.emitNode = {})).flags |= 1048576 /* NoIndentation */;
node.name = typeof name === "string" ? createIdentifier(name) : name;
@@ -10696,7 +11033,7 @@ var ts;
}
ts.updatePropertyAccess = updatePropertyAccess;
function createElementAccess(expression, index, location) {
- var node = createNode(174 /* ElementAccessExpression */, location);
+ var node = createNode(177 /* ElementAccessExpression */, location);
node.expression = parenthesizeForAccess(expression);
node.argumentExpression = typeof index === "number" ? createLiteral(index) : index;
return node;
@@ -10710,7 +11047,7 @@ var ts;
}
ts.updateElementAccess = updateElementAccess;
function createCall(expression, typeArguments, argumentsArray, location, flags) {
- var node = createNode(175 /* CallExpression */, location, flags);
+ var node = createNode(178 /* CallExpression */, location, flags);
node.expression = parenthesizeForAccess(expression);
if (typeArguments) {
node.typeArguments = createNodeArray(typeArguments);
@@ -10727,7 +11064,7 @@ var ts;
}
ts.updateCall = updateCall;
function createNew(expression, typeArguments, argumentsArray, location, flags) {
- var node = createNode(176 /* NewExpression */, location, flags);
+ var node = createNode(179 /* NewExpression */, location, flags);
node.expression = parenthesizeForNew(expression);
node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined;
node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined;
@@ -10742,7 +11079,7 @@ var ts;
}
ts.updateNew = updateNew;
function createTaggedTemplate(tag, template, location) {
- var node = createNode(177 /* TaggedTemplateExpression */, location);
+ var node = createNode(180 /* TaggedTemplateExpression */, location);
node.tag = parenthesizeForAccess(tag);
node.template = template;
return node;
@@ -10756,7 +11093,7 @@ var ts;
}
ts.updateTaggedTemplate = updateTaggedTemplate;
function createParen(expression, location) {
- var node = createNode(179 /* ParenthesizedExpression */, location);
+ var node = createNode(182 /* ParenthesizedExpression */, location);
node.expression = expression;
return node;
}
@@ -10769,7 +11106,7 @@ var ts;
}
ts.updateParen = updateParen;
function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {
- var node = createNode(180 /* FunctionExpression */, location, flags);
+ var node = createNode(183 /* FunctionExpression */, location, flags);
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.asteriskToken = asteriskToken;
node.name = typeof name === "string" ? createIdentifier(name) : name;
@@ -10788,7 +11125,7 @@ var ts;
}
ts.updateFunctionExpression = updateFunctionExpression;
function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) {
- var node = createNode(181 /* ArrowFunction */, location, flags);
+ var node = createNode(184 /* ArrowFunction */, location, flags);
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined;
node.parameters = createNodeArray(parameters);
@@ -10806,7 +11143,7 @@ var ts;
}
ts.updateArrowFunction = updateArrowFunction;
function createDelete(expression, location) {
- var node = createNode(182 /* DeleteExpression */, location);
+ var node = createNode(185 /* DeleteExpression */, location);
node.expression = parenthesizePrefixOperand(expression);
return node;
}
@@ -10819,7 +11156,7 @@ var ts;
}
ts.updateDelete = updateDelete;
function createTypeOf(expression, location) {
- var node = createNode(183 /* TypeOfExpression */, location);
+ var node = createNode(186 /* TypeOfExpression */, location);
node.expression = parenthesizePrefixOperand(expression);
return node;
}
@@ -10832,7 +11169,7 @@ var ts;
}
ts.updateTypeOf = updateTypeOf;
function createVoid(expression, location) {
- var node = createNode(184 /* VoidExpression */, location);
+ var node = createNode(187 /* VoidExpression */, location);
node.expression = parenthesizePrefixOperand(expression);
return node;
}
@@ -10845,7 +11182,7 @@ var ts;
}
ts.updateVoid = updateVoid;
function createAwait(expression, location) {
- var node = createNode(185 /* AwaitExpression */, location);
+ var node = createNode(188 /* AwaitExpression */, location);
node.expression = parenthesizePrefixOperand(expression);
return node;
}
@@ -10858,7 +11195,7 @@ var ts;
}
ts.updateAwait = updateAwait;
function createPrefix(operator, operand, location) {
- var node = createNode(186 /* PrefixUnaryExpression */, location);
+ var node = createNode(189 /* PrefixUnaryExpression */, location);
node.operator = operator;
node.operand = parenthesizePrefixOperand(operand);
return node;
@@ -10872,7 +11209,7 @@ var ts;
}
ts.updatePrefix = updatePrefix;
function createPostfix(operand, operator, location) {
- var node = createNode(187 /* PostfixUnaryExpression */, location);
+ var node = createNode(190 /* PostfixUnaryExpression */, location);
node.operand = parenthesizePostfixOperand(operand);
node.operator = operator;
return node;
@@ -10888,7 +11225,7 @@ var ts;
function createBinary(left, operator, right, location) {
var operatorToken = typeof operator === "number" ? createToken(operator) : operator;
var operatorKind = operatorToken.kind;
- var node = createNode(188 /* BinaryExpression */, location);
+ var node = createNode(191 /* BinaryExpression */, location);
node.left = parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined);
node.operatorToken = operatorToken;
node.right = parenthesizeBinaryOperand(operatorKind, right, /*isLeftSideOfBinary*/ false, node.left);
@@ -10903,7 +11240,7 @@ var ts;
}
ts.updateBinary = updateBinary;
function createConditional(condition, questionToken, whenTrue, colonToken, whenFalse, location) {
- var node = createNode(189 /* ConditionalExpression */, location);
+ var node = createNode(192 /* ConditionalExpression */, location);
node.condition = condition;
node.questionToken = questionToken;
node.whenTrue = whenTrue;
@@ -10920,7 +11257,7 @@ var ts;
}
ts.updateConditional = updateConditional;
function createTemplateExpression(head, templateSpans, location) {
- var node = createNode(190 /* TemplateExpression */, location);
+ var node = createNode(193 /* TemplateExpression */, location);
node.head = head;
node.templateSpans = createNodeArray(templateSpans);
return node;
@@ -10934,7 +11271,7 @@ var ts;
}
ts.updateTemplateExpression = updateTemplateExpression;
function createYield(asteriskToken, expression, location) {
- var node = createNode(191 /* YieldExpression */, location);
+ var node = createNode(194 /* YieldExpression */, location);
node.asteriskToken = asteriskToken;
node.expression = expression;
return node;
@@ -10948,7 +11285,7 @@ var ts;
}
ts.updateYield = updateYield;
function createSpread(expression, location) {
- var node = createNode(192 /* SpreadElementExpression */, location);
+ var node = createNode(195 /* SpreadElement */, location);
node.expression = parenthesizeExpressionForList(expression);
return node;
}
@@ -10961,7 +11298,7 @@ var ts;
}
ts.updateSpread = updateSpread;
function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) {
- var node = createNode(193 /* ClassExpression */, location);
+ var node = createNode(196 /* ClassExpression */, location);
node.decorators = undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.name = name;
@@ -10979,12 +11316,12 @@ var ts;
}
ts.updateClassExpression = updateClassExpression;
function createOmittedExpression(location) {
- var node = createNode(194 /* OmittedExpression */, location);
+ var node = createNode(197 /* OmittedExpression */, location);
return node;
}
ts.createOmittedExpression = createOmittedExpression;
function createExpressionWithTypeArguments(typeArguments, expression, location) {
- var node = createNode(195 /* ExpressionWithTypeArguments */, location);
+ var node = createNode(198 /* ExpressionWithTypeArguments */, location);
node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined;
node.expression = parenthesizeForAccess(expression);
return node;
@@ -10999,7 +11336,7 @@ var ts;
ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments;
// Misc
function createTemplateSpan(expression, literal, location) {
- var node = createNode(198 /* TemplateSpan */, location);
+ var node = createNode(201 /* TemplateSpan */, location);
node.expression = expression;
node.literal = literal;
return node;
@@ -11014,7 +11351,7 @@ var ts;
ts.updateTemplateSpan = updateTemplateSpan;
// Element
function createBlock(statements, location, multiLine, flags) {
- var block = createNode(200 /* Block */, location, flags);
+ var block = createNode(203 /* Block */, location, flags);
block.statements = createNodeArray(statements);
if (multiLine) {
block.multiLine = true;
@@ -11030,7 +11367,7 @@ var ts;
}
ts.updateBlock = updateBlock;
function createVariableStatement(modifiers, declarationList, location, flags) {
- var node = createNode(201 /* VariableStatement */, location, flags);
+ var node = createNode(204 /* VariableStatement */, location, flags);
node.decorators = undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList;
@@ -11045,7 +11382,7 @@ var ts;
}
ts.updateVariableStatement = updateVariableStatement;
function createVariableDeclarationList(declarations, location, flags) {
- var node = createNode(220 /* VariableDeclarationList */, location, flags);
+ var node = createNode(223 /* VariableDeclarationList */, location, flags);
node.declarations = createNodeArray(declarations);
return node;
}
@@ -11058,7 +11395,7 @@ var ts;
}
ts.updateVariableDeclarationList = updateVariableDeclarationList;
function createVariableDeclaration(name, type, initializer, location, flags) {
- var node = createNode(219 /* VariableDeclaration */, location, flags);
+ var node = createNode(222 /* VariableDeclaration */, location, flags);
node.name = typeof name === "string" ? createIdentifier(name) : name;
node.type = type;
node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined;
@@ -11073,11 +11410,11 @@ var ts;
}
ts.updateVariableDeclaration = updateVariableDeclaration;
function createEmptyStatement(location) {
- return createNode(202 /* EmptyStatement */, location);
+ return createNode(205 /* EmptyStatement */, location);
}
ts.createEmptyStatement = createEmptyStatement;
function createStatement(expression, location, flags) {
- var node = createNode(203 /* ExpressionStatement */, location, flags);
+ var node = createNode(206 /* ExpressionStatement */, location, flags);
node.expression = parenthesizeExpressionForExpressionStatement(expression);
return node;
}
@@ -11090,7 +11427,7 @@ var ts;
}
ts.updateStatement = updateStatement;
function createIf(expression, thenStatement, elseStatement, location) {
- var node = createNode(204 /* IfStatement */, location);
+ var node = createNode(207 /* IfStatement */, location);
node.expression = expression;
node.thenStatement = thenStatement;
node.elseStatement = elseStatement;
@@ -11105,7 +11442,7 @@ var ts;
}
ts.updateIf = updateIf;
function createDo(statement, expression, location) {
- var node = createNode(205 /* DoStatement */, location);
+ var node = createNode(208 /* DoStatement */, location);
node.statement = statement;
node.expression = expression;
return node;
@@ -11119,7 +11456,7 @@ var ts;
}
ts.updateDo = updateDo;
function createWhile(expression, statement, location) {
- var node = createNode(206 /* WhileStatement */, location);
+ var node = createNode(209 /* WhileStatement */, location);
node.expression = expression;
node.statement = statement;
return node;
@@ -11133,7 +11470,7 @@ var ts;
}
ts.updateWhile = updateWhile;
function createFor(initializer, condition, incrementor, statement, location) {
- var node = createNode(207 /* ForStatement */, location, /*flags*/ undefined);
+ var node = createNode(210 /* ForStatement */, location, /*flags*/ undefined);
node.initializer = initializer;
node.condition = condition;
node.incrementor = incrementor;
@@ -11149,7 +11486,7 @@ var ts;
}
ts.updateFor = updateFor;
function createForIn(initializer, expression, statement, location) {
- var node = createNode(208 /* ForInStatement */, location);
+ var node = createNode(211 /* ForInStatement */, location);
node.initializer = initializer;
node.expression = expression;
node.statement = statement;
@@ -11164,7 +11501,7 @@ var ts;
}
ts.updateForIn = updateForIn;
function createForOf(initializer, expression, statement, location) {
- var node = createNode(209 /* ForOfStatement */, location);
+ var node = createNode(212 /* ForOfStatement */, location);
node.initializer = initializer;
node.expression = expression;
node.statement = statement;
@@ -11179,7 +11516,7 @@ var ts;
}
ts.updateForOf = updateForOf;
function createContinue(label, location) {
- var node = createNode(210 /* ContinueStatement */, location);
+ var node = createNode(213 /* ContinueStatement */, location);
if (label) {
node.label = label;
}
@@ -11194,7 +11531,7 @@ var ts;
}
ts.updateContinue = updateContinue;
function createBreak(label, location) {
- var node = createNode(211 /* BreakStatement */, location);
+ var node = createNode(214 /* BreakStatement */, location);
if (label) {
node.label = label;
}
@@ -11209,7 +11546,7 @@ var ts;
}
ts.updateBreak = updateBreak;
function createReturn(expression, location) {
- var node = createNode(212 /* ReturnStatement */, location);
+ var node = createNode(215 /* ReturnStatement */, location);
node.expression = expression;
return node;
}
@@ -11222,7 +11559,7 @@ var ts;
}
ts.updateReturn = updateReturn;
function createWith(expression, statement, location) {
- var node = createNode(213 /* WithStatement */, location);
+ var node = createNode(216 /* WithStatement */, location);
node.expression = expression;
node.statement = statement;
return node;
@@ -11236,7 +11573,7 @@ var ts;
}
ts.updateWith = updateWith;
function createSwitch(expression, caseBlock, location) {
- var node = createNode(214 /* SwitchStatement */, location);
+ var node = createNode(217 /* SwitchStatement */, location);
node.expression = parenthesizeExpressionForList(expression);
node.caseBlock = caseBlock;
return node;
@@ -11250,7 +11587,7 @@ var ts;
}
ts.updateSwitch = updateSwitch;
function createLabel(label, statement, location) {
- var node = createNode(215 /* LabeledStatement */, location);
+ var node = createNode(218 /* LabeledStatement */, location);
node.label = typeof label === "string" ? createIdentifier(label) : label;
node.statement = statement;
return node;
@@ -11264,7 +11601,7 @@ var ts;
}
ts.updateLabel = updateLabel;
function createThrow(expression, location) {
- var node = createNode(216 /* ThrowStatement */, location);
+ var node = createNode(219 /* ThrowStatement */, location);
node.expression = expression;
return node;
}
@@ -11277,7 +11614,7 @@ var ts;
}
ts.updateThrow = updateThrow;
function createTry(tryBlock, catchClause, finallyBlock, location) {
- var node = createNode(217 /* TryStatement */, location);
+ var node = createNode(220 /* TryStatement */, location);
node.tryBlock = tryBlock;
node.catchClause = catchClause;
node.finallyBlock = finallyBlock;
@@ -11292,7 +11629,7 @@ var ts;
}
ts.updateTry = updateTry;
function createCaseBlock(clauses, location) {
- var node = createNode(228 /* CaseBlock */, location);
+ var node = createNode(231 /* CaseBlock */, location);
node.clauses = createNodeArray(clauses);
return node;
}
@@ -11305,7 +11642,7 @@ var ts;
}
ts.updateCaseBlock = updateCaseBlock;
function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) {
- var node = createNode(221 /* FunctionDeclaration */, location, flags);
+ var node = createNode(224 /* FunctionDeclaration */, location, flags);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.asteriskToken = asteriskToken;
@@ -11325,7 +11662,7 @@ var ts;
}
ts.updateFunctionDeclaration = updateFunctionDeclaration;
function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) {
- var node = createNode(222 /* ClassDeclaration */, location);
+ var node = createNode(225 /* ClassDeclaration */, location);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.name = name;
@@ -11343,7 +11680,7 @@ var ts;
}
ts.updateClassDeclaration = updateClassDeclaration;
function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) {
- var node = createNode(231 /* ImportDeclaration */, location);
+ var node = createNode(234 /* ImportDeclaration */, location);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.importClause = importClause;
@@ -11359,7 +11696,7 @@ var ts;
}
ts.updateImportDeclaration = updateImportDeclaration;
function createImportClause(name, namedBindings, location) {
- var node = createNode(232 /* ImportClause */, location);
+ var node = createNode(235 /* ImportClause */, location);
node.name = name;
node.namedBindings = namedBindings;
return node;
@@ -11373,7 +11710,7 @@ var ts;
}
ts.updateImportClause = updateImportClause;
function createNamespaceImport(name, location) {
- var node = createNode(233 /* NamespaceImport */, location);
+ var node = createNode(236 /* NamespaceImport */, location);
node.name = name;
return node;
}
@@ -11386,7 +11723,7 @@ var ts;
}
ts.updateNamespaceImport = updateNamespaceImport;
function createNamedImports(elements, location) {
- var node = createNode(234 /* NamedImports */, location);
+ var node = createNode(237 /* NamedImports */, location);
node.elements = createNodeArray(elements);
return node;
}
@@ -11399,7 +11736,7 @@ var ts;
}
ts.updateNamedImports = updateNamedImports;
function createImportSpecifier(propertyName, name, location) {
- var node = createNode(235 /* ImportSpecifier */, location);
+ var node = createNode(238 /* ImportSpecifier */, location);
node.propertyName = propertyName;
node.name = name;
return node;
@@ -11413,7 +11750,7 @@ var ts;
}
ts.updateImportSpecifier = updateImportSpecifier;
function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) {
- var node = createNode(236 /* ExportAssignment */, location);
+ var node = createNode(239 /* ExportAssignment */, location);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.isExportEquals = isExportEquals;
@@ -11429,7 +11766,7 @@ var ts;
}
ts.updateExportAssignment = updateExportAssignment;
function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) {
- var node = createNode(237 /* ExportDeclaration */, location);
+ var node = createNode(240 /* ExportDeclaration */, location);
node.decorators = decorators ? createNodeArray(decorators) : undefined;
node.modifiers = modifiers ? createNodeArray(modifiers) : undefined;
node.exportClause = exportClause;
@@ -11445,7 +11782,7 @@ var ts;
}
ts.updateExportDeclaration = updateExportDeclaration;
function createNamedExports(elements, location) {
- var node = createNode(238 /* NamedExports */, location);
+ var node = createNode(241 /* NamedExports */, location);
node.elements = createNodeArray(elements);
return node;
}
@@ -11458,7 +11795,7 @@ var ts;
}
ts.updateNamedExports = updateNamedExports;
function createExportSpecifier(name, propertyName, location) {
- var node = createNode(239 /* ExportSpecifier */, location);
+ var node = createNode(242 /* ExportSpecifier */, location);
node.name = typeof name === "string" ? createIdentifier(name) : name;
node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName;
return node;
@@ -11473,7 +11810,7 @@ var ts;
ts.updateExportSpecifier = updateExportSpecifier;
// JSX
function createJsxElement(openingElement, children, closingElement, location) {
- var node = createNode(242 /* JsxElement */, location);
+ var node = createNode(245 /* JsxElement */, location);
node.openingElement = openingElement;
node.children = createNodeArray(children);
node.closingElement = closingElement;
@@ -11488,7 +11825,7 @@ var ts;
}
ts.updateJsxElement = updateJsxElement;
function createJsxSelfClosingElement(tagName, attributes, location) {
- var node = createNode(243 /* JsxSelfClosingElement */, location);
+ var node = createNode(246 /* JsxSelfClosingElement */, location);
node.tagName = tagName;
node.attributes = createNodeArray(attributes);
return node;
@@ -11502,7 +11839,7 @@ var ts;
}
ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement;
function createJsxOpeningElement(tagName, attributes, location) {
- var node = createNode(244 /* JsxOpeningElement */, location);
+ var node = createNode(247 /* JsxOpeningElement */, location);
node.tagName = tagName;
node.attributes = createNodeArray(attributes);
return node;
@@ -11516,7 +11853,7 @@ var ts;
}
ts.updateJsxOpeningElement = updateJsxOpeningElement;
function createJsxClosingElement(tagName, location) {
- var node = createNode(245 /* JsxClosingElement */, location);
+ var node = createNode(248 /* JsxClosingElement */, location);
node.tagName = tagName;
return node;
}
@@ -11529,7 +11866,7 @@ var ts;
}
ts.updateJsxClosingElement = updateJsxClosingElement;
function createJsxAttribute(name, initializer, location) {
- var node = createNode(246 /* JsxAttribute */, location);
+ var node = createNode(249 /* JsxAttribute */, location);
node.name = name;
node.initializer = initializer;
return node;
@@ -11543,7 +11880,7 @@ var ts;
}
ts.updateJsxAttribute = updateJsxAttribute;
function createJsxSpreadAttribute(expression, location) {
- var node = createNode(247 /* JsxSpreadAttribute */, location);
+ var node = createNode(250 /* JsxSpreadAttribute */, location);
node.expression = expression;
return node;
}
@@ -11556,7 +11893,7 @@ var ts;
}
ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute;
function createJsxExpression(expression, location) {
- var node = createNode(248 /* JsxExpression */, location);
+ var node = createNode(251 /* JsxExpression */, location);
node.expression = expression;
return node;
}
@@ -11570,7 +11907,7 @@ var ts;
ts.updateJsxExpression = updateJsxExpression;
// Clauses
function createHeritageClause(token, types, location) {
- var node = createNode(251 /* HeritageClause */, location);
+ var node = createNode(254 /* HeritageClause */, location);
node.token = token;
node.types = createNodeArray(types);
return node;
@@ -11584,7 +11921,7 @@ var ts;
}
ts.updateHeritageClause = updateHeritageClause;
function createCaseClause(expression, statements, location) {
- var node = createNode(249 /* CaseClause */, location);
+ var node = createNode(252 /* CaseClause */, location);
node.expression = parenthesizeExpressionForList(expression);
node.statements = createNodeArray(statements);
return node;
@@ -11598,7 +11935,7 @@ var ts;
}
ts.updateCaseClause = updateCaseClause;
function createDefaultClause(statements, location) {
- var node = createNode(250 /* DefaultClause */, location);
+ var node = createNode(253 /* DefaultClause */, location);
node.statements = createNodeArray(statements);
return node;
}
@@ -11611,7 +11948,7 @@ var ts;
}
ts.updateDefaultClause = updateDefaultClause;
function createCatchClause(variableDeclaration, block, location) {
- var node = createNode(252 /* CatchClause */, location);
+ var node = createNode(255 /* CatchClause */, location);
node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration;
node.block = block;
return node;
@@ -11626,7 +11963,7 @@ var ts;
ts.updateCatchClause = updateCatchClause;
// Property assignments
function createPropertyAssignment(name, initializer, location) {
- var node = createNode(253 /* PropertyAssignment */, location);
+ var node = createNode(256 /* PropertyAssignment */, location);
node.name = typeof name === "string" ? createIdentifier(name) : name;
node.questionToken = undefined;
node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined;
@@ -11641,12 +11978,18 @@ var ts;
}
ts.updatePropertyAssignment = updatePropertyAssignment;
function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) {
- var node = createNode(254 /* ShorthandPropertyAssignment */, location);
+ var node = createNode(257 /* ShorthandPropertyAssignment */, location);
node.name = typeof name === "string" ? createIdentifier(name) : name;
node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined;
return node;
}
ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment;
+ function createSpreadAssignment(expression, location) {
+ var node = createNode(258 /* SpreadAssignment */, location);
+ node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined;
+ return node;
+ }
+ ts.createSpreadAssignment = createSpreadAssignment;
function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) {
if (node.name !== name || node.objectAssignmentInitializer !== objectAssignmentInitializer) {
return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer, node), node);
@@ -11654,10 +11997,17 @@ var ts;
return node;
}
ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment;
+ function updateSpreadAssignment(node, expression) {
+ if (node.expression !== expression) {
+ return updateNode(createSpreadAssignment(expression, node), node);
+ }
+ return node;
+ }
+ ts.updateSpreadAssignment = updateSpreadAssignment;
// Top-level nodes
function updateSourceFileNode(node, statements) {
if (node.statements !== statements) {
- var updated = createNode(256 /* SourceFile */, /*location*/ node, node.flags);
+ var updated = createNode(260 /* SourceFile */, /*location*/ node, node.flags);
updated.statements = createNodeArray(statements);
updated.endOfFileToken = node.endOfFileToken;
updated.fileName = node.fileName;
@@ -11726,11 +12076,33 @@ var ts;
* @param original The original statement.
*/
function createNotEmittedStatement(original) {
- var node = createNode(287 /* NotEmittedStatement */, /*location*/ original);
+ var node = createNode(291 /* NotEmittedStatement */, /*location*/ original);
node.original = original;
return node;
}
ts.createNotEmittedStatement = createNotEmittedStatement;
+ /**
+ * Creates a synthetic element to act as a placeholder for the end of an emitted declaration in
+ * order to properly emit exports.
+ */
+ function createEndOfDeclarationMarker(original) {
+ var node = createNode(294 /* EndOfDeclarationMarker */);
+ node.emitNode = {};
+ node.original = original;
+ return node;
+ }
+ ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker;
+ /**
+ * Creates a synthetic element to act as a placeholder for the beginning of a merged declaration in
+ * order to properly emit exports.
+ */
+ function createMergeDeclarationMarker(original) {
+ var node = createNode(293 /* MergeDeclarationMarker */);
+ node.emitNode = {};
+ node.original = original;
+ return node;
+ }
+ ts.createMergeDeclarationMarker = createMergeDeclarationMarker;
/**
* Creates a synthetic expression to act as a placeholder for a not-emitted expression in
* order to preserve comments or sourcemap positions.
@@ -11740,7 +12112,7 @@ var ts;
* @param location The location for the expression. Defaults to the positions from "original" if provided.
*/
function createPartiallyEmittedExpression(expression, original, location) {
- var node = createNode(288 /* PartiallyEmittedExpression */, /*location*/ location || original);
+ var node = createNode(292 /* PartiallyEmittedExpression */, /*location*/ location || original);
node.expression = expression;
node.original = original;
return node;
@@ -11813,15 +12185,6 @@ var ts;
}
}
ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName;
- function createRestParameter(name) {
- return createParameterDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, createToken(23 /* DotDotDotToken */), name,
- /*questionToken*/ undefined,
- /*type*/ undefined,
- /*initializer*/ undefined);
- }
- ts.createRestParameter = createRestParameter;
function createFunctionCall(func, thisArg, argumentsList, location) {
return createCall(createPropertyAccess(func, "call"),
/*typeArguments*/ undefined, [
@@ -11866,7 +12229,20 @@ var ts;
react.parent = ts.getParseTreeNode(parent);
return react;
}
- function createReactCreateElement(reactNamespace, tagName, props, children, parentElement, location) {
+ function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) {
+ if (ts.isQualifiedName(jsxFactory)) {
+ return createPropertyAccess(createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent), setEmitFlags(getMutableClone(jsxFactory.right), 1536 /* NoSourceMap */));
+ }
+ else {
+ return createReactNamespace(jsxFactory.text, parent);
+ }
+ }
+ function createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parent) {
+ return jsxFactoryEntity ?
+ createJsxFactoryExpressionFromEntityName(jsxFactoryEntity, parent) :
+ createPropertyAccess(createReactNamespace(reactNamespace, parent), "createElement");
+ }
+ function createExpressionForJsxElement(jsxFactoryEntity, reactNamespace, tagName, props, children, parentElement, location) {
var argumentsList = [tagName];
if (props) {
argumentsList.push(props);
@@ -11886,10 +12262,22 @@ var ts;
argumentsList.push(children[0]);
}
}
- return createCall(createPropertyAccess(createReactNamespace(reactNamespace, parentElement), "createElement"),
+ return createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement),
/*typeArguments*/ undefined, argumentsList, location);
}
- ts.createReactCreateElement = createReactCreateElement;
+ ts.createExpressionForJsxElement = createExpressionForJsxElement;
+ function createExportDefault(expression) {
+ return createExportAssignment(/*decorators*/ undefined, /*modifiers*/ undefined, /*isExportEquals*/ false, expression);
+ }
+ ts.createExportDefault = createExportDefault;
+ function createExternalModuleExport(exportName) {
+ return createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createNamedExports([createExportSpecifier(exportName)]));
+ }
+ ts.createExternalModuleExport = createExternalModuleExport;
+ function createLetStatement(name, initializer, location) {
+ return createVariableStatement(/*modifiers*/ undefined, createLetDeclarationList([createVariableDeclaration(name, /*type*/ undefined, initializer)]), location);
+ }
+ ts.createLetStatement = createLetStatement;
function createLetDeclarationList(declarations, location) {
return createVariableDeclarationList(declarations, location, 1 /* Let */);
}
@@ -11978,20 +12366,18 @@ var ts;
// name => super[name]
return createArrowFunction(
/*modifiers*/ undefined,
- /*typeParameters*/ undefined, [createParameter("name")],
- /*type*/ undefined,
- /*equalsGreaterThanToken*/ undefined, createElementAccess(target, createIdentifier("name")));
+ /*typeParameters*/ undefined, [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "name")],
+ /*type*/ undefined, createToken(35 /* EqualsGreaterThanToken */), createElementAccess(target, createIdentifier("name")));
}
function createSeti(target) {
// (name, value) => super[name] = value
return createArrowFunction(
/*modifiers*/ undefined,
/*typeParameters*/ undefined, [
- createParameter("name"),
- createParameter("value")
+ createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "name"),
+ createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "value")
],
- /*type*/ undefined,
- /*equalsGreaterThanToken*/ undefined, createAssignment(createElementAccess(target, createIdentifier("name")), createIdentifier("value")));
+ /*type*/ undefined, createToken(35 /* EqualsGreaterThanToken */), createAssignment(createElementAccess(target, createIdentifier("name")), createIdentifier("value")));
}
function createAdvancedAsyncSuperHelper() {
// const _super = (function (geti, seti) {
@@ -12016,7 +12402,7 @@ var ts;
// set value(v) { seti(name, v); }
var setter = createSetAccessor(
/*decorators*/ undefined,
- /*modifiers*/ undefined, "value", [createParameter("v")], createBlock([
+ /*modifiers*/ undefined, "value", [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "v")], createBlock([
createStatement(createCall(createIdentifier("seti"),
/*typeArguments*/ undefined, [
createIdentifier("name"),
@@ -12026,9 +12412,8 @@ var ts;
// return name => cache[name] || ...
var getOrCreateAccessorsForName = createReturn(createArrowFunction(
/*modifiers*/ undefined,
- /*typeParameters*/ undefined, [createParameter("name")],
- /*type*/ undefined,
- /*equalsGreaterThanToken*/ undefined, createLogicalOr(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createParen(createAssignment(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createObjectLiteral([
+ /*typeParameters*/ undefined, [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "name")],
+ /*type*/ undefined, createToken(35 /* EqualsGreaterThanToken */), createLogicalOr(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createParen(createAssignment(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createObjectLiteral([
getter,
setter
]))))));
@@ -12044,8 +12429,8 @@ var ts;
/*asteriskToken*/ undefined,
/*name*/ undefined,
/*typeParameters*/ undefined, [
- createParameter("geti"),
- createParameter("seti")
+ createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "geti"),
+ createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "seti")
],
/*type*/ undefined, createBlock([
createCache,
@@ -12075,13 +12460,13 @@ var ts;
case 8 /* NumericLiteral */:
case 9 /* StringLiteral */:
return false;
- case 171 /* ArrayLiteralExpression */:
+ case 174 /* ArrayLiteralExpression */:
var elements = target.elements;
if (elements.length === 0) {
return false;
}
return true;
- case 172 /* ObjectLiteralExpression */:
+ case 175 /* ObjectLiteralExpression */:
return target.properties.length > 0;
default:
return true;
@@ -12101,7 +12486,7 @@ var ts;
}
else {
switch (callee.kind) {
- case 173 /* PropertyAccessExpression */: {
+ case 176 /* PropertyAccessExpression */: {
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
// for `a.b()` target is `(_a = a).b` and thisArg is `_a`
thisArg = createTempVariable(recordTempVariable);
@@ -12115,7 +12500,7 @@ var ts;
}
break;
}
- case 174 /* ElementAccessExpression */: {
+ case 177 /* ElementAccessExpression */: {
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
// for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a`
thisArg = createTempVariable(recordTempVariable);
@@ -12169,14 +12554,14 @@ var ts;
ts.createExpressionForPropertyName = createExpressionForPropertyName;
function createExpressionForObjectLiteralElementLike(node, property, receiver) {
switch (property.kind) {
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine);
- case 253 /* PropertyAssignment */:
+ case 256 /* PropertyAssignment */:
return createExpressionForPropertyAssignment(property, receiver);
- case 254 /* ShorthandPropertyAssignment */:
+ case 257 /* ShorthandPropertyAssignment */:
return createExpressionForShorthandPropertyAssignment(property, receiver);
- case 148 /* MethodDeclaration */:
+ case 149 /* MethodDeclaration */:
return createExpressionForMethodDeclaration(property, receiver);
}
}
@@ -12240,6 +12625,112 @@ var ts;
/*location*/ method),
/*original*/ method));
}
+ /**
+ * Gets the local name of a declaration. This is primarily used for declarations that can be
+ * referred to by name in the declaration's immediate scope (classes, enums, namespaces). A
+ * local name will *never* be prefixed with an module or namespace export modifier like
+ * "exports." when emitted as an expression.
+ *
+ * @param node The declaration.
+ * @param allowComments A value indicating whether comments may be emitted for the name.
+ * @param allowSourceMaps A value indicating whether source maps may be emitted for the name.
+ */
+ function getLocalName(node, allowComments, allowSourceMaps) {
+ return getName(node, allowComments, allowSourceMaps, 262144 /* LocalName */);
+ }
+ ts.getLocalName = getLocalName;
+ /**
+ * Gets whether an identifier should only be referred to by its local name.
+ */
+ function isLocalName(node) {
+ return (getEmitFlags(node) & 262144 /* LocalName */) !== 0;
+ }
+ ts.isLocalName = isLocalName;
+ /**
+ * Gets the export name of a declaration. This is primarily used for declarations that can be
+ * referred to by name in the declaration's immediate scope (classes, enums, namespaces). An
+ * export name will *always* be prefixed with an module or namespace export modifier like
+ * `"exports."` when emitted as an expression if the name points to an exported symbol.
+ *
+ * @param node The declaration.
+ * @param allowComments A value indicating whether comments may be emitted for the name.
+ * @param allowSourceMaps A value indicating whether source maps may be emitted for the name.
+ */
+ function getExportName(node, allowComments, allowSourceMaps) {
+ return getName(node, allowComments, allowSourceMaps, 131072 /* ExportName */);
+ }
+ ts.getExportName = getExportName;
+ /**
+ * Gets whether an identifier should only be referred to by its export representation if the
+ * name points to an exported symbol.
+ */
+ function isExportName(node) {
+ return (getEmitFlags(node) & 131072 /* ExportName */) !== 0;
+ }
+ ts.isExportName = isExportName;
+ /**
+ * Gets the name of a declaration for use in declarations.
+ *
+ * @param node The declaration.
+ * @param allowComments A value indicating whether comments may be emitted for the name.
+ * @param allowSourceMaps A value indicating whether source maps may be emitted for the name.
+ */
+ function getDeclarationName(node, allowComments, allowSourceMaps) {
+ return getName(node, allowComments, allowSourceMaps);
+ }
+ ts.getDeclarationName = getDeclarationName;
+ function getName(node, allowComments, allowSourceMaps, emitFlags) {
+ if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) {
+ var name_11 = getMutableClone(node.name);
+ emitFlags |= getEmitFlags(node.name);
+ if (!allowSourceMaps)
+ emitFlags |= 1536 /* NoSourceMap */;
+ if (!allowComments)
+ emitFlags |= 49152 /* NoComments */;
+ if (emitFlags)
+ setEmitFlags(name_11, emitFlags);
+ return name_11;
+ }
+ return getGeneratedNameForNode(node);
+ }
+ /**
+ * Gets the exported name of a declaration for use in expressions.
+ *
+ * An exported name will *always* be prefixed with an module or namespace export modifier like
+ * "exports." if the name points to an exported symbol.
+ *
+ * @param ns The namespace identifier.
+ * @param node The declaration.
+ * @param allowComments A value indicating whether comments may be emitted for the name.
+ * @param allowSourceMaps A value indicating whether source maps may be emitted for the name.
+ */
+ function getExternalModuleOrNamespaceExportName(ns, node, allowComments, allowSourceMaps) {
+ if (ns && ts.hasModifier(node, 1 /* Export */)) {
+ return getNamespaceMemberName(ns, getName(node), allowComments, allowSourceMaps);
+ }
+ return getExportName(node, allowComments, allowSourceMaps);
+ }
+ ts.getExternalModuleOrNamespaceExportName = getExternalModuleOrNamespaceExportName;
+ /**
+ * Gets a namespace-qualified name for use in expressions.
+ *
+ * @param ns The namespace identifier.
+ * @param name The name.
+ * @param allowComments A value indicating whether comments may be emitted for the name.
+ * @param allowSourceMaps A value indicating whether source maps may be emitted for the name.
+ */
+ function getNamespaceMemberName(ns, name, allowComments, allowSourceMaps) {
+ var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), /*location*/ name);
+ var emitFlags;
+ if (!allowSourceMaps)
+ emitFlags |= 1536 /* NoSourceMap */;
+ if (!allowComments)
+ emitFlags |= 49152 /* NoComments */;
+ if (emitFlags)
+ setEmitFlags(qualifiedName, emitFlags);
+ return qualifiedName;
+ }
+ ts.getNamespaceMemberName = getNamespaceMemberName;
// Utilities
function isUseStrictPrologue(node) {
return node.expression.text === "use strict";
@@ -12329,7 +12820,7 @@ var ts;
function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
var skipped = skipPartiallyEmittedExpressions(operand);
// If the resulting expression is already parenthesized, we do not need to do any further processing.
- if (skipped.kind === 179 /* ParenthesizedExpression */) {
+ if (skipped.kind === 182 /* ParenthesizedExpression */) {
return operand;
}
return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand)
@@ -12363,8 +12854,8 @@ var ts;
//
// If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve
// the intended order of operations: `(a ** b) ** c`
- var binaryOperatorPrecedence = ts.getOperatorPrecedence(188 /* BinaryExpression */, binaryOperator);
- var binaryOperatorAssociativity = ts.getOperatorAssociativity(188 /* BinaryExpression */, binaryOperator);
+ var binaryOperatorPrecedence = ts.getOperatorPrecedence(191 /* BinaryExpression */, binaryOperator);
+ var binaryOperatorAssociativity = ts.getOperatorAssociativity(191 /* BinaryExpression */, binaryOperator);
var emittedOperand = skipPartiallyEmittedExpressions(operand);
var operandPrecedence = ts.getExpressionPrecedence(emittedOperand);
switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) {
@@ -12373,7 +12864,7 @@ var ts;
// and is a yield expression, then we do not need parentheses.
if (!isLeftSideOfBinary
&& binaryOperatorAssociativity === 1 /* Right */
- && operand.kind === 191 /* YieldExpression */) {
+ && operand.kind === 194 /* YieldExpression */) {
return false;
}
return true;
@@ -12461,7 +12952,7 @@ var ts;
if (ts.isLiteralKind(node.kind)) {
return node.kind;
}
- if (node.kind === 188 /* BinaryExpression */ && node.operatorToken.kind === 36 /* PlusToken */) {
+ if (node.kind === 191 /* BinaryExpression */ && node.operatorToken.kind === 36 /* PlusToken */) {
if (node.cachedLiteralKind !== undefined) {
return node.cachedLiteralKind;
}
@@ -12484,9 +12975,9 @@ var ts;
function parenthesizeForNew(expression) {
var emittedExpression = skipPartiallyEmittedExpressions(expression);
switch (emittedExpression.kind) {
- case 175 /* CallExpression */:
+ case 178 /* CallExpression */:
return createParen(expression);
- case 176 /* NewExpression */:
+ case 179 /* NewExpression */:
return emittedExpression.arguments
? expression
: createParen(expression);
@@ -12511,7 +13002,7 @@ var ts;
//
var emittedExpression = skipPartiallyEmittedExpressions(expression);
if (ts.isLeftHandSideExpression(emittedExpression)
- && (emittedExpression.kind !== 176 /* NewExpression */ || emittedExpression.arguments)
+ && (emittedExpression.kind !== 179 /* NewExpression */ || emittedExpression.arguments)
&& emittedExpression.kind !== 8 /* NumericLiteral */) {
return expression;
}
@@ -12549,7 +13040,7 @@ var ts;
function parenthesizeExpressionForList(expression) {
var emittedExpression = skipPartiallyEmittedExpressions(expression);
var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression);
- var commaPrecedence = ts.getOperatorPrecedence(188 /* BinaryExpression */, 25 /* CommaToken */);
+ var commaPrecedence = ts.getOperatorPrecedence(191 /* BinaryExpression */, 25 /* CommaToken */);
return expressionPrecedence > commaPrecedence
? expression
: createParen(expression, /*location*/ expression);
@@ -12560,7 +13051,7 @@ var ts;
if (ts.isCallExpression(emittedExpression)) {
var callee = emittedExpression.expression;
var kind = skipPartiallyEmittedExpressions(callee).kind;
- if (kind === 180 /* FunctionExpression */ || kind === 181 /* ArrowFunction */) {
+ if (kind === 183 /* FunctionExpression */ || kind === 184 /* ArrowFunction */) {
var mutableCall = getMutableClone(emittedExpression);
mutableCall.expression = createParen(callee, /*location*/ callee);
return recreatePartiallyEmittedExpressions(expression, mutableCall);
@@ -12568,7 +13059,7 @@ var ts;
}
else {
var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind;
- if (leftmostExpressionKind === 172 /* ObjectLiteralExpression */ || leftmostExpressionKind === 180 /* FunctionExpression */) {
+ if (leftmostExpressionKind === 175 /* ObjectLiteralExpression */ || leftmostExpressionKind === 183 /* FunctionExpression */) {
return createParen(expression, /*location*/ expression);
}
}
@@ -12592,21 +13083,21 @@ var ts;
function getLeftmostExpression(node) {
while (true) {
switch (node.kind) {
- case 187 /* PostfixUnaryExpression */:
+ case 190 /* PostfixUnaryExpression */:
node = node.operand;
continue;
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
node = node.left;
continue;
- case 189 /* ConditionalExpression */:
+ case 192 /* ConditionalExpression */:
node = node.condition;
continue;
- case 175 /* CallExpression */:
- case 174 /* ElementAccessExpression */:
- case 173 /* PropertyAccessExpression */:
+ case 178 /* CallExpression */:
+ case 177 /* ElementAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
node = node.expression;
continue;
- case 288 /* PartiallyEmittedExpression */:
+ case 292 /* PartiallyEmittedExpression */:
node = node.expression;
continue;
}
@@ -12615,19 +13106,19 @@ var ts;
}
function parenthesizeConciseBody(body) {
var emittedBody = skipPartiallyEmittedExpressions(body);
- if (emittedBody.kind === 172 /* ObjectLiteralExpression */) {
+ if (emittedBody.kind === 175 /* ObjectLiteralExpression */) {
return createParen(body, /*location*/ body);
}
return body;
}
ts.parenthesizeConciseBody = parenthesizeConciseBody;
+ var OuterExpressionKinds;
(function (OuterExpressionKinds) {
OuterExpressionKinds[OuterExpressionKinds["Parentheses"] = 1] = "Parentheses";
OuterExpressionKinds[OuterExpressionKinds["Assertions"] = 2] = "Assertions";
OuterExpressionKinds[OuterExpressionKinds["PartiallyEmittedExpressions"] = 4] = "PartiallyEmittedExpressions";
OuterExpressionKinds[OuterExpressionKinds["All"] = 7] = "All";
- })(ts.OuterExpressionKinds || (ts.OuterExpressionKinds = {}));
- var OuterExpressionKinds = ts.OuterExpressionKinds;
+ })(OuterExpressionKinds = ts.OuterExpressionKinds || (ts.OuterExpressionKinds = {}));
function skipOuterExpressions(node, kinds) {
if (kinds === void 0) { kinds = 7 /* All */; }
var previousNode;
@@ -12647,7 +13138,7 @@ var ts;
}
ts.skipOuterExpressions = skipOuterExpressions;
function skipParentheses(node) {
- while (node.kind === 179 /* ParenthesizedExpression */) {
+ while (node.kind === 182 /* ParenthesizedExpression */) {
node = node.expression;
}
return node;
@@ -12661,7 +13152,7 @@ var ts;
}
ts.skipAssertions = skipAssertions;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 288 /* PartiallyEmittedExpression */) {
+ while (node.kind === 292 /* PartiallyEmittedExpression */) {
node = node.expression;
}
return node;
@@ -12736,7 +13227,7 @@ var ts;
// To avoid holding onto transformation artifacts, we keep track of any
// parse tree node we are annotating. This allows us to clean them up after
// all transformations have completed.
- if (node.kind === 256 /* SourceFile */) {
+ if (node.kind === 260 /* SourceFile */) {
return node.emitNode = { annotatedNodes: [node] };
}
var sourceFile = ts.getSourceFileOfNode(node);
@@ -12878,13 +13369,13 @@ var ts;
function getLocalNameForExternalImport(node, sourceFile) {
var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);
if (namespaceDeclaration && !ts.isDefaultImport(node)) {
- var name_9 = namespaceDeclaration.name;
- return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
+ var name_12 = namespaceDeclaration.name;
+ return ts.isGeneratedIdentifier(name_12) ? name_12 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
}
- if (node.kind === 231 /* ImportDeclaration */ && node.importClause) {
+ if (node.kind === 234 /* ImportDeclaration */ && node.importClause) {
return getGeneratedNameForNode(node);
}
- if (node.kind === 237 /* ExportDeclaration */ && node.moduleSpecifier) {
+ if (node.kind === 240 /* ExportDeclaration */ && node.moduleSpecifier) {
return getGeneratedNameForNode(node);
}
return undefined;
@@ -12941,6 +13432,363 @@ var ts;
function tryGetModuleNameFromDeclaration(declaration, host, resolver, compilerOptions) {
return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions);
}
+ /**
+ * Transforms the body of a function-like node.
+ *
+ * @param node A function-like node.
+ */
+ function transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis, convertObjectRest) {
+ var multiLine = false; // indicates whether the block *must* be emitted as multiple lines
+ var singleLine = false; // indicates whether the block *may* be emitted as a single line
+ var statementsLocation;
+ var closeBraceLocation;
+ var statements = [];
+ var body = node.body;
+ var statementOffset;
+ context.startLexicalEnvironment();
+ if (ts.isBlock(body)) {
+ // ensureUseStrict is false because no new prologue-directive should be added.
+ // addPrologueDirectives will simply put already-existing directives at the beginning of the target statement-array
+ statementOffset = addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor);
+ }
+ addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis);
+ addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest);
+ addRestParameterIfNeeded(statements, node, /*inConstructorWithSynthesizedSuper*/ false);
+ // If we added any generated statements, this must be a multi-line block.
+ if (!multiLine && statements.length > 0) {
+ multiLine = true;
+ }
+ if (ts.isBlock(body)) {
+ statementsLocation = body.statements;
+ ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));
+ // If the original body was a multi-line block, this must be a multi-line block.
+ if (!multiLine && body.multiLine) {
+ multiLine = true;
+ }
+ }
+ else {
+ ts.Debug.assert(node.kind === 184 /* ArrowFunction */);
+ // To align with the old emitter, we use a synthetic end position on the location
+ // for the statement list we synthesize when we down-level an arrow function with
+ // an expression function body. This prevents both comments and source maps from
+ // being emitted for the end position only.
+ statementsLocation = ts.moveRangeEnd(body, -1);
+ var equalsGreaterThanToken = node.equalsGreaterThanToken;
+ if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
+ if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {
+ singleLine = true;
+ }
+ else {
+ multiLine = true;
+ }
+ }
+ var expression = ts.visitNode(body, visitor, ts.isExpression);
+ var returnStatement = createReturn(expression, /*location*/ body);
+ setEmitFlags(returnStatement, 12288 /* NoTokenSourceMaps */ | 1024 /* NoTrailingSourceMap */ | 32768 /* NoTrailingComments */);
+ statements.push(returnStatement);
+ // To align with the source map emit for the old emitter, we set a custom
+ // source map location for the close brace.
+ closeBraceLocation = body;
+ }
+ var lexicalEnvironment = context.endLexicalEnvironment();
+ ts.addRange(statements, lexicalEnvironment);
+ // If we added any final generated statements, this must be a multi-line block
+ if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {
+ multiLine = true;
+ }
+ var block = createBlock(createNodeArray(statements, statementsLocation), node.body, multiLine);
+ if (!multiLine && singleLine) {
+ setEmitFlags(block, 32 /* SingleLine */);
+ }
+ if (closeBraceLocation) {
+ setTokenSourceMapRange(block, 17 /* CloseBraceToken */, closeBraceLocation);
+ }
+ setOriginalNode(block, node.body);
+ return block;
+ }
+ ts.transformFunctionBody = transformFunctionBody;
+ /**
+ * Adds a statement to capture the `this` of a function declaration if it is needed.
+ *
+ * @param statements The statements for the new function body.
+ * @param node A node.
+ */
+ function addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis) {
+ if (node.transformFlags & 524288 /* ContainsCapturedLexicalThis */ && node.kind !== 184 /* ArrowFunction */) {
+ captureThisForNode(statements, node, createThis(), enableSubstitutionsForCapturedThis);
+ }
+ }
+ ts.addCaptureThisForNodeIfNeeded = addCaptureThisForNodeIfNeeded;
+ function captureThisForNode(statements, node, initializer, enableSubstitutionsForCapturedThis, originalStatement) {
+ enableSubstitutionsForCapturedThis();
+ var captureThisStatement = createVariableStatement(
+ /*modifiers*/ undefined, createVariableDeclarationList([
+ createVariableDeclaration("_this",
+ /*type*/ undefined, initializer)
+ ]), originalStatement);
+ setEmitFlags(captureThisStatement, 49152 /* NoComments */ | 8388608 /* CustomPrologue */);
+ setSourceMapRange(captureThisStatement, node);
+ statements.push(captureThisStatement);
+ }
+ ts.captureThisForNode = captureThisForNode;
+ /**
+ * Gets a value indicating whether we need to add default value assignments for a
+ * function-like node.
+ *
+ * @param node A function-like node.
+ */
+ function shouldAddDefaultValueAssignments(node) {
+ return (node.transformFlags & 2097152 /* ContainsDefaultValueAssignments */) !== 0;
+ }
+ /**
+ * Adds statements to the body of a function-like node if it contains parameters with
+ * binding patterns or initializers.
+ *
+ * @param statements The statements for the new function body.
+ * @param node A function-like node.
+ */
+ function addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest) {
+ if (!shouldAddDefaultValueAssignments(node)) {
+ return;
+ }
+ for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
+ var parameter = _a[_i];
+ var name_13 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
+ // A rest parameter cannot have a binding pattern or an initializer,
+ // so let's just ignore it.
+ if (dotDotDotToken) {
+ continue;
+ }
+ if (ts.isBindingPattern(name_13)) {
+ addDefaultValueAssignmentForBindingPattern(statements, parameter, name_13, initializer, visitor, convertObjectRest);
+ }
+ else if (initializer) {
+ addDefaultValueAssignmentForInitializer(statements, parameter, name_13, initializer, visitor);
+ }
+ }
+ }
+ ts.addDefaultValueAssignmentsIfNeeded = addDefaultValueAssignmentsIfNeeded;
+ /**
+ * Adds statements to the body of a function-like node for parameters with binding patterns
+ *
+ * @param statements The statements for the new function body.
+ * @param parameter The parameter for the function.
+ * @param name The name of the parameter.
+ * @param initializer The initializer for the parameter.
+ */
+ function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer, visitor, convertObjectRest) {
+ var temp = getGeneratedNameForNode(parameter);
+ // In cases where a binding pattern is simply '[]' or '{}',
+ // we usually don't want to emit a var declaration; however, in the presence
+ // of an initializer, we must emit that expression to preserve side effects.
+ if (name.elements.length > 0) {
+ statements.push(setEmitFlags(createVariableStatement(
+ /*modifiers*/ undefined, createVariableDeclarationList(ts.flattenParameterDestructuring(parameter, temp, visitor, convertObjectRest))), 8388608 /* CustomPrologue */));
+ }
+ else if (initializer) {
+ statements.push(setEmitFlags(createStatement(createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 8388608 /* CustomPrologue */));
+ }
+ }
+ /**
+ * Adds statements to the body of a function-like node for parameters with initializers.
+ *
+ * @param statements The statements for the new function body.
+ * @param parameter The parameter for the function.
+ * @param name The name of the parameter.
+ * @param initializer The initializer for the parameter.
+ */
+ function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer, visitor) {
+ initializer = ts.visitNode(initializer, visitor, ts.isExpression);
+ var statement = createIf(createStrictEquality(getSynthesizedClone(name), createVoidZero()), setEmitFlags(createBlock([
+ createStatement(createAssignment(setEmitFlags(getMutableClone(name), 1536 /* NoSourceMap */), setEmitFlags(initializer, 1536 /* NoSourceMap */ | getEmitFlags(initializer)),
+ /*location*/ parameter))
+ ], /*location*/ parameter), 32 /* SingleLine */ | 1024 /* NoTrailingSourceMap */ | 12288 /* NoTokenSourceMaps */),
+ /*elseStatement*/ undefined,
+ /*location*/ parameter);
+ statement.startsOnNewLine = true;
+ setEmitFlags(statement, 12288 /* NoTokenSourceMaps */ | 1024 /* NoTrailingSourceMap */ | 8388608 /* CustomPrologue */);
+ statements.push(statement);
+ }
+ /**
+ * Gets a value indicating whether we need to add statements to handle a rest parameter.
+ *
+ * @param node A ParameterDeclaration node.
+ * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is
+ * part of a constructor declaration with a
+ * synthesized call to `super`
+ */
+ function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {
+ return node && node.dotDotDotToken && node.name.kind === 70 /* Identifier */ && !inConstructorWithSynthesizedSuper;
+ }
+ /**
+ * Adds statements to the body of a function-like node if it contains a rest parameter.
+ *
+ * @param statements The statements for the new function body.
+ * @param node A function-like node.
+ * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is
+ * part of a constructor declaration with a
+ * synthesized call to `super`
+ */
+ function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {
+ var parameter = ts.lastOrUndefined(node.parameters);
+ if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {
+ return;
+ }
+ // `declarationName` is the name of the local declaration for the parameter.
+ var declarationName = getMutableClone(parameter.name);
+ setEmitFlags(declarationName, 1536 /* NoSourceMap */);
+ // `expressionName` is the name of the parameter used in expressions.
+ var expressionName = getSynthesizedClone(parameter.name);
+ var restIndex = node.parameters.length - 1;
+ var temp = createLoopVariable();
+ // var param = [];
+ statements.push(setEmitFlags(createVariableStatement(
+ /*modifiers*/ undefined, createVariableDeclarationList([
+ createVariableDeclaration(declarationName,
+ /*type*/ undefined, createArrayLiteral([]))
+ ]),
+ /*location*/ parameter), 8388608 /* CustomPrologue */));
+ // for (var _i = restIndex; _i < arguments.length; _i++) {
+ // param[_i - restIndex] = arguments[_i];
+ // }
+ var forStatement = createFor(createVariableDeclarationList([
+ createVariableDeclaration(temp, /*type*/ undefined, createLiteral(restIndex))
+ ], /*location*/ parameter), createLessThan(temp, createPropertyAccess(createIdentifier("arguments"), "length"),
+ /*location*/ parameter), createPostfixIncrement(temp, /*location*/ parameter), createBlock([
+ startOnNewLine(createStatement(createAssignment(createElementAccess(expressionName, createSubtract(temp, createLiteral(restIndex))), createElementAccess(createIdentifier("arguments"), temp)),
+ /*location*/ parameter))
+ ]));
+ setEmitFlags(forStatement, 8388608 /* CustomPrologue */);
+ startOnNewLine(forStatement);
+ statements.push(forStatement);
+ }
+ ts.addRestParameterIfNeeded = addRestParameterIfNeeded;
+ function convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, convertObjectRest) {
+ // The following ES6 code:
+ //
+ // for (let v of expr) { }
+ //
+ // should be emitted as
+ //
+ // for (var _i = 0, _a = expr; _i < _a.length; _i++) {
+ // var v = _a[_i];
+ // }
+ //
+ // where _a and _i are temps emitted to capture the RHS and the counter,
+ // respectively.
+ // When the left hand side is an expression instead of a let declaration,
+ // the "let v" is not emitted.
+ // When the left hand side is a let/const, the v is renamed if there is
+ // another v in scope.
+ // Note that all assignments to the LHS are emitted in the body, including
+ // all destructuring.
+ // Note also that because an extra statement is needed to assign to the LHS,
+ // for-of bodies are always emitted as blocks.
+ var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
+ var initializer = node.initializer;
+ var statements = [];
+ // In the case where the user wrote an identifier as the RHS, like this:
+ //
+ // for (let v of arr) { }
+ //
+ // we don't want to emit a temporary variable for the RHS, just use it directly.
+ var counter = convertObjectRest ? undefined : createLoopVariable();
+ var rhsReference = expression.kind === 70 /* Identifier */
+ ? createUniqueName(expression.text)
+ : createTempVariable(/*recordTempVariable*/ undefined);
+ var elementAccess = convertObjectRest ? rhsReference : createElementAccess(rhsReference, counter);
+ // Initialize LHS
+ // var v = _a[_i];
+ if (ts.isVariableDeclarationList(initializer)) {
+ if (initializer.flags & 3 /* BlockScoped */) {
+ enableSubstitutionsForBlockScopedBindings();
+ }
+ var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);
+ if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {
+ // This works whether the declaration is a var, let, or const.
+ // It will use rhsIterationValue _a[_i] as the initializer.
+ var declarations = ts.flattenVariableDestructuring(firstOriginalDeclaration, elementAccess, visitor,
+ /*recordTempVariable*/ undefined, convertObjectRest);
+ var declarationList = createVariableDeclarationList(declarations, /*location*/ initializer);
+ setOriginalNode(declarationList, initializer);
+ // Adjust the source map range for the first declaration to align with the old
+ // emitter.
+ var firstDeclaration = declarations[0];
+ var lastDeclaration = ts.lastOrUndefined(declarations);
+ setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));
+ statements.push(createVariableStatement(
+ /*modifiers*/ undefined, declarationList));
+ }
+ else {
+ // The following call does not include the initializer, so we have
+ // to emit it separately.
+ statements.push(createVariableStatement(
+ /*modifiers*/ undefined, setOriginalNode(createVariableDeclarationList([
+ createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : createTempVariable(/*recordTempVariable*/ undefined),
+ /*type*/ undefined, createElementAccess(rhsReference, counter))
+ ], /*location*/ ts.moveRangePos(initializer, -1)), initializer),
+ /*location*/ ts.moveRangeEnd(initializer, -1)));
+ }
+ }
+ else {
+ // Initializer is an expression. Emit the expression in the body, so that it's
+ // evaluated on every iteration.
+ var assignment = createAssignment(initializer, elementAccess);
+ if (ts.isDestructuringAssignment(assignment)) {
+ // This is a destructuring pattern, so we flatten the destructuring instead.
+ statements.push(createStatement(ts.flattenDestructuringAssignment(context, assignment,
+ /*needsValue*/ false, context.hoistVariableDeclaration, visitor, convertObjectRest)));
+ }
+ else {
+ // Currently there is not way to check that assignment is binary expression of destructing assignment
+ // so we have to cast never type to binaryExpression
+ assignment.end = initializer.end;
+ statements.push(createStatement(assignment, /*location*/ ts.moveRangeEnd(initializer, -1)));
+ }
+ }
+ var bodyLocation;
+ var statementsLocation;
+ if (convertedLoopBodyStatements) {
+ ts.addRange(statements, convertedLoopBodyStatements);
+ }
+ else {
+ var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
+ if (ts.isBlock(statement)) {
+ ts.addRange(statements, statement.statements);
+ bodyLocation = statement;
+ statementsLocation = statement.statements;
+ }
+ else {
+ statements.push(statement);
+ }
+ }
+ // The old emitter does not emit source maps for the expression
+ setEmitFlags(expression, 1536 /* NoSourceMap */ | getEmitFlags(expression));
+ // The old emitter does not emit source maps for the block.
+ // We add the location to preserve comments.
+ var body = createBlock(createNodeArray(statements, /*location*/ statementsLocation),
+ /*location*/ bodyLocation);
+ setEmitFlags(body, 1536 /* NoSourceMap */ | 12288 /* NoTokenSourceMaps */);
+ var forStatement;
+ if (convertObjectRest) {
+ forStatement = createForOf(createVariableDeclarationList([
+ createVariableDeclaration(rhsReference, /*type*/ undefined, /*initializer*/ undefined, /*location*/ node.expression)
+ ], /*location*/ node.expression), node.expression, body,
+ /*location*/ node);
+ }
+ else {
+ forStatement = createFor(setEmitFlags(createVariableDeclarationList([
+ createVariableDeclaration(counter, /*type*/ undefined, createLiteral(0), /*location*/ ts.moveRangePos(node.expression, -1)),
+ createVariableDeclaration(rhsReference, /*type*/ undefined, expression, /*location*/ node.expression)
+ ], /*location*/ node.expression), 16777216 /* NoHoisting */), createLessThan(counter, createPropertyAccess(rhsReference, "length"),
+ /*location*/ node.expression), createPostfixIncrement(counter, /*location*/ node.expression), body,
+ /*location*/ node);
+ }
+ // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter.
+ setEmitFlags(forStatement, 8192 /* NoTokenTrailingSourceMaps */);
+ return forStatement;
+ }
+ ts.convertForOf = convertForOf;
})(ts || (ts = {}));
///
///
@@ -12952,13 +13800,13 @@ var ts;
var IdentifierConstructor;
var SourceFileConstructor;
function createNode(kind, pos, end) {
- if (kind === 256 /* SourceFile */) {
+ if (kind === 260 /* SourceFile */) {
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
}
else if (kind === 70 /* Identifier */) {
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
}
- else if (kind < 140 /* FirstNode */) {
+ else if (kind < 141 /* FirstNode */) {
return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);
}
else {
@@ -13001,26 +13849,28 @@ var ts;
var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode;
var cbNodes = cbNodeArray || cbNode;
switch (node.kind) {
- case 140 /* QualifiedName */:
+ case 141 /* QualifiedName */:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.right);
- case 142 /* TypeParameter */:
+ case 143 /* TypeParameter */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.constraint) ||
visitNode(cbNode, node.expression);
- case 254 /* ShorthandPropertyAssignment */:
+ case 257 /* ShorthandPropertyAssignment */:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.equalsToken) ||
visitNode(cbNode, node.objectAssignmentInitializer);
- case 143 /* Parameter */:
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 253 /* PropertyAssignment */:
- case 219 /* VariableDeclaration */:
- case 170 /* BindingElement */:
+ case 258 /* SpreadAssignment */:
+ return visitNode(cbNode, node.expression);
+ case 144 /* Parameter */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 256 /* PropertyAssignment */:
+ case 222 /* VariableDeclaration */:
+ case 173 /* BindingElement */:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.propertyName) ||
@@ -13029,24 +13879,24 @@ var ts;
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 154 /* IndexSignature */:
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 155 /* IndexSignature */:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNodes(cbNodes, node.typeParameters) ||
visitNodes(cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 149 /* Constructor */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 180 /* FunctionExpression */:
- case 221 /* FunctionDeclaration */:
- case 181 /* ArrowFunction */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 150 /* Constructor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 183 /* FunctionExpression */:
+ case 224 /* FunctionDeclaration */:
+ case 184 /* ArrowFunction */:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.asteriskToken) ||
@@ -13057,309 +13907,313 @@ var ts;
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.equalsGreaterThanToken) ||
visitNode(cbNode, node.body);
- case 156 /* TypeReference */:
+ case 157 /* TypeReference */:
return visitNode(cbNode, node.typeName) ||
visitNodes(cbNodes, node.typeArguments);
- case 155 /* TypePredicate */:
+ case 156 /* TypePredicate */:
return visitNode(cbNode, node.parameterName) ||
visitNode(cbNode, node.type);
- case 159 /* TypeQuery */:
+ case 160 /* TypeQuery */:
return visitNode(cbNode, node.exprName);
- case 160 /* TypeLiteral */:
+ case 161 /* TypeLiteral */:
return visitNodes(cbNodes, node.members);
- case 161 /* ArrayType */:
+ case 162 /* ArrayType */:
return visitNode(cbNode, node.elementType);
- case 162 /* TupleType */:
+ case 163 /* TupleType */:
return visitNodes(cbNodes, node.elementTypes);
- case 163 /* UnionType */:
- case 164 /* IntersectionType */:
+ case 164 /* UnionType */:
+ case 165 /* IntersectionType */:
return visitNodes(cbNodes, node.types);
- case 165 /* ParenthesizedType */:
+ case 166 /* ParenthesizedType */:
+ case 168 /* TypeOperator */:
return visitNode(cbNode, node.type);
- case 167 /* LiteralType */:
+ case 169 /* IndexedAccessType */:
+ return visitNode(cbNode, node.objectType) ||
+ visitNode(cbNode, node.indexType);
+ case 170 /* LiteralType */:
return visitNode(cbNode, node.literal);
- case 168 /* ObjectBindingPattern */:
- case 169 /* ArrayBindingPattern */:
+ case 171 /* ObjectBindingPattern */:
+ case 172 /* ArrayBindingPattern */:
return visitNodes(cbNodes, node.elements);
- case 171 /* ArrayLiteralExpression */:
+ case 174 /* ArrayLiteralExpression */:
return visitNodes(cbNodes, node.elements);
- case 172 /* ObjectLiteralExpression */:
+ case 175 /* ObjectLiteralExpression */:
return visitNodes(cbNodes, node.properties);
- case 173 /* PropertyAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.name);
- case 174 /* ElementAccessExpression */:
+ case 177 /* ElementAccessExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.argumentExpression);
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNodes, node.typeArguments) ||
visitNodes(cbNodes, node.arguments);
- case 177 /* TaggedTemplateExpression */:
+ case 180 /* TaggedTemplateExpression */:
return visitNode(cbNode, node.tag) ||
visitNode(cbNode, node.template);
- case 178 /* TypeAssertionExpression */:
+ case 181 /* TypeAssertionExpression */:
return visitNode(cbNode, node.type) ||
visitNode(cbNode, node.expression);
- case 179 /* ParenthesizedExpression */:
+ case 182 /* ParenthesizedExpression */:
return visitNode(cbNode, node.expression);
- case 182 /* DeleteExpression */:
+ case 185 /* DeleteExpression */:
return visitNode(cbNode, node.expression);
- case 183 /* TypeOfExpression */:
+ case 186 /* TypeOfExpression */:
return visitNode(cbNode, node.expression);
- case 184 /* VoidExpression */:
+ case 187 /* VoidExpression */:
return visitNode(cbNode, node.expression);
- case 186 /* PrefixUnaryExpression */:
+ case 189 /* PrefixUnaryExpression */:
return visitNode(cbNode, node.operand);
- case 191 /* YieldExpression */:
+ case 194 /* YieldExpression */:
return visitNode(cbNode, node.asteriskToken) ||
visitNode(cbNode, node.expression);
- case 185 /* AwaitExpression */:
+ case 188 /* AwaitExpression */:
return visitNode(cbNode, node.expression);
- case 187 /* PostfixUnaryExpression */:
+ case 190 /* PostfixUnaryExpression */:
return visitNode(cbNode, node.operand);
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.operatorToken) ||
visitNode(cbNode, node.right);
- case 196 /* AsExpression */:
+ case 199 /* AsExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.type);
- case 197 /* NonNullExpression */:
+ case 200 /* NonNullExpression */:
return visitNode(cbNode, node.expression);
- case 189 /* ConditionalExpression */:
+ case 192 /* ConditionalExpression */:
return visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.whenTrue) ||
visitNode(cbNode, node.colonToken) ||
visitNode(cbNode, node.whenFalse);
- case 192 /* SpreadElementExpression */:
+ case 195 /* SpreadElement */:
return visitNode(cbNode, node.expression);
- case 200 /* Block */:
- case 227 /* ModuleBlock */:
+ case 203 /* Block */:
+ case 230 /* ModuleBlock */:
return visitNodes(cbNodes, node.statements);
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
return visitNodes(cbNodes, node.statements) ||
visitNode(cbNode, node.endOfFileToken);
- case 201 /* VariableStatement */:
+ case 204 /* VariableStatement */:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.declarationList);
- case 220 /* VariableDeclarationList */:
+ case 223 /* VariableDeclarationList */:
return visitNodes(cbNodes, node.declarations);
- case 203 /* ExpressionStatement */:
+ case 206 /* ExpressionStatement */:
return visitNode(cbNode, node.expression);
- case 204 /* IfStatement */:
+ case 207 /* IfStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.thenStatement) ||
visitNode(cbNode, node.elseStatement);
- case 205 /* DoStatement */:
+ case 208 /* DoStatement */:
return visitNode(cbNode, node.statement) ||
visitNode(cbNode, node.expression);
- case 206 /* WhileStatement */:
+ case 209 /* WhileStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 207 /* ForStatement */:
+ case 210 /* ForStatement */:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.incrementor) ||
visitNode(cbNode, node.statement);
- case 208 /* ForInStatement */:
+ case 211 /* ForInStatement */:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 209 /* ForOfStatement */:
+ case 212 /* ForOfStatement */:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 210 /* ContinueStatement */:
- case 211 /* BreakStatement */:
+ case 213 /* ContinueStatement */:
+ case 214 /* BreakStatement */:
return visitNode(cbNode, node.label);
- case 212 /* ReturnStatement */:
+ case 215 /* ReturnStatement */:
return visitNode(cbNode, node.expression);
- case 213 /* WithStatement */:
+ case 216 /* WithStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 214 /* SwitchStatement */:
+ case 217 /* SwitchStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.caseBlock);
- case 228 /* CaseBlock */:
+ case 231 /* CaseBlock */:
return visitNodes(cbNodes, node.clauses);
- case 249 /* CaseClause */:
+ case 252 /* CaseClause */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNodes, node.statements);
- case 250 /* DefaultClause */:
+ case 253 /* DefaultClause */:
return visitNodes(cbNodes, node.statements);
- case 215 /* LabeledStatement */:
+ case 218 /* LabeledStatement */:
return visitNode(cbNode, node.label) ||
visitNode(cbNode, node.statement);
- case 216 /* ThrowStatement */:
+ case 219 /* ThrowStatement */:
return visitNode(cbNode, node.expression);
- case 217 /* TryStatement */:
+ case 220 /* TryStatement */:
return visitNode(cbNode, node.tryBlock) ||
visitNode(cbNode, node.catchClause) ||
visitNode(cbNode, node.finallyBlock);
- case 252 /* CatchClause */:
+ case 255 /* CatchClause */:
return visitNode(cbNode, node.variableDeclaration) ||
visitNode(cbNode, node.block);
- case 144 /* Decorator */:
+ case 145 /* Decorator */:
return visitNode(cbNode, node.expression);
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNodes, node.typeParameters) ||
visitNodes(cbNodes, node.heritageClauses) ||
visitNodes(cbNodes, node.members);
- case 223 /* InterfaceDeclaration */:
+ case 226 /* InterfaceDeclaration */:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNodes, node.typeParameters) ||
visitNodes(cbNodes, node.heritageClauses) ||
visitNodes(cbNodes, node.members);
- case 224 /* TypeAliasDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNodes, node.typeParameters) ||
visitNode(cbNode, node.type);
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNodes, node.members);
- case 255 /* EnumMember */:
+ case 259 /* EnumMember */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.body);
- case 230 /* ImportEqualsDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.moduleReference);
- case 231 /* ImportDeclaration */:
+ case 234 /* ImportDeclaration */:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.importClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 232 /* ImportClause */:
+ case 235 /* ImportClause */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.namedBindings);
- case 229 /* NamespaceExportDeclaration */:
+ case 232 /* NamespaceExportDeclaration */:
return visitNode(cbNode, node.name);
- case 233 /* NamespaceImport */:
+ case 236 /* NamespaceImport */:
return visitNode(cbNode, node.name);
- case 234 /* NamedImports */:
- case 238 /* NamedExports */:
+ case 237 /* NamedImports */:
+ case 241 /* NamedExports */:
return visitNodes(cbNodes, node.elements);
- case 237 /* ExportDeclaration */:
+ case 240 /* ExportDeclaration */:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.exportClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 235 /* ImportSpecifier */:
- case 239 /* ExportSpecifier */:
+ case 238 /* ImportSpecifier */:
+ case 242 /* ExportSpecifier */:
return visitNode(cbNode, node.propertyName) ||
visitNode(cbNode, node.name);
- case 236 /* ExportAssignment */:
+ case 239 /* ExportAssignment */:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, node.expression);
- case 190 /* TemplateExpression */:
+ case 193 /* TemplateExpression */:
return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans);
- case 198 /* TemplateSpan */:
+ case 201 /* TemplateSpan */:
return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal);
- case 141 /* ComputedPropertyName */:
+ case 142 /* ComputedPropertyName */:
return visitNode(cbNode, node.expression);
- case 251 /* HeritageClause */:
+ case 254 /* HeritageClause */:
return visitNodes(cbNodes, node.types);
- case 195 /* ExpressionWithTypeArguments */:
+ case 198 /* ExpressionWithTypeArguments */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNodes, node.typeArguments);
- case 241 /* ExternalModuleReference */:
+ case 244 /* ExternalModuleReference */:
return visitNode(cbNode, node.expression);
- case 240 /* MissingDeclaration */:
+ case 243 /* MissingDeclaration */:
return visitNodes(cbNodes, node.decorators);
- case 242 /* JsxElement */:
+ case 245 /* JsxElement */:
return visitNode(cbNode, node.openingElement) ||
visitNodes(cbNodes, node.children) ||
visitNode(cbNode, node.closingElement);
- case 243 /* JsxSelfClosingElement */:
- case 244 /* JsxOpeningElement */:
+ case 246 /* JsxSelfClosingElement */:
+ case 247 /* JsxOpeningElement */:
return visitNode(cbNode, node.tagName) ||
visitNodes(cbNodes, node.attributes);
- case 246 /* JsxAttribute */:
+ case 249 /* JsxAttribute */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 247 /* JsxSpreadAttribute */:
+ case 250 /* JsxSpreadAttribute */:
return visitNode(cbNode, node.expression);
- case 248 /* JsxExpression */:
+ case 251 /* JsxExpression */:
return visitNode(cbNode, node.expression);
- case 245 /* JsxClosingElement */:
+ case 248 /* JsxClosingElement */:
return visitNode(cbNode, node.tagName);
- case 257 /* JSDocTypeExpression */:
+ case 261 /* JSDocTypeExpression */:
return visitNode(cbNode, node.type);
- case 261 /* JSDocUnionType */:
+ case 265 /* JSDocUnionType */:
return visitNodes(cbNodes, node.types);
- case 262 /* JSDocTupleType */:
+ case 266 /* JSDocTupleType */:
return visitNodes(cbNodes, node.types);
- case 260 /* JSDocArrayType */:
+ case 264 /* JSDocArrayType */:
return visitNode(cbNode, node.elementType);
- case 264 /* JSDocNonNullableType */:
+ case 268 /* JSDocNonNullableType */:
return visitNode(cbNode, node.type);
- case 263 /* JSDocNullableType */:
+ case 267 /* JSDocNullableType */:
return visitNode(cbNode, node.type);
- case 265 /* JSDocRecordType */:
+ case 269 /* JSDocRecordType */:
return visitNode(cbNode, node.literal);
- case 267 /* JSDocTypeReference */:
+ case 271 /* JSDocTypeReference */:
return visitNode(cbNode, node.name) ||
visitNodes(cbNodes, node.typeArguments);
- case 268 /* JSDocOptionalType */:
+ case 272 /* JSDocOptionalType */:
return visitNode(cbNode, node.type);
- case 269 /* JSDocFunctionType */:
+ case 273 /* JSDocFunctionType */:
return visitNodes(cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 270 /* JSDocVariadicType */:
+ case 274 /* JSDocVariadicType */:
return visitNode(cbNode, node.type);
- case 271 /* JSDocConstructorType */:
+ case 275 /* JSDocConstructorType */:
return visitNode(cbNode, node.type);
- case 272 /* JSDocThisType */:
+ case 276 /* JSDocThisType */:
return visitNode(cbNode, node.type);
- case 266 /* JSDocRecordMember */:
+ case 270 /* JSDocRecordMember */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.type);
- case 273 /* JSDocComment */:
+ case 277 /* JSDocComment */:
return visitNodes(cbNodes, node.tags);
- case 275 /* JSDocParameterTag */:
+ case 279 /* JSDocParameterTag */:
return visitNode(cbNode, node.preParameterName) ||
visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.postParameterName);
- case 276 /* JSDocReturnTag */:
+ case 280 /* JSDocReturnTag */:
return visitNode(cbNode, node.typeExpression);
- case 277 /* JSDocTypeTag */:
+ case 281 /* JSDocTypeTag */:
return visitNode(cbNode, node.typeExpression);
- case 278 /* JSDocTemplateTag */:
+ case 282 /* JSDocTemplateTag */:
return visitNodes(cbNodes, node.typeParameters);
- case 279 /* JSDocTypedefTag */:
+ case 283 /* JSDocTypedefTag */:
return visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.jsDocTypeLiteral);
- case 281 /* JSDocTypeLiteral */:
+ case 285 /* JSDocTypeLiteral */:
return visitNodes(cbNodes, node.jsDocPropertyTags);
- case 280 /* JSDocPropertyTag */:
+ case 284 /* JSDocPropertyTag */:
return visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name);
- case 288 /* PartiallyEmittedExpression */:
+ case 292 /* PartiallyEmittedExpression */:
return visitNode(cbNode, node.expression);
- case 282 /* JSDocLiteralType */:
+ case 286 /* JSDocLiteralType */:
return visitNode(cbNode, node.literal);
}
}
@@ -13373,6 +14227,10 @@ var ts;
return result;
}
ts.createSourceFile = createSourceFile;
+ function parseIsolatedEntityName(text, languageVersion) {
+ return Parser.parseIsolatedEntityName(text, languageVersion);
+ }
+ ts.parseIsolatedEntityName = parseIsolatedEntityName;
function isExternalModule(file) {
return file.externalModuleIndicator !== undefined;
}
@@ -13414,8 +14272,8 @@ var ts;
(function (Parser) {
// Share a single scanner across all calls to parse a source file. This helps speed things
// up by avoiding the cost of creating/compiling scanners over and over again.
- var scanner = ts.createScanner(4 /* Latest */, /*skipTrivia*/ true);
- var disallowInAndDecoratorContext = 32768 /* DisallowInContext */ | 131072 /* DecoratorContext */;
+ var scanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ true);
+ var disallowInAndDecoratorContext = 65536 /* DisallowInContext */ | 262144 /* DecoratorContext */;
// capture constructors in 'initializeState' to avoid null checks
var NodeConstructor;
var TokenConstructor;
@@ -13513,6 +14371,16 @@ var ts;
return result;
}
Parser.parseSourceFile = parseSourceFile;
+ function parseIsolatedEntityName(content, languageVersion) {
+ initializeState(content, languageVersion, /*syntaxCursor*/ undefined, 1 /* JS */);
+ // Prime the scanner.
+ nextToken();
+ var entityName = parseEntityName(/*allowReservedWords*/ true);
+ var isInvalid = token() === 1 /* EndOfFileToken */ && !parseDiagnostics.length;
+ clearState();
+ return isInvalid ? entityName : undefined;
+ }
+ Parser.parseIsolatedEntityName = parseIsolatedEntityName;
function getLanguageVariant(scriptKind) {
// .tsx and .jsx files are treated as jsx language variant.
return scriptKind === 4 /* TSX */ || scriptKind === 2 /* JSX */ || scriptKind === 1 /* JS */ ? 1 /* JSX */ : 0 /* Standard */;
@@ -13529,7 +14397,7 @@ var ts;
identifiers = ts.createMap();
identifierCount = 0;
nodeCount = 0;
- contextFlags = scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */ ? 1048576 /* JavaScriptFile */ : 0 /* None */;
+ contextFlags = scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */ ? 2097152 /* JavaScriptFile */ : 0 /* None */;
parseErrorBeforeNextFinishedNode = false;
// Initialize and prime the scanner before parsing the source elements.
scanner.setText(sourceText);
@@ -13617,7 +14485,7 @@ var ts;
function createSourceFile(fileName, languageVersion, scriptKind) {
// code from createNode is inlined here so createNode won't have to deal with special case of creating source files
// this is quite rare comparing to other nodes and createNode should be as fast as possible
- var sourceFile = new SourceFileConstructor(256 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);
+ var sourceFile = new SourceFileConstructor(260 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);
nodeCount++;
sourceFile.text = sourceText;
sourceFile.bindDiagnostics = [];
@@ -13637,16 +14505,16 @@ var ts;
}
}
function setDisallowInContext(val) {
- setContextFlag(val, 32768 /* DisallowInContext */);
+ setContextFlag(val, 65536 /* DisallowInContext */);
}
function setYieldContext(val) {
- setContextFlag(val, 65536 /* YieldContext */);
+ setContextFlag(val, 131072 /* YieldContext */);
}
function setDecoratorContext(val) {
- setContextFlag(val, 131072 /* DecoratorContext */);
+ setContextFlag(val, 262144 /* DecoratorContext */);
}
function setAwaitContext(val) {
- setContextFlag(val, 262144 /* AwaitContext */);
+ setContextFlag(val, 524288 /* AwaitContext */);
}
function doOutsideOfContext(context, func) {
// contextFlagsToClear will contain only the context flags that are
@@ -13687,40 +14555,40 @@ var ts;
return func();
}
function allowInAnd(func) {
- return doOutsideOfContext(32768 /* DisallowInContext */, func);
+ return doOutsideOfContext(65536 /* DisallowInContext */, func);
}
function disallowInAnd(func) {
- return doInsideOfContext(32768 /* DisallowInContext */, func);
+ return doInsideOfContext(65536 /* DisallowInContext */, func);
}
function doInYieldContext(func) {
- return doInsideOfContext(65536 /* YieldContext */, func);
+ return doInsideOfContext(131072 /* YieldContext */, func);
}
function doInDecoratorContext(func) {
- return doInsideOfContext(131072 /* DecoratorContext */, func);
+ return doInsideOfContext(262144 /* DecoratorContext */, func);
}
function doInAwaitContext(func) {
- return doInsideOfContext(262144 /* AwaitContext */, func);
+ return doInsideOfContext(524288 /* AwaitContext */, func);
}
function doOutsideOfAwaitContext(func) {
- return doOutsideOfContext(262144 /* AwaitContext */, func);
+ return doOutsideOfContext(524288 /* AwaitContext */, func);
}
function doInYieldAndAwaitContext(func) {
- return doInsideOfContext(65536 /* YieldContext */ | 262144 /* AwaitContext */, func);
+ return doInsideOfContext(131072 /* YieldContext */ | 524288 /* AwaitContext */, func);
}
function inContext(flags) {
return (contextFlags & flags) !== 0;
}
function inYieldContext() {
- return inContext(65536 /* YieldContext */);
+ return inContext(131072 /* YieldContext */);
}
function inDisallowInContext() {
- return inContext(32768 /* DisallowInContext */);
+ return inContext(65536 /* DisallowInContext */);
}
function inDecoratorContext() {
- return inContext(131072 /* DecoratorContext */);
+ return inContext(262144 /* DecoratorContext */);
}
function inAwaitContext() {
- return inContext(262144 /* AwaitContext */);
+ return inContext(524288 /* AwaitContext */);
}
function parseErrorAtCurrentToken(message, arg0) {
var start = scanner.getTokenPos();
@@ -13901,7 +14769,7 @@ var ts;
if (!(pos >= 0)) {
pos = scanner.getStartPos();
}
- return kind >= 140 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) :
+ return kind >= 141 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) :
kind === 70 /* Identifier */ ? new IdentifierConstructor(kind, pos, pos) :
new TokenConstructor(kind, pos, pos);
}
@@ -13924,7 +14792,7 @@ var ts;
// flag so that we don't mark any subsequent nodes.
if (parseErrorBeforeNextFinishedNode) {
parseErrorBeforeNextFinishedNode = false;
- node.flags |= 524288 /* ThisNodeHasError */;
+ node.flags |= 1048576 /* ThisNodeHasError */;
}
return node;
}
@@ -13993,7 +14861,7 @@ var ts;
// PropertyName [Yield]:
// LiteralPropertyName
// ComputedPropertyName[?Yield]
- var node = createNode(141 /* ComputedPropertyName */);
+ var node = createNode(142 /* ComputedPropertyName */);
parseExpected(20 /* OpenBracketToken */);
// We parse any expression (including a comma expression). But the grammar
// says that only an assignment expression is allowed, so the grammar checker
@@ -14080,9 +14948,11 @@ var ts;
// which would be a candidate for improved error reporting.
return token() === 20 /* OpenBracketToken */ || isLiteralPropertyName();
case 12 /* ObjectLiteralMembers */:
- return token() === 20 /* OpenBracketToken */ || token() === 38 /* AsteriskToken */ || isLiteralPropertyName();
+ return token() === 20 /* OpenBracketToken */ || token() === 38 /* AsteriskToken */ || token() === 23 /* DotDotDotToken */ || isLiteralPropertyName();
+ case 17 /* RestProperties */:
+ return isLiteralPropertyName();
case 9 /* ObjectBindingElements */:
- return token() === 20 /* OpenBracketToken */ || isLiteralPropertyName();
+ return token() === 20 /* OpenBracketToken */ || token() === 23 /* DotDotDotToken */ || isLiteralPropertyName();
case 7 /* HeritageClauseElement */:
// If we see { } then only consume it as an expression if it is followed by , or {
// That way we won't consume the body of a class in its heritage clause.
@@ -14102,29 +14972,29 @@ var ts;
return isIdentifierOrPattern();
case 10 /* ArrayBindingElements */:
return token() === 25 /* CommaToken */ || token() === 23 /* DotDotDotToken */ || isIdentifierOrPattern();
- case 17 /* TypeParameters */:
+ case 18 /* TypeParameters */:
return isIdentifier();
case 11 /* ArgumentExpressions */:
case 15 /* ArrayLiteralMembers */:
return token() === 25 /* CommaToken */ || token() === 23 /* DotDotDotToken */ || isStartOfExpression();
case 16 /* Parameters */:
return isStartOfParameter();
- case 18 /* TypeArguments */:
- case 19 /* TupleElementTypes */:
+ case 19 /* TypeArguments */:
+ case 20 /* TupleElementTypes */:
return token() === 25 /* CommaToken */ || isStartOfType();
- case 20 /* HeritageClauses */:
+ case 21 /* HeritageClauses */:
return isHeritageClause();
- case 21 /* ImportOrExportSpecifiers */:
+ case 22 /* ImportOrExportSpecifiers */:
return ts.tokenIsIdentifierOrKeyword(token());
case 13 /* JsxAttributes */:
return ts.tokenIsIdentifierOrKeyword(token()) || token() === 16 /* OpenBraceToken */;
case 14 /* JsxChildren */:
return true;
- case 22 /* JSDocFunctionParameters */:
- case 23 /* JSDocTypeArguments */:
- case 25 /* JSDocTupleTypes */:
+ case 23 /* JSDocFunctionParameters */:
+ case 24 /* JSDocTypeArguments */:
+ case 26 /* JSDocTupleTypes */:
return JSDocParser.isJSDocType();
- case 24 /* JSDocRecordMembers */:
+ case 25 /* JSDocRecordMembers */:
return isSimplePropertyName();
}
ts.Debug.fail("Non-exhaustive case in 'isListElement'.");
@@ -14177,7 +15047,7 @@ var ts;
case 6 /* EnumMembers */:
case 12 /* ObjectLiteralMembers */:
case 9 /* ObjectBindingElements */:
- case 21 /* ImportOrExportSpecifiers */:
+ case 22 /* ImportOrExportSpecifiers */:
return token() === 17 /* CloseBraceToken */;
case 3 /* SwitchClauseStatements */:
return token() === 17 /* CloseBraceToken */ || token() === 72 /* CaseKeyword */ || token() === 78 /* DefaultKeyword */;
@@ -14185,35 +15055,36 @@ var ts;
return token() === 16 /* OpenBraceToken */ || token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */;
case 8 /* VariableDeclarations */:
return isVariableDeclaratorListTerminator();
- case 17 /* TypeParameters */:
+ case 18 /* TypeParameters */:
// Tokens other than '>' are here for better error recovery
return token() === 28 /* GreaterThanToken */ || token() === 18 /* OpenParenToken */ || token() === 16 /* OpenBraceToken */ || token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */;
case 11 /* ArgumentExpressions */:
// Tokens other than ')' are here for better error recovery
return token() === 19 /* CloseParenToken */ || token() === 24 /* SemicolonToken */;
case 15 /* ArrayLiteralMembers */:
- case 19 /* TupleElementTypes */:
+ case 20 /* TupleElementTypes */:
case 10 /* ArrayBindingElements */:
return token() === 21 /* CloseBracketToken */;
case 16 /* Parameters */:
+ case 17 /* RestProperties */:
// Tokens other than ')' and ']' (the latter for index signatures) are here for better error recovery
return token() === 19 /* CloseParenToken */ || token() === 21 /* CloseBracketToken */ /*|| token === SyntaxKind.OpenBraceToken*/;
- case 18 /* TypeArguments */:
+ case 19 /* TypeArguments */:
// All other tokens should cause the type-argument to terminate except comma token
return token() !== 25 /* CommaToken */;
- case 20 /* HeritageClauses */:
+ case 21 /* HeritageClauses */:
return token() === 16 /* OpenBraceToken */ || token() === 17 /* CloseBraceToken */;
case 13 /* JsxAttributes */:
return token() === 28 /* GreaterThanToken */ || token() === 40 /* SlashToken */;
case 14 /* JsxChildren */:
return token() === 26 /* LessThanToken */ && lookAhead(nextTokenIsSlash);
- case 22 /* JSDocFunctionParameters */:
+ case 23 /* JSDocFunctionParameters */:
return token() === 19 /* CloseParenToken */ || token() === 55 /* ColonToken */ || token() === 17 /* CloseBraceToken */;
- case 23 /* JSDocTypeArguments */:
+ case 24 /* JSDocTypeArguments */:
return token() === 28 /* GreaterThanToken */ || token() === 17 /* CloseBraceToken */;
- case 25 /* JSDocTupleTypes */:
+ case 26 /* JSDocTupleTypes */:
return token() === 21 /* CloseBracketToken */ || token() === 17 /* CloseBraceToken */;
- case 24 /* JSDocRecordMembers */:
+ case 25 /* JSDocRecordMembers */:
return token() === 17 /* CloseBraceToken */;
}
}
@@ -14240,7 +15111,7 @@ var ts;
}
// True if positioned at element or terminator of the current list or any enclosing list
function isInSomeParsingContext() {
- for (var kind = 0; kind < 26 /* Count */; kind++) {
+ for (var kind = 0; kind < 27 /* Count */; kind++) {
if (parsingContext & (1 << kind)) {
if (isListElement(kind, /*inErrorRecovery*/ true) || isListTerminator(kind)) {
return true;
@@ -14315,7 +15186,7 @@ var ts;
// differently depending on what mode it is in.
//
// This also applies to all our other context flags as well.
- var nodeContextFlags = node.flags & 1540096 /* ContextFlags */;
+ var nodeContextFlags = node.flags & 3080192 /* ContextFlags */;
if (nodeContextFlags !== contextFlags) {
return undefined;
}
@@ -14350,20 +15221,22 @@ var ts;
return isReusableVariableDeclaration(node);
case 16 /* Parameters */:
return isReusableParameter(node);
+ case 17 /* RestProperties */:
+ return false;
// Any other lists we do not care about reusing nodes in. But feel free to add if
// you can do so safely. Danger areas involve nodes that may involve speculative
// parsing. If speculative parsing is involved with the node, then the range the
// parser reached while looking ahead might be in the edited range (see the example
// in canReuseVariableDeclaratorNode for a good case of this).
- case 20 /* HeritageClauses */:
+ case 21 /* HeritageClauses */:
// This would probably be safe to reuse. There is no speculative parsing with
// heritage clauses.
- case 17 /* TypeParameters */:
+ case 18 /* TypeParameters */:
// This would probably be safe to reuse. There is no speculative parsing with
// type parameters. Note that that's because type *parameters* only occur in
// unambiguous *type* contexts. While type *arguments* occur in very ambiguous
// *expression* contexts.
- case 19 /* TupleElementTypes */:
+ case 20 /* TupleElementTypes */:
// This would probably be safe to reuse. There is no speculative parsing with
// tuple types.
// Technically, type argument list types are probably safe to reuse. While
@@ -14371,7 +15244,7 @@ var ts;
// produced from speculative parsing a < as a type argument list), we only have
// the types because speculative parsing succeeded. Thus, the lookahead never
// went past the end of the list and rewound.
- case 18 /* TypeArguments */:
+ case 19 /* TypeArguments */:
// Note: these are almost certainly not safe to ever reuse. Expressions commonly
// need a large amount of lookahead, and we should not reuse them as they may
// have actually intersected the edit.
@@ -14395,14 +15268,14 @@ var ts;
function isReusableClassMember(node) {
if (node) {
switch (node.kind) {
- case 149 /* Constructor */:
- case 154 /* IndexSignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 146 /* PropertyDeclaration */:
- case 199 /* SemicolonClassElement */:
+ case 150 /* Constructor */:
+ case 155 /* IndexSignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 147 /* PropertyDeclaration */:
+ case 202 /* SemicolonClassElement */:
return true;
- case 148 /* MethodDeclaration */:
+ case 149 /* MethodDeclaration */:
// Method declarations are not necessarily reusable. An object-literal
// may have a method calls "constructor(...)" and we must reparse that
// into an actual .ConstructorDeclaration.
@@ -14417,8 +15290,8 @@ var ts;
function isReusableSwitchClause(node) {
if (node) {
switch (node.kind) {
- case 249 /* CaseClause */:
- case 250 /* DefaultClause */:
+ case 252 /* CaseClause */:
+ case 253 /* DefaultClause */:
return true;
}
}
@@ -14427,58 +15300,58 @@ var ts;
function isReusableStatement(node) {
if (node) {
switch (node.kind) {
- case 221 /* FunctionDeclaration */:
- case 201 /* VariableStatement */:
- case 200 /* Block */:
- case 204 /* IfStatement */:
- case 203 /* ExpressionStatement */:
- case 216 /* ThrowStatement */:
- case 212 /* ReturnStatement */:
- case 214 /* SwitchStatement */:
- case 211 /* BreakStatement */:
- case 210 /* ContinueStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
- case 207 /* ForStatement */:
- case 206 /* WhileStatement */:
- case 213 /* WithStatement */:
- case 202 /* EmptyStatement */:
- case 217 /* TryStatement */:
- case 215 /* LabeledStatement */:
- case 205 /* DoStatement */:
- case 218 /* DebuggerStatement */:
- case 231 /* ImportDeclaration */:
- case 230 /* ImportEqualsDeclaration */:
- case 237 /* ExportDeclaration */:
- case 236 /* ExportAssignment */:
- case 226 /* ModuleDeclaration */:
- case 222 /* ClassDeclaration */:
- case 223 /* InterfaceDeclaration */:
- case 225 /* EnumDeclaration */:
- case 224 /* TypeAliasDeclaration */:
+ case 224 /* FunctionDeclaration */:
+ case 204 /* VariableStatement */:
+ case 203 /* Block */:
+ case 207 /* IfStatement */:
+ case 206 /* ExpressionStatement */:
+ case 219 /* ThrowStatement */:
+ case 215 /* ReturnStatement */:
+ case 217 /* SwitchStatement */:
+ case 214 /* BreakStatement */:
+ case 213 /* ContinueStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
+ case 210 /* ForStatement */:
+ case 209 /* WhileStatement */:
+ case 216 /* WithStatement */:
+ case 205 /* EmptyStatement */:
+ case 220 /* TryStatement */:
+ case 218 /* LabeledStatement */:
+ case 208 /* DoStatement */:
+ case 221 /* DebuggerStatement */:
+ case 234 /* ImportDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
+ case 240 /* ExportDeclaration */:
+ case 239 /* ExportAssignment */:
+ case 229 /* ModuleDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
return true;
}
}
return false;
}
function isReusableEnumMember(node) {
- return node.kind === 255 /* EnumMember */;
+ return node.kind === 259 /* EnumMember */;
}
function isReusableTypeMember(node) {
if (node) {
switch (node.kind) {
- case 153 /* ConstructSignature */:
- case 147 /* MethodSignature */:
- case 154 /* IndexSignature */:
- case 145 /* PropertySignature */:
- case 152 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 148 /* MethodSignature */:
+ case 155 /* IndexSignature */:
+ case 146 /* PropertySignature */:
+ case 153 /* CallSignature */:
return true;
}
}
return false;
}
function isReusableVariableDeclaration(node) {
- if (node.kind !== 219 /* VariableDeclaration */) {
+ if (node.kind !== 222 /* VariableDeclaration */) {
return false;
}
// Very subtle incremental parsing bug. Consider the following code:
@@ -14499,7 +15372,7 @@ var ts;
return variableDeclarator.initializer === undefined;
}
function isReusableParameter(node) {
- if (node.kind !== 143 /* Parameter */) {
+ if (node.kind !== 144 /* Parameter */) {
return false;
}
// See the comment in isReusableVariableDeclaration for why we do this.
@@ -14521,6 +15394,7 @@ var ts;
case 1 /* BlockStatements */: return ts.Diagnostics.Declaration_or_statement_expected;
case 2 /* SwitchClauses */: return ts.Diagnostics.case_or_default_expected;
case 3 /* SwitchClauseStatements */: return ts.Diagnostics.Statement_expected;
+ case 17 /* RestProperties */: // fallthrough
case 4 /* TypeMembers */: return ts.Diagnostics.Property_or_signature_expected;
case 5 /* ClassMembers */: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected;
case 6 /* EnumMembers */: return ts.Diagnostics.Enum_member_expected;
@@ -14532,17 +15406,17 @@ var ts;
case 12 /* ObjectLiteralMembers */: return ts.Diagnostics.Property_assignment_expected;
case 15 /* ArrayLiteralMembers */: return ts.Diagnostics.Expression_or_comma_expected;
case 16 /* Parameters */: return ts.Diagnostics.Parameter_declaration_expected;
- case 17 /* TypeParameters */: return ts.Diagnostics.Type_parameter_declaration_expected;
- case 18 /* TypeArguments */: return ts.Diagnostics.Type_argument_expected;
- case 19 /* TupleElementTypes */: return ts.Diagnostics.Type_expected;
- case 20 /* HeritageClauses */: return ts.Diagnostics.Unexpected_token_expected;
- case 21 /* ImportOrExportSpecifiers */: return ts.Diagnostics.Identifier_expected;
+ case 18 /* TypeParameters */: return ts.Diagnostics.Type_parameter_declaration_expected;
+ case 19 /* TypeArguments */: return ts.Diagnostics.Type_argument_expected;
+ case 20 /* TupleElementTypes */: return ts.Diagnostics.Type_expected;
+ case 21 /* HeritageClauses */: return ts.Diagnostics.Unexpected_token_expected;
+ case 22 /* ImportOrExportSpecifiers */: return ts.Diagnostics.Identifier_expected;
case 13 /* JsxAttributes */: return ts.Diagnostics.Identifier_expected;
case 14 /* JsxChildren */: return ts.Diagnostics.Identifier_expected;
- case 22 /* JSDocFunctionParameters */: return ts.Diagnostics.Parameter_declaration_expected;
- case 23 /* JSDocTypeArguments */: return ts.Diagnostics.Type_argument_expected;
- case 25 /* JSDocTupleTypes */: return ts.Diagnostics.Type_expected;
- case 24 /* JSDocRecordMembers */: return ts.Diagnostics.Property_assignment_expected;
+ case 23 /* JSDocFunctionParameters */: return ts.Diagnostics.Parameter_declaration_expected;
+ case 24 /* JSDocTypeArguments */: return ts.Diagnostics.Type_argument_expected;
+ case 26 /* JSDocTupleTypes */: return ts.Diagnostics.Type_expected;
+ case 25 /* JSDocRecordMembers */: return ts.Diagnostics.Property_assignment_expected;
}
}
;
@@ -14611,7 +15485,7 @@ var ts;
function parseEntityName(allowReservedWords, diagnosticMessage) {
var entity = parseIdentifier(diagnosticMessage);
while (parseOptional(22 /* DotToken */)) {
- var node = createNode(140 /* QualifiedName */, entity.pos); // !!!
+ var node = createNode(141 /* QualifiedName */, entity.pos); // !!!
node.left = entity;
node.right = parseRightSideOfDot(allowReservedWords);
entity = finishNode(node);
@@ -14650,7 +15524,7 @@ var ts;
return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
}
function parseTemplateExpression() {
- var template = createNode(190 /* TemplateExpression */);
+ var template = createNode(193 /* TemplateExpression */);
template.head = parseTemplateHead();
ts.Debug.assert(template.head.kind === 13 /* TemplateHead */, "Template head has wrong token kind");
var templateSpans = createNodeArray();
@@ -14662,7 +15536,7 @@ var ts;
return finishNode(template);
}
function parseTemplateSpan() {
- var span = createNode(198 /* TemplateSpan */);
+ var span = createNode(201 /* TemplateSpan */);
span.expression = allowInAnd(parseExpression);
var literal;
if (token() === 17 /* CloseBraceToken */) {
@@ -14717,33 +15591,33 @@ var ts;
// TYPES
function parseTypeReference() {
var typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected);
- var node = createNode(156 /* TypeReference */, typeName.pos);
+ var node = createNode(157 /* TypeReference */, typeName.pos);
node.typeName = typeName;
if (!scanner.hasPrecedingLineBreak() && token() === 26 /* LessThanToken */) {
- node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 26 /* LessThanToken */, 28 /* GreaterThanToken */);
+ node.typeArguments = parseBracketedList(19 /* TypeArguments */, parseType, 26 /* LessThanToken */, 28 /* GreaterThanToken */);
}
return finishNode(node);
}
function parseThisTypePredicate(lhs) {
nextToken();
- var node = createNode(155 /* TypePredicate */, lhs.pos);
+ var node = createNode(156 /* TypePredicate */, lhs.pos);
node.parameterName = lhs;
node.type = parseType();
return finishNode(node);
}
function parseThisTypeNode() {
- var node = createNode(166 /* ThisType */);
+ var node = createNode(167 /* ThisType */);
nextToken();
return finishNode(node);
}
function parseTypeQuery() {
- var node = createNode(159 /* TypeQuery */);
+ var node = createNode(160 /* TypeQuery */);
parseExpected(102 /* TypeOfKeyword */);
node.exprName = parseEntityName(/*allowReservedWords*/ true);
return finishNode(node);
}
function parseTypeParameter() {
- var node = createNode(142 /* TypeParameter */);
+ var node = createNode(143 /* TypeParameter */);
node.name = parseIdentifier();
if (parseOptional(84 /* ExtendsKeyword */)) {
// It's not uncommon for people to write improper constraints to a generic. If the
@@ -14768,7 +15642,7 @@ var ts;
}
function parseTypeParameters() {
if (token() === 26 /* LessThanToken */) {
- return parseBracketedList(17 /* TypeParameters */, parseTypeParameter, 26 /* LessThanToken */, 28 /* GreaterThanToken */);
+ return parseBracketedList(18 /* TypeParameters */, parseTypeParameter, 26 /* LessThanToken */, 28 /* GreaterThanToken */);
}
}
function parseParameterType() {
@@ -14781,7 +15655,7 @@ var ts;
return token() === 23 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 /* AtToken */ || token() === 98 /* ThisKeyword */;
}
function parseParameter() {
- var node = createNode(143 /* Parameter */);
+ var node = createNode(144 /* Parameter */);
if (token() === 98 /* ThisKeyword */) {
node.name = createIdentifier(/*isIdentifier*/ true, undefined);
node.type = parseParameterType();
@@ -14880,7 +15754,7 @@ var ts;
}
function parseSignatureMember(kind) {
var node = createNode(kind);
- if (kind === 153 /* ConstructSignature */) {
+ if (kind === 154 /* ConstructSignature */) {
parseExpected(93 /* NewKeyword */);
}
fillSignature(55 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node);
@@ -14944,7 +15818,7 @@ var ts;
return token() === 55 /* ColonToken */ || token() === 25 /* CommaToken */ || token() === 21 /* CloseBracketToken */;
}
function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(154 /* IndexSignature */, fullStart);
+ var node = createNode(155 /* IndexSignature */, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 20 /* OpenBracketToken */, 21 /* CloseBracketToken */);
@@ -14956,7 +15830,7 @@ var ts;
var name = parsePropertyName();
var questionToken = parseOptionalToken(54 /* QuestionToken */);
if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) {
- var method = createNode(147 /* MethodSignature */, fullStart);
+ var method = createNode(148 /* MethodSignature */, fullStart);
method.modifiers = modifiers;
method.name = name;
method.questionToken = questionToken;
@@ -14967,7 +15841,7 @@ var ts;
return addJSDocComment(finishNode(method));
}
else {
- var property = createNode(145 /* PropertySignature */, fullStart);
+ var property = createNode(146 /* PropertySignature */, fullStart);
property.modifiers = modifiers;
property.name = name;
property.questionToken = questionToken;
@@ -15016,10 +15890,10 @@ var ts;
}
function parseTypeMember() {
if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) {
- return parseSignatureMember(152 /* CallSignature */);
+ return parseSignatureMember(153 /* CallSignature */);
}
if (token() === 93 /* NewKeyword */ && lookAhead(isStartOfConstructSignature)) {
- return parseSignatureMember(153 /* ConstructSignature */);
+ return parseSignatureMember(154 /* ConstructSignature */);
}
var fullStart = getNodePos();
var modifiers = parseModifiers();
@@ -15033,7 +15907,7 @@ var ts;
return token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */;
}
function parseTypeLiteral() {
- var node = createNode(160 /* TypeLiteral */);
+ var node = createNode(161 /* TypeLiteral */);
node.members = parseObjectTypeMembers();
return finishNode(node);
}
@@ -15049,12 +15923,12 @@ var ts;
return members;
}
function parseTupleType() {
- var node = createNode(162 /* TupleType */);
- node.elementTypes = parseBracketedList(19 /* TupleElementTypes */, parseType, 20 /* OpenBracketToken */, 21 /* CloseBracketToken */);
+ var node = createNode(163 /* TupleType */);
+ node.elementTypes = parseBracketedList(20 /* TupleElementTypes */, parseType, 20 /* OpenBracketToken */, 21 /* CloseBracketToken */);
return finishNode(node);
}
function parseParenthesizedType() {
- var node = createNode(165 /* ParenthesizedType */);
+ var node = createNode(166 /* ParenthesizedType */);
parseExpected(18 /* OpenParenToken */);
node.type = parseType();
parseExpected(19 /* CloseParenToken */);
@@ -15062,7 +15936,7 @@ var ts;
}
function parseFunctionOrConstructorType(kind) {
var node = createNode(kind);
- if (kind === 158 /* ConstructorType */) {
+ if (kind === 159 /* ConstructorType */) {
parseExpected(93 /* NewKeyword */);
}
fillSignature(35 /* EqualsGreaterThanToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node);
@@ -15073,7 +15947,7 @@ var ts;
return token() === 22 /* DotToken */ ? undefined : node;
}
function parseLiteralTypeNode() {
- var node = createNode(167 /* LiteralType */);
+ var node = createNode(170 /* LiteralType */);
node.literal = parseSimpleUnaryExpression();
finishNode(node);
return node;
@@ -15084,12 +15958,12 @@ var ts;
function parseNonArrayType() {
switch (token()) {
case 118 /* AnyKeyword */:
- case 133 /* StringKeyword */:
- case 131 /* NumberKeyword */:
+ case 134 /* StringKeyword */:
+ case 132 /* NumberKeyword */:
case 121 /* BooleanKeyword */:
- case 134 /* SymbolKeyword */:
- case 136 /* UndefinedKeyword */:
- case 128 /* NeverKeyword */:
+ case 135 /* SymbolKeyword */:
+ case 137 /* UndefinedKeyword */:
+ case 129 /* NeverKeyword */:
// If these are followed by a dot, then parse these out as a dotted type reference instead.
var node = tryParse(parseKeywordAndNoDot);
return node || parseTypeReference();
@@ -15127,16 +16001,16 @@ var ts;
function isStartOfType() {
switch (token()) {
case 118 /* AnyKeyword */:
- case 133 /* StringKeyword */:
- case 131 /* NumberKeyword */:
+ case 134 /* StringKeyword */:
+ case 132 /* NumberKeyword */:
case 121 /* BooleanKeyword */:
- case 134 /* SymbolKeyword */:
+ case 135 /* SymbolKeyword */:
case 104 /* VoidKeyword */:
- case 136 /* UndefinedKeyword */:
+ case 137 /* UndefinedKeyword */:
case 94 /* NullKeyword */:
case 98 /* ThisKeyword */:
case 102 /* TypeOfKeyword */:
- case 128 /* NeverKeyword */:
+ case 129 /* NeverKeyword */:
case 16 /* OpenBraceToken */:
case 20 /* OpenBracketToken */:
case 26 /* LessThanToken */:
@@ -15163,13 +16037,36 @@ var ts;
function parseArrayTypeOrHigher() {
var type = parseNonArrayType();
while (!scanner.hasPrecedingLineBreak() && parseOptional(20 /* OpenBracketToken */)) {
- parseExpected(21 /* CloseBracketToken */);
- var node = createNode(161 /* ArrayType */, type.pos);
- node.elementType = type;
- type = finishNode(node);
+ if (isStartOfType()) {
+ var node = createNode(169 /* IndexedAccessType */, type.pos);
+ node.objectType = type;
+ node.indexType = parseType();
+ parseExpected(21 /* CloseBracketToken */);
+ type = finishNode(node);
+ }
+ else {
+ var node = createNode(162 /* ArrayType */, type.pos);
+ node.elementType = type;
+ parseExpected(21 /* CloseBracketToken */);
+ type = finishNode(node);
+ }
}
return type;
}
+ function parseTypeOperator(operator) {
+ var node = createNode(168 /* TypeOperator */);
+ parseExpected(operator);
+ node.operator = operator;
+ node.type = parseTypeOperatorOrHigher();
+ return finishNode(node);
+ }
+ function parseTypeOperatorOrHigher() {
+ switch (token()) {
+ case 126 /* KeyOfKeyword */:
+ return parseTypeOperator(126 /* KeyOfKeyword */);
+ }
+ return parseArrayTypeOrHigher();
+ }
function parseUnionOrIntersectionType(kind, parseConstituentType, operator) {
var type = parseConstituentType();
if (token() === operator) {
@@ -15185,10 +16082,10 @@ var ts;
return type;
}
function parseIntersectionTypeOrHigher() {
- return parseUnionOrIntersectionType(164 /* IntersectionType */, parseArrayTypeOrHigher, 47 /* AmpersandToken */);
+ return parseUnionOrIntersectionType(165 /* IntersectionType */, parseTypeOperatorOrHigher, 47 /* AmpersandToken */);
}
function parseUnionTypeOrHigher() {
- return parseUnionOrIntersectionType(163 /* UnionType */, parseIntersectionTypeOrHigher, 48 /* BarToken */);
+ return parseUnionOrIntersectionType(164 /* UnionType */, parseIntersectionTypeOrHigher, 48 /* BarToken */);
}
function isStartOfFunctionType() {
if (token() === 26 /* LessThanToken */) {
@@ -15245,7 +16142,7 @@ var ts;
var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);
var type = parseType();
if (typePredicateVariable) {
- var node = createNode(155 /* TypePredicate */, typePredicateVariable.pos);
+ var node = createNode(156 /* TypePredicate */, typePredicateVariable.pos);
node.parameterName = typePredicateVariable;
node.type = type;
return finishNode(node);
@@ -15264,14 +16161,14 @@ var ts;
function parseType() {
// The rules about 'yield' only apply to actual code/expression contexts. They don't
// apply to 'type' contexts. So we disable these parameters here before moving on.
- return doOutsideOfContext(327680 /* TypeExcludesFlags */, parseTypeWorker);
+ return doOutsideOfContext(655360 /* TypeExcludesFlags */, parseTypeWorker);
}
function parseTypeWorker() {
if (isStartOfFunctionType()) {
- return parseFunctionOrConstructorType(157 /* FunctionType */);
+ return parseFunctionOrConstructorType(158 /* FunctionType */);
}
if (token() === 93 /* NewKeyword */) {
- return parseFunctionOrConstructorType(158 /* ConstructorType */);
+ return parseFunctionOrConstructorType(159 /* ConstructorType */);
}
return parseUnionTypeOrHigher();
}
@@ -15472,7 +16369,7 @@ var ts;
return !scanner.hasPrecedingLineBreak() && isIdentifier();
}
function parseYieldExpression() {
- var node = createNode(191 /* YieldExpression */);
+ var node = createNode(194 /* YieldExpression */);
// YieldExpression[In] :
// yield
// yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield]
@@ -15494,13 +16391,13 @@ var ts;
ts.Debug.assert(token() === 35 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
var node;
if (asyncModifier) {
- node = createNode(181 /* ArrowFunction */, asyncModifier.pos);
+ node = createNode(184 /* ArrowFunction */, asyncModifier.pos);
node.modifiers = asyncModifier;
}
else {
- node = createNode(181 /* ArrowFunction */, identifier.pos);
+ node = createNode(184 /* ArrowFunction */, identifier.pos);
}
- var parameter = createNode(143 /* Parameter */, identifier.pos);
+ var parameter = createNode(144 /* Parameter */, identifier.pos);
parameter.name = identifier;
finishNode(parameter);
node.parameters = createNodeArray([parameter], parameter.pos);
@@ -15682,7 +16579,7 @@ var ts;
return 0 /* False */;
}
function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) {
- var node = createNode(181 /* ArrowFunction */);
+ var node = createNode(184 /* ArrowFunction */);
node.modifiers = parseModifiersForArrowFunction();
var isAsync = !!(ts.getModifierFlags(node) & 256 /* Async */);
// Arrow functions are never generators.
@@ -15748,7 +16645,7 @@ var ts;
}
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
// we do not that for the 'whenFalse' part.
- var node = createNode(189 /* ConditionalExpression */, leftOperand.pos);
+ var node = createNode(192 /* ConditionalExpression */, leftOperand.pos);
node.condition = leftOperand;
node.questionToken = questionToken;
node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);
@@ -15761,7 +16658,7 @@ var ts;
return parseBinaryExpressionRest(precedence, leftOperand);
}
function isInOrOfKeyword(t) {
- return t === 91 /* InKeyword */ || t === 139 /* OfKeyword */;
+ return t === 91 /* InKeyword */ || t === 140 /* OfKeyword */;
}
function parseBinaryExpressionRest(precedence, leftOperand) {
while (true) {
@@ -15869,39 +16766,39 @@ var ts;
return -1;
}
function makeBinaryExpression(left, operatorToken, right) {
- var node = createNode(188 /* BinaryExpression */, left.pos);
+ var node = createNode(191 /* BinaryExpression */, left.pos);
node.left = left;
node.operatorToken = operatorToken;
node.right = right;
return finishNode(node);
}
function makeAsExpression(left, right) {
- var node = createNode(196 /* AsExpression */, left.pos);
+ var node = createNode(199 /* AsExpression */, left.pos);
node.expression = left;
node.type = right;
return finishNode(node);
}
function parsePrefixUnaryExpression() {
- var node = createNode(186 /* PrefixUnaryExpression */);
+ var node = createNode(189 /* PrefixUnaryExpression */);
node.operator = token();
nextToken();
node.operand = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseDeleteExpression() {
- var node = createNode(182 /* DeleteExpression */);
+ var node = createNode(185 /* DeleteExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseTypeOfExpression() {
- var node = createNode(183 /* TypeOfExpression */);
+ var node = createNode(186 /* TypeOfExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseVoidExpression() {
- var node = createNode(184 /* VoidExpression */);
+ var node = createNode(187 /* VoidExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
@@ -15917,7 +16814,7 @@ var ts;
return false;
}
function parseAwaitExpression() {
- var node = createNode(185 /* AwaitExpression */);
+ var node = createNode(188 /* AwaitExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
@@ -15960,7 +16857,7 @@ var ts;
var simpleUnaryExpression = parseSimpleUnaryExpression();
if (token() === 39 /* AsteriskAsteriskToken */) {
var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos);
- if (simpleUnaryExpression.kind === 178 /* TypeAssertionExpression */) {
+ if (simpleUnaryExpression.kind === 181 /* TypeAssertionExpression */) {
parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
}
else {
@@ -16056,7 +16953,7 @@ var ts;
*/
function parseIncrementExpression() {
if (token() === 42 /* PlusPlusToken */ || token() === 43 /* MinusMinusToken */) {
- var node = createNode(186 /* PrefixUnaryExpression */);
+ var node = createNode(189 /* PrefixUnaryExpression */);
node.operator = token();
nextToken();
node.operand = parseLeftHandSideExpressionOrHigher();
@@ -16069,7 +16966,7 @@ var ts;
var expression = parseLeftHandSideExpressionOrHigher();
ts.Debug.assert(ts.isLeftHandSideExpression(expression));
if ((token() === 42 /* PlusPlusToken */ || token() === 43 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) {
- var node = createNode(187 /* PostfixUnaryExpression */, expression.pos);
+ var node = createNode(190 /* PostfixUnaryExpression */, expression.pos);
node.operand = expression;
node.operator = token();
nextToken();
@@ -16173,7 +17070,7 @@ var ts;
}
// If we have seen "super" it must be followed by '(' or '.'.
// If it wasn't then just try to parse out a '.' and report an error.
- var node = createNode(173 /* PropertyAccessExpression */, expression.pos);
+ var node = createNode(176 /* PropertyAccessExpression */, expression.pos);
node.expression = expression;
parseExpectedToken(22 /* DotToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
@@ -16198,8 +17095,8 @@ var ts;
function parseJsxElementOrSelfClosingElement(inExpressionContext) {
var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext);
var result;
- if (opening.kind === 244 /* JsxOpeningElement */) {
- var node = createNode(242 /* JsxElement */, opening.pos);
+ if (opening.kind === 247 /* JsxOpeningElement */) {
+ var node = createNode(245 /* JsxElement */, opening.pos);
node.openingElement = opening;
node.children = parseJsxChildren(node.openingElement.tagName);
node.closingElement = parseJsxClosingElement(inExpressionContext);
@@ -16209,7 +17106,7 @@ var ts;
result = finishNode(node);
}
else {
- ts.Debug.assert(opening.kind === 243 /* JsxSelfClosingElement */);
+ ts.Debug.assert(opening.kind === 246 /* JsxSelfClosingElement */);
// Nothing else to do for self-closing elements
result = opening;
}
@@ -16224,7 +17121,7 @@ var ts;
var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); });
if (invalidElement) {
parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element);
- var badNode = createNode(188 /* BinaryExpression */, result.pos);
+ var badNode = createNode(191 /* BinaryExpression */, result.pos);
badNode.end = invalidElement.end;
badNode.left = result;
badNode.right = invalidElement;
@@ -16283,7 +17180,7 @@ var ts;
// Closing tag, so scan the immediately-following text with the JSX scanning instead
// of regular scanning to avoid treating illegal characters (e.g. '#') as immediate
// scanning errors
- node = createNode(244 /* JsxOpeningElement */, fullStart);
+ node = createNode(247 /* JsxOpeningElement */, fullStart);
scanJsxText();
}
else {
@@ -16295,7 +17192,7 @@ var ts;
parseExpected(28 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false);
scanJsxText();
}
- node = createNode(243 /* JsxSelfClosingElement */, fullStart);
+ node = createNode(246 /* JsxSelfClosingElement */, fullStart);
}
node.tagName = tagName;
node.attributes = attributes;
@@ -16311,7 +17208,7 @@ var ts;
var expression = token() === 98 /* ThisKeyword */ ?
parseTokenNode() : parseIdentifierName();
while (parseOptional(22 /* DotToken */)) {
- var propertyAccess = createNode(173 /* PropertyAccessExpression */, expression.pos);
+ var propertyAccess = createNode(176 /* PropertyAccessExpression */, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
expression = finishNode(propertyAccess);
@@ -16319,7 +17216,7 @@ var ts;
return expression;
}
function parseJsxExpression(inExpressionContext) {
- var node = createNode(248 /* JsxExpression */);
+ var node = createNode(251 /* JsxExpression */);
parseExpected(16 /* OpenBraceToken */);
if (token() !== 17 /* CloseBraceToken */) {
node.expression = parseAssignmentExpressionOrHigher();
@@ -16338,7 +17235,7 @@ var ts;
return parseJsxSpreadAttribute();
}
scanJsxIdentifier();
- var node = createNode(246 /* JsxAttribute */);
+ var node = createNode(249 /* JsxAttribute */);
node.name = parseIdentifierName();
if (token() === 57 /* EqualsToken */) {
switch (scanJsxAttributeValue()) {
@@ -16353,7 +17250,7 @@ var ts;
return finishNode(node);
}
function parseJsxSpreadAttribute() {
- var node = createNode(247 /* JsxSpreadAttribute */);
+ var node = createNode(250 /* JsxSpreadAttribute */);
parseExpected(16 /* OpenBraceToken */);
parseExpected(23 /* DotDotDotToken */);
node.expression = parseExpression();
@@ -16361,7 +17258,7 @@ var ts;
return finishNode(node);
}
function parseJsxClosingElement(inExpressionContext) {
- var node = createNode(245 /* JsxClosingElement */);
+ var node = createNode(248 /* JsxClosingElement */);
parseExpected(27 /* LessThanSlashToken */);
node.tagName = parseJsxElementName();
if (inExpressionContext) {
@@ -16374,7 +17271,7 @@ var ts;
return finishNode(node);
}
function parseTypeAssertion() {
- var node = createNode(178 /* TypeAssertionExpression */);
+ var node = createNode(181 /* TypeAssertionExpression */);
parseExpected(26 /* LessThanToken */);
node.type = parseType();
parseExpected(28 /* GreaterThanToken */);
@@ -16385,7 +17282,7 @@ var ts;
while (true) {
var dotToken = parseOptionalToken(22 /* DotToken */);
if (dotToken) {
- var propertyAccess = createNode(173 /* PropertyAccessExpression */, expression.pos);
+ var propertyAccess = createNode(176 /* PropertyAccessExpression */, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
expression = finishNode(propertyAccess);
@@ -16393,14 +17290,14 @@ var ts;
}
if (token() === 50 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
nextToken();
- var nonNullExpression = createNode(197 /* NonNullExpression */, expression.pos);
+ var nonNullExpression = createNode(200 /* NonNullExpression */, expression.pos);
nonNullExpression.expression = expression;
expression = finishNode(nonNullExpression);
continue;
}
// when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName
if (!inDecoratorContext() && parseOptional(20 /* OpenBracketToken */)) {
- var indexedAccess = createNode(174 /* ElementAccessExpression */, expression.pos);
+ var indexedAccess = createNode(177 /* ElementAccessExpression */, expression.pos);
indexedAccess.expression = expression;
// It's not uncommon for a user to write: "new Type[]".
// Check for that common pattern and report a better error message.
@@ -16416,7 +17313,7 @@ var ts;
continue;
}
if (token() === 12 /* NoSubstitutionTemplateLiteral */ || token() === 13 /* TemplateHead */) {
- var tagExpression = createNode(177 /* TaggedTemplateExpression */, expression.pos);
+ var tagExpression = createNode(180 /* TaggedTemplateExpression */, expression.pos);
tagExpression.tag = expression;
tagExpression.template = token() === 12 /* NoSubstitutionTemplateLiteral */
? parseLiteralNode()
@@ -16439,7 +17336,7 @@ var ts;
if (!typeArguments) {
return expression;
}
- var callExpr = createNode(175 /* CallExpression */, expression.pos);
+ var callExpr = createNode(178 /* CallExpression */, expression.pos);
callExpr.expression = expression;
callExpr.typeArguments = typeArguments;
callExpr.arguments = parseArgumentList();
@@ -16447,7 +17344,7 @@ var ts;
continue;
}
else if (token() === 18 /* OpenParenToken */) {
- var callExpr = createNode(175 /* CallExpression */, expression.pos);
+ var callExpr = createNode(178 /* CallExpression */, expression.pos);
callExpr.expression = expression;
callExpr.arguments = parseArgumentList();
expression = finishNode(callExpr);
@@ -16466,7 +17363,7 @@ var ts;
if (!parseOptional(26 /* LessThanToken */)) {
return undefined;
}
- var typeArguments = parseDelimitedList(18 /* TypeArguments */, parseType);
+ var typeArguments = parseDelimitedList(19 /* TypeArguments */, parseType);
if (!parseExpected(28 /* GreaterThanToken */)) {
// If it doesn't have the closing > then it's definitely not an type argument list.
return undefined;
@@ -16557,28 +17454,28 @@ var ts;
return parseIdentifier(ts.Diagnostics.Expression_expected);
}
function parseParenthesizedExpression() {
- var node = createNode(179 /* ParenthesizedExpression */);
+ var node = createNode(182 /* ParenthesizedExpression */);
parseExpected(18 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(19 /* CloseParenToken */);
return finishNode(node);
}
function parseSpreadElement() {
- var node = createNode(192 /* SpreadElementExpression */);
+ var node = createNode(195 /* SpreadElement */);
parseExpected(23 /* DotDotDotToken */);
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
function parseArgumentOrArrayLiteralElement() {
return token() === 23 /* DotDotDotToken */ ? parseSpreadElement() :
- token() === 25 /* CommaToken */ ? createNode(194 /* OmittedExpression */) :
+ token() === 25 /* CommaToken */ ? createNode(197 /* OmittedExpression */) :
parseAssignmentExpressionOrHigher();
}
function parseArgumentExpression() {
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
}
function parseArrayLiteralExpression() {
- var node = createNode(171 /* ArrayLiteralExpression */);
+ var node = createNode(174 /* ArrayLiteralExpression */);
parseExpected(20 /* OpenBracketToken */);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -16589,15 +17486,21 @@ var ts;
}
function tryParseAccessorDeclaration(fullStart, decorators, modifiers) {
if (parseContextualModifier(124 /* GetKeyword */)) {
- return parseAccessorDeclaration(150 /* GetAccessor */, fullStart, decorators, modifiers);
+ return parseAccessorDeclaration(151 /* GetAccessor */, fullStart, decorators, modifiers);
}
- else if (parseContextualModifier(132 /* SetKeyword */)) {
- return parseAccessorDeclaration(151 /* SetAccessor */, fullStart, decorators, modifiers);
+ else if (parseContextualModifier(133 /* SetKeyword */)) {
+ return parseAccessorDeclaration(152 /* SetAccessor */, fullStart, decorators, modifiers);
}
return undefined;
}
function parseObjectLiteralElement() {
var fullStart = scanner.getStartPos();
+ var dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */);
+ if (dotDotDotToken) {
+ var spreadElement = createNode(258 /* SpreadAssignment */, fullStart);
+ spreadElement.expression = parseAssignmentExpressionOrHigher();
+ return addJSDocComment(finishNode(spreadElement));
+ }
var decorators = parseDecorators();
var modifiers = parseModifiers();
var accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers);
@@ -16619,7 +17522,7 @@ var ts;
// this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 /* CommaToken */ || token() === 17 /* CloseBraceToken */ || token() === 57 /* EqualsToken */);
if (isShorthandPropertyAssignment) {
- var shorthandDeclaration = createNode(254 /* ShorthandPropertyAssignment */, fullStart);
+ var shorthandDeclaration = createNode(257 /* ShorthandPropertyAssignment */, fullStart);
shorthandDeclaration.name = propertyName;
shorthandDeclaration.questionToken = questionToken;
var equalsToken = parseOptionalToken(57 /* EqualsToken */);
@@ -16630,7 +17533,7 @@ var ts;
return addJSDocComment(finishNode(shorthandDeclaration));
}
else {
- var propertyAssignment = createNode(253 /* PropertyAssignment */, fullStart);
+ var propertyAssignment = createNode(256 /* PropertyAssignment */, fullStart);
propertyAssignment.modifiers = modifiers;
propertyAssignment.name = propertyName;
propertyAssignment.questionToken = questionToken;
@@ -16640,7 +17543,7 @@ var ts;
}
}
function parseObjectLiteralExpression() {
- var node = createNode(172 /* ObjectLiteralExpression */);
+ var node = createNode(175 /* ObjectLiteralExpression */);
parseExpected(16 /* OpenBraceToken */);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -16659,7 +17562,7 @@ var ts;
if (saveDecoratorContext) {
setDecoratorContext(/*val*/ false);
}
- var node = createNode(180 /* FunctionExpression */);
+ var node = createNode(183 /* FunctionExpression */);
node.modifiers = parseModifiers();
parseExpected(88 /* FunctionKeyword */);
node.asteriskToken = parseOptionalToken(38 /* AsteriskToken */);
@@ -16681,7 +17584,7 @@ var ts;
return isIdentifier() ? parseIdentifier() : undefined;
}
function parseNewExpression() {
- var node = createNode(176 /* NewExpression */);
+ var node = createNode(179 /* NewExpression */);
parseExpected(93 /* NewKeyword */);
node.expression = parseMemberExpressionOrHigher();
node.typeArguments = tryParse(parseTypeArgumentsInExpression);
@@ -16692,7 +17595,7 @@ var ts;
}
// STATEMENTS
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
- var node = createNode(200 /* Block */);
+ var node = createNode(203 /* Block */);
if (parseExpected(16 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) {
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -16725,12 +17628,12 @@ var ts;
return block;
}
function parseEmptyStatement() {
- var node = createNode(202 /* EmptyStatement */);
+ var node = createNode(205 /* EmptyStatement */);
parseExpected(24 /* SemicolonToken */);
return finishNode(node);
}
function parseIfStatement() {
- var node = createNode(204 /* IfStatement */);
+ var node = createNode(207 /* IfStatement */);
parseExpected(89 /* IfKeyword */);
parseExpected(18 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
@@ -16740,7 +17643,7 @@ var ts;
return finishNode(node);
}
function parseDoStatement() {
- var node = createNode(205 /* DoStatement */);
+ var node = createNode(208 /* DoStatement */);
parseExpected(80 /* DoKeyword */);
node.statement = parseStatement();
parseExpected(105 /* WhileKeyword */);
@@ -16755,7 +17658,7 @@ var ts;
return finishNode(node);
}
function parseWhileStatement() {
- var node = createNode(206 /* WhileStatement */);
+ var node = createNode(209 /* WhileStatement */);
parseExpected(105 /* WhileKeyword */);
parseExpected(18 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
@@ -16778,21 +17681,21 @@ var ts;
}
var forOrForInOrForOfStatement;
if (parseOptional(91 /* InKeyword */)) {
- var forInStatement = createNode(208 /* ForInStatement */, pos);
+ var forInStatement = createNode(211 /* ForInStatement */, pos);
forInStatement.initializer = initializer;
forInStatement.expression = allowInAnd(parseExpression);
parseExpected(19 /* CloseParenToken */);
forOrForInOrForOfStatement = forInStatement;
}
- else if (parseOptional(139 /* OfKeyword */)) {
- var forOfStatement = createNode(209 /* ForOfStatement */, pos);
+ else if (parseOptional(140 /* OfKeyword */)) {
+ var forOfStatement = createNode(212 /* ForOfStatement */, pos);
forOfStatement.initializer = initializer;
forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher);
parseExpected(19 /* CloseParenToken */);
forOrForInOrForOfStatement = forOfStatement;
}
else {
- var forStatement = createNode(207 /* ForStatement */, pos);
+ var forStatement = createNode(210 /* ForStatement */, pos);
forStatement.initializer = initializer;
parseExpected(24 /* SemicolonToken */);
if (token() !== 24 /* SemicolonToken */ && token() !== 19 /* CloseParenToken */) {
@@ -16810,7 +17713,7 @@ var ts;
}
function parseBreakOrContinueStatement(kind) {
var node = createNode(kind);
- parseExpected(kind === 211 /* BreakStatement */ ? 71 /* BreakKeyword */ : 76 /* ContinueKeyword */);
+ parseExpected(kind === 214 /* BreakStatement */ ? 71 /* BreakKeyword */ : 76 /* ContinueKeyword */);
if (!canParseSemicolon()) {
node.label = parseIdentifier();
}
@@ -16818,7 +17721,7 @@ var ts;
return finishNode(node);
}
function parseReturnStatement() {
- var node = createNode(212 /* ReturnStatement */);
+ var node = createNode(215 /* ReturnStatement */);
parseExpected(95 /* ReturnKeyword */);
if (!canParseSemicolon()) {
node.expression = allowInAnd(parseExpression);
@@ -16827,7 +17730,7 @@ var ts;
return finishNode(node);
}
function parseWithStatement() {
- var node = createNode(213 /* WithStatement */);
+ var node = createNode(216 /* WithStatement */);
parseExpected(106 /* WithKeyword */);
parseExpected(18 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
@@ -16836,7 +17739,7 @@ var ts;
return finishNode(node);
}
function parseCaseClause() {
- var node = createNode(249 /* CaseClause */);
+ var node = createNode(252 /* CaseClause */);
parseExpected(72 /* CaseKeyword */);
node.expression = allowInAnd(parseExpression);
parseExpected(55 /* ColonToken */);
@@ -16844,7 +17747,7 @@ var ts;
return finishNode(node);
}
function parseDefaultClause() {
- var node = createNode(250 /* DefaultClause */);
+ var node = createNode(253 /* DefaultClause */);
parseExpected(78 /* DefaultKeyword */);
parseExpected(55 /* ColonToken */);
node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
@@ -16854,12 +17757,12 @@ var ts;
return token() === 72 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause();
}
function parseSwitchStatement() {
- var node = createNode(214 /* SwitchStatement */);
+ var node = createNode(217 /* SwitchStatement */);
parseExpected(97 /* SwitchKeyword */);
parseExpected(18 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(19 /* CloseParenToken */);
- var caseBlock = createNode(228 /* CaseBlock */, scanner.getStartPos());
+ var caseBlock = createNode(231 /* CaseBlock */, scanner.getStartPos());
parseExpected(16 /* OpenBraceToken */);
caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause);
parseExpected(17 /* CloseBraceToken */);
@@ -16874,7 +17777,7 @@ var ts;
// directly as that might consume an expression on the following line.
// We just return 'undefined' in that case. The actual error will be reported in the
// grammar walker.
- var node = createNode(216 /* ThrowStatement */);
+ var node = createNode(219 /* ThrowStatement */);
parseExpected(99 /* ThrowKeyword */);
node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression);
parseSemicolon();
@@ -16882,7 +17785,7 @@ var ts;
}
// TODO: Review for error recovery
function parseTryStatement() {
- var node = createNode(217 /* TryStatement */);
+ var node = createNode(220 /* TryStatement */);
parseExpected(101 /* TryKeyword */);
node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
node.catchClause = token() === 73 /* CatchKeyword */ ? parseCatchClause() : undefined;
@@ -16895,7 +17798,7 @@ var ts;
return finishNode(node);
}
function parseCatchClause() {
- var result = createNode(252 /* CatchClause */);
+ var result = createNode(255 /* CatchClause */);
parseExpected(73 /* CatchKeyword */);
if (parseExpected(18 /* OpenParenToken */)) {
result.variableDeclaration = parseVariableDeclaration();
@@ -16905,7 +17808,7 @@ var ts;
return finishNode(result);
}
function parseDebuggerStatement() {
- var node = createNode(218 /* DebuggerStatement */);
+ var node = createNode(221 /* DebuggerStatement */);
parseExpected(77 /* DebuggerKeyword */);
parseSemicolon();
return finishNode(node);
@@ -16917,13 +17820,13 @@ var ts;
var fullStart = scanner.getStartPos();
var expression = allowInAnd(parseExpression);
if (expression.kind === 70 /* Identifier */ && parseOptional(55 /* ColonToken */)) {
- var labeledStatement = createNode(215 /* LabeledStatement */, fullStart);
+ var labeledStatement = createNode(218 /* LabeledStatement */, fullStart);
labeledStatement.label = expression;
labeledStatement.statement = parseStatement();
return addJSDocComment(finishNode(labeledStatement));
}
else {
- var expressionStatement = createNode(203 /* ExpressionStatement */, fullStart);
+ var expressionStatement = createNode(206 /* ExpressionStatement */, fullStart);
expressionStatement.expression = expression;
parseSemicolon();
return addJSDocComment(finishNode(expressionStatement));
@@ -16973,10 +17876,10 @@ var ts;
//
// could be legal, it would add complexity for very little gain.
case 108 /* InterfaceKeyword */:
- case 135 /* TypeKeyword */:
+ case 136 /* TypeKeyword */:
return nextTokenIsIdentifierOnSameLine();
- case 126 /* ModuleKeyword */:
- case 127 /* NamespaceKeyword */:
+ case 127 /* ModuleKeyword */:
+ case 128 /* NamespaceKeyword */:
return nextTokenIsIdentifierOrStringLiteralOnSameLine();
case 116 /* AbstractKeyword */:
case 119 /* AsyncKeyword */:
@@ -16984,14 +17887,14 @@ var ts;
case 111 /* PrivateKeyword */:
case 112 /* ProtectedKeyword */:
case 113 /* PublicKeyword */:
- case 129 /* ReadonlyKeyword */:
+ case 130 /* ReadonlyKeyword */:
nextToken();
// ASI takes effect for this modifier.
if (scanner.hasPrecedingLineBreak()) {
return false;
}
continue;
- case 138 /* GlobalKeyword */:
+ case 139 /* GlobalKeyword */:
nextToken();
return token() === 16 /* OpenBraceToken */ || token() === 70 /* Identifier */ || token() === 83 /* ExportKeyword */;
case 90 /* ImportKeyword */:
@@ -17051,17 +17954,17 @@ var ts;
case 119 /* AsyncKeyword */:
case 123 /* DeclareKeyword */:
case 108 /* InterfaceKeyword */:
- case 126 /* ModuleKeyword */:
- case 127 /* NamespaceKeyword */:
- case 135 /* TypeKeyword */:
- case 138 /* GlobalKeyword */:
+ case 127 /* ModuleKeyword */:
+ case 128 /* NamespaceKeyword */:
+ case 136 /* TypeKeyword */:
+ case 139 /* GlobalKeyword */:
// When these don't start a declaration, they're an identifier in an expression statement
return true;
case 113 /* PublicKeyword */:
case 111 /* PrivateKeyword */:
case 112 /* ProtectedKeyword */:
case 114 /* StaticKeyword */:
- case 129 /* ReadonlyKeyword */:
+ case 130 /* ReadonlyKeyword */:
// When these don't start a declaration, they may be the start of a class member if an identifier
// immediately follows. Otherwise they're an identifier in an expression statement.
return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
@@ -17104,9 +18007,9 @@ var ts;
case 87 /* ForKeyword */:
return parseForOrForInOrForOfStatement();
case 76 /* ContinueKeyword */:
- return parseBreakOrContinueStatement(210 /* ContinueStatement */);
+ return parseBreakOrContinueStatement(213 /* ContinueStatement */);
case 71 /* BreakKeyword */:
- return parseBreakOrContinueStatement(211 /* BreakStatement */);
+ return parseBreakOrContinueStatement(214 /* BreakStatement */);
case 95 /* ReturnKeyword */:
return parseReturnStatement();
case 106 /* WithKeyword */:
@@ -17126,9 +18029,9 @@ var ts;
return parseDeclaration();
case 119 /* AsyncKeyword */:
case 108 /* InterfaceKeyword */:
- case 135 /* TypeKeyword */:
- case 126 /* ModuleKeyword */:
- case 127 /* NamespaceKeyword */:
+ case 136 /* TypeKeyword */:
+ case 127 /* ModuleKeyword */:
+ case 128 /* NamespaceKeyword */:
case 123 /* DeclareKeyword */:
case 75 /* ConstKeyword */:
case 82 /* EnumKeyword */:
@@ -17139,8 +18042,8 @@ var ts;
case 113 /* PublicKeyword */:
case 116 /* AbstractKeyword */:
case 114 /* StaticKeyword */:
- case 129 /* ReadonlyKeyword */:
- case 138 /* GlobalKeyword */:
+ case 130 /* ReadonlyKeyword */:
+ case 139 /* GlobalKeyword */:
if (isStartOfDeclaration()) {
return parseDeclaration();
}
@@ -17163,13 +18066,13 @@ var ts;
return parseClassDeclaration(fullStart, decorators, modifiers);
case 108 /* InterfaceKeyword */:
return parseInterfaceDeclaration(fullStart, decorators, modifiers);
- case 135 /* TypeKeyword */:
+ case 136 /* TypeKeyword */:
return parseTypeAliasDeclaration(fullStart, decorators, modifiers);
case 82 /* EnumKeyword */:
return parseEnumDeclaration(fullStart, decorators, modifiers);
- case 138 /* GlobalKeyword */:
- case 126 /* ModuleKeyword */:
- case 127 /* NamespaceKeyword */:
+ case 139 /* GlobalKeyword */:
+ case 127 /* ModuleKeyword */:
+ case 128 /* NamespaceKeyword */:
return parseModuleDeclaration(fullStart, decorators, modifiers);
case 90 /* ImportKeyword */:
return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers);
@@ -17188,7 +18091,7 @@ var ts;
if (decorators || modifiers) {
// We reached this point because we encountered decorators and/or modifiers and assumed a declaration
// would follow. For recovery and error reporting purposes, return an incomplete declaration.
- var node = createMissingNode(240 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
+ var node = createMissingNode(243 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
node.pos = fullStart;
node.decorators = decorators;
node.modifiers = modifiers;
@@ -17210,16 +18113,17 @@ var ts;
// DECLARATIONS
function parseArrayBindingElement() {
if (token() === 25 /* CommaToken */) {
- return createNode(194 /* OmittedExpression */);
+ return createNode(197 /* OmittedExpression */);
}
- var node = createNode(170 /* BindingElement */);
+ var node = createNode(173 /* BindingElement */);
node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */);
node.name = parseIdentifierOrPattern();
node.initializer = parseBindingElementInitializer(/*inParameter*/ false);
return finishNode(node);
}
function parseObjectBindingElement() {
- var node = createNode(170 /* BindingElement */);
+ var node = createNode(173 /* BindingElement */);
+ node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */);
var tokenIsIdentifier = isIdentifier();
var propertyName = parsePropertyName();
if (tokenIsIdentifier && token() !== 55 /* ColonToken */) {
@@ -17234,14 +18138,14 @@ var ts;
return finishNode(node);
}
function parseObjectBindingPattern() {
- var node = createNode(168 /* ObjectBindingPattern */);
+ var node = createNode(171 /* ObjectBindingPattern */);
parseExpected(16 /* OpenBraceToken */);
node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
parseExpected(17 /* CloseBraceToken */);
return finishNode(node);
}
function parseArrayBindingPattern() {
- var node = createNode(169 /* ArrayBindingPattern */);
+ var node = createNode(172 /* ArrayBindingPattern */);
parseExpected(20 /* OpenBracketToken */);
node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
parseExpected(21 /* CloseBracketToken */);
@@ -17260,7 +18164,7 @@ var ts;
return parseIdentifier();
}
function parseVariableDeclaration() {
- var node = createNode(219 /* VariableDeclaration */);
+ var node = createNode(222 /* VariableDeclaration */);
node.name = parseIdentifierOrPattern();
node.type = parseTypeAnnotation();
if (!isInOrOfKeyword(token())) {
@@ -17269,7 +18173,7 @@ var ts;
return finishNode(node);
}
function parseVariableDeclarationList(inForStatementInitializer) {
- var node = createNode(220 /* VariableDeclarationList */);
+ var node = createNode(223 /* VariableDeclarationList */);
switch (token()) {
case 103 /* VarKeyword */:
break;
@@ -17292,7 +18196,7 @@ var ts;
// So we need to look ahead to determine if 'of' should be treated as a keyword in
// this context.
// The checker will then give an error that there is an empty declaration list.
- if (token() === 139 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) {
+ if (token() === 140 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) {
node.declarations = createMissingList();
}
else {
@@ -17307,7 +18211,7 @@ var ts;
return nextTokenIsIdentifier() && nextToken() === 19 /* CloseParenToken */;
}
function parseVariableStatement(fullStart, decorators, modifiers) {
- var node = createNode(201 /* VariableStatement */, fullStart);
+ var node = createNode(204 /* VariableStatement */, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false);
@@ -17315,7 +18219,7 @@ var ts;
return addJSDocComment(finishNode(node));
}
function parseFunctionDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(221 /* FunctionDeclaration */, fullStart);
+ var node = createNode(224 /* FunctionDeclaration */, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
parseExpected(88 /* FunctionKeyword */);
@@ -17328,7 +18232,7 @@ var ts;
return addJSDocComment(finishNode(node));
}
function parseConstructorDeclaration(pos, decorators, modifiers) {
- var node = createNode(149 /* Constructor */, pos);
+ var node = createNode(150 /* Constructor */, pos);
node.decorators = decorators;
node.modifiers = modifiers;
parseExpected(122 /* ConstructorKeyword */);
@@ -17337,7 +18241,7 @@ var ts;
return addJSDocComment(finishNode(node));
}
function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) {
- var method = createNode(148 /* MethodDeclaration */, fullStart);
+ var method = createNode(149 /* MethodDeclaration */, fullStart);
method.decorators = decorators;
method.modifiers = modifiers;
method.asteriskToken = asteriskToken;
@@ -17350,7 +18254,7 @@ var ts;
return addJSDocComment(finishNode(method));
}
function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) {
- var property = createNode(146 /* PropertyDeclaration */, fullStart);
+ var property = createNode(147 /* PropertyDeclaration */, fullStart);
property.decorators = decorators;
property.modifiers = modifiers;
property.name = name;
@@ -17367,7 +18271,7 @@ var ts;
// The checker may still error in the static case to explicitly disallow the yield expression.
property.initializer = ts.hasModifier(property, 32 /* Static */)
? allowInAnd(parseNonParameterInitializer)
- : doOutsideOfContext(65536 /* YieldContext */ | 32768 /* DisallowInContext */, parseNonParameterInitializer);
+ : doOutsideOfContext(131072 /* YieldContext */ | 65536 /* DisallowInContext */, parseNonParameterInitializer);
parseSemicolon();
return addJSDocComment(finishNode(property));
}
@@ -17402,7 +18306,7 @@ var ts;
case 111 /* PrivateKeyword */:
case 112 /* ProtectedKeyword */:
case 114 /* StaticKeyword */:
- case 129 /* ReadonlyKeyword */:
+ case 130 /* ReadonlyKeyword */:
return true;
default:
return false;
@@ -17443,7 +18347,7 @@ var ts;
// If we were able to get any potential identifier...
if (idToken !== undefined) {
// If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse.
- if (!ts.isKeyword(idToken) || idToken === 132 /* SetKeyword */ || idToken === 124 /* GetKeyword */) {
+ if (!ts.isKeyword(idToken) || idToken === 133 /* SetKeyword */ || idToken === 124 /* GetKeyword */) {
return true;
}
// If it *is* a keyword, but not an accessor, check a little farther along
@@ -17473,7 +18377,7 @@ var ts;
if (!parseOptional(56 /* AtToken */)) {
break;
}
- var decorator = createNode(144 /* Decorator */, decoratorStart);
+ var decorator = createNode(145 /* Decorator */, decoratorStart);
decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher);
finishNode(decorator);
if (!decorators) {
@@ -17539,7 +18443,7 @@ var ts;
}
function parseClassElement() {
if (token() === 24 /* SemicolonToken */) {
- var result = createNode(199 /* SemicolonClassElement */);
+ var result = createNode(202 /* SemicolonClassElement */);
nextToken();
return finishNode(result);
}
@@ -17567,8 +18471,8 @@ var ts;
}
if (decorators || modifiers) {
// treat this as a property declaration with a missing name.
- var name_10 = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
- return parsePropertyDeclaration(fullStart, decorators, modifiers, name_10, /*questionToken*/ undefined);
+ var name_14 = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
+ return parsePropertyDeclaration(fullStart, decorators, modifiers, name_14, /*questionToken*/ undefined);
}
// 'isClassMemberStart' should have hinted not to attempt parsing.
ts.Debug.fail("Should not have attempted to parse class member declaration.");
@@ -17577,10 +18481,10 @@ var ts;
return parseClassDeclarationOrExpression(
/*fullStart*/ scanner.getStartPos(),
/*decorators*/ undefined,
- /*modifiers*/ undefined, 193 /* ClassExpression */);
+ /*modifiers*/ undefined, 196 /* ClassExpression */);
}
function parseClassDeclaration(fullStart, decorators, modifiers) {
- return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 222 /* ClassDeclaration */);
+ return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 225 /* ClassDeclaration */);
}
function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) {
var node = createNode(kind, fullStart);
@@ -17618,13 +18522,13 @@ var ts;
// ClassTail[Yield,Await] : (Modified) See 14.5
// ClassHeritage[?Yield,?Await]opt { ClassBody[?Yield,?Await]opt }
if (isHeritageClause()) {
- return parseList(20 /* HeritageClauses */, parseHeritageClause);
+ return parseList(21 /* HeritageClauses */, parseHeritageClause);
}
return undefined;
}
function parseHeritageClause() {
if (token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */) {
- var node = createNode(251 /* HeritageClause */);
+ var node = createNode(254 /* HeritageClause */);
node.token = token();
nextToken();
node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments);
@@ -17633,10 +18537,10 @@ var ts;
return undefined;
}
function parseExpressionWithTypeArguments() {
- var node = createNode(195 /* ExpressionWithTypeArguments */);
+ var node = createNode(198 /* ExpressionWithTypeArguments */);
node.expression = parseLeftHandSideExpressionOrHigher();
if (token() === 26 /* LessThanToken */) {
- node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 26 /* LessThanToken */, 28 /* GreaterThanToken */);
+ node.typeArguments = parseBracketedList(19 /* TypeArguments */, parseType, 26 /* LessThanToken */, 28 /* GreaterThanToken */);
}
return finishNode(node);
}
@@ -17647,7 +18551,7 @@ var ts;
return parseList(5 /* ClassMembers */, parseClassElement);
}
function parseInterfaceDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(223 /* InterfaceDeclaration */, fullStart);
+ var node = createNode(226 /* InterfaceDeclaration */, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
parseExpected(108 /* InterfaceKeyword */);
@@ -17658,10 +18562,10 @@ var ts;
return addJSDocComment(finishNode(node));
}
function parseTypeAliasDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(224 /* TypeAliasDeclaration */, fullStart);
+ var node = createNode(227 /* TypeAliasDeclaration */, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- parseExpected(135 /* TypeKeyword */);
+ parseExpected(136 /* TypeKeyword */);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
parseExpected(57 /* EqualsToken */);
@@ -17674,13 +18578,13 @@ var ts;
// ConstantEnumMemberSection, which starts at the beginning of an enum declaration
// or any time an integer literal initializer is encountered.
function parseEnumMember() {
- var node = createNode(255 /* EnumMember */, scanner.getStartPos());
+ var node = createNode(259 /* EnumMember */, scanner.getStartPos());
node.name = parsePropertyName();
node.initializer = allowInAnd(parseNonParameterInitializer);
return addJSDocComment(finishNode(node));
}
function parseEnumDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(225 /* EnumDeclaration */, fullStart);
+ var node = createNode(228 /* EnumDeclaration */, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
parseExpected(82 /* EnumKeyword */);
@@ -17695,7 +18599,7 @@ var ts;
return addJSDocComment(finishNode(node));
}
function parseModuleBlock() {
- var node = createNode(227 /* ModuleBlock */, scanner.getStartPos());
+ var node = createNode(230 /* ModuleBlock */, scanner.getStartPos());
if (parseExpected(16 /* OpenBraceToken */)) {
node.statements = parseList(1 /* BlockStatements */, parseStatement);
parseExpected(17 /* CloseBraceToken */);
@@ -17706,7 +18610,7 @@ var ts;
return finishNode(node);
}
function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) {
- var node = createNode(226 /* ModuleDeclaration */, fullStart);
+ var node = createNode(229 /* ModuleDeclaration */, fullStart);
// If we are parsing a dotted namespace name, we want to
// propagate the 'Namespace' flag across the names if set.
var namespaceFlag = flags & 16 /* Namespace */;
@@ -17720,10 +18624,10 @@ var ts;
return addJSDocComment(finishNode(node));
}
function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(226 /* ModuleDeclaration */, fullStart);
+ var node = createNode(229 /* ModuleDeclaration */, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
- if (token() === 138 /* GlobalKeyword */) {
+ if (token() === 139 /* GlobalKeyword */) {
// parse 'global' as name of global scope augmentation
node.name = parseIdentifier();
node.flags |= 512 /* GlobalAugmentation */;
@@ -17741,15 +18645,15 @@ var ts;
}
function parseModuleDeclaration(fullStart, decorators, modifiers) {
var flags = 0;
- if (token() === 138 /* GlobalKeyword */) {
+ if (token() === 139 /* GlobalKeyword */) {
// global augmentation
return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers);
}
- else if (parseOptional(127 /* NamespaceKeyword */)) {
+ else if (parseOptional(128 /* NamespaceKeyword */)) {
flags |= 16 /* Namespace */;
}
else {
- parseExpected(126 /* ModuleKeyword */);
+ parseExpected(127 /* ModuleKeyword */);
if (token() === 9 /* StringLiteral */) {
return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers);
}
@@ -17757,7 +18661,7 @@ var ts;
return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags);
}
function isExternalModuleReference() {
- return token() === 130 /* RequireKeyword */ &&
+ return token() === 131 /* RequireKeyword */ &&
lookAhead(nextTokenIsOpenParen);
}
function nextTokenIsOpenParen() {
@@ -17767,11 +18671,11 @@ var ts;
return nextToken() === 40 /* SlashToken */;
}
function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) {
- var exportDeclaration = createNode(229 /* NamespaceExportDeclaration */, fullStart);
+ var exportDeclaration = createNode(232 /* NamespaceExportDeclaration */, fullStart);
exportDeclaration.decorators = decorators;
exportDeclaration.modifiers = modifiers;
parseExpected(117 /* AsKeyword */);
- parseExpected(127 /* NamespaceKeyword */);
+ parseExpected(128 /* NamespaceKeyword */);
exportDeclaration.name = parseIdentifier();
parseSemicolon();
return finishNode(exportDeclaration);
@@ -17782,11 +18686,11 @@ var ts;
var identifier;
if (isIdentifier()) {
identifier = parseIdentifier();
- if (token() !== 25 /* CommaToken */ && token() !== 137 /* FromKeyword */) {
+ if (token() !== 25 /* CommaToken */ && token() !== 138 /* FromKeyword */) {
// ImportEquals declaration of type:
// import x = require("mod"); or
// import x = M.x;
- var importEqualsDeclaration = createNode(230 /* ImportEqualsDeclaration */, fullStart);
+ var importEqualsDeclaration = createNode(233 /* ImportEqualsDeclaration */, fullStart);
importEqualsDeclaration.decorators = decorators;
importEqualsDeclaration.modifiers = modifiers;
importEqualsDeclaration.name = identifier;
@@ -17797,7 +18701,7 @@ var ts;
}
}
// Import statement
- var importDeclaration = createNode(231 /* ImportDeclaration */, fullStart);
+ var importDeclaration = createNode(234 /* ImportDeclaration */, fullStart);
importDeclaration.decorators = decorators;
importDeclaration.modifiers = modifiers;
// ImportDeclaration:
@@ -17807,7 +18711,7 @@ var ts;
token() === 38 /* AsteriskToken */ ||
token() === 16 /* OpenBraceToken */) {
importDeclaration.importClause = parseImportClause(identifier, afterImportPos);
- parseExpected(137 /* FromKeyword */);
+ parseExpected(138 /* FromKeyword */);
}
importDeclaration.moduleSpecifier = parseModuleSpecifier();
parseSemicolon();
@@ -17820,7 +18724,7 @@ var ts;
// NamedImports
// ImportedDefaultBinding, NameSpaceImport
// ImportedDefaultBinding, NamedImports
- var importClause = createNode(232 /* ImportClause */, fullStart);
+ var importClause = createNode(235 /* ImportClause */, fullStart);
if (identifier) {
// ImportedDefaultBinding:
// ImportedBinding
@@ -17830,7 +18734,7 @@ var ts;
// parse namespace or named imports
if (!importClause.name ||
parseOptional(25 /* CommaToken */)) {
- importClause.namedBindings = token() === 38 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(234 /* NamedImports */);
+ importClause.namedBindings = token() === 38 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(237 /* NamedImports */);
}
return finishNode(importClause);
}
@@ -17840,8 +18744,8 @@ var ts;
: parseEntityName(/*allowReservedWords*/ false);
}
function parseExternalModuleReference() {
- var node = createNode(241 /* ExternalModuleReference */);
- parseExpected(130 /* RequireKeyword */);
+ var node = createNode(244 /* ExternalModuleReference */);
+ parseExpected(131 /* RequireKeyword */);
parseExpected(18 /* OpenParenToken */);
node.expression = parseModuleSpecifier();
parseExpected(19 /* CloseParenToken */);
@@ -17863,7 +18767,7 @@ var ts;
function parseNamespaceImport() {
// NameSpaceImport:
// * as ImportedBinding
- var namespaceImport = createNode(233 /* NamespaceImport */);
+ var namespaceImport = createNode(236 /* NamespaceImport */);
parseExpected(38 /* AsteriskToken */);
parseExpected(117 /* AsKeyword */);
namespaceImport.name = parseIdentifier();
@@ -17878,14 +18782,14 @@ var ts;
// ImportsList:
// ImportSpecifier
// ImportsList, ImportSpecifier
- node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 234 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 16 /* OpenBraceToken */, 17 /* CloseBraceToken */);
+ node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 237 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 16 /* OpenBraceToken */, 17 /* CloseBraceToken */);
return finishNode(node);
}
function parseExportSpecifier() {
- return parseImportOrExportSpecifier(239 /* ExportSpecifier */);
+ return parseImportOrExportSpecifier(242 /* ExportSpecifier */);
}
function parseImportSpecifier() {
- return parseImportOrExportSpecifier(235 /* ImportSpecifier */);
+ return parseImportOrExportSpecifier(238 /* ImportSpecifier */);
}
function parseImportOrExportSpecifier(kind) {
var node = createNode(kind);
@@ -17910,27 +18814,27 @@ var ts;
else {
node.name = identifierName;
}
- if (kind === 235 /* ImportSpecifier */ && checkIdentifierIsKeyword) {
+ if (kind === 238 /* ImportSpecifier */ && checkIdentifierIsKeyword) {
// Report error identifier expected
parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected);
}
return finishNode(node);
}
function parseExportDeclaration(fullStart, decorators, modifiers) {
- var node = createNode(237 /* ExportDeclaration */, fullStart);
+ var node = createNode(240 /* ExportDeclaration */, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
if (parseOptional(38 /* AsteriskToken */)) {
- parseExpected(137 /* FromKeyword */);
+ parseExpected(138 /* FromKeyword */);
node.moduleSpecifier = parseModuleSpecifier();
}
else {
- node.exportClause = parseNamedImportsOrExports(238 /* NamedExports */);
+ node.exportClause = parseNamedImportsOrExports(241 /* NamedExports */);
// It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios,
// the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`)
// If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect.
- if (token() === 137 /* FromKeyword */ || (token() === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) {
- parseExpected(137 /* FromKeyword */);
+ if (token() === 138 /* FromKeyword */ || (token() === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) {
+ parseExpected(138 /* FromKeyword */);
node.moduleSpecifier = parseModuleSpecifier();
}
}
@@ -17938,7 +18842,7 @@ var ts;
return finishNode(node);
}
function parseExportAssignment(fullStart, decorators, modifiers) {
- var node = createNode(236 /* ExportAssignment */, fullStart);
+ var node = createNode(239 /* ExportAssignment */, fullStart);
node.decorators = decorators;
node.modifiers = modifiers;
if (parseOptional(57 /* EqualsToken */)) {
@@ -18020,10 +18924,10 @@ var ts;
function setExternalModuleIndicator(sourceFile) {
sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) {
return ts.hasModifier(node, 1 /* Export */)
- || node.kind === 230 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 241 /* ExternalModuleReference */
- || node.kind === 231 /* ImportDeclaration */
- || node.kind === 236 /* ExportAssignment */
- || node.kind === 237 /* ExportDeclaration */
+ || node.kind === 233 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 244 /* ExternalModuleReference */
+ || node.kind === 234 /* ImportDeclaration */
+ || node.kind === 239 /* ExportAssignment */
+ || node.kind === 240 /* ExportDeclaration */
? node
: undefined;
});
@@ -18047,16 +18951,17 @@ var ts;
ParsingContext[ParsingContext["JsxChildren"] = 14] = "JsxChildren";
ParsingContext[ParsingContext["ArrayLiteralMembers"] = 15] = "ArrayLiteralMembers";
ParsingContext[ParsingContext["Parameters"] = 16] = "Parameters";
- ParsingContext[ParsingContext["TypeParameters"] = 17] = "TypeParameters";
- ParsingContext[ParsingContext["TypeArguments"] = 18] = "TypeArguments";
- ParsingContext[ParsingContext["TupleElementTypes"] = 19] = "TupleElementTypes";
- ParsingContext[ParsingContext["HeritageClauses"] = 20] = "HeritageClauses";
- ParsingContext[ParsingContext["ImportOrExportSpecifiers"] = 21] = "ImportOrExportSpecifiers";
- ParsingContext[ParsingContext["JSDocFunctionParameters"] = 22] = "JSDocFunctionParameters";
- ParsingContext[ParsingContext["JSDocTypeArguments"] = 23] = "JSDocTypeArguments";
- ParsingContext[ParsingContext["JSDocRecordMembers"] = 24] = "JSDocRecordMembers";
- ParsingContext[ParsingContext["JSDocTupleTypes"] = 25] = "JSDocTupleTypes";
- ParsingContext[ParsingContext["Count"] = 26] = "Count"; // Number of parsing contexts
+ ParsingContext[ParsingContext["RestProperties"] = 17] = "RestProperties";
+ ParsingContext[ParsingContext["TypeParameters"] = 18] = "TypeParameters";
+ ParsingContext[ParsingContext["TypeArguments"] = 19] = "TypeArguments";
+ ParsingContext[ParsingContext["TupleElementTypes"] = 20] = "TupleElementTypes";
+ ParsingContext[ParsingContext["HeritageClauses"] = 21] = "HeritageClauses";
+ ParsingContext[ParsingContext["ImportOrExportSpecifiers"] = 22] = "ImportOrExportSpecifiers";
+ ParsingContext[ParsingContext["JSDocFunctionParameters"] = 23] = "JSDocFunctionParameters";
+ ParsingContext[ParsingContext["JSDocTypeArguments"] = 24] = "JSDocTypeArguments";
+ ParsingContext[ParsingContext["JSDocRecordMembers"] = 25] = "JSDocRecordMembers";
+ ParsingContext[ParsingContext["JSDocTupleTypes"] = 26] = "JSDocTupleTypes";
+ ParsingContext[ParsingContext["Count"] = 27] = "Count"; // Number of parsing contexts
})(ParsingContext || (ParsingContext = {}));
var Tristate;
(function (Tristate) {
@@ -18084,8 +18989,8 @@ var ts;
}
JSDocParser.isJSDocType = isJSDocType;
function parseJSDocTypeExpressionForTests(content, start, length) {
- initializeState(content, 4 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
- sourceFile = createSourceFile("file.js", 4 /* Latest */, 1 /* JS */);
+ initializeState(content, 5 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ sourceFile = createSourceFile("file.js", 5 /* Latest */, 1 /* JS */);
scanner.setText(content, start, length);
currentToken = scanner.scan();
var jsDocTypeExpression = parseJSDocTypeExpression();
@@ -18097,7 +19002,7 @@ var ts;
// Parses out a JSDoc type expression.
/* @internal */
function parseJSDocTypeExpression() {
- var result = createNode(257 /* JSDocTypeExpression */, scanner.getTokenPos());
+ var result = createNode(261 /* JSDocTypeExpression */, scanner.getTokenPos());
parseExpected(16 /* OpenBraceToken */);
result.type = parseJSDocTopLevelType();
parseExpected(17 /* CloseBraceToken */);
@@ -18108,12 +19013,12 @@ var ts;
function parseJSDocTopLevelType() {
var type = parseJSDocType();
if (token() === 48 /* BarToken */) {
- var unionType = createNode(261 /* JSDocUnionType */, type.pos);
+ var unionType = createNode(265 /* JSDocUnionType */, type.pos);
unionType.types = parseJSDocTypeList(type);
type = finishNode(unionType);
}
if (token() === 57 /* EqualsToken */) {
- var optionalType = createNode(268 /* JSDocOptionalType */, type.pos);
+ var optionalType = createNode(272 /* JSDocOptionalType */, type.pos);
nextToken();
optionalType.type = type;
type = finishNode(optionalType);
@@ -18124,20 +19029,20 @@ var ts;
var type = parseBasicTypeExpression();
while (true) {
if (token() === 20 /* OpenBracketToken */) {
- var arrayType = createNode(260 /* JSDocArrayType */, type.pos);
+ var arrayType = createNode(264 /* JSDocArrayType */, type.pos);
arrayType.elementType = type;
nextToken();
parseExpected(21 /* CloseBracketToken */);
type = finishNode(arrayType);
}
else if (token() === 54 /* QuestionToken */) {
- var nullableType = createNode(263 /* JSDocNullableType */, type.pos);
+ var nullableType = createNode(267 /* JSDocNullableType */, type.pos);
nullableType.type = type;
nextToken();
type = finishNode(nullableType);
}
else if (token() === 50 /* ExclamationToken */) {
- var nonNullableType = createNode(264 /* JSDocNonNullableType */, type.pos);
+ var nonNullableType = createNode(268 /* JSDocNonNullableType */, type.pos);
nonNullableType.type = type;
nextToken();
type = finishNode(nonNullableType);
@@ -18171,14 +19076,14 @@ var ts;
case 98 /* ThisKeyword */:
return parseJSDocThisType();
case 118 /* AnyKeyword */:
- case 133 /* StringKeyword */:
- case 131 /* NumberKeyword */:
+ case 134 /* StringKeyword */:
+ case 132 /* NumberKeyword */:
case 121 /* BooleanKeyword */:
- case 134 /* SymbolKeyword */:
+ case 135 /* SymbolKeyword */:
case 104 /* VoidKeyword */:
case 94 /* NullKeyword */:
- case 136 /* UndefinedKeyword */:
- case 128 /* NeverKeyword */:
+ case 137 /* UndefinedKeyword */:
+ case 129 /* NeverKeyword */:
return parseTokenNode();
case 9 /* StringLiteral */:
case 8 /* NumericLiteral */:
@@ -18189,30 +19094,30 @@ var ts;
return parseJSDocTypeReference();
}
function parseJSDocThisType() {
- var result = createNode(272 /* JSDocThisType */);
+ var result = createNode(276 /* JSDocThisType */);
nextToken();
parseExpected(55 /* ColonToken */);
result.type = parseJSDocType();
return finishNode(result);
}
function parseJSDocConstructorType() {
- var result = createNode(271 /* JSDocConstructorType */);
+ var result = createNode(275 /* JSDocConstructorType */);
nextToken();
parseExpected(55 /* ColonToken */);
result.type = parseJSDocType();
return finishNode(result);
}
function parseJSDocVariadicType() {
- var result = createNode(270 /* JSDocVariadicType */);
+ var result = createNode(274 /* JSDocVariadicType */);
nextToken();
result.type = parseJSDocType();
return finishNode(result);
}
function parseJSDocFunctionType() {
- var result = createNode(269 /* JSDocFunctionType */);
+ var result = createNode(273 /* JSDocFunctionType */);
nextToken();
parseExpected(18 /* OpenParenToken */);
- result.parameters = parseDelimitedList(22 /* JSDocFunctionParameters */, parseJSDocParameter);
+ result.parameters = parseDelimitedList(23 /* JSDocFunctionParameters */, parseJSDocParameter);
checkForTrailingComma(result.parameters);
parseExpected(19 /* CloseParenToken */);
if (token() === 55 /* ColonToken */) {
@@ -18222,7 +19127,7 @@ var ts;
return finishNode(result);
}
function parseJSDocParameter() {
- var parameter = createNode(143 /* Parameter */);
+ var parameter = createNode(144 /* Parameter */);
parameter.type = parseJSDocType();
if (parseOptional(57 /* EqualsToken */)) {
// TODO(rbuckton): Can this be changed to SyntaxKind.QuestionToken?
@@ -18231,7 +19136,7 @@ var ts;
return finishNode(parameter);
}
function parseJSDocTypeReference() {
- var result = createNode(267 /* JSDocTypeReference */);
+ var result = createNode(271 /* JSDocTypeReference */);
result.name = parseSimplePropertyName();
if (token() === 26 /* LessThanToken */) {
result.typeArguments = parseTypeArguments();
@@ -18252,7 +19157,7 @@ var ts;
function parseTypeArguments() {
// Move past the <
nextToken();
- var typeArguments = parseDelimitedList(23 /* JSDocTypeArguments */, parseJSDocType);
+ var typeArguments = parseDelimitedList(24 /* JSDocTypeArguments */, parseJSDocType);
checkForTrailingComma(typeArguments);
checkForEmptyTypeArgumentList(typeArguments);
parseExpected(28 /* GreaterThanToken */);
@@ -18266,26 +19171,26 @@ var ts;
}
}
function parseQualifiedName(left) {
- var result = createNode(140 /* QualifiedName */, left.pos);
+ var result = createNode(141 /* QualifiedName */, left.pos);
result.left = left;
result.right = parseIdentifierName();
return finishNode(result);
}
function parseJSDocRecordType() {
- var result = createNode(265 /* JSDocRecordType */);
+ var result = createNode(269 /* JSDocRecordType */);
result.literal = parseTypeLiteral();
return finishNode(result);
}
function parseJSDocNonNullableType() {
- var result = createNode(264 /* JSDocNonNullableType */);
+ var result = createNode(268 /* JSDocNonNullableType */);
nextToken();
result.type = parseJSDocType();
return finishNode(result);
}
function parseJSDocTupleType() {
- var result = createNode(262 /* JSDocTupleType */);
+ var result = createNode(266 /* JSDocTupleType */);
nextToken();
- result.types = parseDelimitedList(25 /* JSDocTupleTypes */, parseJSDocType);
+ result.types = parseDelimitedList(26 /* JSDocTupleTypes */, parseJSDocType);
checkForTrailingComma(result.types);
parseExpected(21 /* CloseBracketToken */);
return finishNode(result);
@@ -18297,7 +19202,7 @@ var ts;
}
}
function parseJSDocUnionType() {
- var result = createNode(261 /* JSDocUnionType */);
+ var result = createNode(265 /* JSDocUnionType */);
nextToken();
result.types = parseJSDocTypeList(parseJSDocType());
parseExpected(19 /* CloseParenToken */);
@@ -18313,12 +19218,12 @@ var ts;
return types;
}
function parseJSDocAllType() {
- var result = createNode(258 /* JSDocAllType */);
+ var result = createNode(262 /* JSDocAllType */);
nextToken();
return finishNode(result);
}
function parseJSDocLiteralType() {
- var result = createNode(282 /* JSDocLiteralType */);
+ var result = createNode(286 /* JSDocLiteralType */);
result.literal = parseLiteralTypeNode();
return finishNode(result);
}
@@ -18341,17 +19246,17 @@ var ts;
token() === 28 /* GreaterThanToken */ ||
token() === 57 /* EqualsToken */ ||
token() === 48 /* BarToken */) {
- var result = createNode(259 /* JSDocUnknownType */, pos);
+ var result = createNode(263 /* JSDocUnknownType */, pos);
return finishNode(result);
}
else {
- var result = createNode(263 /* JSDocNullableType */, pos);
+ var result = createNode(267 /* JSDocNullableType */, pos);
result.type = parseJSDocType();
return finishNode(result);
}
}
function parseIsolatedJSDocComment(content, start, length) {
- initializeState(content, 4 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ initializeState(content, 5 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
sourceFile = { languageVariant: 0 /* Standard */, text: content };
var jsDoc = parseJSDocCommentWorker(start, length);
var diagnostics = parseDiagnostics;
@@ -18504,7 +19409,7 @@ var ts;
content.charCodeAt(start + 3) !== 42 /* asterisk */;
}
function createJSDocComment() {
- var result = createNode(273 /* JSDocComment */, start);
+ var result = createNode(277 /* JSDocComment */, start);
result.tags = tags;
result.comment = comments.length ? comments.join("") : undefined;
return finishNode(result, end);
@@ -18617,7 +19522,7 @@ var ts;
return comments;
}
function parseUnknownTag(atToken, tagName) {
- var result = createNode(274 /* JSDocTag */, atToken.pos);
+ var result = createNode(278 /* JSDocTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
return finishNode(result);
@@ -18674,7 +19579,7 @@ var ts;
if (!typeExpression) {
typeExpression = tryParseTypeExpression();
}
- var result = createNode(275 /* JSDocParameterTag */, atToken.pos);
+ var result = createNode(279 /* JSDocParameterTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.preParameterName = preName;
@@ -18685,20 +19590,20 @@ var ts;
return finishNode(result);
}
function parseReturnTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 276 /* JSDocReturnTag */; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 280 /* JSDocReturnTag */; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
- var result = createNode(276 /* JSDocReturnTag */, atToken.pos);
+ var result = createNode(280 /* JSDocReturnTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
}
function parseTypeTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 277 /* JSDocTypeTag */; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 281 /* JSDocTypeTag */; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
- var result = createNode(277 /* JSDocTypeTag */, atToken.pos);
+ var result = createNode(281 /* JSDocTypeTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
@@ -18713,7 +19618,7 @@ var ts;
parseErrorAtPosition(scanner.getStartPos(), /*length*/ 0, ts.Diagnostics.Identifier_expected);
return undefined;
}
- var result = createNode(280 /* JSDocPropertyTag */, atToken.pos);
+ var result = createNode(284 /* JSDocPropertyTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.name = name;
@@ -18723,7 +19628,7 @@ var ts;
function parseTypedefTag(atToken, tagName) {
var typeExpression = tryParseTypeExpression();
skipWhitespace();
- var typedefTag = createNode(279 /* JSDocTypedefTag */, atToken.pos);
+ var typedefTag = createNode(283 /* JSDocTypedefTag */, atToken.pos);
typedefTag.atToken = atToken;
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0);
@@ -18737,11 +19642,11 @@ var ts;
typedefTag.typeExpression = typeExpression;
skipWhitespace();
if (typeExpression) {
- if (typeExpression.type.kind === 267 /* JSDocTypeReference */) {
+ if (typeExpression.type.kind === 271 /* JSDocTypeReference */) {
var jsDocTypeReference = typeExpression.type;
if (jsDocTypeReference.name.kind === 70 /* Identifier */) {
- var name_11 = jsDocTypeReference.name;
- if (name_11.text === "Object") {
+ var name_15 = jsDocTypeReference.name;
+ if (name_15.text === "Object") {
typedefTag.jsDocTypeLiteral = scanChildTags();
}
}
@@ -18755,7 +19660,7 @@ var ts;
}
return finishNode(typedefTag);
function scanChildTags() {
- var jsDocTypeLiteral = createNode(281 /* JSDocTypeLiteral */, scanner.getStartPos());
+ var jsDocTypeLiteral = createNode(285 /* JSDocTypeLiteral */, scanner.getStartPos());
var resumePos = scanner.getStartPos();
var canParseTag = true;
var seenAsterisk = false;
@@ -18796,7 +19701,7 @@ var ts;
var pos = scanner.getTokenPos();
var typeNameOrNamespaceName = parseJSDocIdentifierName();
if (typeNameOrNamespaceName && parseOptional(22 /* DotToken */)) {
- var jsDocNamespaceNode = createNode(226 /* ModuleDeclaration */, pos);
+ var jsDocNamespaceNode = createNode(229 /* ModuleDeclaration */, pos);
jsDocNamespaceNode.flags |= flags;
jsDocNamespaceNode.name = typeNameOrNamespaceName;
jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4 /* NestedNamespace */);
@@ -18842,20 +19747,20 @@ var ts;
return false;
}
function parseTemplateTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 278 /* JSDocTemplateTag */; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocTemplateTag */; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
// Type parameter list looks like '@template T,U,V'
var typeParameters = createNodeArray();
while (true) {
- var name_12 = parseJSDocIdentifierName();
+ var name_16 = parseJSDocIdentifierName();
skipWhitespace();
- if (!name_12) {
+ if (!name_16) {
parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);
return undefined;
}
- var typeParameter = createNode(142 /* TypeParameter */, name_12.pos);
- typeParameter.name = name_12;
+ var typeParameter = createNode(143 /* TypeParameter */, name_16.pos);
+ typeParameter.name = name_16;
finishNode(typeParameter);
typeParameters.push(typeParameter);
if (token() === 25 /* CommaToken */) {
@@ -18866,7 +19771,7 @@ var ts;
break;
}
}
- var result = createNode(278 /* JSDocTemplateTag */, atToken.pos);
+ var result = createNode(282 /* JSDocTemplateTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeParameters = typeParameters;
@@ -19377,25 +20282,25 @@ var ts;
/* @internal */
var ts;
(function (ts) {
+ var ModuleInstanceState;
(function (ModuleInstanceState) {
ModuleInstanceState[ModuleInstanceState["NonInstantiated"] = 0] = "NonInstantiated";
ModuleInstanceState[ModuleInstanceState["Instantiated"] = 1] = "Instantiated";
ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly";
- })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {}));
- var ModuleInstanceState = ts.ModuleInstanceState;
+ })(ModuleInstanceState = ts.ModuleInstanceState || (ts.ModuleInstanceState = {}));
function getModuleInstanceState(node) {
// A module is uninstantiated if it contains only
// 1. interface declarations, type alias declarations
- if (node.kind === 223 /* InterfaceDeclaration */ || node.kind === 224 /* TypeAliasDeclaration */) {
+ if (node.kind === 226 /* InterfaceDeclaration */ || node.kind === 227 /* TypeAliasDeclaration */) {
return 0 /* NonInstantiated */;
}
else if (ts.isConstEnumDeclaration(node)) {
return 2 /* ConstEnumOnly */;
}
- else if ((node.kind === 231 /* ImportDeclaration */ || node.kind === 230 /* ImportEqualsDeclaration */) && !(ts.hasModifier(node, 1 /* Export */))) {
+ else if ((node.kind === 234 /* ImportDeclaration */ || node.kind === 233 /* ImportEqualsDeclaration */) && !(ts.hasModifier(node, 1 /* Export */))) {
return 0 /* NonInstantiated */;
}
- else if (node.kind === 227 /* ModuleBlock */) {
+ else if (node.kind === 230 /* ModuleBlock */) {
var state_1 = 0 /* NonInstantiated */;
ts.forEachChild(node, function (n) {
switch (getModuleInstanceState(n)) {
@@ -19414,7 +20319,7 @@ var ts;
});
return state_1;
}
- else if (node.kind === 226 /* ModuleDeclaration */) {
+ else if (node.kind === 229 /* ModuleDeclaration */) {
var body = node.body;
return body ? getModuleInstanceState(body) : 1 /* Instantiated */;
}
@@ -19555,7 +20460,7 @@ var ts;
if (symbolFlags & 107455 /* Value */) {
var valueDeclaration = symbol.valueDeclaration;
if (!valueDeclaration ||
- (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 226 /* ModuleDeclaration */)) {
+ (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 229 /* ModuleDeclaration */)) {
// other kinds of value declarations take precedence over modules
symbol.valueDeclaration = node;
}
@@ -19568,7 +20473,7 @@ var ts;
if (ts.isAmbientModule(node)) {
return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\"";
}
- if (node.name.kind === 141 /* ComputedPropertyName */) {
+ if (node.name.kind === 142 /* ComputedPropertyName */) {
var nameExpression = node.name.expression;
// treat computed property names where expression is string/numeric literal as just string/numeric literal
if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
@@ -19580,21 +20485,21 @@ var ts;
return node.name.text;
}
switch (node.kind) {
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
return "__constructor";
- case 157 /* FunctionType */:
- case 152 /* CallSignature */:
+ case 158 /* FunctionType */:
+ case 153 /* CallSignature */:
return "__call";
- case 158 /* ConstructorType */:
- case 153 /* ConstructSignature */:
+ case 159 /* ConstructorType */:
+ case 154 /* ConstructSignature */:
return "__new";
- case 154 /* IndexSignature */:
+ case 155 /* IndexSignature */:
return "__index";
- case 237 /* ExportDeclaration */:
+ case 240 /* ExportDeclaration */:
return "__export";
- case 236 /* ExportAssignment */:
+ case 239 /* ExportAssignment */:
return node.isExportEquals ? "export=" : "default";
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
switch (ts.getSpecialPropertyAssignmentKind(node)) {
case 2 /* ModuleExports */:
// module.exports = ...
@@ -19609,22 +20514,22 @@ var ts;
}
ts.Debug.fail("Unknown binary declaration kind");
break;
- case 221 /* FunctionDeclaration */:
- case 222 /* ClassDeclaration */:
+ case 224 /* FunctionDeclaration */:
+ case 225 /* ClassDeclaration */:
return ts.hasModifier(node, 512 /* Default */) ? "default" : undefined;
- case 269 /* JSDocFunctionType */:
+ case 273 /* JSDocFunctionType */:
return ts.isJSDocConstructSignature(node) ? "__new" : "__call";
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
// Parameters with names are handled at the top of this function. Parameters
// without names can only come from JSDocFunctionTypes.
- ts.Debug.assert(node.parent.kind === 269 /* JSDocFunctionType */);
+ ts.Debug.assert(node.parent.kind === 273 /* JSDocFunctionType */);
var functionType = node.parent;
var index = ts.indexOf(functionType.parameters, node);
return "arg" + index;
- case 279 /* JSDocTypedefTag */:
+ case 283 /* JSDocTypedefTag */:
var parentNode = node.parent && node.parent.parent;
var nameFromParentNode = void 0;
- if (parentNode && parentNode.kind === 201 /* VariableStatement */) {
+ if (parentNode && parentNode.kind === 204 /* VariableStatement */) {
if (parentNode.declarationList.declarations.length > 0) {
var nameIdentifier = parentNode.declarationList.declarations[0].name;
if (nameIdentifier.kind === 70 /* Identifier */) {
@@ -19711,7 +20616,7 @@ var ts;
// 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default
// 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers)
if (symbol.declarations && symbol.declarations.length &&
- (isDefaultExport || (node.kind === 236 /* ExportAssignment */ && !node.isExportEquals))) {
+ (isDefaultExport || (node.kind === 239 /* ExportAssignment */ && !node.isExportEquals))) {
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
}
}
@@ -19731,7 +20636,7 @@ var ts;
function declareModuleMember(node, symbolFlags, symbolExcludes) {
var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */;
if (symbolFlags & 8388608 /* Alias */) {
- if (node.kind === 239 /* ExportSpecifier */ || (node.kind === 230 /* ImportEqualsDeclaration */ && hasExportModifier)) {
+ if (node.kind === 242 /* ExportSpecifier */ || (node.kind === 233 /* ImportEqualsDeclaration */ && hasExportModifier)) {
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
}
else {
@@ -19754,7 +20659,7 @@ var ts;
// during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation
// and this case is specially handled. Module augmentations should only be merged with original module definition
// and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed.
- var isJSDocTypedefInJSDocNamespace = node.kind === 279 /* JSDocTypedefTag */ &&
+ var isJSDocTypedefInJSDocNamespace = node.kind === 283 /* JSDocTypedefTag */ &&
node.name &&
node.name.kind === 70 /* Identifier */ &&
node.name.isInJSDocNamespace;
@@ -19816,8 +20721,8 @@ var ts;
var saveReturnTarget = currentReturnTarget;
var saveActiveLabels = activeLabels;
var saveHasExplicitReturn = hasExplicitReturn;
- var isIIFE = containerFlags & 16 /* IsFunctionExpression */ && !!ts.getImmediatelyInvokedFunctionExpression(node);
- // An IIFE is considered part of the containing control flow. Return statements behave
+ var isIIFE = containerFlags & 16 /* IsFunctionExpression */ && !ts.hasModifier(node, 256 /* Async */) && !!ts.getImmediatelyInvokedFunctionExpression(node);
+ // A non-async IIFE is considered part of the containing control flow. Return statements behave
// similarly to break statements that exit to a label just past the statement body.
if (isIIFE) {
currentReturnTarget = createBranchLabel();
@@ -19836,13 +20741,13 @@ var ts;
bindChildren(node);
// Reset all reachability check related flags on node (for incremental scenarios)
// Reset all emit helper flags on node (for incremental scenarios)
- node.flags &= ~32128 /* ReachabilityAndEmitFlags */;
+ node.flags &= ~64896 /* ReachabilityAndEmitFlags */;
if (!(currentFlow.flags & 1 /* Unreachable */) && containerFlags & 8 /* IsFunctionLike */ && ts.nodeIsPresent(node.body)) {
node.flags |= 128 /* HasImplicitReturn */;
if (hasExplicitReturn)
node.flags |= 256 /* HasExplicitReturn */;
}
- if (node.kind === 256 /* SourceFile */) {
+ if (node.kind === 260 /* SourceFile */) {
node.flags |= emitFlags;
}
if (isIIFE) {
@@ -19898,64 +20803,64 @@ var ts;
return;
}
switch (node.kind) {
- case 206 /* WhileStatement */:
+ case 209 /* WhileStatement */:
bindWhileStatement(node);
break;
- case 205 /* DoStatement */:
+ case 208 /* DoStatement */:
bindDoStatement(node);
break;
- case 207 /* ForStatement */:
+ case 210 /* ForStatement */:
bindForStatement(node);
break;
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
bindForInOrForOfStatement(node);
break;
- case 204 /* IfStatement */:
+ case 207 /* IfStatement */:
bindIfStatement(node);
break;
- case 212 /* ReturnStatement */:
- case 216 /* ThrowStatement */:
+ case 215 /* ReturnStatement */:
+ case 219 /* ThrowStatement */:
bindReturnOrThrow(node);
break;
- case 211 /* BreakStatement */:
- case 210 /* ContinueStatement */:
+ case 214 /* BreakStatement */:
+ case 213 /* ContinueStatement */:
bindBreakOrContinueStatement(node);
break;
- case 217 /* TryStatement */:
+ case 220 /* TryStatement */:
bindTryStatement(node);
break;
- case 214 /* SwitchStatement */:
+ case 217 /* SwitchStatement */:
bindSwitchStatement(node);
break;
- case 228 /* CaseBlock */:
+ case 231 /* CaseBlock */:
bindCaseBlock(node);
break;
- case 249 /* CaseClause */:
+ case 252 /* CaseClause */:
bindCaseClause(node);
break;
- case 215 /* LabeledStatement */:
+ case 218 /* LabeledStatement */:
bindLabeledStatement(node);
break;
- case 186 /* PrefixUnaryExpression */:
+ case 189 /* PrefixUnaryExpression */:
bindPrefixUnaryExpressionFlow(node);
break;
- case 187 /* PostfixUnaryExpression */:
+ case 190 /* PostfixUnaryExpression */:
bindPostfixUnaryExpressionFlow(node);
break;
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
bindBinaryExpressionFlow(node);
break;
- case 182 /* DeleteExpression */:
+ case 185 /* DeleteExpression */:
bindDeleteExpressionFlow(node);
break;
- case 189 /* ConditionalExpression */:
+ case 192 /* ConditionalExpression */:
bindConditionalExpressionFlow(node);
break;
- case 219 /* VariableDeclaration */:
+ case 222 /* VariableDeclaration */:
bindVariableDeclarationFlow(node);
break;
- case 175 /* CallExpression */:
+ case 178 /* CallExpression */:
bindCallExpressionFlow(node);
break;
default:
@@ -19967,15 +20872,15 @@ var ts;
switch (expr.kind) {
case 70 /* Identifier */:
case 98 /* ThisKeyword */:
- case 173 /* PropertyAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
return isNarrowableReference(expr);
- case 175 /* CallExpression */:
+ case 178 /* CallExpression */:
return hasNarrowableArgument(expr);
- case 179 /* ParenthesizedExpression */:
+ case 182 /* ParenthesizedExpression */:
return isNarrowingExpression(expr.expression);
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
return isNarrowingBinaryExpression(expr);
- case 186 /* PrefixUnaryExpression */:
+ case 189 /* PrefixUnaryExpression */:
return expr.operator === 50 /* ExclamationToken */ && isNarrowingExpression(expr.operand);
}
return false;
@@ -19983,7 +20888,7 @@ var ts;
function isNarrowableReference(expr) {
return expr.kind === 70 /* Identifier */ ||
expr.kind === 98 /* ThisKeyword */ ||
- expr.kind === 173 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression);
+ expr.kind === 176 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression);
}
function hasNarrowableArgument(expr) {
if (expr.arguments) {
@@ -19994,14 +20899,14 @@ var ts;
}
}
}
- if (expr.expression.kind === 173 /* PropertyAccessExpression */ &&
+ if (expr.expression.kind === 176 /* PropertyAccessExpression */ &&
isNarrowableReference(expr.expression.expression)) {
return true;
}
return false;
}
function isNarrowingTypeofOperands(expr1, expr2) {
- return expr1.kind === 183 /* TypeOfExpression */ && isNarrowableOperand(expr1.expression) && expr2.kind === 9 /* StringLiteral */;
+ return expr1.kind === 186 /* TypeOfExpression */ && isNarrowableOperand(expr1.expression) && expr2.kind === 9 /* StringLiteral */;
}
function isNarrowingBinaryExpression(expr) {
switch (expr.operatorToken.kind) {
@@ -20022,9 +20927,9 @@ var ts;
}
function isNarrowableOperand(expr) {
switch (expr.kind) {
- case 179 /* ParenthesizedExpression */:
+ case 182 /* ParenthesizedExpression */:
return isNarrowableOperand(expr.expression);
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
switch (expr.operatorToken.kind) {
case 57 /* EqualsToken */:
return isNarrowableOperand(expr.left);
@@ -20119,33 +21024,33 @@ var ts;
function isStatementCondition(node) {
var parent = node.parent;
switch (parent.kind) {
- case 204 /* IfStatement */:
- case 206 /* WhileStatement */:
- case 205 /* DoStatement */:
+ case 207 /* IfStatement */:
+ case 209 /* WhileStatement */:
+ case 208 /* DoStatement */:
return parent.expression === node;
- case 207 /* ForStatement */:
- case 189 /* ConditionalExpression */:
+ case 210 /* ForStatement */:
+ case 192 /* ConditionalExpression */:
return parent.condition === node;
}
return false;
}
function isLogicalExpression(node) {
while (true) {
- if (node.kind === 179 /* ParenthesizedExpression */) {
+ if (node.kind === 182 /* ParenthesizedExpression */) {
node = node.expression;
}
- else if (node.kind === 186 /* PrefixUnaryExpression */ && node.operator === 50 /* ExclamationToken */) {
+ else if (node.kind === 189 /* PrefixUnaryExpression */ && node.operator === 50 /* ExclamationToken */) {
node = node.operand;
}
else {
- return node.kind === 188 /* BinaryExpression */ && (node.operatorToken.kind === 52 /* AmpersandAmpersandToken */ ||
+ return node.kind === 191 /* BinaryExpression */ && (node.operatorToken.kind === 52 /* AmpersandAmpersandToken */ ||
node.operatorToken.kind === 53 /* BarBarToken */);
}
}
}
function isTopLevelLogicalExpression(node) {
- while (node.parent.kind === 179 /* ParenthesizedExpression */ ||
- node.parent.kind === 186 /* PrefixUnaryExpression */ &&
+ while (node.parent.kind === 182 /* ParenthesizedExpression */ ||
+ node.parent.kind === 189 /* PrefixUnaryExpression */ &&
node.parent.operator === 50 /* ExclamationToken */) {
node = node.parent;
}
@@ -20187,8 +21092,13 @@ var ts;
}
function bindDoStatement(node) {
var preDoLabel = createLoopLabel();
- var preConditionLabel = createBranchLabel();
- var postDoLabel = createBranchLabel();
+ var enclosingLabeledStatement = node.parent.kind === 218 /* LabeledStatement */
+ ? ts.lastOrUndefined(activeLabels)
+ : undefined;
+ // if do statement is wrapped in labeled statement then target labels for break/continue with or without
+ // label should be the same
+ var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel();
+ var postDoLabel = enclosingLabeledStatement ? enclosingLabeledStatement.breakTarget : createBranchLabel();
addAntecedent(preDoLabel, currentFlow);
currentFlow = preDoLabel;
bindIterativeStatement(node.statement, postDoLabel, preConditionLabel);
@@ -20219,7 +21129,7 @@ var ts;
bind(node.expression);
addAntecedent(postLoopLabel, currentFlow);
bind(node.initializer);
- if (node.initializer.kind !== 220 /* VariableDeclarationList */) {
+ if (node.initializer.kind !== 223 /* VariableDeclarationList */) {
bindAssignmentTargetFlow(node.initializer);
}
bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);
@@ -20241,7 +21151,7 @@ var ts;
}
function bindReturnOrThrow(node) {
bind(node.expression);
- if (node.kind === 212 /* ReturnStatement */) {
+ if (node.kind === 215 /* ReturnStatement */) {
hasExplicitReturn = true;
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
@@ -20261,7 +21171,7 @@ var ts;
return undefined;
}
function bindbreakOrContinueFlow(node, breakTarget, continueTarget) {
- var flowLabel = node.kind === 211 /* BreakStatement */ ? breakTarget : continueTarget;
+ var flowLabel = node.kind === 214 /* BreakStatement */ ? breakTarget : continueTarget;
if (flowLabel) {
addAntecedent(flowLabel, currentFlow);
currentFlow = unreachableFlow;
@@ -20327,7 +21237,7 @@ var ts;
preSwitchCaseFlow = currentFlow;
bind(node.caseBlock);
addAntecedent(postSwitchLabel, currentFlow);
- var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 250 /* DefaultClause */; });
+ var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 253 /* DefaultClause */; });
// We mark a switch statement as possibly exhaustive if it has no default clause and if all
// case clauses have unreachable end points (e.g. they all return).
node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents;
@@ -20390,11 +21300,14 @@ var ts;
if (!activeLabel.referenced && !options.allowUnusedLabels) {
file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label));
}
- addAntecedent(postStatementLabel, currentFlow);
- currentFlow = finishFlowLabel(postStatementLabel);
+ if (!node.statement || node.statement.kind !== 208 /* DoStatement */) {
+ // do statement sets current flow inside bindDoStatement
+ addAntecedent(postStatementLabel, currentFlow);
+ currentFlow = finishFlowLabel(postStatementLabel);
+ }
}
function bindDestructuringTargetFlow(node) {
- if (node.kind === 188 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */) {
+ if (node.kind === 191 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */) {
bindAssignmentTargetFlow(node.left);
}
else {
@@ -20405,10 +21318,10 @@ var ts;
if (isNarrowableReference(node)) {
currentFlow = createFlowAssignment(currentFlow, node);
}
- else if (node.kind === 171 /* ArrayLiteralExpression */) {
+ else if (node.kind === 174 /* ArrayLiteralExpression */) {
for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
var e = _a[_i];
- if (e.kind === 192 /* SpreadElementExpression */) {
+ if (e.kind === 195 /* SpreadElement */) {
bindAssignmentTargetFlow(e.expression);
}
else {
@@ -20416,15 +21329,18 @@ var ts;
}
}
}
- else if (node.kind === 172 /* ObjectLiteralExpression */) {
+ else if (node.kind === 175 /* ObjectLiteralExpression */) {
for (var _b = 0, _c = node.properties; _b < _c.length; _b++) {
var p = _c[_b];
- if (p.kind === 253 /* PropertyAssignment */) {
+ if (p.kind === 256 /* PropertyAssignment */) {
bindDestructuringTargetFlow(p.initializer);
}
- else if (p.kind === 254 /* ShorthandPropertyAssignment */) {
+ else if (p.kind === 257 /* ShorthandPropertyAssignment */) {
bindAssignmentTargetFlow(p.name);
}
+ else if (p.kind === 258 /* SpreadAssignment */) {
+ bindAssignmentTargetFlow(p.expression);
+ }
}
}
}
@@ -20476,9 +21392,9 @@ var ts;
}
else {
ts.forEachChild(node, bind);
- if (operator === 57 /* EqualsToken */ && !ts.isAssignmentTarget(node)) {
+ if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) {
bindAssignmentTargetFlow(node.left);
- if (node.left.kind === 174 /* ElementAccessExpression */) {
+ if (operator === 57 /* EqualsToken */ && node.left.kind === 177 /* ElementAccessExpression */) {
var elementAccess = node.left;
if (isNarrowableOperand(elementAccess.expression)) {
currentFlow = createFlowArrayMutation(currentFlow, node);
@@ -20489,7 +21405,7 @@ var ts;
}
function bindDeleteExpressionFlow(node) {
ts.forEachChild(node, bind);
- if (node.expression.kind === 173 /* PropertyAccessExpression */) {
+ if (node.expression.kind === 176 /* PropertyAccessExpression */) {
bindAssignmentTargetFlow(node.expression);
}
}
@@ -20499,9 +21415,11 @@ var ts;
var postExpressionLabel = createBranchLabel();
bindCondition(node.condition, trueLabel, falseLabel);
currentFlow = finishFlowLabel(trueLabel);
+ bind(node.questionToken);
bind(node.whenTrue);
addAntecedent(postExpressionLabel, currentFlow);
currentFlow = finishFlowLabel(falseLabel);
+ bind(node.colonToken);
bind(node.whenFalse);
addAntecedent(postExpressionLabel, currentFlow);
currentFlow = finishFlowLabel(postExpressionLabel);
@@ -20520,7 +21438,7 @@ var ts;
}
function bindVariableDeclarationFlow(node) {
ts.forEachChild(node, bind);
- if (node.initializer || node.parent.parent.kind === 208 /* ForInStatement */ || node.parent.parent.kind === 209 /* ForOfStatement */) {
+ if (node.initializer || node.parent.parent.kind === 211 /* ForInStatement */ || node.parent.parent.kind === 212 /* ForOfStatement */) {
bindInitializedVariableFlow(node);
}
}
@@ -20529,10 +21447,10 @@ var ts;
// an immediately invoked function expression (IIFE). Initialize the flowNode property to
// the current control flow (which includes evaluation of the IIFE arguments).
var expr = node.expression;
- while (expr.kind === 179 /* ParenthesizedExpression */) {
+ while (expr.kind === 182 /* ParenthesizedExpression */) {
expr = expr.expression;
}
- if (expr.kind === 180 /* FunctionExpression */ || expr.kind === 181 /* ArrowFunction */) {
+ if (expr.kind === 183 /* FunctionExpression */ || expr.kind === 184 /* ArrowFunction */) {
ts.forEach(node.typeArguments, bind);
ts.forEach(node.arguments, bind);
bind(node.expression);
@@ -20540,7 +21458,7 @@ var ts;
else {
ts.forEachChild(node, bind);
}
- if (node.expression.kind === 173 /* PropertyAccessExpression */) {
+ if (node.expression.kind === 176 /* PropertyAccessExpression */) {
var propertyAccess = node.expression;
if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) {
currentFlow = createFlowArrayMutation(currentFlow, node);
@@ -20549,51 +21467,51 @@ var ts;
}
function getContainerFlags(node) {
switch (node.kind) {
- case 193 /* ClassExpression */:
- case 222 /* ClassDeclaration */:
- case 225 /* EnumDeclaration */:
- case 172 /* ObjectLiteralExpression */:
- case 160 /* TypeLiteral */:
- case 281 /* JSDocTypeLiteral */:
- case 265 /* JSDocRecordType */:
+ case 196 /* ClassExpression */:
+ case 225 /* ClassDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 175 /* ObjectLiteralExpression */:
+ case 161 /* TypeLiteral */:
+ case 285 /* JSDocTypeLiteral */:
+ case 269 /* JSDocRecordType */:
return 1 /* IsContainer */;
- case 223 /* InterfaceDeclaration */:
+ case 226 /* InterfaceDeclaration */:
return 1 /* IsContainer */ | 64 /* IsInterface */;
- case 269 /* JSDocFunctionType */:
- case 226 /* ModuleDeclaration */:
- case 224 /* TypeAliasDeclaration */:
+ case 273 /* JSDocFunctionType */:
+ case 229 /* ModuleDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
return 1 /* IsContainer */ | 32 /* HasLocals */;
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
- case 148 /* MethodDeclaration */:
+ case 149 /* MethodDeclaration */:
if (ts.isObjectLiteralOrClassExpressionMethod(node)) {
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethod */;
}
- case 149 /* Constructor */:
- case 221 /* FunctionDeclaration */:
- case 147 /* MethodSignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 154 /* IndexSignature */:
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
+ case 150 /* Constructor */:
+ case 224 /* FunctionDeclaration */:
+ case 148 /* MethodSignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 155 /* IndexSignature */:
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */;
- case 227 /* ModuleBlock */:
+ case 230 /* ModuleBlock */:
return 4 /* IsControlFlowContainer */;
- case 146 /* PropertyDeclaration */:
+ case 147 /* PropertyDeclaration */:
return node.initializer ? 4 /* IsControlFlowContainer */ : 0;
- case 252 /* CatchClause */:
- case 207 /* ForStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
- case 228 /* CaseBlock */:
+ case 255 /* CatchClause */:
+ case 210 /* ForStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
+ case 231 /* CaseBlock */:
return 2 /* IsBlockScopedContainer */;
- case 200 /* Block */:
+ case 203 /* Block */:
// do not treat blocks directly inside a function as a block-scoped-container.
// Locals that reside in this block should go to the function locals. Otherwise 'x'
// would not appear to be a redeclaration of a block scoped local in the following
@@ -20630,41 +21548,41 @@ var ts;
// members are declared (for example, a member of a class will go into a specific
// symbol table depending on if it is static or not). We defer to specialized
// handlers to take care of declaring these child members.
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
return declareModuleMember(node, symbolFlags, symbolExcludes);
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
return declareSourceFileMember(node, symbolFlags, symbolExcludes);
- case 193 /* ClassExpression */:
- case 222 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 225 /* ClassDeclaration */:
return declareClassMember(node, symbolFlags, symbolExcludes);
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
- case 160 /* TypeLiteral */:
- case 172 /* ObjectLiteralExpression */:
- case 223 /* InterfaceDeclaration */:
- case 265 /* JSDocRecordType */:
- case 281 /* JSDocTypeLiteral */:
+ case 161 /* TypeLiteral */:
+ case 175 /* ObjectLiteralExpression */:
+ case 226 /* InterfaceDeclaration */:
+ case 269 /* JSDocRecordType */:
+ case 285 /* JSDocTypeLiteral */:
// Interface/Object-types always have their children added to the 'members' of
// their container. They are only accessible through an instance of their
// container, and are never in scope otherwise (even inside the body of the
// object / type / interface declaring them). An exception is type parameters,
// which are in scope without qualification (similar to 'locals').
return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 154 /* IndexSignature */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 149 /* Constructor */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
- case 269 /* JSDocFunctionType */:
- case 224 /* TypeAliasDeclaration */:
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 155 /* IndexSignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 150 /* Constructor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 273 /* JSDocFunctionType */:
+ case 227 /* TypeAliasDeclaration */:
// All the children of these container types are never visible through another
// symbol (i.e. through another symbol's 'exports' or 'members'). Instead,
// they're only accessed 'lexically' (i.e. from code that exists underneath
@@ -20685,11 +21603,11 @@ var ts;
: declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes);
}
function hasExportDeclarations(node) {
- var body = node.kind === 256 /* SourceFile */ ? node : node.body;
- if (body && (body.kind === 256 /* SourceFile */ || body.kind === 227 /* ModuleBlock */)) {
+ var body = node.kind === 260 /* SourceFile */ ? node : node.body;
+ if (body && (body.kind === 260 /* SourceFile */ || body.kind === 230 /* ModuleBlock */)) {
for (var _i = 0, _a = body.statements; _i < _a.length; _i++) {
var stat = _a[_i];
- if (stat.kind === 237 /* ExportDeclaration */ || stat.kind === 236 /* ExportAssignment */) {
+ if (stat.kind === 240 /* ExportDeclaration */ || stat.kind === 239 /* ExportAssignment */) {
return true;
}
}
@@ -20782,7 +21700,7 @@ var ts;
var seen = ts.createMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- if (prop.name.kind !== 70 /* Identifier */) {
+ if (prop.kind === 258 /* SpreadAssignment */ || prop.name.kind !== 70 /* Identifier */) {
continue;
}
var identifier = prop.name;
@@ -20794,7 +21712,7 @@ var ts;
// c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
// d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
- var currentKind = prop.kind === 253 /* PropertyAssignment */ || prop.kind === 254 /* ShorthandPropertyAssignment */ || prop.kind === 148 /* MethodDeclaration */
+ var currentKind = prop.kind === 256 /* PropertyAssignment */ || prop.kind === 257 /* ShorthandPropertyAssignment */ || prop.kind === 149 /* MethodDeclaration */
? 1 /* Property */
: 2 /* Accessor */;
var existingKind = seen[identifier.text];
@@ -20816,10 +21734,10 @@ var ts;
}
function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) {
switch (blockScopeContainer.kind) {
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
declareModuleMember(node, symbolFlags, symbolExcludes);
break;
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
if (ts.isExternalModule(container)) {
declareModuleMember(node, symbolFlags, symbolExcludes);
break;
@@ -20930,8 +21848,8 @@ var ts;
function checkStrictModeFunctionDeclaration(node) {
if (languageVersion < 2 /* ES2015 */) {
// Report error if function is not top level function declaration
- if (blockScopeContainer.kind !== 256 /* SourceFile */ &&
- blockScopeContainer.kind !== 226 /* ModuleDeclaration */ &&
+ if (blockScopeContainer.kind !== 260 /* SourceFile */ &&
+ blockScopeContainer.kind !== 229 /* ModuleDeclaration */ &&
!ts.isFunctionLike(blockScopeContainer)) {
// We check first if the name is inside class declaration or class expression; if so give explicit message
// otherwise report generic error message.
@@ -20997,7 +21915,7 @@ var ts;
// the current 'container' node when it changes. This helps us know which symbol table
// a local should go into for example. Since terminal nodes are known not to have
// children, as an optimization we don't process those.
- if (node.kind > 139 /* LastToken */) {
+ if (node.kind > 140 /* LastToken */) {
var saveParent = parent;
parent = node;
var containerFlags = getContainerFlags(node);
@@ -21044,23 +21962,23 @@ var ts;
// current "blockScopeContainer" needs to be set to its immediate namespace parent.
if (node.isInJSDocNamespace) {
var parentNode = node.parent;
- while (parentNode && parentNode.kind !== 279 /* JSDocTypedefTag */) {
+ while (parentNode && parentNode.kind !== 283 /* JSDocTypedefTag */) {
parentNode = parentNode.parent;
}
bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */);
break;
}
case 98 /* ThisKeyword */:
- if (currentFlow && (ts.isExpression(node) || parent.kind === 254 /* ShorthandPropertyAssignment */)) {
+ if (currentFlow && (ts.isExpression(node) || parent.kind === 257 /* ShorthandPropertyAssignment */)) {
node.flowNode = currentFlow;
}
return checkStrictModeIdentifier(node);
- case 173 /* PropertyAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
if (currentFlow && isNarrowableReference(node)) {
node.flowNode = currentFlow;
}
break;
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
if (ts.isInJavaScriptFile(node)) {
var specialKind = ts.getSpecialPropertyAssignmentKind(node);
switch (specialKind) {
@@ -21084,123 +22002,139 @@ var ts;
}
}
return checkStrictModeBinaryExpression(node);
- case 252 /* CatchClause */:
+ case 255 /* CatchClause */:
return checkStrictModeCatchClause(node);
- case 182 /* DeleteExpression */:
+ case 185 /* DeleteExpression */:
return checkStrictModeDeleteExpression(node);
case 8 /* NumericLiteral */:
return checkStrictModeNumericLiteral(node);
- case 187 /* PostfixUnaryExpression */:
+ case 190 /* PostfixUnaryExpression */:
return checkStrictModePostfixUnaryExpression(node);
- case 186 /* PrefixUnaryExpression */:
+ case 189 /* PrefixUnaryExpression */:
return checkStrictModePrefixUnaryExpression(node);
- case 213 /* WithStatement */:
+ case 216 /* WithStatement */:
return checkStrictModeWithStatement(node);
- case 166 /* ThisType */:
+ case 167 /* ThisType */:
seenThisKeyword = true;
return;
- case 155 /* TypePredicate */:
+ case 156 /* TypePredicate */:
return checkTypePredicate(node);
- case 142 /* TypeParameter */:
+ case 143 /* TypeParameter */:
return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530920 /* TypeParameterExcludes */);
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
return bindParameter(node);
- case 219 /* VariableDeclaration */:
- case 170 /* BindingElement */:
+ case 222 /* VariableDeclaration */:
+ case 173 /* BindingElement */:
+ if (node.dotDotDotToken && node.parent.kind === 171 /* ObjectBindingPattern */) {
+ emitFlags |= 32768 /* HasRestAttribute */;
+ }
return bindVariableDeclarationOrBindingElement(node);
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 266 /* JSDocRecordMember */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 270 /* JSDocRecordMember */:
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */);
- case 280 /* JSDocPropertyTag */:
+ case 284 /* JSDocPropertyTag */:
return bindJSDocProperty(node);
- case 253 /* PropertyAssignment */:
- case 254 /* ShorthandPropertyAssignment */:
+ case 256 /* PropertyAssignment */:
+ case 257 /* ShorthandPropertyAssignment */:
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */);
- case 255 /* EnumMember */:
+ case 259 /* EnumMember */:
return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */);
- case 247 /* JsxSpreadAttribute */:
- emitFlags |= 16384 /* HasJsxSpreadAttributes */;
+ case 258 /* SpreadAssignment */:
+ case 250 /* JsxSpreadAttribute */:
+ var root = container;
+ var hasRest = false;
+ while (root.parent) {
+ if (root.kind === 175 /* ObjectLiteralExpression */ &&
+ root.parent.kind === 191 /* BinaryExpression */ &&
+ root.parent.operatorToken.kind === 57 /* EqualsToken */ &&
+ root.parent.left === root) {
+ hasRest = true;
+ break;
+ }
+ root = root.parent;
+ }
+ emitFlags |= hasRest ? 32768 /* HasRestAttribute */ : 16384 /* HasSpreadAttribute */;
return;
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 154 /* IndexSignature */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 155 /* IndexSignature */:
return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */);
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
// If this is an ObjectLiteralExpression method, then it sits in the same space
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
// so that it will conflict with any other object literal members with the same
// name.
return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 99263 /* MethodExcludes */);
- case 221 /* FunctionDeclaration */:
+ case 224 /* FunctionDeclaration */:
return bindFunctionDeclaration(node);
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */);
- case 150 /* GetAccessor */:
+ case 151 /* GetAccessor */:
return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */);
- case 151 /* SetAccessor */:
+ case 152 /* SetAccessor */:
return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */);
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
- case 269 /* JSDocFunctionType */:
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
+ case 273 /* JSDocFunctionType */:
return bindFunctionOrConstructorType(node);
- case 160 /* TypeLiteral */:
- case 281 /* JSDocTypeLiteral */:
- case 265 /* JSDocRecordType */:
+ case 161 /* TypeLiteral */:
+ case 285 /* JSDocTypeLiteral */:
+ case 269 /* JSDocRecordType */:
return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type");
- case 172 /* ObjectLiteralExpression */:
+ case 175 /* ObjectLiteralExpression */:
return bindObjectLiteralExpression(node);
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
return bindFunctionExpression(node);
- case 175 /* CallExpression */:
+ case 178 /* CallExpression */:
if (ts.isInJavaScriptFile(node)) {
bindCallExpression(node);
}
break;
// Members of classes, interfaces, and modules
- case 193 /* ClassExpression */:
- case 222 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 225 /* ClassDeclaration */:
// All classes are automatically in strict mode in ES6.
inStrictMode = true;
return bindClassLikeDeclaration(node);
- case 223 /* InterfaceDeclaration */:
+ case 226 /* InterfaceDeclaration */:
return bindBlockScopedDeclaration(node, 64 /* Interface */, 792968 /* InterfaceExcludes */);
- case 279 /* JSDocTypedefTag */:
+ case 283 /* JSDocTypedefTag */:
if (!node.fullName || node.fullName.kind === 70 /* Identifier */) {
return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */);
}
break;
- case 224 /* TypeAliasDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */);
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
return bindEnumDeclaration(node);
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
return bindModuleDeclaration(node);
// Imports and exports
- case 230 /* ImportEqualsDeclaration */:
- case 233 /* NamespaceImport */:
- case 235 /* ImportSpecifier */:
- case 239 /* ExportSpecifier */:
+ case 233 /* ImportEqualsDeclaration */:
+ case 236 /* NamespaceImport */:
+ case 238 /* ImportSpecifier */:
+ case 242 /* ExportSpecifier */:
return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */);
- case 229 /* NamespaceExportDeclaration */:
+ case 232 /* NamespaceExportDeclaration */:
return bindNamespaceExportDeclaration(node);
- case 232 /* ImportClause */:
+ case 235 /* ImportClause */:
return bindImportClause(node);
- case 237 /* ExportDeclaration */:
+ case 240 /* ExportDeclaration */:
return bindExportDeclaration(node);
- case 236 /* ExportAssignment */:
+ case 239 /* ExportAssignment */:
return bindExportAssignment(node);
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
updateStrictModeStatementList(node.statements);
return bindSourceFileIfExternalModule();
- case 200 /* Block */:
+ case 203 /* Block */:
if (!ts.isFunctionLike(node.parent)) {
return;
}
// Fall through
- case 227 /* ModuleBlock */:
+ case 230 /* ModuleBlock */:
return updateStrictModeStatementList(node.statements);
}
}
@@ -21209,7 +22143,7 @@ var ts;
if (parameterName && parameterName.kind === 70 /* Identifier */) {
checkStrictModeIdentifier(parameterName);
}
- if (parameterName && parameterName.kind === 166 /* ThisType */) {
+ if (parameterName && parameterName.kind === 167 /* ThisType */) {
seenThisKeyword = true;
}
bind(type);
@@ -21232,7 +22166,7 @@ var ts;
// An export default clause with an expression exports a value
// We want to exclude both class and function here, this is necessary to issue an error when there are both
// default export-assignment and default export function and class declaration.
- var flags = node.kind === 236 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node)
+ var flags = node.kind === 239 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node)
? 8388608 /* Alias */
: 4 /* Property */;
declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 /* Property */ | 8388608 /* AliasExcludes */ | 32 /* Class */ | 16 /* Function */);
@@ -21242,17 +22176,17 @@ var ts;
if (node.modifiers && node.modifiers.length) {
file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here));
}
- if (node.parent.kind !== 256 /* SourceFile */) {
+ if (node.parent.kind !== 260 /* SourceFile */) {
file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level));
return;
}
else {
- var parent_6 = node.parent;
- if (!ts.isExternalModule(parent_6)) {
+ var parent_5 = node.parent;
+ if (!ts.isExternalModule(parent_5)) {
file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files));
return;
}
- if (!parent_6.isDeclarationFile) {
+ if (!parent_5.isDeclarationFile) {
file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files));
return;
}
@@ -21297,12 +22231,12 @@ var ts;
function bindThisPropertyAssignment(node) {
ts.Debug.assert(ts.isInJavaScriptFile(node));
// Declare a 'member' if the container is an ES5 class or ES6 constructor
- if (container.kind === 221 /* FunctionDeclaration */ || container.kind === 180 /* FunctionExpression */) {
+ if (container.kind === 224 /* FunctionDeclaration */ || container.kind === 183 /* FunctionExpression */) {
container.symbol.members = container.symbol.members || ts.createMap();
// It's acceptable for multiple 'this' assignments of the same identifier to occur
declareSymbol(container.symbol.members, container.symbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */);
}
- else if (container.kind === 149 /* Constructor */) {
+ else if (container.kind === 150 /* Constructor */) {
// this.foo assignment in a JavaScript class
// Bind this property to the containing class
var saveContainer = container;
@@ -21353,7 +22287,7 @@ var ts;
emitFlags |= 2048 /* HasDecorators */;
}
}
- if (node.kind === 222 /* ClassDeclaration */) {
+ if (node.kind === 225 /* ClassDeclaration */) {
bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */);
}
else {
@@ -21497,13 +22431,13 @@ var ts;
if (currentFlow === unreachableFlow) {
var reportError =
// report error on all statements except empty ones
- (ts.isStatementButNotDeclaration(node) && node.kind !== 202 /* EmptyStatement */) ||
+ (ts.isStatementButNotDeclaration(node) && node.kind !== 205 /* EmptyStatement */) ||
// report error on class declarations
- node.kind === 222 /* ClassDeclaration */ ||
+ node.kind === 225 /* ClassDeclaration */ ||
// report error on instantiated modules or const-enums only modules if preserveConstEnums is set
- (node.kind === 226 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) ||
+ (node.kind === 229 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) ||
// report error on regular enums and const enums if preserveConstEnums is set
- (node.kind === 225 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums));
+ (node.kind === 228 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums));
if (reportError) {
currentFlow = reportedUnreachableFlow;
// unreachable code is reported if
@@ -21517,7 +22451,7 @@ var ts;
// On the other side we do want to report errors on non-initialized 'lets' because of TDZ
var reportUnreachableCode = !options.allowUnreachableCode &&
!ts.isInAmbientContext(node) &&
- (node.kind !== 201 /* VariableStatement */ ||
+ (node.kind !== 204 /* VariableStatement */ ||
ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */ ||
ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; }));
if (reportUnreachableCode) {
@@ -21537,56 +22471,56 @@ var ts;
function computeTransformFlagsForNode(node, subtreeFlags) {
var kind = node.kind;
switch (kind) {
- case 175 /* CallExpression */:
+ case 178 /* CallExpression */:
return computeCallExpression(node, subtreeFlags);
- case 176 /* NewExpression */:
+ case 179 /* NewExpression */:
return computeNewExpression(node, subtreeFlags);
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
return computeModuleDeclaration(node, subtreeFlags);
- case 179 /* ParenthesizedExpression */:
+ case 182 /* ParenthesizedExpression */:
return computeParenthesizedExpression(node, subtreeFlags);
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
return computeBinaryExpression(node, subtreeFlags);
- case 203 /* ExpressionStatement */:
+ case 206 /* ExpressionStatement */:
return computeExpressionStatement(node, subtreeFlags);
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
return computeParameter(node, subtreeFlags);
- case 181 /* ArrowFunction */:
+ case 184 /* ArrowFunction */:
return computeArrowFunction(node, subtreeFlags);
- case 180 /* FunctionExpression */:
+ case 183 /* FunctionExpression */:
return computeFunctionExpression(node, subtreeFlags);
- case 221 /* FunctionDeclaration */:
+ case 224 /* FunctionDeclaration */:
return computeFunctionDeclaration(node, subtreeFlags);
- case 219 /* VariableDeclaration */:
+ case 222 /* VariableDeclaration */:
return computeVariableDeclaration(node, subtreeFlags);
- case 220 /* VariableDeclarationList */:
+ case 223 /* VariableDeclarationList */:
return computeVariableDeclarationList(node, subtreeFlags);
- case 201 /* VariableStatement */:
+ case 204 /* VariableStatement */:
return computeVariableStatement(node, subtreeFlags);
- case 215 /* LabeledStatement */:
+ case 218 /* LabeledStatement */:
return computeLabeledStatement(node, subtreeFlags);
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
return computeClassDeclaration(node, subtreeFlags);
- case 193 /* ClassExpression */:
+ case 196 /* ClassExpression */:
return computeClassExpression(node, subtreeFlags);
- case 251 /* HeritageClause */:
+ case 254 /* HeritageClause */:
return computeHeritageClause(node, subtreeFlags);
- case 252 /* CatchClause */:
+ case 255 /* CatchClause */:
return computeCatchClause(node, subtreeFlags);
- case 195 /* ExpressionWithTypeArguments */:
+ case 198 /* ExpressionWithTypeArguments */:
return computeExpressionWithTypeArguments(node, subtreeFlags);
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
return computeConstructor(node, subtreeFlags);
- case 146 /* PropertyDeclaration */:
+ case 147 /* PropertyDeclaration */:
return computePropertyDeclaration(node, subtreeFlags);
- case 148 /* MethodDeclaration */:
+ case 149 /* MethodDeclaration */:
return computeMethod(node, subtreeFlags);
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
return computeAccessor(node, subtreeFlags);
- case 230 /* ImportEqualsDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
return computeImportEquals(node, subtreeFlags);
- case 173 /* PropertyAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
return computePropertyAccess(node, subtreeFlags);
default:
return computeOther(node, kind, subtreeFlags);
@@ -21600,21 +22534,21 @@ var ts;
if (node.typeArguments) {
transformFlags |= 3 /* AssertTypeScript */;
}
- if (subtreeFlags & 1048576 /* ContainsSpreadElementExpression */
+ if (subtreeFlags & 8388608 /* ContainsSpreadExpression */
|| isSuperOrSuperProperty(expression, expressionKind)) {
- // If the this node contains a SpreadElementExpression, or is a super call, then it is an ES6
+ // If the this node contains a SpreadExpression, or is a super call, then it is an ES6
// node.
- transformFlags |= 768 /* AssertES2015 */;
+ transformFlags |= 3072 /* AssertES2015 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~537922901 /* ArrayLiteralOrCallOrNewExcludes */;
+ return transformFlags & ~545281365 /* ArrayLiteralOrCallOrNewExcludes */;
}
function isSuperOrSuperProperty(node, kind) {
switch (kind) {
case 96 /* SuperKeyword */:
return true;
- case 173 /* PropertyAccessExpression */:
- case 174 /* ElementAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
+ case 177 /* ElementAccessExpression */:
var expression = node.expression;
var expressionKind = expression.kind;
return expressionKind === 96 /* SuperKeyword */;
@@ -21626,31 +22560,34 @@ var ts;
if (node.typeArguments) {
transformFlags |= 3 /* AssertTypeScript */;
}
- if (subtreeFlags & 1048576 /* ContainsSpreadElementExpression */) {
+ if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
// If the this node contains a SpreadElementExpression then it is an ES6
// node.
- transformFlags |= 768 /* AssertES2015 */;
+ transformFlags |= 3072 /* AssertES2015 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~537922901 /* ArrayLiteralOrCallOrNewExcludes */;
+ return transformFlags & ~545281365 /* ArrayLiteralOrCallOrNewExcludes */;
}
function computeBinaryExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
var operatorTokenKind = node.operatorToken.kind;
var leftKind = node.left.kind;
- if (operatorTokenKind === 57 /* EqualsToken */
- && (leftKind === 172 /* ObjectLiteralExpression */
- || leftKind === 171 /* ArrayLiteralExpression */)) {
- // Destructuring assignments are ES6 syntax.
- transformFlags |= 768 /* AssertES2015 */ | 1024 /* DestructuringAssignment */;
+ if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 175 /* ObjectLiteralExpression */) {
+ // Destructuring object assignments with are ES2015 syntax
+ // and possibly ESNext if they contain rest
+ transformFlags |= 48 /* AssertESNext */ | 3072 /* AssertES2015 */ | 49152 /* AssertDestructuringAssignment */;
+ }
+ else if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 174 /* ArrayLiteralExpression */) {
+ // Destructuring assignments are ES2015 syntax.
+ transformFlags |= 3072 /* AssertES2015 */ | 49152 /* AssertDestructuringAssignment */;
}
else if (operatorTokenKind === 39 /* AsteriskAsteriskToken */
|| operatorTokenKind === 61 /* AsteriskAsteriskEqualsToken */) {
// Exponentiation is ES2016 syntax.
- transformFlags |= 192 /* AssertES2016 */;
+ transformFlags |= 768 /* AssertES2016 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536874325 /* NodeExcludes */;
+ return transformFlags & ~536892757 /* NodeExcludes */;
}
function computeParameter(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -21662,21 +22599,25 @@ var ts;
// syntax.
if (node.questionToken
|| node.type
- || subtreeFlags & 8192 /* ContainsDecorators */
+ || subtreeFlags & 65536 /* ContainsDecorators */
|| ts.isThisIdentifier(name)) {
transformFlags |= 3 /* AssertTypeScript */;
}
// If a parameter has an accessibility modifier, then it is TypeScript syntax.
if (modifierFlags & 92 /* ParameterPropertyModifier */) {
- transformFlags |= 3 /* AssertTypeScript */ | 524288 /* ContainsParameterPropertyAssignments */;
+ transformFlags |= 3 /* AssertTypeScript */ | 4194304 /* ContainsParameterPropertyAssignments */;
+ }
+ // parameters with object rest destructuring are ES Next syntax
+ if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
+ transformFlags |= 48 /* AssertESNext */;
}
// If a parameter has an initializer, a binding pattern or a dotDotDot token, then
// it is ES6 syntax and its container must emit default value assignments or parameter destructuring downlevel.
- if (subtreeFlags & 8388608 /* ContainsBindingPattern */ || initializer || dotDotDotToken) {
- transformFlags |= 768 /* AssertES2015 */ | 262144 /* ContainsDefaultValueAssignments */;
+ if (subtreeFlags & 67108864 /* ContainsBindingPattern */ || initializer || dotDotDotToken) {
+ transformFlags |= 3072 /* AssertES2015 */ | 2097152 /* ContainsDefaultValueAssignments */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~545262933 /* ParameterExcludes */;
+ return transformFlags & ~604001621 /* ParameterExcludes */;
}
function computeParenthesizedExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -21686,17 +22627,17 @@ var ts;
// If the node is synthesized, it means the emitter put the parentheses there,
// not the user. If we didn't want them, the emitter would not have put them
// there.
- if (expressionKind === 196 /* AsExpression */
- || expressionKind === 178 /* TypeAssertionExpression */) {
+ if (expressionKind === 199 /* AsExpression */
+ || expressionKind === 181 /* TypeAssertionExpression */) {
transformFlags |= 3 /* AssertTypeScript */;
}
// If the expression of a ParenthesizedExpression is a destructuring assignment,
// then the ParenthesizedExpression is a destructuring assignment.
- if (expressionTransformFlags & 1024 /* DestructuringAssignment */) {
- transformFlags |= 1024 /* DestructuringAssignment */;
+ if (expressionTransformFlags & 16384 /* DestructuringAssignment */) {
+ transformFlags |= 16384 /* DestructuringAssignment */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536874325 /* NodeExcludes */;
+ return transformFlags & ~536892757 /* NodeExcludes */;
}
function computeClassDeclaration(node, subtreeFlags) {
var transformFlags;
@@ -21707,47 +22648,47 @@ var ts;
}
else {
// A ClassDeclaration is ES6 syntax.
- transformFlags = subtreeFlags | 768 /* AssertES2015 */;
+ transformFlags = subtreeFlags | 3072 /* AssertES2015 */;
// A class with a parameter property assignment, property initializer, or decorator is
// TypeScript syntax.
- // An exported declaration may be TypeScript syntax.
- if ((subtreeFlags & 548864 /* TypeScriptClassSyntaxMask */)
- || (modifierFlags & 1 /* Export */)
+ // An exported declaration may be TypeScript syntax, but is handled by the visitor
+ // for a namespace declaration.
+ if ((subtreeFlags & 4390912 /* TypeScriptClassSyntaxMask */)
|| node.typeParameters) {
transformFlags |= 3 /* AssertTypeScript */;
}
- if (subtreeFlags & 131072 /* ContainsLexicalThisInComputedPropertyName */) {
+ if (subtreeFlags & 1048576 /* ContainsLexicalThisInComputedPropertyName */) {
// A computed property name containing `this` might need to be rewritten,
// so propagate the ContainsLexicalThis flag upward.
- transformFlags |= 32768 /* ContainsLexicalThis */;
+ transformFlags |= 262144 /* ContainsLexicalThis */;
}
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~539749717 /* ClassExcludes */;
+ return transformFlags & ~559895893 /* ClassExcludes */;
}
function computeClassExpression(node, subtreeFlags) {
// A ClassExpression is ES6 syntax.
- var transformFlags = subtreeFlags | 768 /* AssertES2015 */;
+ var transformFlags = subtreeFlags | 3072 /* AssertES2015 */;
// A class with a parameter property assignment, property initializer, or decorator is
// TypeScript syntax.
- if (subtreeFlags & 548864 /* TypeScriptClassSyntaxMask */
+ if (subtreeFlags & 4390912 /* TypeScriptClassSyntaxMask */
|| node.typeParameters) {
transformFlags |= 3 /* AssertTypeScript */;
}
- if (subtreeFlags & 131072 /* ContainsLexicalThisInComputedPropertyName */) {
+ if (subtreeFlags & 1048576 /* ContainsLexicalThisInComputedPropertyName */) {
// A computed property name containing `this` might need to be rewritten,
// so propagate the ContainsLexicalThis flag upward.
- transformFlags |= 32768 /* ContainsLexicalThis */;
+ transformFlags |= 262144 /* ContainsLexicalThis */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~539749717 /* ClassExcludes */;
+ return transformFlags & ~559895893 /* ClassExcludes */;
}
function computeHeritageClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
switch (node.token) {
case 84 /* ExtendsKeyword */:
// An `extends` HeritageClause is ES6 syntax.
- transformFlags |= 768 /* AssertES2015 */;
+ transformFlags |= 3072 /* AssertES2015 */;
break;
case 107 /* ImplementsKeyword */:
// An `implements` HeritageClause is TypeScript syntax.
@@ -21758,27 +22699,27 @@ var ts;
break;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536874325 /* NodeExcludes */;
+ return transformFlags & ~536892757 /* NodeExcludes */;
}
function computeCatchClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
if (node.variableDeclaration && ts.isBindingPattern(node.variableDeclaration.name)) {
- transformFlags |= 768 /* AssertES2015 */;
+ transformFlags |= 3072 /* AssertES2015 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536874325 /* NodeExcludes */;
+ return transformFlags & ~536892757 /* NodeExcludes */;
}
function computeExpressionWithTypeArguments(node, subtreeFlags) {
// An ExpressionWithTypeArguments is ES6 syntax, as it is used in the
// extends clause of a class.
- var transformFlags = subtreeFlags | 768 /* AssertES2015 */;
+ var transformFlags = subtreeFlags | 3072 /* AssertES2015 */;
// If an ExpressionWithTypeArguments contains type arguments, then it
// is TypeScript syntax.
if (node.typeArguments) {
transformFlags |= 3 /* AssertTypeScript */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536874325 /* NodeExcludes */;
+ return transformFlags & ~536892757 /* NodeExcludes */;
}
function computeConstructor(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -21788,11 +22729,11 @@ var ts;
transformFlags |= 3 /* AssertTypeScript */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~591760725 /* ConstructorExcludes */;
+ return transformFlags & ~975983957 /* ConstructorExcludes */;
}
function computeMethod(node, subtreeFlags) {
// A MethodDeclaration is ES6 syntax.
- var transformFlags = subtreeFlags | 768 /* AssertES2015 */;
+ var transformFlags = subtreeFlags | 3072 /* AssertES2015 */;
// Decorators, TypeScript-specific modifiers, type parameters, type annotations, and
// overloads are TypeScript syntax.
if (node.decorators
@@ -21804,14 +22745,14 @@ var ts;
}
// An async method declaration is ES2017 syntax.
if (ts.hasModifier(node, 256 /* Async */)) {
- transformFlags |= 48 /* AssertES2017 */;
+ transformFlags |= 192 /* AssertES2017 */;
}
// Currently, we only support generators that were originally async function bodies.
if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) {
- transformFlags |= 6144 /* AssertGenerator */;
+ transformFlags |= 12288 /* AssertGenerator */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~591760725 /* MethodOrAccessorExcludes */;
+ return transformFlags & ~975983957 /* MethodOrAccessorExcludes */;
}
function computeAccessor(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -21824,7 +22765,7 @@ var ts;
transformFlags |= 3 /* AssertTypeScript */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~591760725 /* MethodOrAccessorExcludes */;
+ return transformFlags & ~975983957 /* MethodOrAccessorExcludes */;
}
function computePropertyDeclaration(node, subtreeFlags) {
// A PropertyDeclaration is TypeScript syntax.
@@ -21832,10 +22773,10 @@ var ts;
// If the PropertyDeclaration has an initializer, we need to inform its ancestor
// so that it handle the transformation.
if (node.initializer) {
- transformFlags |= 16384 /* ContainsPropertyInitializer */;
+ transformFlags |= 131072 /* ContainsPropertyInitializer */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536874325 /* NodeExcludes */;
+ return transformFlags & ~536892757 /* NodeExcludes */;
}
function computeFunctionDeclaration(node, subtreeFlags) {
var transformFlags;
@@ -21847,11 +22788,7 @@ var ts;
transformFlags = 3 /* AssertTypeScript */;
}
else {
- transformFlags = subtreeFlags | 33554432 /* ContainsHoistedDeclarationOrCompletion */;
- // If a FunctionDeclaration is exported, then it is either ES6 or TypeScript syntax.
- if (modifierFlags & 1 /* Export */) {
- transformFlags |= 3 /* AssertTypeScript */ | 768 /* AssertES2015 */;
- }
+ transformFlags = subtreeFlags | 268435456 /* ContainsHoistedDeclarationOrCompletion */;
// TypeScript-specific modifiers, type parameters, and type annotations are TypeScript
// syntax.
if (modifierFlags & 2270 /* TypeScriptModifier */
@@ -21861,13 +22798,17 @@ var ts;
}
// An async function declaration is ES2017 syntax.
if (modifierFlags & 256 /* Async */) {
- transformFlags |= 48 /* AssertES2017 */;
+ transformFlags |= 192 /* AssertES2017 */;
+ }
+ // function declarations with object rest destructuring are ES Next syntax
+ if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
+ transformFlags |= 48 /* AssertESNext */;
}
// If a FunctionDeclaration's subtree has marked the container as needing to capture the
// lexical this, or the function contains parameters with initializers, then this node is
// ES6 syntax.
- if (subtreeFlags & 327680 /* ES2015FunctionSyntaxMask */) {
- transformFlags |= 768 /* AssertES2015 */;
+ if (subtreeFlags & 2621440 /* ES2015FunctionSyntaxMask */) {
+ transformFlags |= 3072 /* AssertES2015 */;
}
// If a FunctionDeclaration is generator function and is the body of a
// transformed async function, then this node can be transformed to a
@@ -21875,11 +22816,11 @@ var ts;
// Currently we do not support transforming any other generator fucntions
// down level.
if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) {
- transformFlags |= 6144 /* AssertGenerator */;
+ transformFlags |= 12288 /* AssertGenerator */;
}
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~592293205 /* FunctionExcludes */;
+ return transformFlags & ~980243797 /* FunctionExcludes */;
}
function computeFunctionExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -21892,13 +22833,17 @@ var ts;
}
// An async function expression is ES2017 syntax.
if (ts.hasModifier(node, 256 /* Async */)) {
- transformFlags |= 48 /* AssertES2017 */;
+ transformFlags |= 192 /* AssertES2017 */;
+ }
+ // function expressions with object rest destructuring are ES Next syntax
+ if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
+ transformFlags |= 48 /* AssertESNext */;
}
// If a FunctionExpression's subtree has marked the container as needing to capture the
// lexical this, or the function contains parameters with initializers, then this node is
// ES6 syntax.
- if (subtreeFlags & 327680 /* ES2015FunctionSyntaxMask */) {
- transformFlags |= 768 /* AssertES2015 */;
+ if (subtreeFlags & 2621440 /* ES2015FunctionSyntaxMask */) {
+ transformFlags |= 3072 /* AssertES2015 */;
}
// If a FunctionExpression is generator function and is the body of a
// transformed async function, then this node can be transformed to a
@@ -21906,14 +22851,14 @@ var ts;
// Currently we do not support transforming any other generator fucntions
// down level.
if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) {
- transformFlags |= 6144 /* AssertGenerator */;
+ transformFlags |= 12288 /* AssertGenerator */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~592293205 /* FunctionExcludes */;
+ return transformFlags & ~980243797 /* FunctionExcludes */;
}
function computeArrowFunction(node, subtreeFlags) {
// An ArrowFunction is ES6 syntax, and excludes markers that should not escape the scope of an ArrowFunction.
- var transformFlags = subtreeFlags | 768 /* AssertES2015 */;
+ var transformFlags = subtreeFlags | 3072 /* AssertES2015 */;
// TypeScript-specific modifiers, type parameters, and type annotations are TypeScript
// syntax.
if (ts.hasModifier(node, 2270 /* TypeScriptModifier */)
@@ -21923,14 +22868,18 @@ var ts;
}
// An async arrow function is ES2017 syntax.
if (ts.hasModifier(node, 256 /* Async */)) {
- transformFlags |= 48 /* AssertES2017 */;
+ transformFlags |= 192 /* AssertES2017 */;
+ }
+ // arrow functions with object rest destructuring are ES Next syntax
+ if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
+ transformFlags |= 48 /* AssertESNext */;
}
// If an ArrowFunction contains a lexical this, its container must capture the lexical this.
- if (subtreeFlags & 32768 /* ContainsLexicalThis */) {
- transformFlags |= 65536 /* ContainsCapturedLexicalThis */;
+ if (subtreeFlags & 262144 /* ContainsLexicalThis */) {
+ transformFlags |= 524288 /* ContainsCapturedLexicalThis */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~592227669 /* ArrowFunctionExcludes */;
+ return transformFlags & ~979719509 /* ArrowFunctionExcludes */;
}
function computePropertyAccess(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -21939,24 +22888,28 @@ var ts;
// If a PropertyAccessExpression starts with a super keyword, then it is
// ES6 syntax, and requires a lexical `this` binding.
if (expressionKind === 96 /* SuperKeyword */) {
- transformFlags |= 32768 /* ContainsLexicalThis */;
+ transformFlags |= 262144 /* ContainsLexicalThis */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536874325 /* NodeExcludes */;
+ return transformFlags & ~536892757 /* NodeExcludes */;
}
function computeVariableDeclaration(node, subtreeFlags) {
var transformFlags = subtreeFlags;
var nameKind = node.name.kind;
- // A VariableDeclaration with a binding pattern is ES6 syntax.
- if (nameKind === 168 /* ObjectBindingPattern */ || nameKind === 169 /* ArrayBindingPattern */) {
- transformFlags |= 768 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */;
+ // A VariableDeclaration with an object binding pattern is ES2015 syntax
+ // and possibly ESNext syntax if it contains an object binding pattern
+ if (nameKind === 171 /* ObjectBindingPattern */) {
+ transformFlags |= 48 /* AssertESNext */ | 3072 /* AssertES2015 */ | 67108864 /* ContainsBindingPattern */;
+ }
+ else if (nameKind === 172 /* ArrayBindingPattern */) {
+ transformFlags |= 3072 /* AssertES2015 */ | 67108864 /* ContainsBindingPattern */;
}
// Type annotations are TypeScript syntax.
if (node.type) {
transformFlags |= 3 /* AssertTypeScript */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536874325 /* NodeExcludes */;
+ return transformFlags & ~536892757 /* NodeExcludes */;
}
function computeVariableStatement(node, subtreeFlags) {
var transformFlags;
@@ -21968,26 +22921,22 @@ var ts;
}
else {
transformFlags = subtreeFlags;
- // If a VariableStatement is exported, then it is either ES6 or TypeScript syntax.
- if (modifierFlags & 1 /* Export */) {
- transformFlags |= 768 /* AssertES2015 */ | 3 /* AssertTypeScript */;
- }
- if (declarationListTransformFlags & 8388608 /* ContainsBindingPattern */) {
- transformFlags |= 768 /* AssertES2015 */;
+ if (declarationListTransformFlags & 67108864 /* ContainsBindingPattern */) {
+ transformFlags |= 3072 /* AssertES2015 */;
}
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536874325 /* NodeExcludes */;
+ return transformFlags & ~536892757 /* NodeExcludes */;
}
function computeLabeledStatement(node, subtreeFlags) {
var transformFlags = subtreeFlags;
// A labeled statement containing a block scoped binding *may* need to be transformed from ES6.
- if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */
+ if (subtreeFlags & 33554432 /* ContainsBlockScopedBinding */
&& ts.isIterationStatement(node, /*lookInLabeledStatements*/ true)) {
- transformFlags |= 768 /* AssertES2015 */;
+ transformFlags |= 3072 /* AssertES2015 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536874325 /* NodeExcludes */;
+ return transformFlags & ~536892757 /* NodeExcludes */;
}
function computeImportEquals(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -21996,18 +22945,18 @@ var ts;
transformFlags |= 3 /* AssertTypeScript */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536874325 /* NodeExcludes */;
+ return transformFlags & ~536892757 /* NodeExcludes */;
}
function computeExpressionStatement(node, subtreeFlags) {
var transformFlags = subtreeFlags;
// If the expression of an expression statement is a destructuring assignment,
// then we treat the statement as ES6 so that we can indicate that we do not
// need to hold on to the right-hand side.
- if (node.expression.transformFlags & 1024 /* DestructuringAssignment */) {
- transformFlags |= 768 /* AssertES2015 */;
+ if (node.expression.transformFlags & 16384 /* DestructuringAssignment */) {
+ transformFlags |= 3072 /* AssertES2015 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536874325 /* NodeExcludes */;
+ return transformFlags & ~536892757 /* NodeExcludes */;
}
function computeModuleDeclaration(node, subtreeFlags) {
var transformFlags = 3 /* AssertTypeScript */;
@@ -22016,29 +22965,29 @@ var ts;
transformFlags |= subtreeFlags;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~574729557 /* ModuleExcludes */;
+ return transformFlags & ~839734613 /* ModuleExcludes */;
}
function computeVariableDeclarationList(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 33554432 /* ContainsHoistedDeclarationOrCompletion */;
- if (subtreeFlags & 8388608 /* ContainsBindingPattern */) {
- transformFlags |= 768 /* AssertES2015 */;
+ var transformFlags = subtreeFlags | 268435456 /* ContainsHoistedDeclarationOrCompletion */;
+ if (subtreeFlags & 67108864 /* ContainsBindingPattern */) {
+ transformFlags |= 3072 /* AssertES2015 */;
}
// If a VariableDeclarationList is `let` or `const`, then it is ES6 syntax.
if (node.flags & 3 /* BlockScoped */) {
- transformFlags |= 768 /* AssertES2015 */ | 4194304 /* ContainsBlockScopedBinding */;
+ transformFlags |= 3072 /* AssertES2015 */ | 33554432 /* ContainsBlockScopedBinding */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~545262933 /* VariableDeclarationListExcludes */;
+ return transformFlags & ~604001621 /* VariableDeclarationListExcludes */;
}
function computeOther(node, kind, subtreeFlags) {
// Mark transformations needed for each node
var transformFlags = subtreeFlags;
- var excludeFlags = 536874325 /* NodeExcludes */;
+ var excludeFlags = 536892757 /* NodeExcludes */;
switch (kind) {
case 119 /* AsyncKeyword */:
- case 185 /* AwaitExpression */:
+ case 188 /* AwaitExpression */:
// async/await is ES2017 syntax
- transformFlags |= 48 /* AssertES2017 */;
+ transformFlags |= 192 /* AssertES2017 */;
break;
case 113 /* PublicKeyword */:
case 111 /* PrivateKeyword */:
@@ -22046,84 +22995,85 @@ var ts;
case 116 /* AbstractKeyword */:
case 123 /* DeclareKeyword */:
case 75 /* ConstKeyword */:
- case 225 /* EnumDeclaration */:
- case 255 /* EnumMember */:
- case 178 /* TypeAssertionExpression */:
- case 196 /* AsExpression */:
- case 197 /* NonNullExpression */:
- case 129 /* ReadonlyKeyword */:
+ case 228 /* EnumDeclaration */:
+ case 259 /* EnumMember */:
+ case 181 /* TypeAssertionExpression */:
+ case 199 /* AsExpression */:
+ case 200 /* NonNullExpression */:
+ case 130 /* ReadonlyKeyword */:
// These nodes are TypeScript syntax.
transformFlags |= 3 /* AssertTypeScript */;
break;
- case 242 /* JsxElement */:
- case 243 /* JsxSelfClosingElement */:
- case 244 /* JsxOpeningElement */:
+ case 245 /* JsxElement */:
+ case 246 /* JsxSelfClosingElement */:
+ case 247 /* JsxOpeningElement */:
case 10 /* JsxText */:
- case 245 /* JsxClosingElement */:
- case 246 /* JsxAttribute */:
- case 247 /* JsxSpreadAttribute */:
- case 248 /* JsxExpression */:
+ case 248 /* JsxClosingElement */:
+ case 249 /* JsxAttribute */:
+ case 250 /* JsxSpreadAttribute */:
+ case 251 /* JsxExpression */:
// These nodes are Jsx syntax.
transformFlags |= 12 /* AssertJsx */;
break;
- case 83 /* ExportKeyword */:
- // This node is both ES6 and TypeScript syntax.
- transformFlags |= 768 /* AssertES2015 */ | 3 /* AssertTypeScript */;
- break;
- case 78 /* DefaultKeyword */:
+ case 212 /* ForOfStatement */:
+ // for-of might be ESNext if it has a rest destructuring
+ transformFlags |= 48 /* AssertESNext */;
+ // FALLTHROUGH
case 12 /* NoSubstitutionTemplateLiteral */:
case 13 /* TemplateHead */:
case 14 /* TemplateMiddle */:
case 15 /* TemplateTail */:
- case 190 /* TemplateExpression */:
- case 177 /* TaggedTemplateExpression */:
- case 254 /* ShorthandPropertyAssignment */:
- case 209 /* ForOfStatement */:
+ case 193 /* TemplateExpression */:
+ case 180 /* TaggedTemplateExpression */:
+ case 257 /* ShorthandPropertyAssignment */:
+ case 114 /* StaticKeyword */:
// These nodes are ES6 syntax.
- transformFlags |= 768 /* AssertES2015 */;
+ transformFlags |= 3072 /* AssertES2015 */;
break;
- case 191 /* YieldExpression */:
+ case 194 /* YieldExpression */:
// This node is ES6 syntax.
- transformFlags |= 768 /* AssertES2015 */ | 16777216 /* ContainsYield */;
+ transformFlags |= 3072 /* AssertES2015 */ | 134217728 /* ContainsYield */;
break;
case 118 /* AnyKeyword */:
- case 131 /* NumberKeyword */:
- case 128 /* NeverKeyword */:
- case 133 /* StringKeyword */:
+ case 132 /* NumberKeyword */:
+ case 129 /* NeverKeyword */:
+ case 134 /* StringKeyword */:
case 121 /* BooleanKeyword */:
- case 134 /* SymbolKeyword */:
+ case 135 /* SymbolKeyword */:
case 104 /* VoidKeyword */:
- case 142 /* TypeParameter */:
- case 145 /* PropertySignature */:
- case 147 /* MethodSignature */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 154 /* IndexSignature */:
- case 155 /* TypePredicate */:
- case 156 /* TypeReference */:
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
- case 159 /* TypeQuery */:
- case 160 /* TypeLiteral */:
- case 161 /* ArrayType */:
- case 162 /* TupleType */:
- case 163 /* UnionType */:
- case 164 /* IntersectionType */:
- case 165 /* ParenthesizedType */:
- case 223 /* InterfaceDeclaration */:
- case 224 /* TypeAliasDeclaration */:
- case 166 /* ThisType */:
- case 167 /* LiteralType */:
+ case 143 /* TypeParameter */:
+ case 146 /* PropertySignature */:
+ case 148 /* MethodSignature */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 155 /* IndexSignature */:
+ case 156 /* TypePredicate */:
+ case 157 /* TypeReference */:
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
+ case 160 /* TypeQuery */:
+ case 161 /* TypeLiteral */:
+ case 162 /* ArrayType */:
+ case 163 /* TupleType */:
+ case 164 /* UnionType */:
+ case 165 /* IntersectionType */:
+ case 166 /* ParenthesizedType */:
+ case 226 /* InterfaceDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
+ case 167 /* ThisType */:
+ case 168 /* TypeOperator */:
+ case 169 /* IndexedAccessType */:
+ case 170 /* LiteralType */:
// Types and signatures are TypeScript syntax, and exclude all other facts.
transformFlags = 3 /* AssertTypeScript */;
excludeFlags = -3 /* TypeExcludes */;
break;
- case 141 /* ComputedPropertyName */:
+ case 142 /* ComputedPropertyName */:
// Even though computed property names are ES6, we don't treat them as such.
// This is so that they can flow through PropertyName transforms unaffected.
// Instead, we mark the container as ES6, so that it can properly handle the transform.
- transformFlags |= 2097152 /* ContainsComputedPropertyName */;
- if (subtreeFlags & 32768 /* ContainsLexicalThis */) {
+ transformFlags |= 16777216 /* ContainsComputedPropertyName */;
+ if (subtreeFlags & 262144 /* ContainsLexicalThis */) {
// A computed method name like `[this.getName()](x: string) { ... }` needs to
// distinguish itself from the normal case of a method body containing `this`:
// `this` inside a method doesn't need to be rewritten (the method provides `this`),
@@ -22132,70 +23082,86 @@ var ts;
// `_this = this; () => class K { [_this.getName()]() { ... } }`
// To make this distinction, use ContainsLexicalThisInComputedPropertyName
// instead of ContainsLexicalThis for computed property names
- transformFlags |= 131072 /* ContainsLexicalThisInComputedPropertyName */;
+ transformFlags |= 1048576 /* ContainsLexicalThisInComputedPropertyName */;
}
break;
- case 192 /* SpreadElementExpression */:
- // This node is ES6 syntax, but is handled by a containing node.
- transformFlags |= 1048576 /* ContainsSpreadElementExpression */;
+ case 195 /* SpreadElement */:
+ case 258 /* SpreadAssignment */:
+ // This node is ES6 or ES next syntax, but is handled by a containing node.
+ transformFlags |= 8388608 /* ContainsSpreadExpression */;
break;
+ case 173 /* BindingElement */:
+ if (node.dotDotDotToken) {
+ // this node is ES2015 or ES next syntax, but is handled by a containing node.
+ transformFlags |= 8388608 /* ContainsSpreadExpression */;
+ }
case 96 /* SuperKeyword */:
// This node is ES6 syntax.
- transformFlags |= 768 /* AssertES2015 */;
+ transformFlags |= 3072 /* AssertES2015 */;
break;
case 98 /* ThisKeyword */:
// Mark this node and its ancestors as containing a lexical `this` keyword.
- transformFlags |= 32768 /* ContainsLexicalThis */;
+ transformFlags |= 262144 /* ContainsLexicalThis */;
break;
- case 168 /* ObjectBindingPattern */:
- case 169 /* ArrayBindingPattern */:
- // These nodes are ES6 syntax.
- transformFlags |= 768 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */;
+ case 171 /* ObjectBindingPattern */:
+ case 172 /* ArrayBindingPattern */:
+ // These nodes are ES2015 or ES Next syntax.
+ if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
+ transformFlags |= 48 /* AssertESNext */ | 67108864 /* ContainsBindingPattern */;
+ }
+ else {
+ transformFlags |= 3072 /* AssertES2015 */ | 67108864 /* ContainsBindingPattern */;
+ }
break;
- case 144 /* Decorator */:
+ case 145 /* Decorator */:
// This node is TypeScript syntax, and marks its container as also being TypeScript syntax.
- transformFlags |= 3 /* AssertTypeScript */ | 8192 /* ContainsDecorators */;
+ transformFlags |= 3 /* AssertTypeScript */ | 65536 /* ContainsDecorators */;
break;
- case 172 /* ObjectLiteralExpression */:
- excludeFlags = 539110741 /* ObjectLiteralExcludes */;
- if (subtreeFlags & 2097152 /* ContainsComputedPropertyName */) {
+ case 175 /* ObjectLiteralExpression */:
+ excludeFlags = 554784085 /* ObjectLiteralExcludes */;
+ if (subtreeFlags & 16777216 /* ContainsComputedPropertyName */) {
// If an ObjectLiteralExpression contains a ComputedPropertyName, then it
// is an ES6 node.
- transformFlags |= 768 /* AssertES2015 */;
+ transformFlags |= 3072 /* AssertES2015 */;
}
- if (subtreeFlags & 131072 /* ContainsLexicalThisInComputedPropertyName */) {
+ if (subtreeFlags & 1048576 /* ContainsLexicalThisInComputedPropertyName */) {
// A computed property name containing `this` might need to be rewritten,
// so propagate the ContainsLexicalThis flag upward.
- transformFlags |= 32768 /* ContainsLexicalThis */;
+ transformFlags |= 262144 /* ContainsLexicalThis */;
+ }
+ if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
+ // If an ObjectLiteralExpression contains a spread element, then it
+ // is an ES next node.
+ transformFlags |= 48 /* AssertESNext */;
}
break;
- case 171 /* ArrayLiteralExpression */:
- case 176 /* NewExpression */:
- excludeFlags = 537922901 /* ArrayLiteralOrCallOrNewExcludes */;
- if (subtreeFlags & 1048576 /* ContainsSpreadElementExpression */) {
- // If the this node contains a SpreadElementExpression, then it is an ES6
+ case 174 /* ArrayLiteralExpression */:
+ case 179 /* NewExpression */:
+ excludeFlags = 545281365 /* ArrayLiteralOrCallOrNewExcludes */;
+ if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
+ // If the this node contains a SpreadExpression, then it is an ES6
// node.
- transformFlags |= 768 /* AssertES2015 */;
+ transformFlags |= 3072 /* AssertES2015 */;
}
break;
- case 205 /* DoStatement */:
- case 206 /* WhileStatement */:
- case 207 /* ForStatement */:
- case 208 /* ForInStatement */:
+ case 208 /* DoStatement */:
+ case 209 /* WhileStatement */:
+ case 210 /* ForStatement */:
+ case 211 /* ForInStatement */:
// A loop containing a block scoped binding *may* need to be transformed from ES6.
- if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */) {
- transformFlags |= 768 /* AssertES2015 */;
+ if (subtreeFlags & 33554432 /* ContainsBlockScopedBinding */) {
+ transformFlags |= 3072 /* AssertES2015 */;
}
break;
- case 256 /* SourceFile */:
- if (subtreeFlags & 65536 /* ContainsCapturedLexicalThis */) {
- transformFlags |= 768 /* AssertES2015 */;
+ case 260 /* SourceFile */:
+ if (subtreeFlags & 524288 /* ContainsCapturedLexicalThis */) {
+ transformFlags |= 3072 /* AssertES2015 */;
}
break;
- case 212 /* ReturnStatement */:
- case 210 /* ContinueStatement */:
- case 211 /* BreakStatement */:
- transformFlags |= 33554432 /* ContainsHoistedDeclarationOrCompletion */;
+ case 215 /* ReturnStatement */:
+ case 213 /* ContinueStatement */:
+ case 214 /* BreakStatement */:
+ transformFlags |= 268435456 /* ContainsHoistedDeclarationOrCompletion */;
break;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
@@ -22210,54 +23176,54 @@ var ts;
*/
/* @internal */
function getTransformFlagsSubtreeExclusions(kind) {
- if (kind >= 155 /* FirstTypeNode */ && kind <= 167 /* LastTypeNode */) {
+ if (kind >= 156 /* FirstTypeNode */ && kind <= 170 /* LastTypeNode */) {
return -3 /* TypeExcludes */;
}
switch (kind) {
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
- case 171 /* ArrayLiteralExpression */:
- return 537922901 /* ArrayLiteralOrCallOrNewExcludes */;
- case 226 /* ModuleDeclaration */:
- return 574729557 /* ModuleExcludes */;
- case 143 /* Parameter */:
- return 545262933 /* ParameterExcludes */;
- case 181 /* ArrowFunction */:
- return 592227669 /* ArrowFunctionExcludes */;
- case 180 /* FunctionExpression */:
- case 221 /* FunctionDeclaration */:
- return 592293205 /* FunctionExcludes */;
- case 220 /* VariableDeclarationList */:
- return 545262933 /* VariableDeclarationListExcludes */;
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- return 539749717 /* ClassExcludes */;
- case 149 /* Constructor */:
- return 591760725 /* ConstructorExcludes */;
- case 148 /* MethodDeclaration */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- return 591760725 /* MethodOrAccessorExcludes */;
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
+ case 174 /* ArrayLiteralExpression */:
+ return 545281365 /* ArrayLiteralOrCallOrNewExcludes */;
+ case 229 /* ModuleDeclaration */:
+ return 839734613 /* ModuleExcludes */;
+ case 144 /* Parameter */:
+ return 604001621 /* ParameterExcludes */;
+ case 184 /* ArrowFunction */:
+ return 979719509 /* ArrowFunctionExcludes */;
+ case 183 /* FunctionExpression */:
+ case 224 /* FunctionDeclaration */:
+ return 980243797 /* FunctionExcludes */;
+ case 223 /* VariableDeclarationList */:
+ return 604001621 /* VariableDeclarationListExcludes */;
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ return 559895893 /* ClassExcludes */;
+ case 150 /* Constructor */:
+ return 975983957 /* ConstructorExcludes */;
+ case 149 /* MethodDeclaration */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ return 975983957 /* MethodOrAccessorExcludes */;
case 118 /* AnyKeyword */:
- case 131 /* NumberKeyword */:
- case 128 /* NeverKeyword */:
- case 133 /* StringKeyword */:
+ case 132 /* NumberKeyword */:
+ case 129 /* NeverKeyword */:
+ case 134 /* StringKeyword */:
case 121 /* BooleanKeyword */:
- case 134 /* SymbolKeyword */:
+ case 135 /* SymbolKeyword */:
case 104 /* VoidKeyword */:
- case 142 /* TypeParameter */:
- case 145 /* PropertySignature */:
- case 147 /* MethodSignature */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 154 /* IndexSignature */:
- case 223 /* InterfaceDeclaration */:
- case 224 /* TypeAliasDeclaration */:
+ case 143 /* TypeParameter */:
+ case 146 /* PropertySignature */:
+ case 148 /* MethodSignature */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 155 /* IndexSignature */:
+ case 226 /* InterfaceDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
return -3 /* TypeExcludes */;
- case 172 /* ObjectLiteralExpression */:
- return 539110741 /* ObjectLiteralExcludes */;
+ case 175 /* ObjectLiteralExpression */:
+ return 554784085 /* ObjectLiteralExcludes */;
default:
- return 536874325 /* NodeExcludes */;
+ return 536892757 /* NodeExcludes */;
}
}
ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions;
@@ -22275,25 +23241,63 @@ var ts;
return compilerOptions.traceResolution && host.trace !== undefined;
}
ts.isTraceEnabled = isTraceEnabled;
- /* @internal */
- function createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations) {
- return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations };
+ /**
+ * Kinds of file that we are currently looking for.
+ * Typically there is one pass with Extensions.TypeScript, then a second pass with Extensions.JavaScript.
+ */
+ var Extensions;
+ (function (Extensions) {
+ Extensions[Extensions["TypeScript"] = 0] = "TypeScript";
+ Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
+ Extensions[Extensions["DtsOnly"] = 2] = "DtsOnly"; /** Only '.d.ts' */
+ })(Extensions || (Extensions = {}));
+ /** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */
+ function resolvedTypeScriptOnly(resolved) {
+ if (!resolved) {
+ return undefined;
+ }
+ ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension));
+ return resolved.path;
+ }
+ /** Create Resolved from a file with unknown extension. */
+ function resolvedFromAnyFile(path) {
+ return { path: path, extension: ts.extensionFromPath(path) };
+ }
+ /** Adds `isExernalLibraryImport` to a Resolved to get a ResolvedModule. */
+ function resolvedModuleFromResolved(_a, isExternalLibraryImport) {
+ var path = _a.path, extension = _a.extension;
+ return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport };
+ }
+ function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations) {
+ return { resolvedModule: resolved && resolvedModuleFromResolved(resolved, isExternalLibraryImport), failedLookupLocations: failedLookupLocations };
}
- ts.createResolvedModule = createResolvedModule;
function moduleHasNonRelativeName(moduleName) {
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
}
- function tryReadTypesSection(packageJsonPath, baseDirectory, state) {
+ function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) {
var jsonContent = readJson(packageJsonPath, state.host);
+ switch (extensions) {
+ case 2 /* DtsOnly */:
+ case 0 /* TypeScript */:
+ return tryReadFromField("typings") || tryReadFromField("types");
+ case 1 /* JavaScript */:
+ if (typeof jsonContent.main === "string") {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main);
+ }
+ return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main));
+ }
+ return undefined;
+ }
function tryReadFromField(fieldName) {
if (ts.hasProperty(jsonContent, fieldName)) {
var typesFile = jsonContent[fieldName];
if (typeof typesFile === "string") {
- var typesFilePath_1 = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile));
+ var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile));
if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath_1);
+ trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath);
}
- return typesFilePath_1;
+ return typesFilePath;
}
else {
if (state.traceEnabled) {
@@ -22302,19 +23306,6 @@ var ts;
}
}
}
- var typesFilePath = tryReadFromField("typings") || tryReadFromField("types");
- if (typesFilePath) {
- return typesFilePath;
- }
- // Use the main module for inferring types if no types package specified and the allowJs is set
- if (state.compilerOptions.allowJs && jsonContent.main && typeof jsonContent.main === "string") {
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0, jsonContent.main);
- }
- var mainFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main));
- return mainFilePath;
- }
- return undefined;
}
function readJson(path, host) {
try {
@@ -22326,7 +23317,6 @@ var ts;
return {};
}
}
- var typeReferenceExtensions = [".d.ts"];
function getEffectiveTypeRoots(options, host) {
if (options.typeRoots) {
return options.typeRoots;
@@ -22355,11 +23345,11 @@ var ts;
if (host.directoryExists(atTypes)) {
(typeRoots || (typeRoots = [])).push(atTypes);
}
- var parent_7 = ts.getDirectoryPath(currentDirectory);
- if (parent_7 === currentDirectory) {
+ var parent_6 = ts.getDirectoryPath(currentDirectory);
+ if (parent_6 === currentDirectory) {
break;
}
- currentDirectory = parent_7;
+ currentDirectory = parent_6;
}
return typeRoots;
}
@@ -22374,7 +23364,6 @@ var ts;
var moduleResolutionState = {
compilerOptions: options,
host: host,
- skipTsx: true,
traceEnabled: traceEnabled
};
var typeRoots = getEffectiveTypeRoots(options, host);
@@ -22402,18 +23391,17 @@ var ts;
if (traceEnabled) {
trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", "));
}
- var primarySearchPaths = typeRoots;
- for (var _i = 0, primarySearchPaths_1 = primarySearchPaths; _i < primarySearchPaths_1.length; _i++) {
- var typeRoot = primarySearchPaths_1[_i];
+ for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) {
+ var typeRoot = typeRoots_1[_i];
var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName);
var candidateDirectory = ts.getDirectoryPath(candidate);
- var resolvedFile_1 = loadNodeModuleFromDirectory(typeReferenceExtensions, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState);
- if (resolvedFile_1) {
+ var resolved = resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2 /* DtsOnly */, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState));
+ if (resolved) {
if (traceEnabled) {
- trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile_1, true);
+ trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolved, true);
}
return {
- resolvedTypeReferenceDirective: { primary: true, resolvedFileName: resolvedFile_1 },
+ resolvedTypeReferenceDirective: { primary: true, resolvedFileName: resolved },
failedLookupLocations: failedLookupLocations
};
}
@@ -22425,16 +23413,13 @@ var ts;
}
}
var resolvedFile;
- var initialLocationForSecondaryLookup;
- if (containingFile) {
- initialLocationForSecondaryLookup = ts.getDirectoryPath(containingFile);
- }
+ var initialLocationForSecondaryLookup = containingFile && ts.getDirectoryPath(containingFile);
if (initialLocationForSecondaryLookup !== undefined) {
// check secondary locations
if (traceEnabled) {
trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
}
- resolvedFile = loadModuleFromNodeModules(typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, /*checkOneLevel*/ false);
+ resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2 /* DtsOnly */, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, /*checkOneLevel*/ false));
if (traceEnabled) {
if (resolvedFile) {
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile, false);
@@ -22450,9 +23435,7 @@ var ts;
}
}
return {
- resolvedTypeReferenceDirective: resolvedFile
- ? { primary: false, resolvedFileName: resolvedFile }
- : undefined,
+ resolvedTypeReferenceDirective: resolvedFile ? { primary: false, resolvedFileName: resolvedFile } : undefined,
failedLookupLocations: failedLookupLocations
};
}
@@ -22475,8 +23458,8 @@ var ts;
if (host.directoryExists && host.getDirectories) {
var typeRoots = getEffectiveTypeRoots(options, host);
if (typeRoots) {
- for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) {
- var root = typeRoots_1[_i];
+ for (var _i = 0, typeRoots_2 = typeRoots; _i < typeRoots_2.length; _i++) {
+ var root = typeRoots_2[_i];
if (host.directoryExists(root)) {
for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) {
var typeDirectivePath = _b[_a];
@@ -22593,15 +23576,15 @@ var ts;
* be converted to a path relative to found rootDir entry './content/protocols/file2' (*). As a last step compiler will check all remaining
* entries in 'rootDirs', use them to build absolute path out of (*) and try to resolve module from this location.
*/
- function tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) {
+ function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) {
if (moduleHasNonRelativeName(moduleName)) {
- return tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state);
+ return tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state);
}
else {
- return tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state);
+ return tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state);
}
}
- function tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) {
+ function tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) {
if (!state.compilerOptions.rootDirs) {
return undefined;
}
@@ -22639,7 +23622,7 @@ var ts;
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate);
}
- var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state);
+ var resolvedFileName = loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state);
if (resolvedFileName) {
return resolvedFileName;
}
@@ -22658,7 +23641,7 @@ var ts;
trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1);
}
var baseDirectory = ts.getDirectoryPath(candidate_1);
- var resolvedFileName_1 = loader(candidate_1, supportedExtensions, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state);
+ var resolvedFileName_1 = loader(extensions, candidate_1, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state);
if (resolvedFileName_1) {
return resolvedFileName_1;
}
@@ -22669,7 +23652,7 @@ var ts;
}
return undefined;
}
- function tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state) {
+ function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state) {
if (!state.compilerOptions.baseUrl) {
return undefined;
}
@@ -22697,9 +23680,9 @@ var ts;
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path);
}
- var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
- if (resolvedFileName) {
- return resolvedFileName;
+ var resolved = loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
+ if (resolved) {
+ return resolved;
}
}
return undefined;
@@ -22709,46 +23692,56 @@ var ts;
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate);
}
- return loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
+ return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
}
}
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) {
var containingDirectory = ts.getDirectoryPath(containingFile);
- var supportedExtensions = ts.getSupportedExtensions(compilerOptions);
var traceEnabled = isTraceEnabled(compilerOptions, host);
var failedLookupLocations = [];
- var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: false };
- var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, supportedExtensions, state);
- var isExternalLibraryImport = false;
- if (!resolvedFileName) {
+ var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };
+ var result = tryResolve(0 /* TypeScript */) || tryResolve(1 /* JavaScript */);
+ if (result) {
+ var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport;
+ return createResolvedModuleWithFailedLookupLocations(resolved && resolvedWithRealpath(resolved, host, traceEnabled), isExternalLibraryImport, failedLookupLocations);
+ }
+ return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
+ function tryResolve(extensions) {
+ var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state);
+ if (resolved) {
+ return { resolved: resolved, isExternalLibraryImport: false };
+ }
if (moduleHasNonRelativeName(moduleName)) {
if (traceEnabled) {
trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName);
}
- resolvedFileName = loadModuleFromNodeModules(moduleName, containingDirectory, failedLookupLocations, state, /*checkOneLevel*/ false);
- isExternalLibraryImport = resolvedFileName !== undefined;
+ var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, /*checkOneLevel*/ false);
+ return resolved_1 && { resolved: resolved_1, isExternalLibraryImport: true };
}
else {
var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
- resolvedFileName = nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state);
+ var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state);
+ return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false };
}
}
- if (resolvedFileName && host.realpath) {
- var originalFileName = resolvedFileName;
- resolvedFileName = ts.normalizePath(host.realpath(resolvedFileName));
- if (traceEnabled) {
- trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, originalFileName, resolvedFileName);
- }
- }
- return createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations);
}
ts.nodeModuleNameResolver = nodeModuleNameResolver;
- function nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state) {
+ function resolvedWithRealpath(resolved, host, traceEnabled) {
+ if (!host.realpath) {
+ return resolved;
+ }
+ var real = ts.normalizePath(host.realpath(resolved.path));
+ if (traceEnabled) {
+ trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, resolved.path, real);
+ }
+ return { path: real, extension: resolved.extension };
+ }
+ function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate);
}
- var resolvedFileName = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state);
- return resolvedFileName || loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, onlyRecordFailures, state);
+ var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state);
+ return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state);
}
/* @internal */
function directoryProbablyExists(directoryName, host) {
@@ -22760,9 +23753,9 @@ var ts;
* @param {boolean} onlyRecordFailures - if true then function won't try to actually load files but instead record all attempts as failures. This flag is necessary
* in cases when we know upfront that all load attempts will fail (because containing folder does not exists) however we still need to record all failed lookup locations.
*/
- function loadModuleFromFile(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) {
+ function loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {
// First, try adding an extension. An import of "foo" could be matched by a file "foo.ts", or "foo.js" by "foo.js.ts"
- var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocation, onlyRecordFailures, state);
+ var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state);
if (resolvedByAddingExtension) {
return resolvedByAddingExtension;
}
@@ -22774,11 +23767,11 @@ var ts;
var extension = candidate.substring(extensionless.length);
trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
}
- return tryAddingExtensions(extensionless, extensions, failedLookupLocation, onlyRecordFailures, state);
+ return tryAddingExtensions(extensionless, extensions, failedLookupLocations, onlyRecordFailures, state);
}
}
/** Try to return an existing file that adds one of the `extensions` to `candidate`. */
- function tryAddingExtensions(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) {
+ function tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state) {
if (!onlyRecordFailures) {
// check if containing folder exists - if it doesn't then just record failures for all supported extensions without disk probing
var directory = ts.getDirectoryPath(candidate);
@@ -22786,9 +23779,18 @@ var ts;
onlyRecordFailures = !directoryProbablyExists(directory, state.host);
}
}
- return ts.forEach(extensions, function (ext) {
- return !(state.skipTsx && ts.isJsxOrTsxExtension(ext)) && tryFile(candidate + ext, failedLookupLocation, onlyRecordFailures, state);
- });
+ switch (extensions) {
+ case 2 /* DtsOnly */:
+ return tryExtension(".d.ts", ts.Extension.Dts);
+ case 0 /* TypeScript */:
+ return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts);
+ case 1 /* JavaScript */:
+ return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx);
+ }
+ function tryExtension(ext, extension) {
+ var path = tryFile(candidate + ext, failedLookupLocations, onlyRecordFailures, state);
+ return path && { path: path, extension: extension };
+ }
}
/** Return the file if it exists. */
function tryFile(fileName, failedLookupLocation, onlyRecordFailures, state) {
@@ -22813,19 +23815,23 @@ var ts;
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
}
- var typesFile = tryReadTypesSection(packageJsonPath, candidate, state);
+ var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state);
if (typesFile) {
var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host);
// A package.json "typings" may specify an exact filename, or may choose to omit an extension.
- var result = tryFile(typesFile, failedLookupLocation, onlyRecordFailures_1, state) ||
- tryAddingExtensions(typesFile, extensions, failedLookupLocation, onlyRecordFailures_1, state);
- if (result) {
- return result;
+ var fromFile = tryFile(typesFile, failedLookupLocation, onlyRecordFailures_1, state);
+ if (fromFile) {
+ // Note: this would allow a package.json to specify a ".js" file as typings. Maybe that should be forbidden.
+ return resolvedFromAnyFile(fromFile);
+ }
+ var x = tryAddingExtensions(typesFile, 0 /* TypeScript */, failedLookupLocation, onlyRecordFailures_1, state);
+ if (x) {
+ return x;
}
}
else {
if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.package_json_does_not_have_types_field);
+ trace(state.host, ts.Diagnostics.package_json_does_not_have_a_types_or_main_field);
}
}
}
@@ -22836,91 +23842,78 @@ var ts;
// record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results
failedLookupLocation.push(packageJsonPath);
}
- return loadModuleFromFile(ts.combinePaths(candidate, "index"), extensions, failedLookupLocation, !directoryExists, state);
+ return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocation, !directoryExists, state);
}
function pathToPackageJson(directory) {
return ts.combinePaths(directory, "package.json");
}
- function loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) {
+ function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) {
var nodeModulesFolder = ts.combinePaths(directory, "node_modules");
var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host);
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName));
- var supportedExtensions = ts.getSupportedExtensions(state.compilerOptions);
- var result = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, !nodeModulesFolderExists, state);
- if (result) {
- return result;
- }
- result = loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state);
- if (result) {
- return result;
- }
+ return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) ||
+ loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state);
}
- /* @internal */
- function loadModuleFromNodeModules(moduleName, directory, failedLookupLocations, state, checkOneLevel) {
- return loadModuleFromNodeModulesWorker(moduleName, directory, failedLookupLocations, state, checkOneLevel, /*typesOnly*/ false);
+ function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, checkOneLevel) {
+ return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, checkOneLevel, /*typesOnly*/ false);
}
- ts.loadModuleFromNodeModules = loadModuleFromNodeModules;
function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) {
- return loadModuleFromNodeModulesWorker(moduleName, directory, failedLookupLocations, state, /*checkOneLevel*/ false, /*typesOnly*/ true);
+ return loadModuleFromNodeModulesWorker(0 /* TypeScript */, moduleName, directory, failedLookupLocations, state, /*checkOneLevel*/ false, /*typesOnly*/ true);
}
- function loadModuleFromNodeModulesWorker(moduleName, directory, failedLookupLocations, state, checkOneLevel, typesOnly) {
+ function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, checkOneLevel, typesOnly) {
directory = ts.normalizeSlashes(directory);
while (true) {
- var baseName = ts.getBaseFileName(directory);
- if (baseName !== "node_modules") {
- var packageResult = void 0;
- if (!typesOnly) {
- // Try to load source from the package
- packageResult = loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state);
- if (packageResult && ts.hasTypeScriptFileExtension(packageResult)) {
- // Always prefer a TypeScript (.ts, .tsx, .d.ts) file shipped with the package
- return packageResult;
- }
- }
- // Else prefer a types package over non-TypeScript results (e.g. JavaScript files)
- var typesResult = loadModuleFromNodeModulesFolder(ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state);
- if (typesResult || packageResult) {
- return typesResult || packageResult;
+ if (ts.getBaseFileName(directory) !== "node_modules") {
+ var resolved = tryInDirectory();
+ if (resolved) {
+ return resolved;
}
}
var parentPath = ts.getDirectoryPath(directory);
if (parentPath === directory || checkOneLevel) {
- break;
+ return undefined;
}
directory = parentPath;
}
- return undefined;
+ function tryInDirectory() {
+ var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state);
+ return packageResult || loadModuleFromNodeModulesFolder(extensions, ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state);
+ }
}
function classicNameResolver(moduleName, containingFile, compilerOptions, host) {
var traceEnabled = isTraceEnabled(compilerOptions, host);
- var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: !compilerOptions.jsx };
+ var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };
var failedLookupLocations = [];
- var supportedExtensions = ts.getSupportedExtensions(compilerOptions);
var containingDirectory = ts.getDirectoryPath(containingFile);
- var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, supportedExtensions, state);
- if (resolvedFileName) {
- return createResolvedModule(resolvedFileName, /*isExternalLibraryImport*/ false, failedLookupLocations);
+ var resolved = tryResolve(0 /* TypeScript */) || tryResolve(1 /* JavaScript */);
+ return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ false, failedLookupLocations);
+ function tryResolve(extensions) {
+ var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state);
+ if (resolvedUsingSettings) {
+ return resolvedUsingSettings;
+ }
+ if (moduleHasNonRelativeName(moduleName)) {
+ var resolved_3 = loadModuleFromAncestorDirectories(extensions, moduleName, containingDirectory, failedLookupLocations, state);
+ if (resolved_3) {
+ return resolved_3;
+ }
+ if (extensions === 0 /* TypeScript */) {
+ // If we didn't find the file normally, look it up in @types.
+ return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state);
+ }
+ }
+ else {
+ var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
+ return loadModuleFromFile(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state);
+ }
}
- var referencedSourceFile;
- if (moduleHasNonRelativeName(moduleName)) {
- referencedSourceFile = referencedSourceFile = loadModuleFromAncestorDirectories(moduleName, containingDirectory, supportedExtensions, failedLookupLocations, state) ||
- // If we didn't find the file normally, look it up in @types.
- loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state);
- }
- else {
- var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
- referencedSourceFile = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state);
- }
- return referencedSourceFile
- ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations }
- : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
}
ts.classicNameResolver = classicNameResolver;
/** Climb up parent directories looking for a module. */
- function loadModuleFromAncestorDirectories(moduleName, containingDirectory, supportedExtensions, failedLookupLocations, state) {
+ function loadModuleFromAncestorDirectories(extensions, moduleName, containingDirectory, failedLookupLocations, state) {
while (true) {
var searchName = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
- var referencedSourceFile = loadModuleFromFile(searchName, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state);
+ var referencedSourceFile = loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state);
if (referencedSourceFile) {
return referencedSourceFile;
}
@@ -22931,6 +23924,23 @@ var ts;
containingDirectory = parentPath;
}
}
+ /**
+ * LSHost may load a module from a global cache of typings.
+ * This is the minumum code needed to expose that functionality; the rest is in LSHost.
+ */
+ /* @internal */
+ function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache) {
+ var traceEnabled = isTraceEnabled(compilerOptions, host);
+ if (traceEnabled) {
+ trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache);
+ }
+ var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };
+ var failedLookupLocations = [];
+ var resolved = loadModuleFromNodeModules(0 /* TypeScript */, moduleName, globalCache, failedLookupLocations, state, /*checkOneLevel*/ true) ||
+ loadModuleFromNodeModules(1 /* JavaScript */, moduleName, globalCache, failedLookupLocations, state, /*checkOneLevel*/ true);
+ return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations);
+ }
+ ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
})(ts || (ts = {}));
///
///
@@ -23030,7 +24040,12 @@ var ts;
getAmbientModules: getAmbientModules,
getJsxElementAttributesType: getJsxElementAttributesType,
getJsxIntrinsicTagNames: getJsxIntrinsicTagNames,
- isOptionalParameter: isOptionalParameter
+ isOptionalParameter: isOptionalParameter,
+ tryFindAmbientModuleWithoutAugmentations: function (moduleName) {
+ // we deliberately exclude augmentations
+ // since we are only interested in declarations of the module itself
+ return tryFindAmbientModule(moduleName, /*withAugmentations*/ false);
+ }
};
var tupleTypes = [];
var unionTypes = ts.createMap();
@@ -23044,9 +24059,9 @@ var ts;
var autoType = createIntrinsicType(1 /* Any */, "any");
var unknownType = createIntrinsicType(1 /* Any */, "unknown");
var undefinedType = createIntrinsicType(2048 /* Undefined */, "undefined");
- var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(2048 /* Undefined */ | 524288 /* ContainsWideningType */, "undefined");
+ var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(2048 /* Undefined */ | 2097152 /* ContainsWideningType */, "undefined");
var nullType = createIntrinsicType(4096 /* Null */, "null");
- var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(4096 /* Null */ | 524288 /* ContainsWideningType */, "null");
+ var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(4096 /* Null */ | 2097152 /* ContainsWideningType */, "null");
var stringType = createIntrinsicType(2 /* String */, "string");
var numberType = createIntrinsicType(4 /* Number */, "number");
var trueType = createIntrinsicType(128 /* BooleanLiteral */, "true");
@@ -23056,13 +24071,17 @@ var ts;
var voidType = createIntrinsicType(1024 /* Void */, "void");
var neverType = createIntrinsicType(8192 /* Never */, "never");
var silentNeverType = createIntrinsicType(8192 /* Never */, "never");
+ var stringOrNumberType = getUnionType([stringType, numberType]);
var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
+ var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */ | 67108864 /* Transient */, "__type");
+ emptyTypeLiteralSymbol.members = ts.createMap();
+ var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
emptyGenericType.instantiations = ts.createMap();
var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
// The anyFunctionType contains the anyFunctionType by definition. The flag is further propagated
// in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes.
- anyFunctionType.flags |= 2097152 /* ContainsAnyFunctionType */;
+ anyFunctionType.flags |= 8388608 /* ContainsAnyFunctionType */;
var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
@@ -23221,6 +24240,8 @@ var ts;
"undefined": undefinedType
});
var jsxElementType;
+ var _jsxNamespace;
+ var _jsxFactoryEntity;
/** Things we lazy load from the JSX namespace */
var jsxTypes = ts.createMap();
var JsxNames = {
@@ -23250,6 +24271,21 @@ var ts;
builtinGlobals[undefinedSymbol.name] = undefinedSymbol;
initializeTypeChecker();
return checker;
+ function getJsxNamespace() {
+ if (_jsxNamespace === undefined) {
+ _jsxNamespace = "React";
+ if (compilerOptions.jsxFactory) {
+ _jsxFactoryEntity = ts.parseIsolatedEntityName(compilerOptions.jsxFactory, languageVersion);
+ if (_jsxFactoryEntity) {
+ _jsxNamespace = getFirstIdentifier(_jsxFactoryEntity).text;
+ }
+ }
+ else if (compilerOptions.reactNamespace) {
+ _jsxNamespace = compilerOptions.reactNamespace;
+ }
+ }
+ return _jsxNamespace;
+ }
function getEmitResolver(sourceFile, cancellationToken) {
// Ensure we have all the type information in place for this file so that all the
// emitter questions of this resolver will return the right information.
@@ -23333,7 +24369,7 @@ var ts;
target.flags |= source.flags;
if (source.valueDeclaration &&
(!target.valueDeclaration ||
- (target.valueDeclaration.kind === 226 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 226 /* ModuleDeclaration */))) {
+ (target.valueDeclaration.kind === 229 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 229 /* ModuleDeclaration */))) {
// other kinds of value declarations take precedence over modules
target.valueDeclaration = source.valueDeclaration;
}
@@ -23395,7 +24431,7 @@ var ts;
var moduleNotFoundError = !ts.isInAmbientContext(moduleName.parent.parent)
? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found
: undefined;
- var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError);
+ var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true);
if (!mainModule) {
return;
}
@@ -23440,7 +24476,7 @@ var ts;
return type.flags & 32768 /* Object */ ? type.objectFlags : 0;
}
function isGlobalSourceFile(node) {
- return node.kind === 256 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node);
+ return node.kind === 260 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node);
}
function getSymbol(symbols, name, meaning) {
if (meaning) {
@@ -23497,7 +24533,7 @@ var ts;
if (declaration.pos <= usage.pos) {
// declaration is before usage
// still might be illegal if usage is in the initializer of the variable declaration
- return declaration.kind !== 219 /* VariableDeclaration */ ||
+ return declaration.kind !== 222 /* VariableDeclaration */ ||
!isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
}
// declaration is after usage
@@ -23507,9 +24543,9 @@ var ts;
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {
var container = ts.getEnclosingBlockScopeContainer(declaration);
switch (declaration.parent.parent.kind) {
- case 201 /* VariableStatement */:
- case 207 /* ForStatement */:
- case 209 /* ForOfStatement */:
+ case 204 /* VariableStatement */:
+ case 210 /* ForStatement */:
+ case 212 /* ForOfStatement */:
// variable statement/for/for-of statement case,
// use site should not be inside variable declaration (initializer of declaration or binding element)
if (isSameScopeDescendentOf(usage, declaration, container)) {
@@ -23518,8 +24554,8 @@ var ts;
break;
}
switch (declaration.parent.parent.kind) {
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
// ForIn/ForOf case - use site should not be used in expression part
if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) {
return true;
@@ -23537,7 +24573,7 @@ var ts;
return true;
}
var initializerOfNonStaticProperty = current.parent &&
- current.parent.kind === 146 /* PropertyDeclaration */ &&
+ current.parent.kind === 147 /* PropertyDeclaration */ &&
(ts.getModifierFlags(current.parent) & 32 /* Static */) === 0 &&
current.parent.initializer === current;
if (initializerOfNonStaticProperty) {
@@ -23570,11 +24606,11 @@ var ts;
// - parameters are only in the scope of function body
// This restriction does not apply to JSDoc comment types because they are parented
// at a higher level than type parameters would normally be
- if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 273 /* JSDocComment */) {
+ if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 277 /* JSDocComment */) {
useResult = result.flags & 262144 /* TypeParameter */
? lastLocation === location.type ||
- lastLocation.kind === 143 /* Parameter */ ||
- lastLocation.kind === 142 /* TypeParameter */
+ lastLocation.kind === 144 /* Parameter */ ||
+ lastLocation.kind === 143 /* TypeParameter */
: false;
}
if (meaning & 107455 /* Value */ && result.flags & 1 /* FunctionScopedVariable */) {
@@ -23583,9 +24619,9 @@ var ts;
// however it is detected separately when checking initializers of parameters
// to make sure that they reference no variables declared after them.
useResult =
- lastLocation.kind === 143 /* Parameter */ ||
+ lastLocation.kind === 144 /* Parameter */ ||
(lastLocation === location.type &&
- result.valueDeclaration.kind === 143 /* Parameter */);
+ result.valueDeclaration.kind === 144 /* Parameter */);
}
}
if (useResult) {
@@ -23597,13 +24633,13 @@ var ts;
}
}
switch (location.kind) {
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location))
break;
isInExternalModule = true;
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
var moduleExports = getSymbolOfNode(location).exports;
- if (location.kind === 256 /* SourceFile */ || ts.isAmbientModule(location)) {
+ if (location.kind === 260 /* SourceFile */ || ts.isAmbientModule(location)) {
// It's an external module. First see if the module has an export default and if the local
// name of that export default matches.
if (result = moduleExports["default"]) {
@@ -23626,7 +24662,7 @@ var ts;
// which is not the desired behavior.
if (moduleExports[name] &&
moduleExports[name].flags === 8388608 /* Alias */ &&
- ts.getDeclarationOfKind(moduleExports[name], 239 /* ExportSpecifier */)) {
+ ts.getDeclarationOfKind(moduleExports[name], 242 /* ExportSpecifier */)) {
break;
}
}
@@ -23634,13 +24670,13 @@ var ts;
break loop;
}
break;
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) {
break loop;
}
break;
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
// TypeScript 1.0 spec (April 2014): 8.4.1
// Initializer expressions for instance member variables are evaluated in the scope
// of the class constructor body but are not permitted to reference parameters or
@@ -23657,9 +24693,9 @@ var ts;
}
}
break;
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 223 /* InterfaceDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 226 /* InterfaceDeclaration */:
if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064 /* Type */)) {
if (lastLocation && ts.getModifierFlags(lastLocation) & 32 /* Static */) {
// TypeScript 1.0 spec (April 2014): 3.4.1
@@ -23670,7 +24706,7 @@ var ts;
}
break loop;
}
- if (location.kind === 193 /* ClassExpression */ && meaning & 32 /* Class */) {
+ if (location.kind === 196 /* ClassExpression */ && meaning & 32 /* Class */) {
var className = location.name;
if (className && name === className.text) {
result = location.symbol;
@@ -23686,9 +24722,9 @@ var ts;
// [foo()]() { } // <-- Reference to T from class's own computed property
// }
//
- case 141 /* ComputedPropertyName */:
+ case 142 /* ComputedPropertyName */:
grandparent = location.parent.parent;
- if (ts.isClassLike(grandparent) || grandparent.kind === 223 /* InterfaceDeclaration */) {
+ if (ts.isClassLike(grandparent) || grandparent.kind === 226 /* InterfaceDeclaration */) {
// A reference to this grandparent's type parameters would be an error
if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064 /* Type */)) {
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
@@ -23696,19 +24732,19 @@ var ts;
}
}
break;
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 149 /* Constructor */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 221 /* FunctionDeclaration */:
- case 181 /* ArrowFunction */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 150 /* Constructor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 224 /* FunctionDeclaration */:
+ case 184 /* ArrowFunction */:
if (meaning & 3 /* Variable */ && name === "arguments") {
result = argumentsSymbol;
break loop;
}
break;
- case 180 /* FunctionExpression */:
+ case 183 /* FunctionExpression */:
if (meaning & 3 /* Variable */ && name === "arguments") {
result = argumentsSymbol;
break loop;
@@ -23721,7 +24757,7 @@ var ts;
}
}
break;
- case 144 /* Decorator */:
+ case 145 /* Decorator */:
// Decorators are resolved at the class declaration. Resolving at the parameter
// or member would result in looking up locals in the method.
//
@@ -23730,7 +24766,7 @@ var ts;
// method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter.
// }
//
- if (location.parent && location.parent.kind === 143 /* Parameter */) {
+ if (location.parent && location.parent.kind === 144 /* Parameter */) {
location = location.parent;
}
//
@@ -23793,7 +24829,7 @@ var ts;
// If we're in an external module, we can't reference value symbols created from UMD export declarations
if (result && isInExternalModule && (meaning & 107455 /* Value */) === 107455 /* Value */) {
var decls = result.declarations;
- if (decls && decls.length === 1 && decls[0].kind === 229 /* NamespaceExportDeclaration */) {
+ if (decls && decls.length === 1 && decls[0].kind === 232 /* NamespaceExportDeclaration */) {
error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name);
}
}
@@ -23847,9 +24883,9 @@ var ts;
function getEntityNameForExtendingInterface(node) {
switch (node.kind) {
case 70 /* Identifier */:
- case 173 /* PropertyAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined;
- case 195 /* ExpressionWithTypeArguments */:
+ case 198 /* ExpressionWithTypeArguments */:
ts.Debug.assert(ts.isEntityNameExpression(node.expression));
return node.expression;
default:
@@ -23871,7 +24907,7 @@ var ts;
// Block-scoped variables cannot be used before their definition
var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; });
ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined");
- if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 219 /* VariableDeclaration */), errorLocation)) {
+ if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 222 /* VariableDeclaration */), errorLocation)) {
error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name));
}
}
@@ -23892,10 +24928,10 @@ var ts;
}
function getAnyImportSyntax(node) {
if (ts.isAliasSymbolDeclaration(node)) {
- if (node.kind === 230 /* ImportEqualsDeclaration */) {
+ if (node.kind === 233 /* ImportEqualsDeclaration */) {
return node;
}
- while (node && node.kind !== 231 /* ImportDeclaration */) {
+ while (node && node.kind !== 234 /* ImportDeclaration */) {
node = node.parent;
}
return node;
@@ -23905,7 +24941,7 @@ var ts;
return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; });
}
function getTargetOfImportEqualsDeclaration(node) {
- if (node.moduleReference.kind === 241 /* ExternalModuleReference */) {
+ if (node.moduleReference.kind === 244 /* ExternalModuleReference */) {
return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node)));
}
return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference);
@@ -23984,31 +25020,31 @@ var ts;
var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier);
if (targetSymbol) {
- var name_13 = specifier.propertyName || specifier.name;
- if (name_13.text) {
+ var name_17 = specifier.propertyName || specifier.name;
+ if (name_17.text) {
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
return moduleSymbol;
}
var symbolFromVariable = void 0;
// First check if module was specified with "export=". If so, get the member from the resolved type
if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) {
- symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_13.text);
+ symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_17.text);
}
else {
- symbolFromVariable = getPropertyOfVariable(targetSymbol, name_13.text);
+ symbolFromVariable = getPropertyOfVariable(targetSymbol, name_17.text);
}
// if symbolFromVariable is export - get its final target
symbolFromVariable = resolveSymbol(symbolFromVariable);
- var symbolFromModule = getExportOfModule(targetSymbol, name_13.text);
+ var symbolFromModule = getExportOfModule(targetSymbol, name_17.text);
// If the export member we're looking for is default, and there is no real default but allowSyntheticDefaultImports is on, return the entire module as the default
- if (!symbolFromModule && allowSyntheticDefaultImports && name_13.text === "default") {
+ if (!symbolFromModule && allowSyntheticDefaultImports && name_17.text === "default") {
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol);
}
var symbol = symbolFromModule && symbolFromVariable ?
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
symbolFromModule || symbolFromVariable;
if (!symbol) {
- error(name_13, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_13));
+ error(name_17, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_17));
}
return symbol;
}
@@ -24030,19 +25066,19 @@ var ts;
}
function getTargetOfAliasDeclaration(node) {
switch (node.kind) {
- case 230 /* ImportEqualsDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
return getTargetOfImportEqualsDeclaration(node);
- case 232 /* ImportClause */:
+ case 235 /* ImportClause */:
return getTargetOfImportClause(node);
- case 233 /* NamespaceImport */:
+ case 236 /* NamespaceImport */:
return getTargetOfNamespaceImport(node);
- case 235 /* ImportSpecifier */:
+ case 238 /* ImportSpecifier */:
return getTargetOfImportSpecifier(node);
- case 239 /* ExportSpecifier */:
+ case 242 /* ExportSpecifier */:
return getTargetOfExportSpecifier(node);
- case 236 /* ExportAssignment */:
+ case 239 /* ExportAssignment */:
return getTargetOfExportAssignment(node);
- case 229 /* NamespaceExportDeclaration */:
+ case 232 /* NamespaceExportDeclaration */:
return getTargetOfNamespaceExportDeclaration(node);
}
}
@@ -24089,11 +25125,11 @@ var ts;
links.referenced = true;
var node = getDeclarationOfAliasSymbol(symbol);
ts.Debug.assert(!!node);
- if (node.kind === 236 /* ExportAssignment */) {
+ if (node.kind === 239 /* ExportAssignment */) {
// export default
checkExpressionCached(node.expression);
}
- else if (node.kind === 239 /* ExportSpecifier */) {
+ else if (node.kind === 242 /* ExportSpecifier */) {
// export { } or export { as foo }
checkExpressionCached(node.propertyName || node.name);
}
@@ -24115,13 +25151,13 @@ var ts;
entityName = entityName.parent;
}
// Check for case 1 and 3 in the above example
- if (entityName.kind === 70 /* Identifier */ || entityName.parent.kind === 140 /* QualifiedName */) {
+ if (entityName.kind === 70 /* Identifier */ || entityName.parent.kind === 141 /* QualifiedName */) {
return resolveEntityName(entityName, 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
else {
// Case 2 in above example
// entityName.kind could be a QualifiedName or a Missing identifier
- ts.Debug.assert(entityName.parent.kind === 230 /* ImportEqualsDeclaration */);
+ ts.Debug.assert(entityName.parent.kind === 233 /* ImportEqualsDeclaration */);
return resolveEntityName(entityName, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
}
@@ -24141,9 +25177,9 @@ var ts;
return undefined;
}
}
- else if (name.kind === 140 /* QualifiedName */ || name.kind === 173 /* PropertyAccessExpression */) {
- var left = name.kind === 140 /* QualifiedName */ ? name.left : name.expression;
- var right = name.kind === 140 /* QualifiedName */ ? name.right : name.name;
+ else if (name.kind === 141 /* QualifiedName */ || name.kind === 176 /* PropertyAccessExpression */) {
+ var left = name.kind === 141 /* QualifiedName */ ? name.left : name.expression;
+ var right = name.kind === 141 /* QualifiedName */ ? name.right : name.name;
var namespace = resolveEntityName(left, 1920 /* Namespace */, ignoreErrors, /*dontResolveAlias*/ false, location);
if (!namespace || ts.nodeIsMissing(right)) {
return undefined;
@@ -24168,30 +25204,30 @@ var ts;
function resolveExternalModuleName(location, moduleReferenceExpression) {
return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ts.Diagnostics.Cannot_find_module_0);
}
- function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError) {
+ function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation) {
+ if (isForAugmentation === void 0) { isForAugmentation = false; }
if (moduleReferenceExpression.kind !== 9 /* StringLiteral */) {
return;
}
var moduleReferenceLiteral = moduleReferenceExpression;
- return resolveExternalModule(location, moduleReferenceLiteral.text, moduleNotFoundError, moduleReferenceLiteral);
+ return resolveExternalModule(location, moduleReferenceLiteral.text, moduleNotFoundError, moduleReferenceLiteral, isForAugmentation);
}
- function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode) {
+ function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {
+ if (isForAugmentation === void 0) { isForAugmentation = false; }
// Module names are escaped in our symbol table. However, string literal values aren't.
// Escape the name in the "require(...)" clause to ensure we find the right symbol.
var moduleName = ts.escapeIdentifier(moduleReference);
if (moduleName === undefined) {
return;
}
- var isRelative = ts.isExternalModuleNameRelative(moduleName);
- if (!isRelative) {
- var symbol = getSymbol(globals, '"' + moduleName + '"', 512 /* ValueModule */);
- if (symbol) {
- // merged symbol is module declaration symbol combined with all augmentations
- return getMergedSymbol(symbol);
- }
+ var ambientModule = tryFindAmbientModule(moduleName, /*withAugmentations*/ true);
+ if (ambientModule) {
+ return ambientModule;
}
+ var isRelative = ts.isExternalModuleNameRelative(moduleName);
var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReference);
- var sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName);
+ var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
+ var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
if (sourceFile) {
if (sourceFile.symbol) {
// merged symbol is module declaration symbol combined with all augmentations
@@ -24209,15 +25245,33 @@ var ts;
return getMergedSymbol(pattern.symbol);
}
}
+ // May be an untyped module. If so, ignore resolutionDiagnostic.
+ if (!isRelative && resolvedModule && !ts.extensionIsTypeScript(resolvedModule.extension)) {
+ if (isForAugmentation) {
+ ts.Debug.assert(!!moduleNotFoundError);
+ var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;
+ error(errorNode, diag, moduleName, resolvedModule.resolvedFileName);
+ }
+ else if (compilerOptions.noImplicitAny && moduleNotFoundError) {
+ error(errorNode, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName);
+ }
+ // Failed imports and untyped modules are both treated in an untyped manner; only difference is whether we give a diagnostic first.
+ return undefined;
+ }
if (moduleNotFoundError) {
// report errors only if it was requested
- var tsExtension = ts.tryExtractTypeScriptExtension(moduleName);
- if (tsExtension) {
- var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
- error(errorNode, diag, tsExtension, ts.removeExtension(moduleName, tsExtension));
+ if (resolutionDiagnostic) {
+ error(errorNode, resolutionDiagnostic, moduleName, resolvedModule.resolvedFileName);
}
else {
- error(errorNode, moduleNotFoundError, moduleName);
+ var tsExtension = ts.tryExtractTypeScriptExtension(moduleName);
+ if (tsExtension) {
+ var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
+ error(errorNode, diag, tsExtension, ts.removeExtension(moduleName, tsExtension));
+ }
+ else {
+ error(errorNode, moduleNotFoundError, moduleName);
+ }
}
}
return undefined;
@@ -24350,7 +25404,7 @@ var ts;
var members = node.members;
for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
var member = members_1[_i];
- if (member.kind === 149 /* Constructor */ && ts.nodeIsPresent(member.body)) {
+ if (member.kind === 150 /* Constructor */ && ts.nodeIsPresent(member.body)) {
return member;
}
}
@@ -24426,11 +25480,11 @@ var ts;
}
}
switch (location_1.kind) {
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location_1)) {
break;
}
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
if (result = callback(getSymbolOfNode(location_1).exports)) {
return result;
}
@@ -24471,7 +25525,7 @@ var ts;
return ts.forEachProperty(symbols, function (symbolFromSymbolTable) {
if (symbolFromSymbolTable.flags & 8388608 /* Alias */
&& symbolFromSymbolTable.name !== "export="
- && !ts.getDeclarationOfKind(symbolFromSymbolTable, 239 /* ExportSpecifier */)) {
+ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 242 /* ExportSpecifier */)) {
if (!useOnlyExternalAliasing ||
// Is this external alias, then use it to name
ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) {
@@ -24510,7 +25564,7 @@ var ts;
return true;
}
// Qualify if the symbol from symbol table has same meaning as expected
- symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 239 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
+ symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 242 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
if (symbolFromSymbolTable.flags & meaning) {
qualify = true;
return true;
@@ -24525,10 +25579,10 @@ var ts;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
switch (declaration.kind) {
- case 146 /* PropertyDeclaration */:
- case 148 /* MethodDeclaration */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 147 /* PropertyDeclaration */:
+ case 149 /* MethodDeclaration */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
continue;
default:
return false;
@@ -24609,7 +25663,7 @@ var ts;
}
}
function hasExternalModuleSymbol(declaration) {
- return ts.isAmbientModule(declaration) || (declaration.kind === 256 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
+ return ts.isAmbientModule(declaration) || (declaration.kind === 260 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
}
function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
var aliasesToMakeVisible;
@@ -24650,12 +25704,12 @@ var ts;
function isEntityNameVisible(entityName, enclosingDeclaration) {
// get symbol of the first identifier of the entityName
var meaning;
- if (entityName.parent.kind === 159 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
+ if (entityName.parent.kind === 160 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
// Typeof value
meaning = 107455 /* Value */ | 1048576 /* ExportValue */;
}
- else if (entityName.kind === 140 /* QualifiedName */ || entityName.kind === 173 /* PropertyAccessExpression */ ||
- entityName.parent.kind === 230 /* ImportEqualsDeclaration */) {
+ else if (entityName.kind === 141 /* QualifiedName */ || entityName.kind === 176 /* PropertyAccessExpression */ ||
+ entityName.parent.kind === 233 /* ImportEqualsDeclaration */) {
// Left identifier from type reference or TypeAlias
// Entity name of the import declaration
meaning = 1920 /* Namespace */;
@@ -24751,10 +25805,10 @@ var ts;
function getTypeAliasForTypeLiteral(type) {
if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) {
var node = type.symbol.declarations[0].parent;
- while (node.kind === 165 /* ParenthesizedType */) {
+ while (node.kind === 166 /* ParenthesizedType */) {
node = node.parent;
}
- if (node.kind === 224 /* TypeAliasDeclaration */) {
+ if (node.kind === 227 /* TypeAliasDeclaration */) {
return getSymbolOfNode(node);
}
}
@@ -24762,7 +25816,7 @@ var ts;
}
function isTopLevelInExternalModuleAugmentation(node) {
return node && node.parent &&
- node.parent.kind === 227 /* ModuleBlock */ &&
+ node.parent.kind === 230 /* ModuleBlock */ &&
ts.isExternalModuleAugmentation(node.parent.parent);
}
function literalTypeToString(type) {
@@ -24776,10 +25830,10 @@ var ts;
return ts.declarationNameToString(declaration.name);
}
switch (declaration.kind) {
- case 193 /* ClassExpression */:
+ case 196 /* ClassExpression */:
return "(Anonymous class)";
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
return "(Anonymous function)";
}
}
@@ -24854,9 +25908,9 @@ var ts;
if (!accessibleSymbolChain ||
needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) {
// Go up and add our parent.
- var parent_8 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);
- if (parent_8) {
- walkSymbol(parent_8, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false);
+ var parent_7 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);
+ if (parent_7) {
+ walkSymbol(parent_7, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false);
}
}
if (accessibleSymbolChain) {
@@ -24918,31 +25972,8 @@ var ts;
// The specified symbol flags need to be reinterpreted as type flags
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793064 /* Type */, 0 /* None */, nextFlags);
}
- else if (!(flags & 512 /* InTypeAlias */) &&
- (getObjectFlags(type) & 16 /* Anonymous */ && !type.target || type.flags & 196608 /* UnionOrIntersection */) &&
- type.aliasSymbol &&
+ else if (!(flags & 512 /* InTypeAlias */) && (getObjectFlags(type) & 16 /* Anonymous */ || type.flags & 196608 /* UnionOrIntersection */) && type.aliasSymbol &&
isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, 793064 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false).accessibility === 0 /* Accessible */) {
- // We emit inferred type as type-alias if type is not in type-alias declaration, existed accessible alias-symbol, type is anonymous or union or intersection.
- // However, if the type is an anonymous type with type arguments, we need to perform additional check.
- // 1) No type arguments, just emit type-alias as is
- // 2) Existed type arguments, check if the type arguments full fill all type parameters of the alias-symbol by
- // checking whether the target's aliasTypeArguments has the same size as type's aliasTypeArguments:
- // i.e
- // type Foo = {
- // foo(): Foo
- // };
- // function foo() {
- // return {} as Foo;
- // }
- // Should be emitted as
- // declare type Foo = {
- // foo(): Foo;
- // };
- // declare function foo(): Foo;
- // Otherwise type-alias is point to another generic type-alias then don't write it using alias symbol
- // export type Bar = () => [X, Y];
- // export type Foo = Bar;
- // export const y = (x: Foo) => 1 // this should be emit as "export declare const y: (x: () => [any, string]) => number;"
var typeArguments = type.aliasTypeArguments;
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
}
@@ -24955,6 +25986,17 @@ var ts;
else if (type.flags & 96 /* StringOrNumberLiteral */) {
writer.writeStringLiteral(literalTypeToString(type));
}
+ else if (type.flags & 262144 /* Index */) {
+ writer.writeKeyword("keyof");
+ writeSpace(writer);
+ writeType(type.type, 64 /* InElementType */);
+ }
+ else if (type.flags & 524288 /* IndexedAccess */) {
+ writeType(type.objectType, 64 /* InElementType */);
+ writePunctuation(writer, 20 /* OpenBracketToken */);
+ writeType(type.indexType, 0 /* None */);
+ writePunctuation(writer, 21 /* CloseBracketToken */);
+ }
else {
// Should never get here
// { ... }
@@ -25018,14 +26060,14 @@ var ts;
while (i < length_1) {
// Find group of type arguments for type parameters with the same declaring container.
var start = i;
- var parent_9 = getParentSymbolOfTypeParameter(outerTypeParameters[i]);
+ var parent_8 = getParentSymbolOfTypeParameter(outerTypeParameters[i]);
do {
i++;
- } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_9);
+ } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_8);
// When type parameters are their own type arguments for the whole group (i.e. we have
// the default outer type arguments), we don't show the group.
if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) {
- writeSymbolTypeReference(parent_9, typeArguments, start, i, flags);
+ writeSymbolTypeReference(parent_8, typeArguments, start, i, flags);
writePunctuation(writer, 22 /* DotToken */);
}
}
@@ -25061,9 +26103,7 @@ var ts;
else if (ts.contains(symbolStack, symbol)) {
// If type is an anonymous type literal in a type alias declaration, use type alias name
var typeAlias = getTypeAliasForTypeLiteral(type);
- // We only want to use type-alias here if the typeAlias is not a generic one. (i.e it doesn't have a target type)
- // If it is a generic type-alias just write out "any"
- if (typeAlias && !type.target) {
+ if (typeAlias) {
// The specified symbol flags need to be reinterpreted as type flags
buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 793064 /* Type */, 0 /* None */, flags);
}
@@ -25093,7 +26133,7 @@ var ts;
var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) &&
(symbol.parent ||
ts.forEach(symbol.declarations, function (declaration) {
- return declaration.parent.kind === 256 /* SourceFile */ || declaration.parent.kind === 227 /* ModuleBlock */;
+ return declaration.parent.kind === 260 /* SourceFile */ || declaration.parent.kind === 230 /* ModuleBlock */;
}));
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
// typeof is allowed only for static/non local functions
@@ -25110,7 +26150,7 @@ var ts;
function writeIndexSignature(info, keyword) {
if (info) {
if (info.isReadonly) {
- writeKeyword(writer, 129 /* ReadonlyKeyword */);
+ writeKeyword(writer, 130 /* ReadonlyKeyword */);
writeSpace(writer);
}
writePunctuation(writer, 20 /* OpenBracketToken */);
@@ -25128,7 +26168,7 @@ var ts;
}
function writePropertyWithModifiers(prop) {
if (isReadonlySymbol(prop)) {
- writeKeyword(writer, 129 /* ReadonlyKeyword */);
+ writeKeyword(writer, 130 /* ReadonlyKeyword */);
writeSpace(writer);
}
buildSymbolDisplay(prop, writer);
@@ -25185,6 +26225,12 @@ var ts;
writePunctuation(writer, 16 /* OpenBraceToken */);
writer.writeLine();
writer.increaseIndent();
+ writeObjectLiteralType(resolved);
+ writer.decreaseIndent();
+ writePunctuation(writer, 17 /* CloseBraceToken */);
+ inObjectTypeLiteral = saveInObjectTypeLiteral;
+ }
+ function writeObjectLiteralType(resolved) {
for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) {
var signature = _a[_i];
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack);
@@ -25197,8 +26243,8 @@ var ts;
writePunctuation(writer, 24 /* SemicolonToken */);
writer.writeLine();
}
- writeIndexSignature(resolved.stringIndexInfo, 133 /* StringKeyword */);
- writeIndexSignature(resolved.numberIndexInfo, 131 /* NumberKeyword */);
+ writeIndexSignature(resolved.stringIndexInfo, 134 /* StringKeyword */);
+ writeIndexSignature(resolved.numberIndexInfo, 132 /* NumberKeyword */);
for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) {
var p = _e[_d];
var t = getTypeOfSymbol(p);
@@ -25221,9 +26267,6 @@ var ts;
writer.writeLine();
}
}
- writer.decreaseIndent();
- writePunctuation(writer, 17 /* CloseBraceToken */);
- inObjectTypeLiteral = saveInObjectTypeLiteral;
}
}
function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration, flags) {
@@ -25262,12 +26305,12 @@ var ts;
}
function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) {
// We have to explicitly emit square bracket and bracket because these tokens are not stored inside the node.
- if (bindingPattern.kind === 168 /* ObjectBindingPattern */) {
+ if (bindingPattern.kind === 171 /* ObjectBindingPattern */) {
writePunctuation(writer, 16 /* OpenBraceToken */);
buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); });
writePunctuation(writer, 17 /* CloseBraceToken */);
}
- else if (bindingPattern.kind === 169 /* ArrayBindingPattern */) {
+ else if (bindingPattern.kind === 172 /* ArrayBindingPattern */) {
writePunctuation(writer, 20 /* OpenBracketToken */);
var elements = bindingPattern.elements;
buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); });
@@ -25281,7 +26324,7 @@ var ts;
if (ts.isOmittedExpression(bindingElement)) {
return;
}
- ts.Debug.assert(bindingElement.kind === 170 /* BindingElement */);
+ ts.Debug.assert(bindingElement.kind === 173 /* BindingElement */);
if (bindingElement.propertyName) {
writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol);
writePunctuation(writer, 55 /* ColonToken */);
@@ -25411,75 +26454,75 @@ var ts;
return false;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
- case 170 /* BindingElement */:
+ case 173 /* BindingElement */:
return isDeclarationVisible(node.parent.parent);
- case 219 /* VariableDeclaration */:
+ case 222 /* VariableDeclaration */:
if (ts.isBindingPattern(node.name) &&
!node.name.elements.length) {
// If the binding pattern is empty, this variable declaration is not visible
return false;
}
// Otherwise fall through
- case 226 /* ModuleDeclaration */:
- case 222 /* ClassDeclaration */:
- case 223 /* InterfaceDeclaration */:
- case 224 /* TypeAliasDeclaration */:
- case 221 /* FunctionDeclaration */:
- case 225 /* EnumDeclaration */:
- case 230 /* ImportEqualsDeclaration */:
+ case 229 /* ModuleDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
+ case 224 /* FunctionDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
// external module augmentation is always visible
if (ts.isExternalModuleAugmentation(node)) {
return true;
}
- var parent_10 = getDeclarationContainer(node);
+ var parent_9 = getDeclarationContainer(node);
// If the node is not exported or it is not ambient module element (except import declaration)
if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) &&
- !(node.kind !== 230 /* ImportEqualsDeclaration */ && parent_10.kind !== 256 /* SourceFile */ && ts.isInAmbientContext(parent_10))) {
- return isGlobalSourceFile(parent_10);
+ !(node.kind !== 233 /* ImportEqualsDeclaration */ && parent_9.kind !== 260 /* SourceFile */ && ts.isInAmbientContext(parent_9))) {
+ return isGlobalSourceFile(parent_9);
}
// Exported members/ambient module elements (exception import declaration) are visible if parent is visible
- return isDeclarationVisible(parent_10);
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ return isDeclarationVisible(parent_9);
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
if (ts.getModifierFlags(node) & (8 /* Private */ | 16 /* Protected */)) {
// Private/protected properties/methods are not visible
return false;
}
// Public properties/methods are visible if its parents are visible, so const it fall into next case statement
- case 149 /* Constructor */:
- case 153 /* ConstructSignature */:
- case 152 /* CallSignature */:
- case 154 /* IndexSignature */:
- case 143 /* Parameter */:
- case 227 /* ModuleBlock */:
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
- case 160 /* TypeLiteral */:
- case 156 /* TypeReference */:
- case 161 /* ArrayType */:
- case 162 /* TupleType */:
- case 163 /* UnionType */:
- case 164 /* IntersectionType */:
- case 165 /* ParenthesizedType */:
+ case 150 /* Constructor */:
+ case 154 /* ConstructSignature */:
+ case 153 /* CallSignature */:
+ case 155 /* IndexSignature */:
+ case 144 /* Parameter */:
+ case 230 /* ModuleBlock */:
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
+ case 161 /* TypeLiteral */:
+ case 157 /* TypeReference */:
+ case 162 /* ArrayType */:
+ case 163 /* TupleType */:
+ case 164 /* UnionType */:
+ case 165 /* IntersectionType */:
+ case 166 /* ParenthesizedType */:
return isDeclarationVisible(node.parent);
// Default binding, import specifier and namespace import is visible
// only on demand so by default it is not visible
- case 232 /* ImportClause */:
- case 233 /* NamespaceImport */:
- case 235 /* ImportSpecifier */:
+ case 235 /* ImportClause */:
+ case 236 /* NamespaceImport */:
+ case 238 /* ImportSpecifier */:
return false;
// Type parameters are always visible
- case 142 /* TypeParameter */:
+ case 143 /* TypeParameter */:
// Source file and namespace export are always visible
- case 256 /* SourceFile */:
- case 229 /* NamespaceExportDeclaration */:
+ case 260 /* SourceFile */:
+ case 232 /* NamespaceExportDeclaration */:
return true;
// Export assignments do not create name bindings outside the module
- case 236 /* ExportAssignment */:
+ case 239 /* ExportAssignment */:
return false;
default:
return false;
@@ -25488,10 +26531,10 @@ var ts;
}
function collectLinkedAliases(node) {
var exportSymbol;
- if (node.parent && node.parent.kind === 236 /* ExportAssignment */) {
+ if (node.parent && node.parent.kind === 239 /* ExportAssignment */) {
exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node);
}
- else if (node.parent.kind === 239 /* ExportSpecifier */) {
+ else if (node.parent.kind === 242 /* ExportSpecifier */) {
var exportSpecifier = node.parent;
exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ?
getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) :
@@ -25584,12 +26627,12 @@ var ts;
node = ts.getRootDeclaration(node);
while (node) {
switch (node.kind) {
- case 219 /* VariableDeclaration */:
- case 220 /* VariableDeclarationList */:
- case 235 /* ImportSpecifier */:
- case 234 /* NamedImports */:
- case 233 /* NamespaceImport */:
- case 232 /* ImportClause */:
+ case 222 /* VariableDeclaration */:
+ case 223 /* VariableDeclarationList */:
+ case 238 /* ImportSpecifier */:
+ case 237 /* NamedImports */:
+ case 236 /* NamespaceImport */:
+ case 235 /* ImportClause */:
node = node.parent;
break;
default:
@@ -25622,22 +26665,30 @@ var ts;
var symbol = getSymbolOfNode(node);
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false);
}
- function getTextOfPropertyName(name) {
- switch (name.kind) {
- case 70 /* Identifier */:
- return name.text;
- case 9 /* StringLiteral */:
- case 8 /* NumericLiteral */:
- return name.text;
- case 141 /* ComputedPropertyName */:
- if (ts.isStringOrNumericLiteral(name.expression.kind)) {
- return name.expression.text;
- }
- }
- return undefined;
- }
function isComputedNonLiteralName(name) {
- return name.kind === 141 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind);
+ return name.kind === 142 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind);
+ }
+ function getRestType(source, properties, symbol) {
+ ts.Debug.assert(!!(source.flags & 32768 /* Object */), "Rest types only support object types right now.");
+ var members = ts.createMap();
+ var names = ts.createMap();
+ for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) {
+ var name_18 = properties_2[_i];
+ names[ts.getTextOfPropertyName(name_18)] = true;
+ }
+ for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
+ var prop = _b[_a];
+ var inNamesToRemove = prop.name in names;
+ var isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */);
+ var isMethod = prop.flags & 8192 /* Method */;
+ var isSetOnlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
+ if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) {
+ members[prop.name] = prop;
+ }
+ }
+ var stringIndexInfo = getIndexInfoOfType(source, 0 /* String */);
+ var numberIndexInfo = getIndexInfoOfType(source, 1 /* Number */);
+ return createAnonymousType(symbol, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
}
/** Return the inferred type for a binding element */
function getTypeForBindingElement(declaration) {
@@ -25657,25 +26708,41 @@ var ts;
return parentType;
}
var type;
- if (pattern.kind === 168 /* ObjectBindingPattern */) {
- // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form)
- var name_14 = declaration.propertyName || declaration.name;
- if (isComputedNonLiteralName(name_14)) {
- // computed properties with non-literal names are treated as 'any'
- return anyType;
+ if (pattern.kind === 171 /* ObjectBindingPattern */) {
+ if (declaration.dotDotDotToken) {
+ if (!(parentType.flags & 32768 /* Object */)) {
+ error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types);
+ return unknownType;
+ }
+ var literalMembers = [];
+ for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
+ var element = _a[_i];
+ if (element.kind !== 197 /* OmittedExpression */ && !element.dotDotDotToken) {
+ literalMembers.push(element.propertyName || element.name);
+ }
+ }
+ type = getRestType(parentType, literalMembers, declaration.symbol);
}
- if (declaration.initializer) {
- getContextualType(declaration.initializer);
- }
- // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature,
- // or otherwise the type of the string index signature.
- var text = getTextOfPropertyName(name_14);
- type = getTypeOfPropertyOfType(parentType, text) ||
- isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1 /* Number */) ||
- getIndexTypeOfType(parentType, 0 /* String */);
- if (!type) {
- error(name_14, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_14));
- return unknownType;
+ else {
+ // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form)
+ var name_19 = declaration.propertyName || declaration.name;
+ if (isComputedNonLiteralName(name_19)) {
+ // computed properties with non-literal names are treated as 'any'
+ return anyType;
+ }
+ if (declaration.initializer) {
+ getContextualType(declaration.initializer);
+ }
+ // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature,
+ // or otherwise the type of the string index signature.
+ var text = ts.getTextOfPropertyName(name_19);
+ type = getTypeOfPropertyOfType(parentType, text) ||
+ isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1 /* Number */) ||
+ getIndexTypeOfType(parentType, 0 /* String */);
+ if (!type) {
+ error(name_19, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_19));
+ return unknownType;
+ }
}
}
else {
@@ -25683,7 +26750,11 @@ var ts;
// present (aka the tuple element property). This call also checks that the parentType is in
// fact an iterable or array (depending on target language).
var elementType = checkIteratedTypeOrElementType(parentType, pattern, /*allowStringInput*/ false);
- if (!declaration.dotDotDotToken) {
+ if (declaration.dotDotDotToken) {
+ // Rest element has an array type with the same element type as the parent type
+ type = createArrayType(elementType);
+ }
+ else {
// Use specific property type when parent is a tuple or numeric index type when parent is an array
var propName = "" + ts.indexOf(pattern.elements, declaration);
type = isTupleLikeType(parentType)
@@ -25699,10 +26770,6 @@ var ts;
return unknownType;
}
}
- else {
- // Rest element has an array type with the same element type as the parent type
- type = createArrayType(elementType);
- }
}
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
// undefined from the final type.
@@ -25725,16 +26792,16 @@ var ts;
if (typeTag && typeTag.typeExpression) {
return typeTag.typeExpression.type;
}
- if (declaration.kind === 219 /* VariableDeclaration */ &&
- declaration.parent.kind === 220 /* VariableDeclarationList */ &&
- declaration.parent.parent.kind === 201 /* VariableStatement */) {
+ if (declaration.kind === 222 /* VariableDeclaration */ &&
+ declaration.parent.kind === 223 /* VariableDeclarationList */ &&
+ declaration.parent.parent.kind === 204 /* VariableStatement */) {
// @type annotation might have been on the variable statement, try that instead.
var annotation = ts.getJSDocTypeTag(declaration.parent.parent);
if (annotation && annotation.typeExpression) {
return annotation.typeExpression.type;
}
}
- else if (declaration.kind === 143 /* Parameter */) {
+ else if (declaration.kind === 144 /* Parameter */) {
// If it's a parameter, see if the parent has a jsdoc comment with an @param
// annotation.
var paramTag = ts.getCorrespondingJSDocParameterTag(declaration);
@@ -25750,14 +26817,14 @@ var ts;
}
function isEmptyArrayLiteral(node) {
var expr = ts.skipParentheses(node);
- return expr.kind === 171 /* ArrayLiteralExpression */ && expr.elements.length === 0;
+ return expr.kind === 174 /* ArrayLiteralExpression */ && expr.elements.length === 0;
}
function addOptionality(type, optional) {
return strictNullChecks && optional ? includeFalsyTypes(type, 2048 /* Undefined */) : type;
}
// Return the inferred type for a variable, parameter, or property declaration
function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {
- if (declaration.flags & 1048576 /* JavaScriptFile */) {
+ if (declaration.flags & 2097152 /* JavaScriptFile */) {
// If this is a variable in a JavaScript file, then use the JSDoc type (if it has
// one as its type), otherwise fallback to the below standard TS codepaths to
// try to figure it out.
@@ -25767,10 +26834,10 @@ var ts;
}
}
// A variable declared in a for..in statement is always of type string
- if (declaration.parent.parent.kind === 208 /* ForInStatement */) {
+ if (declaration.parent.parent.kind === 211 /* ForInStatement */) {
return stringType;
}
- if (declaration.parent.parent.kind === 209 /* ForOfStatement */) {
+ if (declaration.parent.parent.kind === 212 /* ForOfStatement */) {
// checkRightHandSideOfForOf will return undefined if the for-of expression type was
// missing properties/signatures required to get its iteratedType (like
// [Symbol.iterator] or next). This may be because we accessed properties from anyType,
@@ -25784,7 +26851,7 @@ var ts;
if (declaration.type) {
return addOptionality(getTypeFromTypeNode(declaration.type), /*optional*/ declaration.questionToken && includeOptionality);
}
- if (declaration.kind === 219 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&
+ if (declaration.kind === 222 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&
!(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !ts.isInAmbientContext(declaration)) {
// Use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no
// initializer or a 'null' or 'undefined' initializer.
@@ -25797,11 +26864,11 @@ var ts;
return autoArrayType;
}
}
- if (declaration.kind === 143 /* Parameter */) {
+ if (declaration.kind === 144 /* Parameter */) {
var func = declaration.parent;
// For a parameter of a set accessor, use the type of the get accessor if one is present
- if (func.kind === 151 /* SetAccessor */ && !ts.hasDynamicName(func)) {
- var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 150 /* GetAccessor */);
+ if (func.kind === 152 /* SetAccessor */ && !ts.hasDynamicName(func)) {
+ var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 151 /* GetAccessor */);
if (getter) {
var getterSignature = getSignatureFromDeclaration(getter);
var thisParameter = getAccessorThisParameter(func);
@@ -25831,7 +26898,7 @@ var ts;
return addOptionality(type, /*optional*/ declaration.questionToken && includeOptionality);
}
// If it is a short-hand property assignment, use the type of the identifier
- if (declaration.kind === 254 /* ShorthandPropertyAssignment */) {
+ if (declaration.kind === 257 /* ShorthandPropertyAssignment */) {
return checkIdentifier(declaration.name);
}
// If the declaration specifies a binding pattern, use the type implied by the binding pattern
@@ -25862,12 +26929,12 @@ var ts;
var hasComputedProperties = false;
ts.forEach(pattern.elements, function (e) {
var name = e.propertyName || e.name;
- if (isComputedNonLiteralName(name)) {
- // do not include computed properties in the implied type
+ if (isComputedNonLiteralName(name) || e.dotDotDotToken) {
+ // do not include computed properties or rests in the implied type
hasComputedProperties = true;
return;
}
- var text = getTextOfPropertyName(name);
+ var text = ts.getTextOfPropertyName(name);
var flags = 4 /* Property */ | 67108864 /* Transient */ | (e.initializer ? 536870912 /* Optional */ : 0);
var symbol = createSymbol(flags, text);
symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors);
@@ -25907,7 +26974,7 @@ var ts;
// parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of
// the parameter.
function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) {
- return pattern.kind === 168 /* ObjectBindingPattern */
+ return pattern.kind === 171 /* ObjectBindingPattern */
? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors)
: getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors);
}
@@ -25929,7 +26996,7 @@ var ts;
// During a normal type check we'll never get to here with a property assignment (the check of the containing
// object literal uses a different path). We exclude widening only so that language services and type verification
// tools see the actual type.
- if (declaration.kind === 253 /* PropertyAssignment */) {
+ if (declaration.kind === 256 /* PropertyAssignment */) {
return type;
}
return getWidenedType(type);
@@ -25946,7 +27013,7 @@ var ts;
}
function declarationBelongsToPrivateAmbientMember(declaration) {
var root = ts.getRootDeclaration(declaration);
- var memberDeclaration = root.kind === 143 /* Parameter */ ? root.parent : root;
+ var memberDeclaration = root.kind === 144 /* Parameter */ ? root.parent : root;
return isPrivateWithinAmbient(memberDeclaration);
}
function getTypeOfVariableOrParameterOrProperty(symbol) {
@@ -25962,10 +27029,10 @@ var ts;
return links.type = anyType;
}
// Handle export default expressions
- if (declaration.kind === 236 /* ExportAssignment */) {
+ if (declaration.kind === 239 /* ExportAssignment */) {
return links.type = checkExpression(declaration.expression);
}
- if (declaration.flags & 1048576 /* JavaScriptFile */ && declaration.kind === 280 /* JSDocPropertyTag */ && declaration.typeExpression) {
+ if (declaration.flags & 2097152 /* JavaScriptFile */ && declaration.kind === 284 /* JSDocPropertyTag */ && declaration.typeExpression) {
return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
}
// Handle variable, parameter or property
@@ -25978,16 +27045,16 @@ var ts;
// * exports.p = expr
// * this.p = expr
// * className.prototype.method = expr
- if (declaration.kind === 188 /* BinaryExpression */ ||
- declaration.kind === 173 /* PropertyAccessExpression */ && declaration.parent.kind === 188 /* BinaryExpression */) {
+ if (declaration.kind === 191 /* BinaryExpression */ ||
+ declaration.kind === 176 /* PropertyAccessExpression */ && declaration.parent.kind === 191 /* BinaryExpression */) {
// Use JS Doc type if present on parent expression statement
- if (declaration.flags & 1048576 /* JavaScriptFile */) {
+ if (declaration.flags & 2097152 /* JavaScriptFile */) {
var typeTag = ts.getJSDocTypeTag(declaration.parent);
if (typeTag && typeTag.typeExpression) {
return links.type = getTypeFromTypeNode(typeTag.typeExpression.type);
}
}
- var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 188 /* BinaryExpression */ ?
+ var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 191 /* BinaryExpression */ ?
checkExpressionCached(decl.right) :
checkExpressionCached(decl.parent.right); });
type = getUnionType(declaredTypes, /*subtypeReduction*/ true);
@@ -26015,7 +27082,7 @@ var ts;
}
function getAnnotatedAccessorType(accessor) {
if (accessor) {
- if (accessor.kind === 150 /* GetAccessor */) {
+ if (accessor.kind === 151 /* GetAccessor */) {
return accessor.type && getTypeFromTypeNode(accessor.type);
}
else {
@@ -26035,9 +27102,9 @@ var ts;
function getTypeOfAccessors(symbol) {
var links = getSymbolLinks(symbol);
if (!links.type) {
- var getter = ts.getDeclarationOfKind(symbol, 150 /* GetAccessor */);
- var setter = ts.getDeclarationOfKind(symbol, 151 /* SetAccessor */);
- if (getter && getter.flags & 1048576 /* JavaScriptFile */) {
+ var getter = ts.getDeclarationOfKind(symbol, 151 /* GetAccessor */);
+ var setter = ts.getDeclarationOfKind(symbol, 152 /* SetAccessor */);
+ if (getter && getter.flags & 2097152 /* JavaScriptFile */) {
var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter);
if (jsDocType) {
return links.type = jsDocType;
@@ -26080,7 +27147,7 @@ var ts;
if (!popTypeResolution()) {
type = anyType;
if (compilerOptions.noImplicitAny) {
- var getter_1 = ts.getDeclarationOfKind(symbol, 150 /* GetAccessor */);
+ var getter_1 = ts.getDeclarationOfKind(symbol, 151 /* GetAccessor */);
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
}
}
@@ -26091,7 +27158,7 @@ var ts;
function getTypeOfFuncClassEnumModule(symbol) {
var links = getSymbolLinks(symbol);
if (!links.type) {
- if (symbol.valueDeclaration.kind === 226 /* ModuleDeclaration */ && ts.isShorthandAmbientModuleSymbol(symbol)) {
+ if (symbol.flags & 1536 /* Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) {
links.type = anyType;
}
else {
@@ -26187,9 +27254,9 @@ var ts;
if (!node) {
return typeParameters;
}
- if (node.kind === 222 /* ClassDeclaration */ || node.kind === 193 /* ClassExpression */ ||
- node.kind === 221 /* FunctionDeclaration */ || node.kind === 180 /* FunctionExpression */ ||
- node.kind === 148 /* MethodDeclaration */ || node.kind === 181 /* ArrowFunction */) {
+ if (node.kind === 225 /* ClassDeclaration */ || node.kind === 196 /* ClassExpression */ ||
+ node.kind === 224 /* FunctionDeclaration */ || node.kind === 183 /* FunctionExpression */ ||
+ node.kind === 149 /* MethodDeclaration */ || node.kind === 184 /* ArrowFunction */) {
var declarations = node.typeParameters;
if (declarations) {
return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations);
@@ -26199,7 +27266,7 @@ var ts;
}
// The outer type parameters are those defined by enclosing generic classes, methods, or functions.
function getOuterTypeParametersOfClassOrInterface(symbol) {
- var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 223 /* InterfaceDeclaration */);
+ var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 226 /* InterfaceDeclaration */);
return appendOuterTypeParameters(undefined, declaration);
}
// The local type parameters are the combined set of type parameters from all declarations of the class,
@@ -26208,8 +27275,8 @@ var ts;
var result;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var node = _a[_i];
- if (node.kind === 223 /* InterfaceDeclaration */ || node.kind === 222 /* ClassDeclaration */ ||
- node.kind === 193 /* ClassExpression */ || node.kind === 224 /* TypeAliasDeclaration */) {
+ if (node.kind === 226 /* InterfaceDeclaration */ || node.kind === 225 /* ClassDeclaration */ ||
+ node.kind === 196 /* ClassExpression */ || node.kind === 227 /* TypeAliasDeclaration */) {
var declaration = node;
if (declaration.typeParameters) {
result = appendTypeParameters(result, declaration.typeParameters);
@@ -26352,7 +27419,7 @@ var ts;
type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray;
for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 223 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) {
+ if (declaration.kind === 226 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) {
for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) {
var node = _c[_b];
var baseType = getTypeFromTypeNode(node);
@@ -26384,7 +27451,7 @@ var ts;
function isIndependentInterface(symbol) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 223 /* InterfaceDeclaration */) {
+ if (declaration.kind === 226 /* InterfaceDeclaration */) {
if (declaration.flags & 64 /* ContainsThis */) {
return false;
}
@@ -26442,7 +27509,7 @@ var ts;
return unknownType;
}
var typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
- var declaration = ts.getDeclarationOfKind(symbol, 279 /* JSDocTypedefTag */);
+ var declaration = ts.getDeclarationOfKind(symbol, 283 /* JSDocTypedefTag */);
var type = void 0;
if (declaration) {
if (declaration.jsDocTypeLiteral) {
@@ -26453,7 +27520,7 @@ var ts;
}
}
else {
- declaration = ts.getDeclarationOfKind(symbol, 224 /* TypeAliasDeclaration */);
+ declaration = ts.getDeclarationOfKind(symbol, 227 /* TypeAliasDeclaration */);
type = getTypeFromTypeNode(declaration.type, symbol, typeParameters);
}
if (popTypeResolution()) {
@@ -26479,14 +27546,14 @@ var ts;
return !ts.isInAmbientContext(member);
}
return expr.kind === 8 /* NumericLiteral */ ||
- expr.kind === 186 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ &&
+ expr.kind === 189 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ &&
expr.operand.kind === 8 /* NumericLiteral */ ||
expr.kind === 70 /* Identifier */ && !!symbol.exports[expr.text];
}
function enumHasLiteralMembers(symbol) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 225 /* EnumDeclaration */) {
+ if (declaration.kind === 228 /* EnumDeclaration */) {
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
if (!isLiteralEnumMember(symbol, member)) {
@@ -26514,7 +27581,7 @@ var ts;
var memberTypes = ts.createMap();
for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 225 /* EnumDeclaration */) {
+ if (declaration.kind === 228 /* EnumDeclaration */) {
computeEnumMemberValues(declaration);
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
@@ -26552,7 +27619,7 @@ var ts;
if (!links.declaredType) {
var type = createType(16384 /* TypeParameter */);
type.symbol = symbol;
- if (!ts.getDeclarationOfKind(symbol, 142 /* TypeParameter */).constraint) {
+ if (!ts.getDeclarationOfKind(symbol, 143 /* TypeParameter */).constraint) {
type.constraint = noConstraintType;
}
links.declaredType = type;
@@ -26606,19 +27673,19 @@ var ts;
function isIndependentType(node) {
switch (node.kind) {
case 118 /* AnyKeyword */:
- case 133 /* StringKeyword */:
- case 131 /* NumberKeyword */:
+ case 134 /* StringKeyword */:
+ case 132 /* NumberKeyword */:
case 121 /* BooleanKeyword */:
- case 134 /* SymbolKeyword */:
+ case 135 /* SymbolKeyword */:
case 104 /* VoidKeyword */:
- case 136 /* UndefinedKeyword */:
+ case 137 /* UndefinedKeyword */:
case 94 /* NullKeyword */:
- case 128 /* NeverKeyword */:
- case 167 /* LiteralType */:
+ case 129 /* NeverKeyword */:
+ case 170 /* LiteralType */:
return true;
- case 161 /* ArrayType */:
+ case 162 /* ArrayType */:
return isIndependentType(node.elementType);
- case 156 /* TypeReference */:
+ case 157 /* TypeReference */:
return isIndependentTypeReference(node);
}
return false;
@@ -26631,7 +27698,7 @@ var ts;
// A function-like declaration is considered independent (free of this references) if it has a return type
// annotation that is considered independent and if each parameter is considered independent.
function isIndependentFunctionLikeDeclaration(node) {
- if (node.kind !== 149 /* Constructor */ && (!node.type || !isIndependentType(node.type))) {
+ if (node.kind !== 150 /* Constructor */ && (!node.type || !isIndependentType(node.type))) {
return false;
}
for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
@@ -26652,12 +27719,12 @@ var ts;
var declaration = symbol.declarations[0];
if (declaration) {
switch (declaration.kind) {
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
return isIndependentVariableLikeDeclaration(declaration);
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 149 /* Constructor */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 150 /* Constructor */:
return isIndependentFunctionLikeDeclaration(declaration);
}
}
@@ -26725,8 +27792,8 @@ var ts;
else {
mapper = createTypeMapper(typeParameters, typeArguments);
members = createInstantiatedSymbolTable(source.declaredProperties, mapper, /*mappingThisOnly*/ typeParameters.length === 1);
- callSignatures = instantiateList(source.declaredCallSignatures, mapper, instantiateSignature);
- constructSignatures = instantiateList(source.declaredConstructSignatures, mapper, instantiateSignature);
+ callSignatures = instantiateSignatures(source.declaredCallSignatures, mapper);
+ constructSignatures = instantiateSignatures(source.declaredConstructSignatures, mapper);
stringIndexInfo = instantiateIndexInfo(source.declaredStringIndexInfo, mapper);
numberIndexInfo = instantiateIndexInfo(source.declaredNumberIndexInfo, mapper);
}
@@ -26788,7 +27855,7 @@ var ts;
var baseSig = baseSignatures_1[_i];
var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0;
if (typeParamCount === typeArgCount) {
- var sig = typeParamCount ? getSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig);
+ var sig = typeParamCount ? createSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig);
sig.typeParameters = classType.localTypeParameters;
sig.resolvedReturnType = classType;
result.push(sig);
@@ -26893,6 +27960,9 @@ var ts;
function intersectIndexInfos(info1, info2) {
return !info1 ? info2 : !info2 ? info1 : createIndexInfo(getIntersectionType([info1.type, info2.type]), info1.isReadonly && info2.isReadonly);
}
+ function unionSpreadIndexInfos(info1, info2) {
+ return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly);
+ }
function resolveIntersectionTypeMembers(type) {
// The members and properties collections are empty for intersection types. To get all properties of an
// intersection type use getPropertiesOfType (only the language service uses this).
@@ -26913,8 +27983,8 @@ var ts;
var symbol = type.symbol;
if (type.target) {
var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false);
- var callSignatures = instantiateList(getSignaturesOfType(type.target, 0 /* Call */), type.mapper, instantiateSignature);
- var constructSignatures = instantiateList(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper, instantiateSignature);
+ var callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0 /* Call */), type.mapper);
+ var constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper);
var stringIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 0 /* String */), type.mapper);
var numberIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 1 /* Number */), type.mapper);
setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);
@@ -27026,7 +28096,9 @@ var ts;
}
function getPropertiesOfType(type) {
type = getApparentType(type);
- return type.flags & 196608 /* UnionOrIntersection */ ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type);
+ return type.flags & 196608 /* UnionOrIntersection */ ?
+ getPropertiesOfUnionOrIntersectionType(type) :
+ getPropertiesOfObjectType(type);
}
/**
* The apparent type of a type parameter is the base constraint instantiated with the type parameter
@@ -27048,22 +28120,13 @@ var ts;
* type itself. Note that the apparent type of a union type is the union type itself.
*/
function getApparentType(type) {
- if (type.flags & 16384 /* TypeParameter */) {
- type = getApparentTypeOfTypeParameter(type);
- }
- if (type.flags & 34 /* StringLike */) {
- type = globalStringType;
- }
- else if (type.flags & 340 /* NumberLike */) {
- type = globalNumberType;
- }
- else if (type.flags & 136 /* BooleanLike */) {
- type = globalBooleanType;
- }
- else if (type.flags & 512 /* ESSymbol */) {
- type = getGlobalESSymbolType();
- }
- return type;
+ var t = type.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(type) : type;
+ return t.flags & 34 /* StringLike */ ? globalStringType :
+ t.flags & 340 /* NumberLike */ ? globalNumberType :
+ t.flags & 136 /* BooleanLike */ ? globalBooleanType :
+ t.flags & 512 /* ESSymbol */ ? getGlobalESSymbolType() :
+ t.flags & 262144 /* Index */ ? stringOrNumberType :
+ t;
}
function createUnionOrIntersectionProperty(containingType, name) {
var types = containingType.types;
@@ -27227,7 +28290,7 @@ var ts;
return undefined;
}
function getTypeParametersFromJSDocTemplate(declaration) {
- if (declaration.flags & 1048576 /* JavaScriptFile */) {
+ if (declaration.flags & 2097152 /* JavaScriptFile */) {
var templateTag = ts.getJSDocTemplateTag(declaration);
if (templateTag) {
return getTypeParametersFromDeclaration(templateTag.typeParameters);
@@ -27257,8 +28320,8 @@ var ts;
return result;
}
function isJSDocOptionalParameter(node) {
- if (node.flags & 1048576 /* JavaScriptFile */) {
- if (node.type && node.type.kind === 268 /* JSDocOptionalType */) {
+ if (node.flags & 2097152 /* JavaScriptFile */) {
+ if (node.type && node.type.kind === 272 /* JSDocOptionalType */) {
return true;
}
var paramTag = ts.getCorrespondingJSDocParameterTag(node);
@@ -27267,11 +28330,19 @@ var ts;
return true;
}
if (paramTag.typeExpression) {
- return paramTag.typeExpression.type.kind === 268 /* JSDocOptionalType */;
+ return paramTag.typeExpression.type.kind === 272 /* JSDocOptionalType */;
}
}
}
}
+ function tryFindAmbientModule(moduleName, withAugmentations) {
+ if (ts.isExternalModuleNameRelative(moduleName)) {
+ return undefined;
+ }
+ var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512 /* ValueModule */);
+ // merged symbol is module declaration symbol combined with all augmentations
+ return symbol && withAugmentations ? getMergedSymbol(symbol) : symbol;
+ }
function isOptionalParameter(node) {
if (ts.hasQuestionToken(node) || isJSDocOptionalParameter(node)) {
return true;
@@ -27329,7 +28400,7 @@ var ts;
else {
parameters.push(paramSymbol);
}
- if (param.type && param.type.kind === 167 /* LiteralType */) {
+ if (param.type && param.type.kind === 170 /* LiteralType */) {
hasLiteralTypes = true;
}
if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) {
@@ -27343,10 +28414,10 @@ var ts;
}
}
// If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation
- if ((declaration.kind === 150 /* GetAccessor */ || declaration.kind === 151 /* SetAccessor */) &&
+ if ((declaration.kind === 151 /* GetAccessor */ || declaration.kind === 152 /* SetAccessor */) &&
!ts.hasDynamicName(declaration) &&
(!hasThisParameter || !thisParameter)) {
- var otherKind = declaration.kind === 150 /* GetAccessor */ ? 151 /* SetAccessor */ : 150 /* GetAccessor */;
+ var otherKind = declaration.kind === 151 /* GetAccessor */ ? 152 /* SetAccessor */ : 151 /* GetAccessor */;
var other = ts.getDeclarationOfKind(declaration.symbol, otherKind);
if (other) {
thisParameter = getAnnotatedAccessorThisParameter(other);
@@ -27358,14 +28429,14 @@ var ts;
if (isJSConstructSignature) {
minArgumentCount--;
}
- var classType = declaration.kind === 149 /* Constructor */ ?
+ var classType = declaration.kind === 150 /* Constructor */ ?
getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol))
: undefined;
var typeParameters = classType ? classType.localTypeParameters :
declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) :
getTypeParametersFromJSDocTemplate(declaration);
var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType);
- var typePredicate = declaration.type && declaration.type.kind === 155 /* TypePredicate */ ?
+ var typePredicate = declaration.type && declaration.type.kind === 156 /* TypePredicate */ ?
createTypePredicateFromTypePredicateNode(declaration.type) :
undefined;
links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes);
@@ -27382,7 +28453,7 @@ var ts;
else if (declaration.type) {
return getTypeFromTypeNode(declaration.type);
}
- if (declaration.flags & 1048576 /* JavaScriptFile */) {
+ if (declaration.flags & 2097152 /* JavaScriptFile */) {
var type = getReturnTypeFromJSDocComment(declaration);
if (type && type !== unknownType) {
return type;
@@ -27390,8 +28461,8 @@ var ts;
}
// TypeScript 1.0 spec (April 2014):
// If only one accessor includes a type annotation, the other behaves as if it had the same type annotation.
- if (declaration.kind === 150 /* GetAccessor */ && !ts.hasDynamicName(declaration)) {
- var setter = ts.getDeclarationOfKind(declaration.symbol, 151 /* SetAccessor */);
+ if (declaration.kind === 151 /* GetAccessor */ && !ts.hasDynamicName(declaration)) {
+ var setter = ts.getDeclarationOfKind(declaration.symbol, 152 /* SetAccessor */);
return getAnnotatedAccessorType(setter);
}
if (ts.nodeIsMissing(declaration.body)) {
@@ -27405,20 +28476,20 @@ var ts;
for (var i = 0, len = symbol.declarations.length; i < len; i++) {
var node = symbol.declarations[i];
switch (node.kind) {
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
- case 221 /* FunctionDeclaration */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 149 /* Constructor */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 154 /* IndexSignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
- case 269 /* JSDocFunctionType */:
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
+ case 224 /* FunctionDeclaration */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 150 /* Constructor */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 155 /* IndexSignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 273 /* JSDocFunctionType */:
// Don't include signature if node is the implementation of an overloaded function. A node is considered
// an implementation node if it has a body and the previous node is of the same kind and immediately
// precedes the implementation node (i.e. has the same parent and ends where the implementation starts).
@@ -27489,6 +28560,11 @@ var ts;
return anyType;
}
function getSignatureInstantiation(signature, typeArguments) {
+ var instantiations = signature.instantiations || (signature.instantiations = ts.createMap());
+ var id = getTypeListId(typeArguments);
+ return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments));
+ }
+ function createSignatureInstantiation(signature, typeArguments) {
return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), /*eraseTypeParameters*/ true);
}
function getErasedSignature(signature) {
@@ -27505,7 +28581,7 @@ var ts;
// object type literal or interface (using the new keyword). Each way of declaring a constructor
// will result in a different declaration kind.
if (!signature.isolatedSignatureType) {
- var isConstructor = signature.declaration.kind === 149 /* Constructor */ || signature.declaration.kind === 153 /* ConstructSignature */;
+ var isConstructor = signature.declaration.kind === 150 /* Constructor */ || signature.declaration.kind === 154 /* ConstructSignature */;
var type = createObjectType(16 /* Anonymous */);
type.members = emptySymbols;
type.properties = emptyArray;
@@ -27519,7 +28595,7 @@ var ts;
return symbol.members["__index"];
}
function getIndexDeclarationOfSymbol(symbol, kind) {
- var syntaxKind = kind === 1 /* Number */ ? 131 /* NumberKeyword */ : 133 /* StringKeyword */;
+ var syntaxKind = kind === 1 /* Number */ ? 132 /* NumberKeyword */ : 134 /* StringKeyword */;
var indexSymbol = getIndexSymbol(symbol);
if (indexSymbol) {
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
@@ -27546,7 +28622,7 @@ var ts;
return undefined;
}
function getConstraintDeclaration(type) {
- return ts.getDeclarationOfKind(type.symbol, 142 /* TypeParameter */).constraint;
+ return ts.getDeclarationOfKind(type.symbol, 143 /* TypeParameter */).constraint;
}
function hasConstraintReferenceTo(type, target) {
var checked;
@@ -27579,7 +28655,7 @@ var ts;
return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint;
}
function getParentSymbolOfTypeParameter(typeParameter) {
- return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 142 /* TypeParameter */).parent);
+ return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143 /* TypeParameter */).parent);
}
function getTypeListId(types) {
var result = "";
@@ -27616,7 +28692,7 @@ var ts;
result |= type.flags;
}
}
- return result & 3670016 /* PropagatingFlags */;
+ return result & 14680064 /* PropagatingFlags */;
}
function createTypeReference(target, typeArguments) {
var id = getTypeListId(typeArguments);
@@ -27692,11 +28768,11 @@ var ts;
}
function getTypeReferenceName(node) {
switch (node.kind) {
- case 156 /* TypeReference */:
+ case 157 /* TypeReference */:
return node.typeName;
- case 267 /* JSDocTypeReference */:
+ case 271 /* JSDocTypeReference */:
return node.name;
- case 195 /* ExpressionWithTypeArguments */:
+ case 198 /* ExpressionWithTypeArguments */:
// We only support expressions that are simple qualified names. For other
// expressions this produces undefined.
var expr = node.expression;
@@ -27722,7 +28798,7 @@ var ts;
if (symbol.flags & 524288 /* TypeAlias */) {
return getTypeFromTypeAliasReference(node, symbol);
}
- if (symbol.flags & 107455 /* Value */ && node.kind === 267 /* JSDocTypeReference */) {
+ if (symbol.flags & 107455 /* Value */ && node.kind === 271 /* JSDocTypeReference */) {
// A JSDocTypeReference may have resolved to a value (as opposed to a type). In
// that case, the type of this reference is just the type of the value we resolved
// to.
@@ -27735,14 +28811,14 @@ var ts;
if (!links.resolvedType) {
var symbol = void 0;
var type = void 0;
- if (node.kind === 267 /* JSDocTypeReference */) {
+ if (node.kind === 271 /* JSDocTypeReference */) {
var typeReferenceName = getTypeReferenceName(node);
symbol = resolveTypeReferenceName(typeReferenceName);
type = getTypeReferenceType(node, symbol);
}
else {
// We only support expressions that are simple qualified names. For other expressions this produces undefined.
- var typeNameOrExpression = node.kind === 156 /* TypeReference */
+ var typeNameOrExpression = node.kind === 157 /* TypeReference */
? node.typeName
: ts.isEntityNameExpression(node.expression)
? node.expression
@@ -27777,9 +28853,9 @@ var ts;
for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {
var declaration = declarations_3[_i];
switch (declaration.kind) {
- case 222 /* ClassDeclaration */:
- case 223 /* InterfaceDeclaration */:
- case 225 /* EnumDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 228 /* EnumDeclaration */:
return declaration;
}
}
@@ -27934,7 +29010,7 @@ var ts;
typeSet.containsUndefined = true;
if (flags & 4096 /* Null */)
typeSet.containsNull = true;
- if (!(flags & 524288 /* ContainsWideningType */))
+ if (!(flags & 2097152 /* ContainsWideningType */))
typeSet.containsNonWideningType = true;
}
else if (!(flags & 8192 /* Never */)) {
@@ -28012,7 +29088,7 @@ var ts;
var t = types[i];
var remove = t.flags & 32 /* StringLiteral */ && types.containsString ||
t.flags & 64 /* NumberLiteral */ && types.containsNumber ||
- t.flags & 96 /* StringOrNumberLiteral */ && t.flags & 262144 /* FreshLiteral */ && containsType(types, t.regularType);
+ t.flags & 96 /* StringOrNumberLiteral */ && t.flags & 1048576 /* FreshLiteral */ && containsType(types, t.regularType);
if (remove) {
ts.orderedRemoveItemAt(types, i);
}
@@ -28109,7 +29185,7 @@ var ts;
if (types.length === 0) {
return emptyObjectType;
}
- var _loop_1 = function (i) {
+ var _loop_2 = function (i) {
var type_1 = types[i];
if (type_1.flags & 65536 /* Union */) {
return { value: getUnionType(ts.map(type_1.types, function (t) { return getIntersectionType(ts.replaceElement(types, i, t)); }),
@@ -28117,7 +29193,7 @@ var ts;
}
};
for (var i = 0; i < types.length; i++) {
- var state_2 = _loop_1(i);
+ var state_2 = _loop_2(i);
if (typeof state_2 === "object")
return state_2.value;
}
@@ -28147,26 +29223,223 @@ var ts;
}
return links.resolvedType;
}
+ function getIndexTypeForTypeParameter(type) {
+ if (!type.resolvedIndexType) {
+ type.resolvedIndexType = createType(262144 /* Index */);
+ type.resolvedIndexType.type = type;
+ }
+ return type.resolvedIndexType;
+ }
+ function getLiteralTypeFromPropertyName(prop) {
+ return ts.startsWith(prop.name, "__@") ? neverType : getLiteralTypeForText(32 /* StringLiteral */, ts.unescapeIdentifier(prop.name));
+ }
+ function getLiteralTypeFromPropertyNames(type) {
+ return getUnionType(ts.map(getPropertiesOfType(type), getLiteralTypeFromPropertyName));
+ }
+ function getIndexType(type) {
+ return type.flags & 16384 /* TypeParameter */ ? getIndexTypeForTypeParameter(type) :
+ type.flags & 1 /* Any */ || getIndexInfoOfType(type, 0 /* String */) ? stringOrNumberType :
+ getIndexInfoOfType(type, 1 /* Number */) ? getUnionType([numberType, getLiteralTypeFromPropertyNames(type)]) :
+ getLiteralTypeFromPropertyNames(type);
+ }
+ function getTypeFromTypeOperatorNode(node) {
+ var links = getNodeLinks(node);
+ if (!links.resolvedType) {
+ links.resolvedType = getIndexType(getTypeFromTypeNodeNoAlias(node.type));
+ }
+ return links.resolvedType;
+ }
+ function createIndexedAccessType(objectType, indexType) {
+ var type = createType(524288 /* IndexedAccess */);
+ type.objectType = objectType;
+ type.indexType = indexType;
+ return type;
+ }
+ function getIndexedAccessTypeForTypeParameter(objectType, indexType) {
+ var indexedAccessTypes = indexType.resolvedIndexedAccessTypes || (indexType.resolvedIndexedAccessTypes = []);
+ return indexedAccessTypes[objectType.id] || (indexedAccessTypes[objectType.id] = createIndexedAccessType(objectType, indexType));
+ }
+ function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) {
+ var accessExpression = accessNode && accessNode.kind === 177 /* ElementAccessExpression */ ? accessNode : undefined;
+ var propName = indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */ | 256 /* EnumLiteral */) ?
+ indexType.text :
+ accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ?
+ ts.getPropertyNameForKnownSymbolName(accessExpression.argumentExpression.name.text) :
+ undefined;
+ if (propName) {
+ var prop = getPropertyOfType(objectType, propName);
+ if (prop) {
+ if (accessExpression) {
+ if (ts.isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) {
+ error(accessExpression.argumentExpression, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(prop));
+ return unknownType;
+ }
+ if (cacheSymbol) {
+ getNodeLinks(accessNode).resolvedSymbol = prop;
+ }
+ }
+ return getTypeOfSymbol(prop);
+ }
+ }
+ if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 34 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */)) {
+ if (isTypeAny(objectType)) {
+ return anyType;
+ }
+ var indexInfo = isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 /* NumberLike */) && getIndexInfoOfType(objectType, 1 /* Number */) ||
+ getIndexInfoOfType(objectType, 0 /* String */) ||
+ undefined;
+ if (indexInfo) {
+ if (accessExpression && ts.isAssignmentTarget(accessExpression) && indexInfo.isReadonly) {
+ error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
+ return unknownType;
+ }
+ return indexInfo.type;
+ }
+ if (accessExpression && !isConstEnumObjectType(objectType)) {
+ if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) {
+ if (getIndexTypeOfType(objectType, 1 /* Number */)) {
+ error(accessExpression.argumentExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number);
+ }
+ else {
+ error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(objectType));
+ }
+ }
+ return anyType;
+ }
+ }
+ if (accessNode) {
+ var indexNode = accessNode.kind === 177 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType;
+ if (indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */)) {
+ error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.text, typeToString(objectType));
+ }
+ else if (indexType.flags & (2 /* String */ | 4 /* Number */)) {
+ error(indexNode, ts.Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType));
+ }
+ else {
+ error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
+ }
+ }
+ return unknownType;
+ }
+ function getIndexedAccessType(objectType, indexType, accessNode) {
+ if (indexType.flags & 16384 /* TypeParameter */) {
+ if (!isTypeAssignableTo(getConstraintOfTypeParameter(indexType) || emptyObjectType, getIndexType(objectType))) {
+ if (accessNode) {
+ error(accessNode, ts.Diagnostics.Type_0_is_not_constrained_to_keyof_1, typeToString(indexType), typeToString(objectType));
+ }
+ return unknownType;
+ }
+ return getIndexedAccessTypeForTypeParameter(objectType, indexType);
+ }
+ var apparentType = getApparentType(objectType);
+ if (indexType.flags & 65536 /* Union */ && !(indexType.flags & 8190 /* Primitive */)) {
+ var propTypes = [];
+ for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ var propType = getPropertyTypeForIndexType(apparentType, t, accessNode, /*cacheSymbol*/ false);
+ if (propType === unknownType) {
+ return unknownType;
+ }
+ propTypes.push(propType);
+ }
+ return getUnionType(propTypes);
+ }
+ return getPropertyTypeForIndexType(apparentType, indexType, accessNode, /*cacheSymbol*/ true);
+ }
+ function getTypeFromIndexedAccessTypeNode(node) {
+ var links = getNodeLinks(node);
+ if (!links.resolvedType) {
+ links.resolvedType = getIndexedAccessType(getTypeFromTypeNodeNoAlias(node.objectType), getTypeFromTypeNodeNoAlias(node.indexType), node);
+ }
+ return links.resolvedType;
+ }
function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node, aliasSymbol, aliasTypeArguments) {
var links = getNodeLinks(node);
if (!links.resolvedType) {
// Deferred resolution of members is handled by resolveObjectTypeMembers
- var type = createObjectType(16 /* Anonymous */, node.symbol);
- type.aliasSymbol = aliasSymbol;
- type.aliasTypeArguments = aliasTypeArguments;
- links.resolvedType = type;
+ if (ts.isEmpty(node.symbol.members) && !aliasSymbol && !aliasTypeArguments) {
+ links.resolvedType = emptyTypeLiteralType;
+ }
+ else {
+ var type = createObjectType(16 /* Anonymous */, node.symbol);
+ type.aliasSymbol = aliasSymbol;
+ type.aliasTypeArguments = aliasTypeArguments;
+ links.resolvedType = type;
+ }
}
return links.resolvedType;
}
+ /**
+ * Since the source of spread types are object literals, which are not binary,
+ * this function should be called in a left folding style, with left = previous result of getSpreadType
+ * and right = the new element to be spread.
+ */
+ function getSpreadType(left, right, isFromObjectLiteral) {
+ ts.Debug.assert(!!(left.flags & (32768 /* Object */ | 1 /* Any */)) && !!(right.flags & (32768 /* Object */ | 1 /* Any */)), "Only object types may be spread.");
+ if (left.flags & 1 /* Any */ || right.flags & 1 /* Any */) {
+ return anyType;
+ }
+ var members = ts.createMap();
+ var skippedPrivateMembers = ts.createMap();
+ var stringIndexInfo;
+ var numberIndexInfo;
+ if (left === emptyObjectType) {
+ // for the first spread element, left === emptyObjectType, so take the right's string indexer
+ stringIndexInfo = getIndexInfoOfType(right, 0 /* String */);
+ numberIndexInfo = getIndexInfoOfType(right, 1 /* Number */);
+ }
+ else {
+ stringIndexInfo = unionSpreadIndexInfos(getIndexInfoOfType(left, 0 /* String */), getIndexInfoOfType(right, 0 /* String */));
+ numberIndexInfo = unionSpreadIndexInfos(getIndexInfoOfType(left, 1 /* Number */), getIndexInfoOfType(right, 1 /* Number */));
+ }
+ for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) {
+ var rightProp = _a[_i];
+ // we approximate own properties as non-methods plus methods that are inside the object literal
+ var isOwnProperty = !(rightProp.flags & 8192 /* Method */) || isFromObjectLiteral;
+ var isSetterWithoutGetter = rightProp.flags & 65536 /* SetAccessor */ && !(rightProp.flags & 32768 /* GetAccessor */);
+ if (getDeclarationModifierFlagsFromSymbol(rightProp) & (8 /* Private */ | 16 /* Protected */)) {
+ skippedPrivateMembers[rightProp.name] = true;
+ }
+ else if (isOwnProperty && !isSetterWithoutGetter) {
+ members[rightProp.name] = rightProp;
+ }
+ }
+ for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) {
+ var leftProp = _c[_b];
+ if (leftProp.flags & 65536 /* SetAccessor */ && !(leftProp.flags & 32768 /* GetAccessor */)
+ || leftProp.name in skippedPrivateMembers) {
+ continue;
+ }
+ if (leftProp.name in members) {
+ var rightProp = members[leftProp.name];
+ var rightType = getTypeOfSymbol(rightProp);
+ if (maybeTypeOfKind(rightType, 2048 /* Undefined */) || rightProp.flags & 536870912 /* Optional */) {
+ var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations);
+ var flags = 4 /* Property */ | 67108864 /* Transient */ | (leftProp.flags & 536870912 /* Optional */);
+ var result = createSymbol(flags, leftProp.name);
+ result.type = getUnionType([getTypeOfSymbol(leftProp), getTypeWithFacts(rightType, 131072 /* NEUndefined */)]);
+ result.leftSpread = leftProp;
+ result.rightSpread = rightProp;
+ result.declarations = declarations;
+ result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp);
+ members[leftProp.name] = result;
+ }
+ }
+ else {
+ members[leftProp.name] = leftProp;
+ }
+ }
+ return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
+ }
function createLiteralType(flags, text) {
var type = createType(flags);
type.text = text;
return type;
}
function getFreshTypeOfLiteralType(type) {
- if (type.flags & 96 /* StringOrNumberLiteral */ && !(type.flags & 262144 /* FreshLiteral */)) {
+ if (type.flags & 96 /* StringOrNumberLiteral */ && !(type.flags & 1048576 /* FreshLiteral */)) {
if (!type.freshType) {
- var freshType = createLiteralType(type.flags | 262144 /* FreshLiteral */, type.text);
+ var freshType = createLiteralType(type.flags | 1048576 /* FreshLiteral */, type.text);
freshType.regularType = type;
type.freshType = freshType;
}
@@ -28175,7 +29448,7 @@ var ts;
return type;
}
function getRegularTypeOfLiteralType(type) {
- return type.flags & 96 /* StringOrNumberLiteral */ && type.flags & 262144 /* FreshLiteral */ ? type.regularType : type;
+ return type.flags & 96 /* StringOrNumberLiteral */ && type.flags & 1048576 /* FreshLiteral */ ? type.regularType : type;
}
function getLiteralTypeForText(flags, text) {
var map = flags & 32 /* StringLiteral */ ? stringLiteralTypes : numericLiteralTypes;
@@ -28207,9 +29480,9 @@ var ts;
function getThisType(node) {
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
var parent = container && container.parent;
- if (parent && (ts.isClassLike(parent) || parent.kind === 223 /* InterfaceDeclaration */)) {
+ if (parent && (ts.isClassLike(parent) || parent.kind === 226 /* InterfaceDeclaration */)) {
if (!(ts.getModifierFlags(container) & 32 /* Static */) &&
- (container.kind !== 149 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) {
+ (container.kind !== 150 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) {
return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType;
}
}
@@ -28229,81 +29502,85 @@ var ts;
function getTypeFromTypeNode(node, aliasSymbol, aliasTypeArguments) {
switch (node.kind) {
case 118 /* AnyKeyword */:
- case 258 /* JSDocAllType */:
- case 259 /* JSDocUnknownType */:
+ case 262 /* JSDocAllType */:
+ case 263 /* JSDocUnknownType */:
return anyType;
- case 133 /* StringKeyword */:
+ case 134 /* StringKeyword */:
return stringType;
- case 131 /* NumberKeyword */:
+ case 132 /* NumberKeyword */:
return numberType;
case 121 /* BooleanKeyword */:
return booleanType;
- case 134 /* SymbolKeyword */:
+ case 135 /* SymbolKeyword */:
return esSymbolType;
case 104 /* VoidKeyword */:
return voidType;
- case 136 /* UndefinedKeyword */:
+ case 137 /* UndefinedKeyword */:
return undefinedType;
case 94 /* NullKeyword */:
return nullType;
- case 128 /* NeverKeyword */:
+ case 129 /* NeverKeyword */:
return neverType;
- case 283 /* JSDocNullKeyword */:
+ case 287 /* JSDocNullKeyword */:
return nullType;
- case 284 /* JSDocUndefinedKeyword */:
+ case 288 /* JSDocUndefinedKeyword */:
return undefinedType;
- case 285 /* JSDocNeverKeyword */:
+ case 289 /* JSDocNeverKeyword */:
return neverType;
- case 166 /* ThisType */:
+ case 167 /* ThisType */:
case 98 /* ThisKeyword */:
return getTypeFromThisTypeNode(node);
- case 167 /* LiteralType */:
+ case 170 /* LiteralType */:
return getTypeFromLiteralTypeNode(node);
- case 282 /* JSDocLiteralType */:
+ case 286 /* JSDocLiteralType */:
return getTypeFromLiteralTypeNode(node.literal);
- case 156 /* TypeReference */:
- case 267 /* JSDocTypeReference */:
+ case 157 /* TypeReference */:
+ case 271 /* JSDocTypeReference */:
return getTypeFromTypeReference(node);
- case 155 /* TypePredicate */:
+ case 156 /* TypePredicate */:
return booleanType;
- case 195 /* ExpressionWithTypeArguments */:
+ case 198 /* ExpressionWithTypeArguments */:
return getTypeFromTypeReference(node);
- case 159 /* TypeQuery */:
+ case 160 /* TypeQuery */:
return getTypeFromTypeQueryNode(node);
- case 161 /* ArrayType */:
- case 260 /* JSDocArrayType */:
+ case 162 /* ArrayType */:
+ case 264 /* JSDocArrayType */:
return getTypeFromArrayTypeNode(node);
- case 162 /* TupleType */:
+ case 163 /* TupleType */:
return getTypeFromTupleTypeNode(node);
- case 163 /* UnionType */:
- case 261 /* JSDocUnionType */:
+ case 164 /* UnionType */:
+ case 265 /* JSDocUnionType */:
return getTypeFromUnionTypeNode(node, aliasSymbol, aliasTypeArguments);
- case 164 /* IntersectionType */:
+ case 165 /* IntersectionType */:
return getTypeFromIntersectionTypeNode(node, aliasSymbol, aliasTypeArguments);
- case 165 /* ParenthesizedType */:
- case 263 /* JSDocNullableType */:
- case 264 /* JSDocNonNullableType */:
- case 271 /* JSDocConstructorType */:
- case 272 /* JSDocThisType */:
- case 268 /* JSDocOptionalType */:
+ case 166 /* ParenthesizedType */:
+ case 267 /* JSDocNullableType */:
+ case 268 /* JSDocNonNullableType */:
+ case 275 /* JSDocConstructorType */:
+ case 276 /* JSDocThisType */:
+ case 272 /* JSDocOptionalType */:
return getTypeFromTypeNode(node.type);
- case 265 /* JSDocRecordType */:
+ case 269 /* JSDocRecordType */:
return getTypeFromTypeNode(node.literal);
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
- case 160 /* TypeLiteral */:
- case 281 /* JSDocTypeLiteral */:
- case 269 /* JSDocFunctionType */:
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
+ case 161 /* TypeLiteral */:
+ case 285 /* JSDocTypeLiteral */:
+ case 273 /* JSDocFunctionType */:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node, aliasSymbol, aliasTypeArguments);
+ case 168 /* TypeOperator */:
+ return getTypeFromTypeOperatorNode(node);
+ case 169 /* IndexedAccessType */:
+ return getTypeFromIndexedAccessTypeNode(node);
// This function assumes that an identifier or qualified name is a type expression
// Callers should first ensure this by calling isTypeNode
case 70 /* Identifier */:
- case 140 /* QualifiedName */:
+ case 141 /* QualifiedName */:
var symbol = getSymbolAtLocation(node);
return symbol && getDeclaredTypeOfSymbol(symbol);
- case 262 /* JSDocTupleType */:
+ case 266 /* JSDocTupleType */:
return getTypeFromJSDocTupleType(node);
- case 270 /* JSDocVariadicType */:
+ case 274 /* JSDocVariadicType */:
return getTypeFromJSDocVariadicType(node);
default:
return unknownType;
@@ -28320,6 +29597,12 @@ var ts;
}
return items;
}
+ function instantiateTypes(types, mapper) {
+ return instantiateList(types, mapper, instantiateType);
+ }
+ function instantiateSignatures(signatures, mapper) {
+ return instantiateList(signatures, mapper, instantiateSignature);
+ }
function createUnaryTypeMapper(source, target) {
return function (t) { return t === source ? target : t; };
}
@@ -28342,7 +29625,6 @@ var ts;
count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) :
createArrayTypeMapper(sources, targets);
mapper.mappedTypes = sources;
- mapper.targetTypes = targets;
return mapper;
}
function createTypeEraser(sources) {
@@ -28454,11 +29736,14 @@ var ts;
result.target = type;
result.mapper = mapper;
result.aliasSymbol = type.aliasSymbol;
- result.aliasTypeArguments = mapper.targetTypes;
+ result.aliasTypeArguments = instantiateTypes(type.aliasTypeArguments, mapper);
mapper.instantiations[type.id] = result;
return result;
}
function isSymbolInScopeOfMappedTypeParameter(symbol, mapper) {
+ if (!(symbol.declarations && symbol.declarations.length)) {
+ return false;
+ }
var mappedTypes = mapper.mappedTypes;
// Starting with the parent of the symbol's declaration, check if the mapper maps any of
// the type parameters introduced by enclosing declarations. We just pick the first
@@ -28466,23 +29751,23 @@ var ts;
var node = symbol.declarations[0].parent;
while (node) {
switch (node.kind) {
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
- case 221 /* FunctionDeclaration */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 149 /* Constructor */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 154 /* IndexSignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 223 /* InterfaceDeclaration */:
- case 224 /* TypeAliasDeclaration */:
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
+ case 224 /* FunctionDeclaration */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 150 /* Constructor */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 155 /* IndexSignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 226 /* InterfaceDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
var declaration = node;
if (declaration.typeParameters) {
for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) {
@@ -28492,15 +29777,15 @@ var ts;
}
}
}
- if (ts.isClassLike(node) || node.kind === 223 /* InterfaceDeclaration */) {
+ if (ts.isClassLike(node) || node.kind === 226 /* InterfaceDeclaration */) {
var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType;
if (thisType && ts.contains(mappedTypes, thisType)) {
return true;
}
}
break;
- case 226 /* ModuleDeclaration */:
- case 256 /* SourceFile */:
+ case 229 /* ModuleDeclaration */:
+ case 260 /* SourceFile */:
return false;
}
node = node.parent;
@@ -28526,14 +29811,20 @@ var ts;
instantiateAnonymousType(type, mapper) : type;
}
if (type.objectFlags & 4 /* Reference */) {
- return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType));
+ return createTypeReference(type.target, instantiateTypes(type.typeArguments, mapper));
}
}
if (type.flags & 65536 /* Union */ && !(type.flags & 8190 /* Primitive */)) {
- return getUnionType(instantiateList(type.types, mapper, instantiateType), /*subtypeReduction*/ false, type.aliasSymbol, mapper.targetTypes);
+ return getUnionType(instantiateTypes(type.types, mapper), /*subtypeReduction*/ false, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));
}
if (type.flags & 131072 /* Intersection */) {
- return getIntersectionType(instantiateList(type.types, mapper, instantiateType), type.aliasSymbol, mapper.targetTypes);
+ return getIntersectionType(instantiateTypes(type.types, mapper), type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));
+ }
+ if (type.flags & 262144 /* Index */) {
+ return getIndexType(instantiateType(type.type, mapper));
+ }
+ if (type.flags & 524288 /* IndexedAccess */) {
+ return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper));
}
}
return type;
@@ -28544,27 +29835,27 @@ var ts;
// Returns true if the given expression contains (at any level of nesting) a function or arrow expression
// that is subject to contextual typing.
function isContextSensitive(node) {
- ts.Debug.assert(node.kind !== 148 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
switch (node.kind) {
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
return isContextSensitiveFunctionLikeDeclaration(node);
- case 172 /* ObjectLiteralExpression */:
+ case 175 /* ObjectLiteralExpression */:
return ts.forEach(node.properties, isContextSensitive);
- case 171 /* ArrayLiteralExpression */:
+ case 174 /* ArrayLiteralExpression */:
return ts.forEach(node.elements, isContextSensitive);
- case 189 /* ConditionalExpression */:
+ case 192 /* ConditionalExpression */:
return isContextSensitive(node.whenTrue) ||
isContextSensitive(node.whenFalse);
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
return node.operatorToken.kind === 53 /* BarBarToken */ &&
(isContextSensitive(node.left) || isContextSensitive(node.right));
- case 253 /* PropertyAssignment */:
+ case 256 /* PropertyAssignment */:
return isContextSensitive(node.initializer);
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
return isContextSensitiveFunctionLikeDeclaration(node);
- case 179 /* ParenthesizedExpression */:
+ case 182 /* ParenthesizedExpression */:
return isContextSensitive(node.expression);
}
return false;
@@ -28579,7 +29870,7 @@ var ts;
return true;
}
// For arrow functions we now know we're not context sensitive.
- if (node.kind === 181 /* ArrowFunction */) {
+ if (node.kind === 184 /* ArrowFunction */) {
return false;
}
// If the first parameter is not an explicit 'this' parameter, then the function has
@@ -28856,10 +30147,10 @@ var ts;
return false;
}
function isTypeRelatedTo(source, target, relation) {
- if (source.flags & 96 /* StringOrNumberLiteral */ && source.flags & 262144 /* FreshLiteral */) {
+ if (source.flags & 96 /* StringOrNumberLiteral */ && source.flags & 1048576 /* FreshLiteral */) {
source = source.regularType;
}
- if (target.flags & 96 /* StringOrNumberLiteral */ && target.flags & 262144 /* FreshLiteral */) {
+ if (target.flags & 96 /* StringOrNumberLiteral */ && target.flags & 1048576 /* FreshLiteral */) {
target = target.regularType;
}
if (source === target || relation !== identityRelation && isSimpleTypeRelatedTo(source, target, relation)) {
@@ -28872,7 +30163,7 @@ var ts;
return related === 1 /* Succeeded */;
}
}
- if (source.flags & 245760 /* StructuredOrTypeParameter */ || target.flags & 245760 /* StructuredOrTypeParameter */) {
+ if (source.flags & 507904 /* StructuredOrTypeParameter */ || target.flags & 507904 /* StructuredOrTypeParameter */) {
return checkTypeRelatedTo(source, target, relation, undefined, undefined, undefined);
}
return false;
@@ -28919,9 +30210,15 @@ var ts;
targetType = typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */);
}
if (!message) {
- message = relation === comparableRelation ?
- ts.Diagnostics.Type_0_is_not_comparable_to_type_1 :
- ts.Diagnostics.Type_0_is_not_assignable_to_type_1;
+ if (relation === comparableRelation) {
+ message = ts.Diagnostics.Type_0_is_not_comparable_to_type_1;
+ }
+ else if (sourceType === targetType) {
+ message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated;
+ }
+ else {
+ message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1;
+ }
}
reportError(message, sourceType, targetType);
}
@@ -28941,10 +30238,10 @@ var ts;
// Ternary.False if they are not related.
function isRelatedTo(source, target, reportErrors, headMessage) {
var result;
- if (source.flags & 96 /* StringOrNumberLiteral */ && source.flags & 262144 /* FreshLiteral */) {
+ if (source.flags & 96 /* StringOrNumberLiteral */ && source.flags & 1048576 /* FreshLiteral */) {
source = source.regularType;
}
- if (target.flags & 96 /* StringOrNumberLiteral */ && target.flags & 262144 /* FreshLiteral */) {
+ if (target.flags & 96 /* StringOrNumberLiteral */ && target.flags & 1048576 /* FreshLiteral */) {
target = target.regularType;
}
// both types are the same - covers 'they are the same primitive type or both are Any' or the same type parameter cases
@@ -28955,7 +30252,7 @@ var ts;
}
if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1 /* True */;
- if (getObjectFlags(source) & 64 /* ObjectLiteral */ && source.flags & 262144 /* FreshLiteral */) {
+ if (getObjectFlags(source) & 64 /* ObjectLiteral */ && source.flags & 1048576 /* FreshLiteral */) {
if (hasExcessProperties(source, target, reportErrors)) {
if (reportErrors) {
reportRelationError(headMessage, source, target);
@@ -29013,6 +30310,26 @@ var ts;
return result;
}
}
+ if (target.flags & 16384 /* TypeParameter */) {
+ // Given a type parameter K with a constraint keyof T, a type S is
+ // assignable to K if S is assignable to keyof T.
+ var constraint = getConstraintOfTypeParameter(target);
+ if (constraint && constraint.flags & 262144 /* Index */) {
+ if (result = isRelatedTo(source, constraint, reportErrors)) {
+ return result;
+ }
+ }
+ }
+ else if (target.flags & 262144 /* Index */) {
+ // Given a type parameter T with a constraint C, a type S is assignable to
+ // keyof T if S is assignable to keyof C.
+ var constraint = getConstraintOfTypeParameter(target.type);
+ if (constraint) {
+ if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) {
+ return result;
+ }
+ }
+ }
if (source.flags & 16384 /* TypeParameter */) {
var constraint = getConstraintOfTypeParameter(source);
if (!constraint || constraint.flags & 1 /* Any */) {
@@ -29305,8 +30622,8 @@ var ts;
var result = -1 /* True */;
var properties = getPropertiesOfObjectType(target);
var requireOptionalProperties = relation === subtypeRelation && !(getObjectFlags(source) & 64 /* ObjectLiteral */);
- for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) {
- var targetProp = properties_2[_i];
+ for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {
+ var targetProp = properties_3[_i];
var sourceProp = getPropertyOfType(source, targetProp.name);
if (sourceProp !== targetProp) {
if (!sourceProp) {
@@ -29799,8 +31116,8 @@ var ts;
type;
}
function getWidenedLiteralType(type) {
- return type.flags & 32 /* StringLiteral */ && type.flags & 262144 /* FreshLiteral */ ? stringType :
- type.flags & 64 /* NumberLiteral */ && type.flags & 262144 /* FreshLiteral */ ? numberType :
+ return type.flags & 32 /* StringLiteral */ && type.flags & 1048576 /* FreshLiteral */ ? stringType :
+ type.flags & 64 /* NumberLiteral */ && type.flags & 1048576 /* FreshLiteral */ ? numberType :
type.flags & 128 /* BooleanLiteral */ ? booleanType :
type.flags & 256 /* EnumLiteral */ ? type.baseType :
type.flags & 65536 /* Union */ && !(type.flags & 16 /* Enum */) ? getUnionType(ts.sameMap(type.types, getWidenedLiteralType)) :
@@ -29895,7 +31212,7 @@ var ts;
* Leave signatures alone since they are not subject to the check.
*/
function getRegularTypeOfObjectLiteral(type) {
- if (!(getObjectFlags(type) & 64 /* ObjectLiteral */ && type.flags & 262144 /* FreshLiteral */)) {
+ if (!(getObjectFlags(type) & 64 /* ObjectLiteral */ && type.flags & 1048576 /* FreshLiteral */)) {
return type;
}
var regularType = type.regularType;
@@ -29905,7 +31222,7 @@ var ts;
var resolved = type;
var members = transformTypeOfMembers(type, getRegularTypeOfObjectLiteral);
var regularNew = createAnonymousType(resolved.symbol, members, resolved.callSignatures, resolved.constructSignatures, resolved.stringIndexInfo, resolved.numberIndexInfo);
- regularNew.flags = resolved.flags & ~262144 /* FreshLiteral */;
+ regularNew.flags = resolved.flags & ~1048576 /* FreshLiteral */;
regularNew.objectFlags |= 64 /* ObjectLiteral */;
type.regularType = regularNew;
return regularNew;
@@ -29923,7 +31240,7 @@ var ts;
return type.flags & 6144 /* Nullable */ ? type : getWidenedType(type);
}
function getWidenedType(type) {
- if (type.flags & 1572864 /* RequiresWidening */) {
+ if (type.flags & 6291456 /* RequiresWidening */) {
if (type.flags & 6144 /* Nullable */) {
return anyType;
}
@@ -29972,7 +31289,7 @@ var ts;
for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) {
var p = _e[_d];
var t = getTypeOfSymbol(p);
- if (t.flags & 524288 /* ContainsWideningType */) {
+ if (t.flags & 2097152 /* ContainsWideningType */) {
if (!reportWideningErrorsInType(t)) {
error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t)));
}
@@ -29986,25 +31303,25 @@ var ts;
var typeAsString = typeToString(getWidenedType(type));
var diagnostic;
switch (declaration.kind) {
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type;
break;
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
diagnostic = declaration.dotDotDotToken ?
ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type :
ts.Diagnostics.Parameter_0_implicitly_has_an_1_type;
break;
- case 170 /* BindingElement */:
+ case 173 /* BindingElement */:
diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type;
break;
- case 221 /* FunctionDeclaration */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
+ case 224 /* FunctionDeclaration */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
if (!declaration.name) {
error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
@@ -30017,7 +31334,7 @@ var ts;
error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString);
}
function reportErrorsFromWidening(declaration, type) {
- if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 524288 /* ContainsWideningType */) {
+ if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 2097152 /* ContainsWideningType */) {
// Report implicit any error within type if possible, otherwise report error on declaration
if (!reportWideningErrorsInType(type)) {
reportImplicitAnyError(declaration, type);
@@ -30145,7 +31462,7 @@ var ts;
// it as an inference candidate. Hopefully, a better candidate will come along that does
// not contain anyFunctionType when we come back to this argument for its second round
// of inference.
- if (source.flags & 2097152 /* ContainsAnyFunctionType */) {
+ if (source.flags & 8388608 /* ContainsAnyFunctionType */) {
return;
}
for (var i = 0; i < typeParameters.length; i++) {
@@ -30244,8 +31561,8 @@ var ts;
}
function inferFromProperties(source, target) {
var properties = getPropertiesOfObjectType(target);
- for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {
- var targetProp = properties_3[_i];
+ for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
+ var targetProp = properties_4[_i];
var sourceProp = getPropertyOfObjectType(source, targetProp.name);
if (sourceProp) {
inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
@@ -30323,7 +31640,7 @@ var ts;
}
function hasPrimitiveConstraint(type) {
var constraint = getConstraintOfTypeParameter(type);
- return constraint && maybeTypeOfKind(constraint, 8190 /* Primitive */);
+ return constraint && maybeTypeOfKind(constraint, 8190 /* Primitive */ | 262144 /* Index */);
}
function getInferredType(context, index) {
var inferredType = context.inferredTypes[index];
@@ -30393,10 +31710,10 @@ var ts;
// The expression is restricted to a single identifier or a sequence of identifiers separated by periods
while (node) {
switch (node.kind) {
- case 159 /* TypeQuery */:
+ case 160 /* TypeQuery */:
return true;
case 70 /* Identifier */:
- case 140 /* QualifiedName */:
+ case 141 /* QualifiedName */:
node = node.parent;
continue;
default:
@@ -30417,7 +31734,7 @@ var ts;
if (node.kind === 98 /* ThisKeyword */) {
return "0";
}
- if (node.kind === 173 /* PropertyAccessExpression */) {
+ if (node.kind === 176 /* PropertyAccessExpression */) {
var key = getFlowCacheKey(node.expression);
return key && key + "." + node.name.text;
}
@@ -30428,7 +31745,7 @@ var ts;
case 70 /* Identifier */:
case 98 /* ThisKeyword */:
return node;
- case 173 /* PropertyAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
return getLeftmostIdentifierOrThis(node.expression);
}
return undefined;
@@ -30437,19 +31754,19 @@ var ts;
switch (source.kind) {
case 70 /* Identifier */:
return target.kind === 70 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) ||
- (target.kind === 219 /* VariableDeclaration */ || target.kind === 170 /* BindingElement */) &&
+ (target.kind === 222 /* VariableDeclaration */ || target.kind === 173 /* BindingElement */) &&
getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target);
case 98 /* ThisKeyword */:
return target.kind === 98 /* ThisKeyword */;
- case 173 /* PropertyAccessExpression */:
- return target.kind === 173 /* PropertyAccessExpression */ &&
+ case 176 /* PropertyAccessExpression */:
+ return target.kind === 176 /* PropertyAccessExpression */ &&
source.name.text === target.name.text &&
isMatchingReference(source.expression, target.expression);
}
return false;
}
function containsMatchingReference(source, target) {
- while (source.kind === 173 /* PropertyAccessExpression */) {
+ while (source.kind === 176 /* PropertyAccessExpression */) {
source = source.expression;
if (isMatchingReference(source, target)) {
return true;
@@ -30462,7 +31779,7 @@ var ts;
// a possible discriminant if its type differs in the constituents of containing union type, and if every
// choice is a unit type or a union of unit types.
function containsMatchingReferenceDiscriminant(source, target) {
- return target.kind === 173 /* PropertyAccessExpression */ &&
+ return target.kind === 176 /* PropertyAccessExpression */ &&
containsMatchingReference(source, target.expression) &&
isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text);
}
@@ -30470,7 +31787,7 @@ var ts;
if (expr.kind === 70 /* Identifier */) {
return getTypeOfSymbol(getResolvedSymbol(expr));
}
- if (expr.kind === 173 /* PropertyAccessExpression */) {
+ if (expr.kind === 176 /* PropertyAccessExpression */) {
var type = getDeclaredTypeOfReference(expr.expression);
return type && getTypeOfPropertyOfType(type, expr.name.text);
}
@@ -30500,7 +31817,7 @@ var ts;
}
}
}
- if (callExpression.expression.kind === 173 /* PropertyAccessExpression */ &&
+ if (callExpression.expression.kind === 176 /* PropertyAccessExpression */ &&
isOrContainsMatchingReference(reference, callExpression.expression.expression)) {
return true;
}
@@ -30616,7 +31933,7 @@ var ts;
return type;
}
function getTypeOfDestructuredProperty(type, name) {
- var text = getTextOfPropertyName(name);
+ var text = ts.getTextOfPropertyName(name);
return getTypeOfPropertyOfType(type, text) ||
isNumericLiteralName(text) && getIndexTypeOfType(type, 1 /* Number */) ||
getIndexTypeOfType(type, 0 /* String */) ||
@@ -30627,19 +31944,19 @@ var ts;
checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) ||
unknownType;
}
- function getTypeOfDestructuredSpreadElement(type) {
+ function getTypeOfDestructuredSpreadExpression(type) {
return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || unknownType);
}
function getAssignedTypeOfBinaryExpression(node) {
- return node.parent.kind === 171 /* ArrayLiteralExpression */ || node.parent.kind === 253 /* PropertyAssignment */ ?
+ return node.parent.kind === 174 /* ArrayLiteralExpression */ || node.parent.kind === 256 /* PropertyAssignment */ ?
getTypeWithDefault(getAssignedType(node), node.right) :
checkExpression(node.right);
}
function getAssignedTypeOfArrayLiteralElement(node, element) {
return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element));
}
- function getAssignedTypeOfSpreadElement(node) {
- return getTypeOfDestructuredSpreadElement(getAssignedType(node.parent));
+ function getAssignedTypeOfSpreadExpression(node) {
+ return getTypeOfDestructuredSpreadExpression(getAssignedType(node.parent));
}
function getAssignedTypeOfPropertyAssignment(node) {
return getTypeOfDestructuredProperty(getAssignedType(node.parent), node.name);
@@ -30650,21 +31967,21 @@ var ts;
function getAssignedType(node) {
var parent = node.parent;
switch (parent.kind) {
- case 208 /* ForInStatement */:
+ case 211 /* ForInStatement */:
return stringType;
- case 209 /* ForOfStatement */:
+ case 212 /* ForOfStatement */:
return checkRightHandSideOfForOf(parent.expression) || unknownType;
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
return getAssignedTypeOfBinaryExpression(parent);
- case 182 /* DeleteExpression */:
+ case 185 /* DeleteExpression */:
return undefinedType;
- case 171 /* ArrayLiteralExpression */:
+ case 174 /* ArrayLiteralExpression */:
return getAssignedTypeOfArrayLiteralElement(parent, node);
- case 192 /* SpreadElementExpression */:
- return getAssignedTypeOfSpreadElement(parent);
- case 253 /* PropertyAssignment */:
+ case 195 /* SpreadElement */:
+ return getAssignedTypeOfSpreadExpression(parent);
+ case 256 /* PropertyAssignment */:
return getAssignedTypeOfPropertyAssignment(parent);
- case 254 /* ShorthandPropertyAssignment */:
+ case 257 /* ShorthandPropertyAssignment */:
return getAssignedTypeOfShorthandPropertyAssignment(parent);
}
return unknownType;
@@ -30672,11 +31989,11 @@ var ts;
function getInitialTypeOfBindingElement(node) {
var pattern = node.parent;
var parentType = getInitialType(pattern.parent);
- var type = pattern.kind === 168 /* ObjectBindingPattern */ ?
+ var type = pattern.kind === 171 /* ObjectBindingPattern */ ?
getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) :
!node.dotDotDotToken ?
getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) :
- getTypeOfDestructuredSpreadElement(parentType);
+ getTypeOfDestructuredSpreadExpression(parentType);
return getTypeWithDefault(type, node.initializer);
}
function getTypeOfInitializer(node) {
@@ -30690,35 +32007,35 @@ var ts;
if (node.initializer) {
return getTypeOfInitializer(node.initializer);
}
- if (node.parent.parent.kind === 208 /* ForInStatement */) {
+ if (node.parent.parent.kind === 211 /* ForInStatement */) {
return stringType;
}
- if (node.parent.parent.kind === 209 /* ForOfStatement */) {
+ if (node.parent.parent.kind === 212 /* ForOfStatement */) {
return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType;
}
return unknownType;
}
function getInitialType(node) {
- return node.kind === 219 /* VariableDeclaration */ ?
+ return node.kind === 222 /* VariableDeclaration */ ?
getInitialTypeOfVariableDeclaration(node) :
getInitialTypeOfBindingElement(node);
}
function getInitialOrAssignedType(node) {
- return node.kind === 219 /* VariableDeclaration */ || node.kind === 170 /* BindingElement */ ?
+ return node.kind === 222 /* VariableDeclaration */ || node.kind === 173 /* BindingElement */ ?
getInitialType(node) :
getAssignedType(node);
}
function isEmptyArrayAssignment(node) {
- return node.kind === 219 /* VariableDeclaration */ && node.initializer &&
+ return node.kind === 222 /* VariableDeclaration */ && node.initializer &&
isEmptyArrayLiteral(node.initializer) ||
- node.kind !== 170 /* BindingElement */ && node.parent.kind === 188 /* BinaryExpression */ &&
+ node.kind !== 173 /* BindingElement */ && node.parent.kind === 191 /* BinaryExpression */ &&
isEmptyArrayLiteral(node.parent.right);
}
function getReferenceCandidate(node) {
switch (node.kind) {
- case 179 /* ParenthesizedExpression */:
+ case 182 /* ParenthesizedExpression */:
return getReferenceCandidate(node.expression);
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
switch (node.operatorToken.kind) {
case 57 /* EqualsToken */:
return getReferenceCandidate(node.left);
@@ -30730,13 +32047,13 @@ var ts;
}
function getReferenceRoot(node) {
var parent = node.parent;
- return parent.kind === 179 /* ParenthesizedExpression */ ||
- parent.kind === 188 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && parent.left === node ||
- parent.kind === 188 /* BinaryExpression */ && parent.operatorToken.kind === 25 /* CommaToken */ && parent.right === node ?
+ return parent.kind === 182 /* ParenthesizedExpression */ ||
+ parent.kind === 191 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && parent.left === node ||
+ parent.kind === 191 /* BinaryExpression */ && parent.operatorToken.kind === 25 /* CommaToken */ && parent.right === node ?
getReferenceRoot(parent) : node;
}
function getTypeOfSwitchClause(clause) {
- if (clause.kind === 249 /* CaseClause */) {
+ if (clause.kind === 252 /* CaseClause */) {
var caseType = getRegularTypeOfLiteralType(checkExpression(clause.expression));
return isUnitType(caseType) ? caseType : undefined;
}
@@ -30872,11 +32189,11 @@ var ts;
function isEvolvingArrayOperationTarget(node) {
var root = getReferenceRoot(node);
var parent = root.parent;
- var isLengthPushOrUnshift = parent.kind === 173 /* PropertyAccessExpression */ && (parent.name.text === "length" ||
- parent.parent.kind === 175 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name));
- var isElementAssignment = parent.kind === 174 /* ElementAccessExpression */ &&
+ var isLengthPushOrUnshift = parent.kind === 176 /* PropertyAccessExpression */ && (parent.name.text === "length" ||
+ parent.parent.kind === 178 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name));
+ var isElementAssignment = parent.kind === 177 /* ElementAccessExpression */ &&
parent.expression === root &&
- parent.parent.kind === 188 /* BinaryExpression */ &&
+ parent.parent.kind === 191 /* BinaryExpression */ &&
parent.parent.operatorToken.kind === 57 /* EqualsToken */ &&
parent.parent.left === parent &&
!ts.isAssignmentTarget(parent.parent) &&
@@ -30885,7 +32202,7 @@ var ts;
}
function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) {
var key;
- if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 246783 /* Narrowable */)) {
+ if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 1033215 /* Narrowable */)) {
return declaredType;
}
var initialType = assumeInitialized ? declaredType :
@@ -30899,7 +32216,7 @@ var ts;
// on empty arrays are possible without implicit any errors and new element types can be inferred without
// type mismatch errors.
var resultType = getObjectFlags(evolvedType) & 128 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType);
- if (reference.parent.kind === 197 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 8192 /* Never */) {
+ if (reference.parent.kind === 200 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 8192 /* Never */) {
return declaredType;
}
return resultType;
@@ -30948,7 +32265,7 @@ var ts;
else if (flow.flags & 2 /* Start */) {
// Check if we should continue with the control flow of the containing function.
var container = flow.container;
- if (container && container !== flowContainer && reference.kind !== 173 /* PropertyAccessExpression */) {
+ if (container && container !== flowContainer && reference.kind !== 176 /* PropertyAccessExpression */) {
flow = container.flowNode;
continue;
}
@@ -30974,7 +32291,7 @@ var ts;
// Assignments only narrow the computed type if the declared type is a union type. Thus, we
// only need to evaluate the assigned type if the declared type is a union type.
if (isMatchingReference(reference, node)) {
- if (node.parent.kind === 186 /* PrefixUnaryExpression */ || node.parent.kind === 187 /* PostfixUnaryExpression */) {
+ if (ts.getAssignmentTargetKind(node) === 2 /* Compound */) {
var flowType = getTypeAtFlowNode(flow.antecedent);
return createFlowType(getBaseTypeOfLiteralType(getTypeFromFlowType(flowType)), isIncomplete(flowType));
}
@@ -31002,7 +32319,7 @@ var ts;
}
function getTypeAtFlowArrayMutation(flow) {
var node = flow.node;
- var expr = node.kind === 175 /* CallExpression */ ?
+ var expr = node.kind === 178 /* CallExpression */ ?
node.expression.expression :
node.left.expression;
if (isMatchingReference(reference, getReferenceCandidate(expr))) {
@@ -31010,7 +32327,7 @@ var ts;
var type = getTypeFromFlowType(flowType);
if (getObjectFlags(type) & 128 /* EvolvingArray */) {
var evolvedType_1 = type;
- if (node.kind === 175 /* CallExpression */) {
+ if (node.kind === 178 /* CallExpression */) {
for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
var arg = _a[_i];
evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg);
@@ -31165,7 +32482,7 @@ var ts;
return cache[key] = result;
}
function isMatchingReferenceDiscriminant(expr) {
- return expr.kind === 173 /* PropertyAccessExpression */ &&
+ return expr.kind === 176 /* PropertyAccessExpression */ &&
declaredType.flags & 65536 /* Union */ &&
isMatchingReference(reference, expr.expression) &&
isDiscriminantProperty(declaredType, expr.name.text);
@@ -31199,10 +32516,10 @@ var ts;
var operator_1 = expr.operatorToken.kind;
var left_1 = getReferenceCandidate(expr.left);
var right_1 = getReferenceCandidate(expr.right);
- if (left_1.kind === 183 /* TypeOfExpression */ && right_1.kind === 9 /* StringLiteral */) {
+ if (left_1.kind === 186 /* TypeOfExpression */ && right_1.kind === 9 /* StringLiteral */) {
return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue);
}
- if (right_1.kind === 183 /* TypeOfExpression */ && left_1.kind === 9 /* StringLiteral */) {
+ if (right_1.kind === 186 /* TypeOfExpression */ && left_1.kind === 9 /* StringLiteral */) {
return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue);
}
if (isMatchingReference(reference, left_1)) {
@@ -31400,10 +32717,10 @@ var ts;
}
}
else {
- var invokedExpression = skipParenthesizedNodes(callExpression.expression);
- if (invokedExpression.kind === 174 /* ElementAccessExpression */ || invokedExpression.kind === 173 /* PropertyAccessExpression */) {
+ var invokedExpression = ts.skipParentheses(callExpression.expression);
+ if (invokedExpression.kind === 177 /* ElementAccessExpression */ || invokedExpression.kind === 176 /* PropertyAccessExpression */) {
var accessExpression = invokedExpression;
- var possibleReference = skipParenthesizedNodes(accessExpression.expression);
+ var possibleReference = ts.skipParentheses(accessExpression.expression);
if (isMatchingReference(reference, possibleReference)) {
return getNarrowedType(type, predicate.type, assumeTrue);
}
@@ -31420,15 +32737,15 @@ var ts;
switch (expr.kind) {
case 70 /* Identifier */:
case 98 /* ThisKeyword */:
- case 173 /* PropertyAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
return narrowTypeByTruthiness(type, expr, assumeTrue);
- case 175 /* CallExpression */:
+ case 178 /* CallExpression */:
return narrowTypeByTypePredicate(type, expr, assumeTrue);
- case 179 /* ParenthesizedExpression */:
+ case 182 /* ParenthesizedExpression */:
return narrowType(type, expr.expression, assumeTrue);
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
return narrowTypeByBinaryExpression(type, expr, assumeTrue);
- case 186 /* PrefixUnaryExpression */:
+ case 189 /* PrefixUnaryExpression */:
if (expr.operator === 50 /* ExclamationToken */) {
return narrowType(type, expr.operand, !assumeTrue);
}
@@ -31460,19 +32777,13 @@ var ts;
// binder), we simply return the declared type of the symbol.
return getTypeOfSymbol(symbol);
}
- function skipParenthesizedNodes(expression) {
- while (expression.kind === 179 /* ParenthesizedExpression */) {
- expression = expression.expression;
- }
- return expression;
- }
function getControlFlowContainer(node) {
while (true) {
node = node.parent;
if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) ||
- node.kind === 227 /* ModuleBlock */ ||
- node.kind === 256 /* SourceFile */ ||
- node.kind === 146 /* PropertyDeclaration */) {
+ node.kind === 230 /* ModuleBlock */ ||
+ node.kind === 260 /* SourceFile */ ||
+ node.kind === 147 /* PropertyDeclaration */) {
return node;
}
}
@@ -31504,7 +32815,7 @@ var ts;
if (node.kind === 70 /* Identifier */) {
if (ts.isAssignmentTarget(node)) {
var symbol = getResolvedSymbol(node);
- if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 143 /* Parameter */) {
+ if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 144 /* Parameter */) {
symbol.isAssigned = true;
}
}
@@ -31518,6 +32829,9 @@ var ts;
}
function checkIdentifier(node) {
var symbol = getResolvedSymbol(node);
+ if (symbol === unknownSymbol) {
+ return unknownType;
+ }
// As noted in ECMAScript 6 language spec, arrow functions never have an arguments objects.
// Although in down-level emit of arrow function, we emit it using function expression which means that
// arguments objects will be bound to the inner object; emitting arrow function natively in ES6, arguments objects
@@ -31527,16 +32841,17 @@ var ts;
if (symbol === argumentsSymbol) {
var container = ts.getContainingFunction(node);
if (languageVersion < 2 /* ES2015 */) {
- if (container.kind === 181 /* ArrowFunction */) {
+ if (container.kind === 184 /* ArrowFunction */) {
error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
}
else if (ts.hasModifier(container, 256 /* Async */)) {
error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method);
}
}
- if (node.flags & 262144 /* AwaitContext */) {
+ if (node.flags & 524288 /* AwaitContext */) {
getNodeLinks(container).flags |= 8192 /* CaptureArguments */;
}
+ return getTypeOfSymbol(symbol);
}
if (symbol.flags & 8388608 /* Alias */ && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) {
markAliasSymbolAsReferenced(symbol);
@@ -31548,7 +32863,7 @@ var ts;
// must instead be rewritten to point to a temporary variable to avoid issues with the double-bind
// behavior of class names in ES6.
if (languageVersion === 2 /* ES2015 */
- && declaration_1.kind === 222 /* ClassDeclaration */
+ && declaration_1.kind === 225 /* ClassDeclaration */
&& ts.nodeIsDecorated(declaration_1)) {
var container = ts.getContainingClass(node);
while (container !== undefined) {
@@ -31560,14 +32875,14 @@ var ts;
container = ts.getContainingClass(container);
}
}
- else if (declaration_1.kind === 193 /* ClassExpression */) {
+ else if (declaration_1.kind === 196 /* ClassExpression */) {
// When we emit a class expression with static members that contain a reference
// to the constructor in the initializer, we will need to substitute that
// binding with an alias as the class name is not in scope.
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
while (container !== undefined) {
if (container.parent === declaration_1) {
- if (container.kind === 146 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) {
+ if (container.kind === 147 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) {
getNodeLinks(declaration_1).flags |= 8388608 /* ClassWithConstructorReference */;
getNodeLinks(node).flags |= 16777216 /* ConstructorReferenceInClass */;
}
@@ -31582,23 +32897,34 @@ var ts;
checkNestedBlockScopedBinding(node, symbol);
var type = getTypeOfSymbol(localOrExportSymbol);
var declaration = localOrExportSymbol.valueDeclaration;
+ var assignmentKind = ts.getAssignmentTargetKind(node);
+ if (assignmentKind) {
+ if (!(localOrExportSymbol.flags & 3 /* Variable */)) {
+ error(node, ts.Diagnostics.Cannot_assign_to_0_because_it_is_not_a_variable, symbolToString(symbol));
+ return unknownType;
+ }
+ if (isReadonlySymbol(localOrExportSymbol)) {
+ error(node, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(symbol));
+ return unknownType;
+ }
+ }
// We only narrow variables and parameters occurring in a non-assignment position. For all other
// entities we simply return the declared type.
- if (!(localOrExportSymbol.flags & 3 /* Variable */) || ts.isAssignmentTarget(node) || !declaration) {
+ if (!(localOrExportSymbol.flags & 3 /* Variable */) || assignmentKind === 1 /* Definite */ || !declaration) {
return type;
}
// The declaration container is the innermost function that encloses the declaration of the variable
// or parameter. The flow container is the innermost function starting with which we analyze the control
// flow graph to determine the control flow based type.
- var isParameter = ts.getRootDeclaration(declaration).kind === 143 /* Parameter */;
+ var isParameter = ts.getRootDeclaration(declaration).kind === 144 /* Parameter */;
var declarationContainer = getControlFlowContainer(declaration);
var flowContainer = getControlFlowContainer(node);
var isOuterVariable = flowContainer !== declarationContainer;
// When the control flow originates in a function expression or arrow function and we are referencing
// a const variable or parameter from an outer function, we extend the origin of the control flow
// analysis to include the immediately enclosing function.
- while (flowContainer !== declarationContainer && (flowContainer.kind === 180 /* FunctionExpression */ ||
- flowContainer.kind === 181 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
+ while (flowContainer !== declarationContainer && (flowContainer.kind === 183 /* FunctionExpression */ ||
+ flowContainer.kind === 184 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
(isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {
flowContainer = getControlFlowContainer(flowContainer);
}
@@ -31626,7 +32952,7 @@ var ts;
// Return the declared type to reduce follow-on errors
return type;
}
- return flowType;
+ return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
}
function isInsideFunction(node, threshold) {
var current = node;
@@ -31641,7 +32967,7 @@ var ts;
function checkNestedBlockScopedBinding(node, symbol) {
if (languageVersion >= 2 /* ES2015 */ ||
(symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 ||
- symbol.valueDeclaration.parent.kind === 252 /* CatchClause */) {
+ symbol.valueDeclaration.parent.kind === 255 /* CatchClause */) {
return;
}
// 1. walk from the use site up to the declaration and check
@@ -31666,8 +32992,8 @@ var ts;
}
// mark variables that are declared in loop initializer and reassigned inside the body of ForStatement.
// if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back.
- if (container.kind === 207 /* ForStatement */ &&
- ts.getAncestor(symbol.valueDeclaration, 220 /* VariableDeclarationList */).parent === container &&
+ if (container.kind === 210 /* ForStatement */ &&
+ ts.getAncestor(symbol.valueDeclaration, 223 /* VariableDeclarationList */).parent === container &&
isAssignedInBodyOfForStatement(node, container)) {
getNodeLinks(symbol.valueDeclaration).flags |= 2097152 /* NeedsLoopOutParameter */;
}
@@ -31681,7 +33007,7 @@ var ts;
function isAssignedInBodyOfForStatement(node, container) {
var current = node;
// skip parenthesized nodes
- while (current.parent.kind === 179 /* ParenthesizedExpression */) {
+ while (current.parent.kind === 182 /* ParenthesizedExpression */) {
current = current.parent;
}
// check if node is used as LHS in some assignment expression
@@ -31689,7 +33015,7 @@ var ts;
if (ts.isAssignmentTarget(current)) {
isAssigned = true;
}
- else if ((current.parent.kind === 186 /* PrefixUnaryExpression */ || current.parent.kind === 187 /* PostfixUnaryExpression */)) {
+ else if ((current.parent.kind === 189 /* PrefixUnaryExpression */ || current.parent.kind === 190 /* PostfixUnaryExpression */)) {
var expr = current.parent;
isAssigned = expr.operator === 42 /* PlusPlusToken */ || expr.operator === 43 /* MinusMinusToken */;
}
@@ -31710,7 +33036,7 @@ var ts;
}
function captureLexicalThis(node, container) {
getNodeLinks(node).flags |= 2 /* LexicalThis */;
- if (container.kind === 146 /* PropertyDeclaration */ || container.kind === 149 /* Constructor */) {
+ if (container.kind === 147 /* PropertyDeclaration */ || container.kind === 150 /* Constructor */) {
var classNode = container.parent;
getNodeLinks(classNode).flags |= 4 /* CaptureThis */;
}
@@ -31758,7 +33084,7 @@ var ts;
// tell whether 'this' needs to be captured.
var container = ts.getThisContainer(node, /* includeArrowFunctions */ true);
var needToCaptureLexicalThis = false;
- if (container.kind === 149 /* Constructor */) {
+ if (container.kind === 150 /* Constructor */) {
var containingClassDecl = container.parent;
var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl);
// If a containing class does not have extends clause or the class extends null
@@ -31779,32 +33105,32 @@ var ts;
}
}
// Now skip arrow functions to get the "real" owner of 'this'.
- if (container.kind === 181 /* ArrowFunction */) {
+ if (container.kind === 184 /* ArrowFunction */) {
container = ts.getThisContainer(container, /* includeArrowFunctions */ false);
// When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code
needToCaptureLexicalThis = (languageVersion < 2 /* ES2015 */);
}
switch (container.kind) {
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
break;
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
break;
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
if (isInConstructorArgumentInitializer(node, container)) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
}
break;
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
if (ts.getModifierFlags(container) & 32 /* Static */) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer);
}
break;
- case 141 /* ComputedPropertyName */:
+ case 142 /* ComputedPropertyName */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);
break;
}
@@ -31816,7 +33142,7 @@ var ts;
// Note: a parameter initializer should refer to class-this unless function-this is explicitly annotated.
// If this is a function in a JS file, it might be a class method. Check if it's the RHS
// of a x.prototype.y = function [name]() { .... }
- if (container.kind === 180 /* FunctionExpression */ &&
+ if (container.kind === 183 /* FunctionExpression */ &&
ts.isInJavaScriptFile(container.parent) &&
ts.getSpecialPropertyAssignmentKind(container.parent) === 3 /* PrototypeProperty */) {
// Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container')
@@ -31853,28 +33179,28 @@ var ts;
}
function getTypeForThisExpressionFromJSDoc(node) {
var typeTag = ts.getJSDocTypeTag(node);
- if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 269 /* JSDocFunctionType */) {
+ if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 273 /* JSDocFunctionType */) {
var jsDocFunctionType = typeTag.typeExpression.type;
- if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 272 /* JSDocThisType */) {
+ if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 276 /* JSDocThisType */) {
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
}
}
}
function isInConstructorArgumentInitializer(node, constructorDecl) {
for (var n = node; n && n !== constructorDecl; n = n.parent) {
- if (n.kind === 143 /* Parameter */) {
+ if (n.kind === 144 /* Parameter */) {
return true;
}
}
return false;
}
function checkSuperExpression(node) {
- var isCallExpression = node.parent.kind === 175 /* CallExpression */ && node.parent.expression === node;
+ var isCallExpression = node.parent.kind === 178 /* CallExpression */ && node.parent.expression === node;
var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true);
var needToCaptureLexicalThis = false;
// adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting
if (!isCallExpression) {
- while (container && container.kind === 181 /* ArrowFunction */) {
+ while (container && container.kind === 184 /* ArrowFunction */) {
container = ts.getSuperContainer(container, /*stopOnFunctions*/ true);
needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */;
}
@@ -31888,16 +33214,16 @@ var ts;
// [super.foo()]() {}
// }
var current = node;
- while (current && current !== container && current.kind !== 141 /* ComputedPropertyName */) {
+ while (current && current !== container && current.kind !== 142 /* ComputedPropertyName */) {
current = current.parent;
}
- if (current && current.kind === 141 /* ComputedPropertyName */) {
+ if (current && current.kind === 142 /* ComputedPropertyName */) {
error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
}
else if (isCallExpression) {
error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);
}
- else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 172 /* ObjectLiteralExpression */)) {
+ else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 175 /* ObjectLiteralExpression */)) {
error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);
}
else {
@@ -31968,7 +33294,7 @@ var ts;
// This helper creates an object with a "value" property that wraps the `super` property or indexed access for both get and set.
// This is required for destructuring assignments, as a call expression cannot be used as the target of a destructuring assignment
// while a property access can.
- if (container.kind === 148 /* MethodDeclaration */ && ts.getModifierFlags(container) & 256 /* Async */) {
+ if (container.kind === 149 /* MethodDeclaration */ && ts.getModifierFlags(container) & 256 /* Async */) {
if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */;
}
@@ -31982,7 +33308,7 @@ var ts;
// in this case they should also use correct lexical this
captureLexicalThis(node.parent, container);
}
- if (container.parent.kind === 172 /* ObjectLiteralExpression */) {
+ if (container.parent.kind === 175 /* ObjectLiteralExpression */) {
if (languageVersion < 2 /* ES2015 */) {
error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);
return unknownType;
@@ -32002,7 +33328,7 @@ var ts;
}
return unknownType;
}
- if (container.kind === 149 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
+ if (container.kind === 150 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
// issue custom error message for super property access in constructor arguments (to be aligned with old compiler)
error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
return unknownType;
@@ -32017,7 +33343,7 @@ var ts;
if (isCallExpression) {
// TS 1.0 SPEC (April 2014): 4.8.1
// Super calls are only permitted in constructors of derived classes
- return container.kind === 149 /* Constructor */;
+ return container.kind === 150 /* Constructor */;
}
else {
// TS 1.0 SPEC (April 2014)
@@ -32025,21 +33351,21 @@ var ts;
// - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance
// - In a static member function or static member accessor
// topmost container must be something that is directly nested in the class declaration\object literal expression
- if (ts.isClassLike(container.parent) || container.parent.kind === 172 /* ObjectLiteralExpression */) {
+ if (ts.isClassLike(container.parent) || container.parent.kind === 175 /* ObjectLiteralExpression */) {
if (ts.getModifierFlags(container) & 32 /* Static */) {
- return container.kind === 148 /* MethodDeclaration */ ||
- container.kind === 147 /* MethodSignature */ ||
- container.kind === 150 /* GetAccessor */ ||
- container.kind === 151 /* SetAccessor */;
+ return container.kind === 149 /* MethodDeclaration */ ||
+ container.kind === 148 /* MethodSignature */ ||
+ container.kind === 151 /* GetAccessor */ ||
+ container.kind === 152 /* SetAccessor */;
}
else {
- return container.kind === 148 /* MethodDeclaration */ ||
- container.kind === 147 /* MethodSignature */ ||
- container.kind === 150 /* GetAccessor */ ||
- container.kind === 151 /* SetAccessor */ ||
- container.kind === 146 /* PropertyDeclaration */ ||
- container.kind === 145 /* PropertySignature */ ||
- container.kind === 149 /* Constructor */;
+ return container.kind === 149 /* MethodDeclaration */ ||
+ container.kind === 148 /* MethodSignature */ ||
+ container.kind === 151 /* GetAccessor */ ||
+ container.kind === 152 /* SetAccessor */ ||
+ container.kind === 147 /* PropertyDeclaration */ ||
+ container.kind === 146 /* PropertySignature */ ||
+ container.kind === 150 /* Constructor */;
}
}
}
@@ -32047,7 +33373,7 @@ var ts;
}
}
function getContextualThisParameterType(func) {
- if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 181 /* ArrowFunction */) {
+ if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 184 /* ArrowFunction */) {
var contextualSignature = getContextualSignature(func);
if (contextualSignature) {
var thisParameter = contextualSignature.thisParameter;
@@ -32113,7 +33439,7 @@ var ts;
if (declaration.type) {
return getTypeFromTypeNode(declaration.type);
}
- if (declaration.kind === 143 /* Parameter */) {
+ if (declaration.kind === 144 /* Parameter */) {
var type = getContextuallyTypedParameterType(declaration);
if (type) {
return type;
@@ -32124,11 +33450,11 @@ var ts;
}
if (ts.isBindingPattern(declaration.parent)) {
var parentDeclaration = declaration.parent.parent;
- var name_15 = declaration.propertyName || declaration.name;
+ var name_20 = declaration.propertyName || declaration.name;
if (ts.isVariableLike(parentDeclaration) &&
parentDeclaration.type &&
- !ts.isBindingPattern(name_15)) {
- var text = getTextOfPropertyName(name_15);
+ !ts.isBindingPattern(name_20)) {
+ var text = ts.getTextOfPropertyName(name_20);
if (text) {
return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text);
}
@@ -32165,7 +33491,7 @@ var ts;
}
function isInParameterInitializerBeforeContainingFunction(node) {
while (node.parent && !ts.isFunctionLike(node.parent)) {
- if (node.parent.kind === 143 /* Parameter */ && node.parent.initializer === node) {
+ if (node.parent.kind === 144 /* Parameter */ && node.parent.initializer === node) {
return true;
}
node = node.parent;
@@ -32176,8 +33502,8 @@ var ts;
// If the containing function has a return type annotation, is a constructor, or is a get accessor whose
// corresponding set accessor has a type annotation, return statements in the function are contextually typed
if (functionDecl.type ||
- functionDecl.kind === 149 /* Constructor */ ||
- functionDecl.kind === 150 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 151 /* SetAccessor */))) {
+ functionDecl.kind === 150 /* Constructor */ ||
+ functionDecl.kind === 151 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 152 /* SetAccessor */))) {
return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl));
}
// Otherwise, if the containing function is contextually typed by a function type with exactly one call signature
@@ -32199,7 +33525,7 @@ var ts;
return undefined;
}
function getContextualTypeForSubstitutionExpression(template, substitutionExpression) {
- if (template.parent.kind === 177 /* TaggedTemplateExpression */) {
+ if (template.parent.kind === 180 /* TaggedTemplateExpression */) {
return getContextualTypeForArgument(template.parent, substitutionExpression);
}
return undefined;
@@ -32327,13 +33653,13 @@ var ts;
var kind = attribute.kind;
var jsxElement = attribute.parent;
var attrsType = getJsxElementAttributesType(jsxElement);
- if (attribute.kind === 246 /* JsxAttribute */) {
+ if (attribute.kind === 249 /* JsxAttribute */) {
if (!attrsType || isTypeAny(attrsType)) {
return undefined;
}
return getTypeOfPropertyOfType(attrsType, attribute.name.text);
}
- else if (attribute.kind === 247 /* JsxSpreadAttribute */) {
+ else if (attribute.kind === 250 /* JsxSpreadAttribute */) {
return attrsType;
}
ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]");
@@ -32371,41 +33697,41 @@ var ts;
}
var parent = node.parent;
switch (parent.kind) {
- case 219 /* VariableDeclaration */:
- case 143 /* Parameter */:
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 170 /* BindingElement */:
+ case 222 /* VariableDeclaration */:
+ case 144 /* Parameter */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 173 /* BindingElement */:
return getContextualTypeForInitializerExpression(node);
- case 181 /* ArrowFunction */:
- case 212 /* ReturnStatement */:
+ case 184 /* ArrowFunction */:
+ case 215 /* ReturnStatement */:
return getContextualTypeForReturnExpression(node);
- case 191 /* YieldExpression */:
+ case 194 /* YieldExpression */:
return getContextualTypeForYieldOperand(parent);
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
return getContextualTypeForArgument(parent, node);
- case 178 /* TypeAssertionExpression */:
- case 196 /* AsExpression */:
+ case 181 /* TypeAssertionExpression */:
+ case 199 /* AsExpression */:
return getTypeFromTypeNode(parent.type);
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
return getContextualTypeForBinaryOperand(node);
- case 253 /* PropertyAssignment */:
- case 254 /* ShorthandPropertyAssignment */:
+ case 256 /* PropertyAssignment */:
+ case 257 /* ShorthandPropertyAssignment */:
return getContextualTypeForObjectLiteralElement(parent);
- case 171 /* ArrayLiteralExpression */:
+ case 174 /* ArrayLiteralExpression */:
return getContextualTypeForElementExpression(node);
- case 189 /* ConditionalExpression */:
+ case 192 /* ConditionalExpression */:
return getContextualTypeForConditionalOperand(node);
- case 198 /* TemplateSpan */:
- ts.Debug.assert(parent.parent.kind === 190 /* TemplateExpression */);
+ case 201 /* TemplateSpan */:
+ ts.Debug.assert(parent.parent.kind === 193 /* TemplateExpression */);
return getContextualTypeForSubstitutionExpression(parent.parent, node);
- case 179 /* ParenthesizedExpression */:
+ case 182 /* ParenthesizedExpression */:
return getContextualType(parent);
- case 248 /* JsxExpression */:
+ case 251 /* JsxExpression */:
return getContextualType(parent);
- case 246 /* JsxAttribute */:
- case 247 /* JsxSpreadAttribute */:
+ case 249 /* JsxAttribute */:
+ case 250 /* JsxSpreadAttribute */:
return getContextualTypeForJsxAttribute(parent);
}
return undefined;
@@ -32437,7 +33763,7 @@ var ts;
return sourceLength < targetParameterCount;
}
function isFunctionExpressionOrArrowFunction(node) {
- return node.kind === 180 /* FunctionExpression */ || node.kind === 181 /* ArrowFunction */;
+ return node.kind === 183 /* FunctionExpression */ || node.kind === 184 /* ArrowFunction */;
}
function getContextualSignatureForFunctionLikeDeclaration(node) {
// Only function expressions, arrow functions, and object literal methods are contextually typed.
@@ -32456,7 +33782,7 @@ var ts;
// all identical ignoring their return type, the result is same signature but with return type as
// union type of return types from these signatures
function getContextualSignature(node) {
- ts.Debug.assert(node.kind !== 148 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
var type = getContextualTypeForFunctionLikeDeclaration(node);
if (!type) {
return undefined;
@@ -32512,7 +33838,7 @@ var ts;
function isInferentialContext(mapper) {
return mapper && mapper.context;
}
- function checkSpreadElementExpression(node, contextualMapper) {
+ function checkSpreadExpression(node, contextualMapper) {
// It is usually not safe to call checkExpressionCached if we can be contextually typing.
// You can tell that we are contextually typing because of the contextualMapper parameter.
// While it is true that a spread element can have a contextual type, it does not do anything
@@ -32523,8 +33849,8 @@ var ts;
return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false);
}
function hasDefaultValue(node) {
- return (node.kind === 170 /* BindingElement */ && !!node.initializer) ||
- (node.kind === 188 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */);
+ return (node.kind === 173 /* BindingElement */ && !!node.initializer) ||
+ (node.kind === 191 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */);
}
function checkArrayLiteral(node, contextualMapper) {
var elements = node.elements;
@@ -32533,7 +33859,7 @@ var ts;
var inDestructuringPattern = ts.isAssignmentTarget(node);
for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {
var e = elements_1[_i];
- if (inDestructuringPattern && e.kind === 192 /* SpreadElementExpression */) {
+ if (inDestructuringPattern && e.kind === 195 /* SpreadElement */) {
// Given the following situation:
// var c: {};
// [...c] = ["", 0];
@@ -32557,7 +33883,7 @@ var ts;
var type = checkExpressionForMutableLocation(e, contextualMapper);
elementTypes.push(type);
}
- hasSpreadElement = hasSpreadElement || e.kind === 192 /* SpreadElementExpression */;
+ hasSpreadElement = hasSpreadElement || e.kind === 195 /* SpreadElement */;
}
if (!hasSpreadElement) {
// If array literal is actually a destructuring pattern, mark it as an implied type. We do this such
@@ -32572,7 +33898,7 @@ var ts;
var pattern = contextualType.pattern;
// If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting
// tuple type with the corresponding binding or assignment element types to make the lengths equal.
- if (pattern && (pattern.kind === 169 /* ArrayBindingPattern */ || pattern.kind === 171 /* ArrayLiteralExpression */)) {
+ if (pattern && (pattern.kind === 172 /* ArrayBindingPattern */ || pattern.kind === 174 /* ArrayLiteralExpression */)) {
var patternElements = pattern.elements;
for (var i = elementTypes.length; i < patternElements.length; i++) {
var patternElement = patternElements[i];
@@ -32580,7 +33906,7 @@ var ts;
elementTypes.push(contextualType.typeArguments[i]);
}
else {
- if (patternElement.kind !== 194 /* OmittedExpression */) {
+ if (patternElement.kind !== 197 /* OmittedExpression */) {
error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
}
elementTypes.push(unknownType);
@@ -32597,7 +33923,7 @@ var ts;
strictNullChecks ? neverType : undefinedWideningType);
}
function isNumericName(name) {
- return name.kind === 141 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text);
+ return name.kind === 142 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text);
}
function isNumericComputedName(name) {
// It seems odd to consider an expression of type Any to result in a numeric name,
@@ -32665,9 +33991,11 @@ var ts;
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
var propertiesTable = ts.createMap();
var propertiesArray = [];
+ var spread = emptyObjectType;
+ var propagatedFlags = 0;
var contextualType = getApparentTypeOfContextualType(node);
var contextualTypeHasPattern = contextualType && contextualType.pattern &&
- (contextualType.pattern.kind === 168 /* ObjectBindingPattern */ || contextualType.pattern.kind === 172 /* ObjectLiteralExpression */);
+ (contextualType.pattern.kind === 171 /* ObjectBindingPattern */ || contextualType.pattern.kind === 175 /* ObjectLiteralExpression */);
var typeFlags = 0;
var patternWithComputedProperties = false;
var hasComputedStringProperty = false;
@@ -32675,18 +34003,18 @@ var ts;
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var memberDecl = _a[_i];
var member = memberDecl.symbol;
- if (memberDecl.kind === 253 /* PropertyAssignment */ ||
- memberDecl.kind === 254 /* ShorthandPropertyAssignment */ ||
+ if (memberDecl.kind === 256 /* PropertyAssignment */ ||
+ memberDecl.kind === 257 /* ShorthandPropertyAssignment */ ||
ts.isObjectLiteralMethod(memberDecl)) {
var type = void 0;
- if (memberDecl.kind === 253 /* PropertyAssignment */) {
+ if (memberDecl.kind === 256 /* PropertyAssignment */) {
type = checkPropertyAssignment(memberDecl, contextualMapper);
}
- else if (memberDecl.kind === 148 /* MethodDeclaration */) {
+ else if (memberDecl.kind === 149 /* MethodDeclaration */) {
type = checkObjectLiteralMethod(memberDecl, contextualMapper);
}
else {
- ts.Debug.assert(memberDecl.kind === 254 /* ShorthandPropertyAssignment */);
+ ts.Debug.assert(memberDecl.kind === 257 /* ShorthandPropertyAssignment */);
type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper);
}
typeFlags |= type.flags;
@@ -32694,8 +34022,8 @@ var ts;
if (inDestructuringPattern) {
// If object literal is an assignment pattern and if the assignment pattern specifies a default value
// for the property, make the property optional.
- var isOptional = (memberDecl.kind === 253 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) ||
- (memberDecl.kind === 254 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer);
+ var isOptional = (memberDecl.kind === 256 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) ||
+ (memberDecl.kind === 257 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer);
if (isOptional) {
prop.flags |= 536870912 /* Optional */;
}
@@ -32723,13 +34051,30 @@ var ts;
prop.target = member;
member = prop;
}
+ else if (memberDecl.kind === 258 /* SpreadAssignment */) {
+ if (propertiesArray.length > 0) {
+ spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true);
+ propertiesArray = [];
+ propertiesTable = ts.createMap();
+ hasComputedStringProperty = false;
+ hasComputedNumberProperty = false;
+ typeFlags = 0;
+ }
+ var type = checkExpression(memberDecl.expression);
+ if (!(type.flags & (32768 /* Object */ | 1 /* Any */))) {
+ error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types);
+ return unknownType;
+ }
+ spread = getSpreadType(spread, type, /*isFromObjectLiteral*/ false);
+ continue;
+ }
else {
// TypeScript 1.0 spec (April 2014)
// A get accessor declaration is processed in the same manner as
// an ordinary function declaration(section 6.1) with no parameters.
// A set accessor declaration is processed in the same manner
// as an ordinary function declaration with a single parameter and a Void return type.
- ts.Debug.assert(memberDecl.kind === 150 /* GetAccessor */ || memberDecl.kind === 151 /* SetAccessor */);
+ ts.Debug.assert(memberDecl.kind === 151 /* GetAccessor */ || memberDecl.kind === 152 /* SetAccessor */);
checkAccessorDeclaration(memberDecl);
}
if (ts.hasDynamicName(memberDecl)) {
@@ -32759,19 +34104,33 @@ var ts;
}
}
}
- var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0 /* String */) : undefined;
- var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1 /* Number */) : undefined;
- var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
- var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 262144 /* FreshLiteral */;
- result.flags |= 1048576 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 3670016 /* PropagatingFlags */);
- result.objectFlags |= 64 /* ObjectLiteral */;
- if (patternWithComputedProperties) {
- result.objectFlags |= 256 /* ObjectLiteralPatternWithComputedProperties */;
+ if (spread !== emptyObjectType) {
+ if (propertiesArray.length > 0) {
+ spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true);
+ }
+ spread.flags |= propagatedFlags;
+ spread.symbol = node.symbol;
+ return spread;
}
- if (inDestructuringPattern) {
- result.pattern = node;
+ return createObjectLiteralType();
+ function createObjectLiteralType() {
+ var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0 /* String */) : undefined;
+ var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1 /* Number */) : undefined;
+ var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
+ var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshLiteral */;
+ result.flags |= 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */);
+ result.objectFlags |= 64 /* ObjectLiteral */;
+ if (patternWithComputedProperties) {
+ result.objectFlags |= 256 /* ObjectLiteralPatternWithComputedProperties */;
+ }
+ if (inDestructuringPattern) {
+ result.pattern = node;
+ }
+ if (!(result.flags & 6144 /* Nullable */)) {
+ propagatedFlags |= (result.flags & 14680064 /* PropagatingFlags */);
+ }
+ return result;
}
- return result;
}
function checkJsxSelfClosingElement(node) {
checkJsxOpeningLikeElement(node);
@@ -32791,13 +34150,13 @@ var ts;
for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
var child = _a[_i];
switch (child.kind) {
- case 248 /* JsxExpression */:
+ case 251 /* JsxExpression */:
checkJsxExpression(child);
break;
- case 242 /* JsxElement */:
+ case 245 /* JsxElement */:
checkJsxElement(child);
break;
- case 243 /* JsxSelfClosingElement */:
+ case 246 /* JsxSelfClosingElement */:
checkJsxSelfClosingElement(child);
break;
}
@@ -32816,7 +34175,7 @@ var ts;
*/
function isJsxIntrinsicIdentifier(tagName) {
// TODO (yuisu): comment
- if (tagName.kind === 173 /* PropertyAccessExpression */ || tagName.kind === 98 /* ThisKeyword */) {
+ if (tagName.kind === 176 /* PropertyAccessExpression */ || tagName.kind === 98 /* ThisKeyword */) {
return false;
}
else {
@@ -32834,7 +34193,7 @@ var ts;
var correspondingPropSymbol = getPropertyOfType(elementAttributesType, node.name.text);
correspondingPropType = correspondingPropSymbol && getTypeOfSymbol(correspondingPropSymbol);
if (isUnhyphenatedJsxName(node.name.text)) {
- var attributeType = getTypeOfPropertyOfType(elementAttributesType, getTextOfPropertyName(node.name)) || getIndexTypeOfType(elementAttributesType, 0 /* String */);
+ var attributeType = getTypeOfPropertyOfType(elementAttributesType, ts.getTextOfPropertyName(node.name)) || getIndexTypeOfType(elementAttributesType, 0 /* String */);
if (attributeType) {
correspondingPropType = attributeType;
}
@@ -33148,10 +34507,10 @@ var ts;
function checkJsxOpeningLikeElement(node) {
checkGrammarJsxElement(node);
checkJsxPreconditions(node);
- // The reactNamespace symbol should be marked as 'used' so we don't incorrectly elide its import. And if there
- // is no reactNamespace symbol in scope when targeting React emit, we should issue an error.
+ // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
+ // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
var reactRefErr = compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
- var reactNamespace = compilerOptions.reactNamespace ? compilerOptions.reactNamespace : "React";
+ var reactNamespace = getJsxNamespace();
var reactSym = resolveName(node.tagName, reactNamespace, 107455 /* Value */, reactRefErr, reactNamespace);
if (reactSym) {
// Mark local symbol as referenced here because it might not have been marked
@@ -33169,11 +34528,11 @@ var ts;
// thus should have their types ignored
var sawSpreadedAny = false;
for (var i = node.attributes.length - 1; i >= 0; i--) {
- if (node.attributes[i].kind === 246 /* JsxAttribute */) {
+ if (node.attributes[i].kind === 249 /* JsxAttribute */) {
checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable);
}
else {
- ts.Debug.assert(node.attributes[i].kind === 247 /* JsxSpreadAttribute */);
+ ts.Debug.assert(node.attributes[i].kind === 250 /* JsxSpreadAttribute */);
var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable);
if (isTypeAny(spreadType)) {
sawSpreadedAny = true;
@@ -33203,7 +34562,7 @@ var ts;
// If a symbol is a synthesized symbol with no value declaration, we assume it is a property. Example of this are the synthesized
// '.prototype' property as well as synthesized tuple index properties.
function getDeclarationKindFromSymbol(s) {
- return s.valueDeclaration ? s.valueDeclaration.kind : 146 /* PropertyDeclaration */;
+ return s.valueDeclaration ? s.valueDeclaration.kind : 147 /* PropertyDeclaration */;
}
function getDeclarationModifierFlagsFromSymbol(s) {
return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 4 /* Public */ | 32 /* Static */ : 0;
@@ -33222,7 +34581,7 @@ var ts;
function checkClassPropertyAccess(node, left, type, prop) {
var flags = getDeclarationModifierFlagsFromSymbol(prop);
var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop));
- var errorNode = node.kind === 173 /* PropertyAccessExpression */ || node.kind === 219 /* VariableDeclaration */ ?
+ var errorNode = node.kind === 176 /* PropertyAccessExpression */ || node.kind === 222 /* VariableDeclaration */ ?
node.name :
node.right;
if (left.kind === 96 /* SuperKeyword */) {
@@ -33233,7 +34592,7 @@ var ts;
// - In a static member function or static member accessor
// where this references the constructor function object of a derived class,
// a super property access is permitted and must specify a public static member function of the base class.
- if (languageVersion < 2 /* ES2015 */ && getDeclarationKindFromSymbol(prop) !== 148 /* MethodDeclaration */) {
+ if (languageVersion < 2 /* ES2015 */ && getDeclarationKindFromSymbol(prop) !== 149 /* MethodDeclaration */) {
// `prop` refers to a *property* declared in the super class
// rather than a *method*, so it does not satisfy the above criteria.
error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword);
@@ -33313,6 +34672,33 @@ var ts;
function checkQualifiedName(node) {
return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right);
}
+ function reportNonexistentProperty(propNode, containingType) {
+ var errorInfo;
+ if (containingType.flags & 65536 /* Union */ && !(containingType.flags & 8190 /* Primitive */)) {
+ for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) {
+ var subtype = _a[_i];
+ if (!getPropertyOfType(subtype, propNode.text)) {
+ errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(subtype));
+ break;
+ }
+ }
+ }
+ errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(containingType));
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(propNode, errorInfo));
+ }
+ function markPropertyAsReferenced(prop) {
+ if (prop &&
+ noUnusedIdentifiers &&
+ (prop.flags & 106500 /* ClassMember */) &&
+ prop.valueDeclaration && (ts.getModifierFlags(prop.valueDeclaration) & 8 /* Private */)) {
+ if (prop.flags & 16777216 /* Instantiated */) {
+ getSymbolLinks(prop).target.isReferenced = true;
+ }
+ else {
+ prop.isReferenced = true;
+ }
+ }
+ }
function checkPropertyAccessExpressionOrQualifiedName(node, left, right) {
var type = checkNonNullExpression(left);
if (isTypeAny(type) || type === silentNeverType) {
@@ -33330,47 +34716,32 @@ var ts;
}
return unknownType;
}
- if (noUnusedIdentifiers &&
- (prop.flags & 106500 /* ClassMember */) &&
- prop.valueDeclaration && (ts.getModifierFlags(prop.valueDeclaration) & 8 /* Private */)) {
- if (prop.flags & 16777216 /* Instantiated */) {
- getSymbolLinks(prop).target.isReferenced = true;
- }
- else {
- prop.isReferenced = true;
- }
- }
+ markPropertyAsReferenced(prop);
getNodeLinks(node).resolvedSymbol = prop;
if (prop.parent && prop.parent.flags & 32 /* Class */) {
checkClassPropertyAccess(node, left, apparentType, prop);
}
var propType = getTypeOfSymbol(prop);
+ var assignmentKind = ts.getAssignmentTargetKind(node);
+ if (assignmentKind) {
+ if (isReferenceToReadonlyEntity(node, prop) || isReferenceThroughNamespaceImport(node)) {
+ error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, right.text);
+ return unknownType;
+ }
+ }
// Only compute control flow type if this is a property access expression that isn't an
// assignment target, and the referenced property was declared as a variable, property,
// accessor, or optional method.
- if (node.kind !== 173 /* PropertyAccessExpression */ || ts.isAssignmentTarget(node) ||
+ if (node.kind !== 176 /* PropertyAccessExpression */ || assignmentKind === 1 /* Definite */ ||
!(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) &&
!(prop.flags & 8192 /* Method */ && propType.flags & 65536 /* Union */)) {
return propType;
}
- return getFlowTypeOfReference(node, propType, /*assumeInitialized*/ true, /*flowContainer*/ undefined);
- function reportNonexistentProperty(propNode, containingType) {
- var errorInfo;
- if (containingType.flags & 65536 /* Union */ && !(containingType.flags & 8190 /* Primitive */)) {
- for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) {
- var subtype = _a[_i];
- if (!getPropertyOfType(subtype, propNode.text)) {
- errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(subtype));
- break;
- }
- }
- }
- errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(containingType));
- diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(propNode, errorInfo));
- }
+ var flowType = getFlowTypeOfReference(node, propType, /*assumeInitialized*/ true, /*flowContainer*/ undefined);
+ return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
}
function isValidPropertyAccess(node, propertyName) {
- var left = node.kind === 173 /* PropertyAccessExpression */
+ var left = node.kind === 176 /* PropertyAccessExpression */
? node.expression
: node.left;
var type = checkExpression(left);
@@ -33387,7 +34758,7 @@ var ts;
*/
function getForInVariableSymbol(node) {
var initializer = node.initializer;
- if (initializer.kind === 220 /* VariableDeclarationList */) {
+ if (initializer.kind === 223 /* VariableDeclarationList */) {
var variable = initializer.declarations[0];
if (variable && !ts.isBindingPattern(variable.name)) {
return getSymbolOfNode(variable);
@@ -33409,14 +34780,14 @@ var ts;
* that references a for-in variable for an object with numeric property names.
*/
function isForInVariableForNumericPropertyNames(expr) {
- var e = skipParenthesizedNodes(expr);
+ var e = ts.skipParentheses(expr);
if (e.kind === 70 /* Identifier */) {
var symbol = getResolvedSymbol(e);
if (symbol.flags & 3 /* Variable */) {
var child = expr;
var node = expr.parent;
while (node) {
- if (node.kind === 208 /* ForInStatement */ &&
+ if (node.kind === 211 /* ForInStatement */ &&
child === node.statement &&
getForInVariableSymbol(node) === symbol &&
hasNumericPropertyNames(checkExpression(node.expression))) {
@@ -33430,10 +34801,11 @@ var ts;
return false;
}
function checkIndexedAccess(node) {
- // Grammar checking
- if (!node.argumentExpression) {
+ var objectType = checkNonNullExpression(node.expression);
+ var indexExpression = node.argumentExpression;
+ if (!indexExpression) {
var sourceFile = ts.getSourceFileOfNode(node);
- if (node.parent.kind === 176 /* NewExpression */ && node.parent.expression === node) {
+ if (node.parent.kind === 179 /* NewExpression */ && node.parent.expression === node) {
var start = ts.skipTrivia(sourceFile.text, node.expression.end);
var end = node.end;
grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead);
@@ -33443,101 +34815,18 @@ var ts;
var end = node.end;
grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected);
}
+ return unknownType;
}
- // Obtain base constraint such that we can bail out if the constraint is an unknown type
- var objectType = getApparentType(checkNonNullExpression(node.expression));
- var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType;
+ var indexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : checkExpression(indexExpression);
if (objectType === unknownType || objectType === silentNeverType) {
return objectType;
}
- var isConstEnum = isConstEnumObjectType(objectType);
- if (isConstEnum &&
- (!node.argumentExpression || node.argumentExpression.kind !== 9 /* StringLiteral */)) {
- error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
+ if (isConstEnumObjectType(objectType) && indexExpression.kind !== 9 /* StringLiteral */) {
+ error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
return unknownType;
}
- // TypeScript 1.0 spec (April 2014): 4.10 Property Access
- // - If IndexExpr is a string literal or a numeric literal and ObjExpr's apparent type has a property with the name
- // given by that literal(converted to its string representation in the case of a numeric literal), the property access is of the type of that property.
- // - Otherwise, if ObjExpr's apparent type has a numeric index signature and IndexExpr is of type Any, the Number primitive type, or an enum type,
- // the property access is of the type of that index signature.
- // - Otherwise, if ObjExpr's apparent type has a string index signature and IndexExpr is of type Any, the String or Number primitive type, or an enum type,
- // the property access is of the type of that index signature.
- // - Otherwise, if IndexExpr is of type Any, the String or Number primitive type, or an enum type, the property access is of type Any.
- // See if we can index as a property.
- if (node.argumentExpression) {
- var name_16 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType);
- if (name_16 !== undefined) {
- var prop = getPropertyOfType(objectType, name_16);
- if (prop) {
- getNodeLinks(node).resolvedSymbol = prop;
- return getTypeOfSymbol(prop);
- }
- else if (isConstEnum) {
- error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name_16, symbolToString(objectType.symbol));
- return unknownType;
- }
- }
- }
- // Check for compatible indexer types.
- var allowedNullableFlags = strictNullChecks ? 0 : 6144 /* Nullable */;
- if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 34 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */ | allowedNullableFlags)) {
- // Try to use a number indexer.
- if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 /* NumberLike */ | allowedNullableFlags) || isForInVariableForNumericPropertyNames(node.argumentExpression)) {
- var numberIndexInfo = getIndexInfoOfType(objectType, 1 /* Number */);
- if (numberIndexInfo) {
- getNodeLinks(node).resolvedIndexInfo = numberIndexInfo;
- return numberIndexInfo.type;
- }
- }
- // Try to use string indexing.
- var stringIndexInfo = getIndexInfoOfType(objectType, 0 /* String */);
- if (stringIndexInfo) {
- getNodeLinks(node).resolvedIndexInfo = stringIndexInfo;
- return stringIndexInfo.type;
- }
- // Fall back to any.
- if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !isTypeAny(objectType)) {
- error(node, getIndexTypeOfType(objectType, 1 /* Number */) ?
- ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number :
- ts.Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type);
- }
- return anyType;
- }
- // REVIEW: Users should know the type that was actually used.
- error(node, ts.Diagnostics.An_index_expression_argument_must_be_of_type_string_number_symbol_or_any);
- return unknownType;
+ return getIndexedAccessType(objectType, indexType, node);
}
- /**
- * If indexArgumentExpression is a string literal or number literal, returns its text.
- * If indexArgumentExpression is a constant value, returns its string value.
- * If indexArgumentExpression is a well known symbol, returns the property name corresponding
- * to this symbol, as long as it is a proper symbol reference.
- * Otherwise, returns undefined.
- */
- function getPropertyNameForIndexedAccess(indexArgumentExpression, indexArgumentType) {
- if (indexArgumentExpression.kind === 9 /* StringLiteral */ || indexArgumentExpression.kind === 8 /* NumericLiteral */) {
- return indexArgumentExpression.text;
- }
- if (indexArgumentExpression.kind === 174 /* ElementAccessExpression */ || indexArgumentExpression.kind === 173 /* PropertyAccessExpression */) {
- var value = getConstantValue(indexArgumentExpression);
- if (value !== undefined) {
- return value.toString();
- }
- }
- if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, /*reportError*/ false)) {
- var rightHandSideName = indexArgumentExpression.name.text;
- return ts.getPropertyNameForKnownSymbolName(rightHandSideName);
- }
- return undefined;
- }
- /**
- * A proper symbol reference requires the following:
- * 1. The property access denotes a property that exists
- * 2. The expression is of the form Symbol.
- * 3. The property access is of the primitive type symbol.
- * 4. Symbol in this context resolves to the global Symbol object
- */
function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) {
if (expressionType === unknownType) {
// There is already an error, so no need to report one.
@@ -33574,10 +34863,10 @@ var ts;
return true;
}
function resolveUntypedCall(node) {
- if (node.kind === 177 /* TaggedTemplateExpression */) {
+ if (node.kind === 180 /* TaggedTemplateExpression */) {
checkExpression(node.template);
}
- else if (node.kind !== 144 /* Decorator */) {
+ else if (node.kind !== 145 /* Decorator */) {
ts.forEach(node.arguments, function (argument) {
checkExpression(argument);
});
@@ -33607,13 +34896,13 @@ var ts;
for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) {
var signature = signatures_2[_i];
var symbol = signature.declaration && getSymbolOfNode(signature.declaration);
- var parent_11 = signature.declaration && signature.declaration.parent;
+ var parent_10 = signature.declaration && signature.declaration.parent;
if (!lastSymbol || symbol === lastSymbol) {
- if (lastParent && parent_11 === lastParent) {
+ if (lastParent && parent_10 === lastParent) {
index++;
}
else {
- lastParent = parent_11;
+ lastParent = parent_10;
index = cutoffIndex;
}
}
@@ -33621,7 +34910,7 @@ var ts;
// current declaration belongs to a different symbol
// set cutoffIndex so re-orderings in the future won't change result set from 0 to cutoffIndex
index = cutoffIndex = result.length;
- lastParent = parent_11;
+ lastParent = parent_10;
}
lastSymbol = symbol;
// specialized signatures always need to be placed before non-specialized signatures regardless
@@ -33643,7 +34932,7 @@ var ts;
function getSpreadArgumentIndex(args) {
for (var i = 0; i < args.length; i++) {
var arg = args[i];
- if (arg && arg.kind === 192 /* SpreadElementExpression */) {
+ if (arg && arg.kind === 195 /* SpreadElement */) {
return i;
}
}
@@ -33656,13 +34945,13 @@ var ts;
var callIsIncomplete; // In incomplete call we want to be lenient when we have too few arguments
var isDecorator;
var spreadArgIndex = -1;
- if (node.kind === 177 /* TaggedTemplateExpression */) {
+ if (node.kind === 180 /* TaggedTemplateExpression */) {
var tagExpression = node;
// Even if the call is incomplete, we'll have a missing expression as our last argument,
// so we can say the count is just the arg list length
argCount = args.length;
typeArguments = undefined;
- if (tagExpression.template.kind === 190 /* TemplateExpression */) {
+ if (tagExpression.template.kind === 193 /* TemplateExpression */) {
// If a tagged template expression lacks a tail literal, the call is incomplete.
// Specifically, a template only can end in a TemplateTail or a Missing literal.
var templateExpression = tagExpression.template;
@@ -33679,7 +34968,7 @@ var ts;
callIsIncomplete = !!templateLiteral.isUnterminated;
}
}
- else if (node.kind === 144 /* Decorator */) {
+ else if (node.kind === 145 /* Decorator */) {
isDecorator = true;
typeArguments = undefined;
argCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature);
@@ -33688,7 +34977,7 @@ var ts;
var callExpression = node;
if (!callExpression.arguments) {
// This only happens when we have something of the form: 'new C'
- ts.Debug.assert(callExpression.kind === 176 /* NewExpression */);
+ ts.Debug.assert(callExpression.kind === 179 /* NewExpression */);
return signature.minArgumentCount === 0;
}
argCount = signatureHelpTrailingComma ? args.length + 1 : args.length;
@@ -33772,7 +35061,7 @@ var ts;
for (var i = 0; i < argCount; i++) {
var arg = getEffectiveArgument(node, args, i);
// If the effective argument is 'undefined', then it is an argument that is present but is synthetic.
- if (arg === undefined || arg.kind !== 194 /* OmittedExpression */) {
+ if (arg === undefined || arg.kind !== 197 /* OmittedExpression */) {
var paramType = getTypeAtPosition(signature, i);
var argType = getEffectiveArgumentType(node, i);
// If the effective argument type is 'undefined', there is no synthetic type
@@ -33829,7 +35118,7 @@ var ts;
}
function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) {
var thisType = getThisTypeOfSignature(signature);
- if (thisType && thisType !== voidType && node.kind !== 176 /* NewExpression */) {
+ if (thisType && thisType !== voidType && node.kind !== 179 /* NewExpression */) {
// If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType
// If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible.
// If the expression is a new expression, then the check is skipped.
@@ -33846,7 +35135,7 @@ var ts;
for (var i = 0; i < argCount; i++) {
var arg = getEffectiveArgument(node, args, i);
// If the effective argument is 'undefined', then it is an argument that is present but is synthetic.
- if (arg === undefined || arg.kind !== 194 /* OmittedExpression */) {
+ if (arg === undefined || arg.kind !== 197 /* OmittedExpression */) {
// Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter)
var paramType = getTypeAtPosition(signature, i);
var argType = getEffectiveArgumentType(node, i);
@@ -33868,12 +35157,12 @@ var ts;
* Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise.
*/
function getThisArgumentOfCall(node) {
- if (node.kind === 175 /* CallExpression */) {
+ if (node.kind === 178 /* CallExpression */) {
var callee = node.expression;
- if (callee.kind === 173 /* PropertyAccessExpression */) {
+ if (callee.kind === 176 /* PropertyAccessExpression */) {
return callee.expression;
}
- else if (callee.kind === 174 /* ElementAccessExpression */) {
+ else if (callee.kind === 177 /* ElementAccessExpression */) {
return callee.expression;
}
}
@@ -33889,16 +35178,16 @@ var ts;
*/
function getEffectiveCallArguments(node) {
var args;
- if (node.kind === 177 /* TaggedTemplateExpression */) {
+ if (node.kind === 180 /* TaggedTemplateExpression */) {
var template = node.template;
args = [undefined];
- if (template.kind === 190 /* TemplateExpression */) {
+ if (template.kind === 193 /* TemplateExpression */) {
ts.forEach(template.templateSpans, function (span) {
args.push(span.expression);
});
}
}
- else if (node.kind === 144 /* Decorator */) {
+ else if (node.kind === 145 /* Decorator */) {
// For a decorator, we return undefined as we will determine
// the number and types of arguments for a decorator using
// `getEffectiveArgumentCount` and `getEffectiveArgumentType` below.
@@ -33923,19 +35212,19 @@ var ts;
* Otherwise, the argument count is the length of the 'args' array.
*/
function getEffectiveArgumentCount(node, args, signature) {
- if (node.kind === 144 /* Decorator */) {
+ if (node.kind === 145 /* Decorator */) {
switch (node.parent.kind) {
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
// A class decorator will have one argument (see `ClassDecorator` in core.d.ts)
return 1;
- case 146 /* PropertyDeclaration */:
+ case 147 /* PropertyDeclaration */:
// A property declaration decorator will have two arguments (see
// `PropertyDecorator` in core.d.ts)
return 2;
- case 148 /* MethodDeclaration */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 149 /* MethodDeclaration */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
// A method or accessor declaration decorator will have two or three arguments (see
// `PropertyDecorator` and `MethodDecorator` in core.d.ts)
// If we are emitting decorators for ES3, we will only pass two arguments.
@@ -33945,7 +35234,7 @@ var ts;
// If the method decorator signature only accepts a target and a key, we will only
// type check those arguments.
return signature.parameters.length >= 3 ? 3 : 2;
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
// A parameter declaration decorator will have three arguments (see
// `ParameterDecorator` in core.d.ts)
return 3;
@@ -33969,25 +35258,25 @@ var ts;
*/
function getEffectiveDecoratorFirstArgumentType(node) {
// The first argument to a decorator is its `target`.
- if (node.kind === 222 /* ClassDeclaration */) {
+ if (node.kind === 225 /* ClassDeclaration */) {
// For a class decorator, the `target` is the type of the class (e.g. the
// "static" or "constructor" side of the class)
var classSymbol = getSymbolOfNode(node);
return getTypeOfSymbol(classSymbol);
}
- if (node.kind === 143 /* Parameter */) {
+ if (node.kind === 144 /* Parameter */) {
// For a parameter decorator, the `target` is the parent type of the
// parameter's containing method.
node = node.parent;
- if (node.kind === 149 /* Constructor */) {
+ if (node.kind === 150 /* Constructor */) {
var classSymbol = getSymbolOfNode(node);
return getTypeOfSymbol(classSymbol);
}
}
- if (node.kind === 146 /* PropertyDeclaration */ ||
- node.kind === 148 /* MethodDeclaration */ ||
- node.kind === 150 /* GetAccessor */ ||
- node.kind === 151 /* SetAccessor */) {
+ if (node.kind === 147 /* PropertyDeclaration */ ||
+ node.kind === 149 /* MethodDeclaration */ ||
+ node.kind === 151 /* GetAccessor */ ||
+ node.kind === 152 /* SetAccessor */) {
// For a property or method decorator, the `target` is the
// "static"-side type of the parent of the member if the member is
// declared "static"; otherwise, it is the "instance"-side type of the
@@ -34014,21 +35303,21 @@ var ts;
*/
function getEffectiveDecoratorSecondArgumentType(node) {
// The second argument to a decorator is its `propertyKey`
- if (node.kind === 222 /* ClassDeclaration */) {
+ if (node.kind === 225 /* ClassDeclaration */) {
ts.Debug.fail("Class decorators should not have a second synthetic argument.");
return unknownType;
}
- if (node.kind === 143 /* Parameter */) {
+ if (node.kind === 144 /* Parameter */) {
node = node.parent;
- if (node.kind === 149 /* Constructor */) {
+ if (node.kind === 150 /* Constructor */) {
// For a constructor parameter decorator, the `propertyKey` will be `undefined`.
return anyType;
}
}
- if (node.kind === 146 /* PropertyDeclaration */ ||
- node.kind === 148 /* MethodDeclaration */ ||
- node.kind === 150 /* GetAccessor */ ||
- node.kind === 151 /* SetAccessor */) {
+ if (node.kind === 147 /* PropertyDeclaration */ ||
+ node.kind === 149 /* MethodDeclaration */ ||
+ node.kind === 151 /* GetAccessor */ ||
+ node.kind === 152 /* SetAccessor */) {
// The `propertyKey` for a property or method decorator will be a
// string literal type if the member name is an identifier, number, or string;
// otherwise, if the member name is a computed property name it will
@@ -34039,7 +35328,7 @@ var ts;
case 8 /* NumericLiteral */:
case 9 /* StringLiteral */:
return getLiteralTypeForText(32 /* StringLiteral */, element.name.text);
- case 141 /* ComputedPropertyName */:
+ case 142 /* ComputedPropertyName */:
var nameType = checkComputedPropertyName(element.name);
if (isTypeOfKind(nameType, 512 /* ESSymbol */)) {
return nameType;
@@ -34065,21 +35354,21 @@ var ts;
function getEffectiveDecoratorThirdArgumentType(node) {
// The third argument to a decorator is either its `descriptor` for a method decorator
// or its `parameterIndex` for a parameter decorator
- if (node.kind === 222 /* ClassDeclaration */) {
+ if (node.kind === 225 /* ClassDeclaration */) {
ts.Debug.fail("Class decorators should not have a third synthetic argument.");
return unknownType;
}
- if (node.kind === 143 /* Parameter */) {
+ if (node.kind === 144 /* Parameter */) {
// The `parameterIndex` for a parameter decorator is always a number
return numberType;
}
- if (node.kind === 146 /* PropertyDeclaration */) {
+ if (node.kind === 147 /* PropertyDeclaration */) {
ts.Debug.fail("Property decorators should not have a third synthetic argument.");
return unknownType;
}
- if (node.kind === 148 /* MethodDeclaration */ ||
- node.kind === 150 /* GetAccessor */ ||
- node.kind === 151 /* SetAccessor */) {
+ if (node.kind === 149 /* MethodDeclaration */ ||
+ node.kind === 151 /* GetAccessor */ ||
+ node.kind === 152 /* SetAccessor */) {
// The `descriptor` for a method decorator will be a `TypedPropertyDescriptor`
// for the type of the member.
var propertyType = getTypeOfNode(node);
@@ -34111,10 +35400,10 @@ var ts;
// Decorators provide special arguments, a tagged template expression provides
// a special first argument, and string literals get string literal types
// unless we're reporting errors
- if (node.kind === 144 /* Decorator */) {
+ if (node.kind === 145 /* Decorator */) {
return getEffectiveDecoratorArgumentType(node, argIndex);
}
- else if (argIndex === 0 && node.kind === 177 /* TaggedTemplateExpression */) {
+ else if (argIndex === 0 && node.kind === 180 /* TaggedTemplateExpression */) {
return getGlobalTemplateStringsArrayType();
}
// This is not a synthetic argument, so we return 'undefined'
@@ -34126,8 +35415,8 @@ var ts;
*/
function getEffectiveArgument(node, args, argIndex) {
// For a decorator or the first argument of a tagged template expression we return undefined.
- if (node.kind === 144 /* Decorator */ ||
- (argIndex === 0 && node.kind === 177 /* TaggedTemplateExpression */)) {
+ if (node.kind === 145 /* Decorator */ ||
+ (argIndex === 0 && node.kind === 180 /* TaggedTemplateExpression */)) {
return undefined;
}
return args[argIndex];
@@ -34136,11 +35425,11 @@ var ts;
* Gets the error node to use when reporting errors for an effective argument.
*/
function getEffectiveArgumentErrorNode(node, argIndex, arg) {
- if (node.kind === 144 /* Decorator */) {
+ if (node.kind === 145 /* Decorator */) {
// For a decorator, we use the expression of the decorator for error reporting.
return node.expression;
}
- else if (argIndex === 0 && node.kind === 177 /* TaggedTemplateExpression */) {
+ else if (argIndex === 0 && node.kind === 180 /* TaggedTemplateExpression */) {
// For a the first argument of a tagged template expression, we use the template of the tag for error reporting.
return node.template;
}
@@ -34149,8 +35438,8 @@ var ts;
}
}
function resolveCall(node, signatures, candidatesOutArray, headMessage) {
- var isTaggedTemplate = node.kind === 177 /* TaggedTemplateExpression */;
- var isDecorator = node.kind === 144 /* Decorator */;
+ var isTaggedTemplate = node.kind === 180 /* TaggedTemplateExpression */;
+ var isDecorator = node.kind === 145 /* Decorator */;
var typeArguments;
if (!isTaggedTemplate && !isDecorator) {
typeArguments = node.typeArguments;
@@ -34221,7 +35510,7 @@ var ts;
var result;
// If we are in signature help, a trailing comma indicates that we intend to provide another argument,
// so we will only accept overloads with arity at least 1 higher than the current number of provided arguments.
- var signatureHelpTrailingComma = candidatesOutArray && node.kind === 175 /* CallExpression */ && node.arguments.hasTrailingComma;
+ var signatureHelpTrailingComma = candidatesOutArray && node.kind === 178 /* CallExpression */ && node.arguments.hasTrailingComma;
// Section 4.12.1:
// if the candidate list contains one or more signatures for which the type of each argument
// expression is a subtype of each corresponding parameter type, the return type of the first
@@ -34569,16 +35858,16 @@ var ts;
*/
function getDiagnosticHeadMessageForDecoratorResolution(node) {
switch (node.parent.kind) {
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression;
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression;
- case 146 /* PropertyDeclaration */:
+ case 147 /* PropertyDeclaration */:
return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression;
- case 148 /* MethodDeclaration */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 149 /* MethodDeclaration */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression;
}
}
@@ -34608,13 +35897,13 @@ var ts;
}
function resolveSignature(node, candidatesOutArray) {
switch (node.kind) {
- case 175 /* CallExpression */:
+ case 178 /* CallExpression */:
return resolveCallExpression(node, candidatesOutArray);
- case 176 /* NewExpression */:
+ case 179 /* NewExpression */:
return resolveNewExpression(node, candidatesOutArray);
- case 177 /* TaggedTemplateExpression */:
+ case 180 /* TaggedTemplateExpression */:
return resolveTaggedTemplateExpression(node, candidatesOutArray);
- case 144 /* Decorator */:
+ case 145 /* Decorator */:
return resolveDecorator(node, candidatesOutArray);
}
ts.Debug.fail("Branch in 'resolveSignature' should be unreachable.");
@@ -34663,12 +35952,12 @@ var ts;
if (node.expression.kind === 96 /* SuperKeyword */) {
return voidType;
}
- if (node.kind === 176 /* NewExpression */) {
+ if (node.kind === 179 /* NewExpression */) {
var declaration = signature.declaration;
if (declaration &&
- declaration.kind !== 149 /* Constructor */ &&
- declaration.kind !== 153 /* ConstructSignature */ &&
- declaration.kind !== 158 /* ConstructorType */ &&
+ declaration.kind !== 150 /* Constructor */ &&
+ declaration.kind !== 154 /* ConstructSignature */ &&
+ declaration.kind !== 159 /* ConstructorType */ &&
!ts.isJSDocConstructSignature(declaration)) {
// When resolved signature is a call signature (and not a construct signature) the result type is any, unless
// the declaring function had members created through 'x.prototype.y = expr' or 'this.y = expr' psuedodeclarations
@@ -34708,9 +35997,9 @@ var ts;
return false;
}
var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */
- ? 221 /* FunctionDeclaration */
+ ? 224 /* FunctionDeclaration */
: resolvedRequire.flags & 3 /* Variable */
- ? 219 /* VariableDeclaration */
+ ? 222 /* VariableDeclaration */
: 0 /* Unknown */;
if (targetDeclarationKind !== 0 /* Unknown */) {
var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind);
@@ -34807,8 +36096,8 @@ var ts;
links.type = instantiateType(contextualType, mapper);
// if inference didn't come up with anything but {}, fall back to the binding pattern if present.
if (links.type === emptyObjectType &&
- (parameter.valueDeclaration.name.kind === 168 /* ObjectBindingPattern */ ||
- parameter.valueDeclaration.name.kind === 169 /* ArrayBindingPattern */)) {
+ (parameter.valueDeclaration.name.kind === 171 /* ObjectBindingPattern */ ||
+ parameter.valueDeclaration.name.kind === 172 /* ArrayBindingPattern */)) {
links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name);
}
assignBindingElementTypes(parameter.valueDeclaration);
@@ -34866,7 +36155,7 @@ var ts;
function createPromiseReturnType(func, promisedType) {
var promiseType = createPromiseType(promisedType);
if (promiseType === emptyObjectType) {
- error(func, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type);
+ error(func, ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option);
return unknownType;
}
return promiseType;
@@ -34878,7 +36167,7 @@ var ts;
}
var isAsync = ts.isAsyncFunctionLike(func);
var type;
- if (func.body.kind !== 200 /* Block */) {
+ if (func.body.kind !== 203 /* Block */) {
type = checkExpressionCached(func.body, contextualMapper);
if (isAsync) {
// From within an async function you can return either a non-promise value or a promise. Any
@@ -34968,7 +36257,7 @@ var ts;
return false;
}
var lastStatement = ts.lastOrUndefined(func.body.statements);
- if (lastStatement && lastStatement.kind === 214 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) {
+ if (lastStatement && lastStatement.kind === 217 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) {
return false;
}
return true;
@@ -35001,7 +36290,7 @@ var ts;
}
});
if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever ||
- func.kind === 180 /* FunctionExpression */ || func.kind === 181 /* ArrowFunction */)) {
+ func.kind === 183 /* FunctionExpression */ || func.kind === 184 /* ArrowFunction */)) {
return undefined;
}
if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) {
@@ -35030,7 +36319,7 @@ var ts;
}
// If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check.
// also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw
- if (ts.nodeIsMissing(func.body) || func.body.kind !== 200 /* Block */ || !functionHasImplicitReturn(func)) {
+ if (ts.nodeIsMissing(func.body) || func.body.kind !== 203 /* Block */ || !functionHasImplicitReturn(func)) {
return;
}
var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */;
@@ -35063,10 +36352,10 @@ var ts;
}
}
function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) {
- ts.Debug.assert(node.kind !== 148 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
// Grammar checking
var hasGrammarError = checkGrammarFunctionLikeDeclaration(node);
- if (!hasGrammarError && node.kind === 180 /* FunctionExpression */) {
+ if (!hasGrammarError && node.kind === 183 /* FunctionExpression */) {
checkGrammarForGenerator(node);
}
// The identityMapper object is used to indicate that function expressions are wildcards
@@ -35107,14 +36396,14 @@ var ts;
}
}
}
- if (produceDiagnostics && node.kind !== 148 /* MethodDeclaration */) {
+ if (produceDiagnostics && node.kind !== 149 /* MethodDeclaration */) {
checkCollisionWithCapturedSuperVariable(node, node.name);
checkCollisionWithCapturedThisVariable(node, node.name);
}
return type;
}
function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) {
- ts.Debug.assert(node.kind !== 148 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
var isAsync = ts.isAsyncFunctionLike(node);
var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));
if (!node.asteriskToken) {
@@ -35130,7 +36419,7 @@ var ts;
// checkFunctionExpressionBodies). So it must be done now.
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
}
- if (node.body.kind === 200 /* Block */) {
+ if (node.body.kind === 203 /* Block */) {
checkSourceElement(node.body);
}
else {
@@ -35177,11 +36466,11 @@ var ts;
if (isReadonlySymbol(symbol)) {
// Allow assignments to readonly properties within constructors of the same class declaration.
if (symbol.flags & 4 /* Property */ &&
- (expr.kind === 173 /* PropertyAccessExpression */ || expr.kind === 174 /* ElementAccessExpression */) &&
+ (expr.kind === 176 /* PropertyAccessExpression */ || expr.kind === 177 /* ElementAccessExpression */) &&
expr.expression.kind === 98 /* ThisKeyword */) {
// Look for if this is the constructor for the class that `symbol` is a property of.
var func = ts.getContainingFunction(expr);
- if (!(func && func.kind === 149 /* Constructor */))
+ if (!(func && func.kind === 150 /* Constructor */))
return true;
// If func.parent is a class and symbol is a (readonly) property of that class, or
// if func is a constructor and symbol is a (readonly) parameter property declared in it,
@@ -35193,50 +36482,25 @@ var ts;
return false;
}
function isReferenceThroughNamespaceImport(expr) {
- if (expr.kind === 173 /* PropertyAccessExpression */ || expr.kind === 174 /* ElementAccessExpression */) {
- var node = skipParenthesizedNodes(expr.expression);
+ if (expr.kind === 176 /* PropertyAccessExpression */ || expr.kind === 177 /* ElementAccessExpression */) {
+ var node = ts.skipParentheses(expr.expression);
if (node.kind === 70 /* Identifier */) {
var symbol = getNodeLinks(node).resolvedSymbol;
if (symbol.flags & 8388608 /* Alias */) {
var declaration = getDeclarationOfAliasSymbol(symbol);
- return declaration && declaration.kind === 233 /* NamespaceImport */;
+ return declaration && declaration.kind === 236 /* NamespaceImport */;
}
}
}
return false;
}
- function checkReferenceExpression(expr, invalidReferenceMessage, constantVariableMessage) {
+ function checkReferenceExpression(expr, invalidReferenceMessage) {
// References are combinations of identifiers, parentheses, and property accesses.
- var node = skipParenthesizedNodes(expr);
- if (node.kind !== 70 /* Identifier */ && node.kind !== 173 /* PropertyAccessExpression */ && node.kind !== 174 /* ElementAccessExpression */) {
+ var node = ts.skipParentheses(expr);
+ if (node.kind !== 70 /* Identifier */ && node.kind !== 176 /* PropertyAccessExpression */ && node.kind !== 177 /* ElementAccessExpression */) {
error(expr, invalidReferenceMessage);
return false;
}
- // Because we get the symbol from the resolvedSymbol property, it might be of kind
- // SymbolFlags.ExportValue. In this case it is necessary to get the actual export
- // symbol, which will have the correct flags set on it.
- var links = getNodeLinks(node);
- var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol);
- if (symbol) {
- if (symbol !== unknownSymbol && symbol !== argumentsSymbol) {
- // Only variables (and not functions, classes, namespaces, enum objects, or enum members)
- // are considered references when referenced using a simple identifier.
- if (node.kind === 70 /* Identifier */ && !(symbol.flags & 3 /* Variable */)) {
- error(expr, invalidReferenceMessage);
- return false;
- }
- if (isReferenceToReadonlyEntity(node, symbol) || isReferenceThroughNamespaceImport(node)) {
- error(expr, constantVariableMessage);
- return false;
- }
- }
- }
- else if (node.kind === 174 /* ElementAccessExpression */) {
- if (links.resolvedIndexInfo && links.resolvedIndexInfo.isReadonly) {
- error(expr, constantVariableMessage);
- return false;
- }
- }
return true;
}
function checkDeleteExpression(node) {
@@ -35254,7 +36518,7 @@ var ts;
function checkAwaitExpression(node) {
// Grammar checking
if (produceDiagnostics) {
- if (!(node.flags & 262144 /* AwaitContext */)) {
+ if (!(node.flags & 524288 /* AwaitContext */)) {
grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function);
}
if (isInParameterInitializerBeforeContainingFunction(node)) {
@@ -35290,7 +36554,7 @@ var ts;
var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type);
if (ok) {
// run check only if former checks succeeded to avoid reporting cascading errors
- checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property);
+ checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access);
}
return numberType;
}
@@ -35304,7 +36568,7 @@ var ts;
var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type);
if (ok) {
// run check only if former checks succeeded to avoid reporting cascading errors
- checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property);
+ checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access);
}
return numberType;
}
@@ -35395,29 +36659,29 @@ var ts;
}
function checkObjectLiteralAssignment(node, sourceType) {
var properties = node.properties;
- for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
- var p = properties_4[_i];
+ for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) {
+ var p = properties_5[_i];
checkObjectLiteralDestructuringPropertyAssignment(sourceType, p);
}
return sourceType;
}
function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property) {
- if (property.kind === 253 /* PropertyAssignment */ || property.kind === 254 /* ShorthandPropertyAssignment */) {
- var name_17 = property.name;
- if (name_17.kind === 141 /* ComputedPropertyName */) {
- checkComputedPropertyName(name_17);
+ if (property.kind === 256 /* PropertyAssignment */ || property.kind === 257 /* ShorthandPropertyAssignment */) {
+ var name_21 = property.name;
+ if (name_21.kind === 142 /* ComputedPropertyName */) {
+ checkComputedPropertyName(name_21);
}
- if (isComputedNonLiteralName(name_17)) {
+ if (isComputedNonLiteralName(name_21)) {
return undefined;
}
- var text = getTextOfPropertyName(name_17);
+ var text = ts.getTextOfPropertyName(name_21);
var type = isTypeAny(objectLiteralType)
? objectLiteralType
: getTypeOfPropertyOfType(objectLiteralType, text) ||
isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) ||
getIndexTypeOfType(objectLiteralType, 0 /* String */);
if (type) {
- if (property.kind === 254 /* ShorthandPropertyAssignment */) {
+ if (property.kind === 257 /* ShorthandPropertyAssignment */) {
return checkDestructuringAssignment(property, type);
}
else {
@@ -35426,10 +36690,10 @@ var ts;
}
}
else {
- error(name_17, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_17));
+ error(name_21, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_21));
}
}
- else {
+ else if (property.kind !== 258 /* SpreadAssignment */) {
error(property, ts.Diagnostics.Property_assignment_expected);
}
}
@@ -35447,8 +36711,8 @@ var ts;
function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) {
var elements = node.elements;
var element = elements[elementIndex];
- if (element.kind !== 194 /* OmittedExpression */) {
- if (element.kind !== 192 /* SpreadElementExpression */) {
+ if (element.kind !== 197 /* OmittedExpression */) {
+ if (element.kind !== 195 /* SpreadElement */) {
var propName = "" + elementIndex;
var type = isTypeAny(sourceType)
? sourceType
@@ -35472,11 +36736,11 @@ var ts;
}
else {
if (elementIndex < elements.length - 1) {
- error(element, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern);
+ error(element, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
}
else {
var restExpression = element.expression;
- if (restExpression.kind === 188 /* BinaryExpression */ && restExpression.operatorToken.kind === 57 /* EqualsToken */) {
+ if (restExpression.kind === 191 /* BinaryExpression */ && restExpression.operatorToken.kind === 57 /* EqualsToken */) {
error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);
}
else {
@@ -35489,7 +36753,7 @@ var ts;
}
function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) {
var target;
- if (exprOrAssignment.kind === 254 /* ShorthandPropertyAssignment */) {
+ if (exprOrAssignment.kind === 257 /* ShorthandPropertyAssignment */) {
var prop = exprOrAssignment;
if (prop.objectAssignmentInitializer) {
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
@@ -35505,21 +36769,21 @@ var ts;
else {
target = exprOrAssignment;
}
- if (target.kind === 188 /* BinaryExpression */ && target.operatorToken.kind === 57 /* EqualsToken */) {
+ if (target.kind === 191 /* BinaryExpression */ && target.operatorToken.kind === 57 /* EqualsToken */) {
checkBinaryExpression(target, contextualMapper);
target = target.left;
}
- if (target.kind === 172 /* ObjectLiteralExpression */) {
+ if (target.kind === 175 /* ObjectLiteralExpression */) {
return checkObjectLiteralAssignment(target, sourceType);
}
- if (target.kind === 171 /* ArrayLiteralExpression */) {
+ if (target.kind === 174 /* ArrayLiteralExpression */) {
return checkArrayLiteralAssignment(target, sourceType, contextualMapper);
}
return checkReferenceAssignment(target, sourceType, contextualMapper);
}
function checkReferenceAssignment(target, sourceType, contextualMapper) {
var targetType = checkExpression(target, contextualMapper);
- if (checkReferenceExpression(target, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property)) {
+ if (checkReferenceExpression(target, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) {
checkTypeAssignableTo(sourceType, targetType, target, /*headMessage*/ undefined);
}
return sourceType;
@@ -35538,35 +36802,35 @@ var ts;
case 70 /* Identifier */:
case 9 /* StringLiteral */:
case 11 /* RegularExpressionLiteral */:
- case 177 /* TaggedTemplateExpression */:
- case 190 /* TemplateExpression */:
+ case 180 /* TaggedTemplateExpression */:
+ case 193 /* TemplateExpression */:
case 12 /* NoSubstitutionTemplateLiteral */:
case 8 /* NumericLiteral */:
case 100 /* TrueKeyword */:
case 85 /* FalseKeyword */:
case 94 /* NullKeyword */:
- case 136 /* UndefinedKeyword */:
- case 180 /* FunctionExpression */:
- case 193 /* ClassExpression */:
- case 181 /* ArrowFunction */:
- case 171 /* ArrayLiteralExpression */:
- case 172 /* ObjectLiteralExpression */:
- case 183 /* TypeOfExpression */:
- case 197 /* NonNullExpression */:
- case 243 /* JsxSelfClosingElement */:
- case 242 /* JsxElement */:
+ case 137 /* UndefinedKeyword */:
+ case 183 /* FunctionExpression */:
+ case 196 /* ClassExpression */:
+ case 184 /* ArrowFunction */:
+ case 174 /* ArrayLiteralExpression */:
+ case 175 /* ObjectLiteralExpression */:
+ case 186 /* TypeOfExpression */:
+ case 200 /* NonNullExpression */:
+ case 246 /* JsxSelfClosingElement */:
+ case 245 /* JsxElement */:
return true;
- case 189 /* ConditionalExpression */:
+ case 192 /* ConditionalExpression */:
return isSideEffectFree(node.whenTrue) &&
isSideEffectFree(node.whenFalse);
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
if (ts.isAssignmentOperator(node.operatorToken.kind)) {
return false;
}
return isSideEffectFree(node.left) &&
isSideEffectFree(node.right);
- case 186 /* PrefixUnaryExpression */:
- case 187 /* PostfixUnaryExpression */:
+ case 189 /* PrefixUnaryExpression */:
+ case 190 /* PostfixUnaryExpression */:
// Unary operators ~, !, +, and - have no side effects.
// The rest do.
switch (node.operator) {
@@ -35578,9 +36842,9 @@ var ts;
}
return false;
// Some forms listed here for clarity
- case 184 /* VoidExpression */: // Explicit opt-out
- case 178 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings
- case 196 /* AsExpression */: // Not SEF, but can produce useful type warnings
+ case 187 /* VoidExpression */: // Explicit opt-out
+ case 181 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings
+ case 199 /* AsExpression */: // Not SEF, but can produce useful type warnings
default:
return false;
}
@@ -35600,7 +36864,7 @@ var ts;
}
function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) {
var operator = operatorToken.kind;
- if (operator === 57 /* EqualsToken */ && (left.kind === 172 /* ObjectLiteralExpression */ || left.kind === 171 /* ArrayLiteralExpression */)) {
+ if (operator === 57 /* EqualsToken */ && (left.kind === 175 /* ObjectLiteralExpression */ || left.kind === 174 /* ArrayLiteralExpression */)) {
return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper);
}
var leftType = checkExpression(left, contextualMapper);
@@ -35783,9 +37047,7 @@ var ts;
// requires VarExpr to be classified as a reference
// A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1)
// and the type of the non - compound operation to be assignable to the type of VarExpr.
- var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property);
- // Use default messages
- if (ok) {
+ if (checkReferenceExpression(left, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) {
// to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported
checkTypeAssignableTo(valueType, leftType, left, /*headMessage*/ undefined);
}
@@ -35813,7 +37075,7 @@ var ts;
function checkYieldExpression(node) {
// Grammar checking
if (produceDiagnostics) {
- if (!(node.flags & 65536 /* YieldContext */) || isYieldExpressionInClass(node)) {
+ if (!(node.flags & 131072 /* YieldContext */) || isYieldExpressionInClass(node)) {
grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);
}
if (isInParameterInitializerBeforeContainingFunction(node)) {
@@ -35901,8 +37163,8 @@ var ts;
return links.resolvedType;
}
function isTypeAssertion(node) {
- node = skipParenthesizedNodes(node);
- return node.kind === 178 /* TypeAssertionExpression */ || node.kind === 196 /* AsExpression */;
+ node = ts.skipParentheses(node);
+ return node.kind === 181 /* TypeAssertionExpression */ || node.kind === 199 /* AsExpression */;
}
function checkDeclarationInitializer(declaration) {
var type = checkExpressionCached(declaration.initializer);
@@ -35934,7 +37196,7 @@ var ts;
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 141 /* ComputedPropertyName */) {
+ if (node.name.kind === 142 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
return checkExpressionForMutableLocation(node.initializer, contextualMapper);
@@ -35945,7 +37207,7 @@ var ts;
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 141 /* ComputedPropertyName */) {
+ if (node.name.kind === 142 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper);
@@ -35975,7 +37237,7 @@ var ts;
// contextually typed function and arrow expressions in the initial phase.
function checkExpression(node, contextualMapper) {
var type;
- if (node.kind === 140 /* QualifiedName */) {
+ if (node.kind === 141 /* QualifiedName */) {
type = checkQualifiedName(node);
}
else {
@@ -35987,9 +37249,9 @@ var ts;
// - 'left' in property access
// - 'object' in indexed access
// - target in rhs of import statement
- var ok = (node.parent.kind === 173 /* PropertyAccessExpression */ && node.parent.expression === node) ||
- (node.parent.kind === 174 /* ElementAccessExpression */ && node.parent.expression === node) ||
- ((node.kind === 70 /* Identifier */ || node.kind === 140 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node));
+ var ok = (node.parent.kind === 176 /* PropertyAccessExpression */ && node.parent.expression === node) ||
+ (node.parent.kind === 177 /* ElementAccessExpression */ && node.parent.expression === node) ||
+ ((node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node));
if (!ok) {
error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment);
}
@@ -36011,66 +37273,66 @@ var ts;
case 100 /* TrueKeyword */:
case 85 /* FalseKeyword */:
return checkLiteralExpression(node);
- case 190 /* TemplateExpression */:
+ case 193 /* TemplateExpression */:
return checkTemplateExpression(node);
case 12 /* NoSubstitutionTemplateLiteral */:
return stringType;
case 11 /* RegularExpressionLiteral */:
return globalRegExpType;
- case 171 /* ArrayLiteralExpression */:
+ case 174 /* ArrayLiteralExpression */:
return checkArrayLiteral(node, contextualMapper);
- case 172 /* ObjectLiteralExpression */:
+ case 175 /* ObjectLiteralExpression */:
return checkObjectLiteral(node, contextualMapper);
- case 173 /* PropertyAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
return checkPropertyAccessExpression(node);
- case 174 /* ElementAccessExpression */:
+ case 177 /* ElementAccessExpression */:
return checkIndexedAccess(node);
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
return checkCallExpression(node);
- case 177 /* TaggedTemplateExpression */:
+ case 180 /* TaggedTemplateExpression */:
return checkTaggedTemplateExpression(node);
- case 179 /* ParenthesizedExpression */:
+ case 182 /* ParenthesizedExpression */:
return checkExpression(node.expression, contextualMapper);
- case 193 /* ClassExpression */:
+ case 196 /* ClassExpression */:
return checkClassExpression(node);
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper);
- case 183 /* TypeOfExpression */:
+ case 186 /* TypeOfExpression */:
return checkTypeOfExpression(node);
- case 178 /* TypeAssertionExpression */:
- case 196 /* AsExpression */:
+ case 181 /* TypeAssertionExpression */:
+ case 199 /* AsExpression */:
return checkAssertion(node);
- case 197 /* NonNullExpression */:
+ case 200 /* NonNullExpression */:
return checkNonNullAssertion(node);
- case 182 /* DeleteExpression */:
+ case 185 /* DeleteExpression */:
return checkDeleteExpression(node);
- case 184 /* VoidExpression */:
+ case 187 /* VoidExpression */:
return checkVoidExpression(node);
- case 185 /* AwaitExpression */:
+ case 188 /* AwaitExpression */:
return checkAwaitExpression(node);
- case 186 /* PrefixUnaryExpression */:
+ case 189 /* PrefixUnaryExpression */:
return checkPrefixUnaryExpression(node);
- case 187 /* PostfixUnaryExpression */:
+ case 190 /* PostfixUnaryExpression */:
return checkPostfixUnaryExpression(node);
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
return checkBinaryExpression(node, contextualMapper);
- case 189 /* ConditionalExpression */:
+ case 192 /* ConditionalExpression */:
return checkConditionalExpression(node, contextualMapper);
- case 192 /* SpreadElementExpression */:
- return checkSpreadElementExpression(node, contextualMapper);
- case 194 /* OmittedExpression */:
+ case 195 /* SpreadElement */:
+ return checkSpreadExpression(node, contextualMapper);
+ case 197 /* OmittedExpression */:
return undefinedWideningType;
- case 191 /* YieldExpression */:
+ case 194 /* YieldExpression */:
return checkYieldExpression(node);
- case 248 /* JsxExpression */:
+ case 251 /* JsxExpression */:
return checkJsxExpression(node);
- case 242 /* JsxElement */:
+ case 245 /* JsxElement */:
return checkJsxElement(node);
- case 243 /* JsxSelfClosingElement */:
+ case 246 /* JsxSelfClosingElement */:
return checkJsxSelfClosingElement(node);
- case 244 /* JsxOpeningElement */:
+ case 247 /* JsxOpeningElement */:
ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement");
}
return unknownType;
@@ -36098,7 +37360,7 @@ var ts;
var func = ts.getContainingFunction(node);
if (ts.getModifierFlags(node) & 92 /* ParameterPropertyModifier */) {
func = ts.getContainingFunction(node);
- if (!(func.kind === 149 /* Constructor */ && ts.nodeIsPresent(func.body))) {
+ if (!(func.kind === 150 /* Constructor */ && ts.nodeIsPresent(func.body))) {
error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
}
}
@@ -36109,7 +37371,7 @@ var ts;
if (ts.indexOf(func.parameters, node) !== 0) {
error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter);
}
- if (func.kind === 149 /* Constructor */ || func.kind === 153 /* ConstructSignature */ || func.kind === 158 /* ConstructorType */) {
+ if (func.kind === 150 /* Constructor */ || func.kind === 154 /* ConstructSignature */ || func.kind === 159 /* ConstructorType */) {
error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter);
}
}
@@ -36123,9 +37385,9 @@ var ts;
if (!node.asteriskToken || !node.body) {
return false;
}
- return node.kind === 148 /* MethodDeclaration */ ||
- node.kind === 221 /* FunctionDeclaration */ ||
- node.kind === 180 /* FunctionExpression */;
+ return node.kind === 149 /* MethodDeclaration */ ||
+ node.kind === 224 /* FunctionDeclaration */ ||
+ node.kind === 183 /* FunctionExpression */;
}
function getTypePredicateParameterIndex(parameterList, parameter) {
if (parameterList) {
@@ -36168,9 +37430,9 @@ var ts;
else if (parameterName) {
var hasReportedError = false;
for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) {
- var name_18 = _a[_i].name;
- if (ts.isBindingPattern(name_18) &&
- checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_18, parameterName, typePredicate.parameterName)) {
+ var name_22 = _a[_i].name;
+ if (ts.isBindingPattern(name_22) &&
+ checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, parameterName, typePredicate.parameterName)) {
hasReportedError = true;
break;
}
@@ -36183,16 +37445,16 @@ var ts;
}
function getTypePredicateParent(node) {
switch (node.parent.kind) {
- case 181 /* ArrowFunction */:
- case 152 /* CallSignature */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 157 /* FunctionType */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- var parent_12 = node.parent;
- if (node === parent_12.type) {
- return parent_12;
+ case 184 /* ArrowFunction */:
+ case 153 /* CallSignature */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 158 /* FunctionType */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ var parent_11 = node.parent;
+ if (node === parent_11.type) {
+ return parent_11;
}
}
}
@@ -36202,15 +37464,15 @@ var ts;
if (ts.isOmittedExpression(element)) {
continue;
}
- var name_19 = element.name;
- if (name_19.kind === 70 /* Identifier */ &&
- name_19.text === predicateVariableName) {
+ var name_23 = element.name;
+ if (name_23.kind === 70 /* Identifier */ &&
+ name_23.text === predicateVariableName) {
error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
return true;
}
- else if (name_19.kind === 169 /* ArrayBindingPattern */ ||
- name_19.kind === 168 /* ObjectBindingPattern */) {
- if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_19, predicateVariableNode, predicateVariableName)) {
+ else if (name_23.kind === 172 /* ArrayBindingPattern */ ||
+ name_23.kind === 171 /* ObjectBindingPattern */) {
+ if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, predicateVariableNode, predicateVariableName)) {
return true;
}
}
@@ -36218,12 +37480,12 @@ var ts;
}
function checkSignatureDeclaration(node) {
// Grammar checking
- if (node.kind === 154 /* IndexSignature */) {
+ if (node.kind === 155 /* IndexSignature */) {
checkGrammarIndexSignature(node);
}
- else if (node.kind === 157 /* FunctionType */ || node.kind === 221 /* FunctionDeclaration */ || node.kind === 158 /* ConstructorType */ ||
- node.kind === 152 /* CallSignature */ || node.kind === 149 /* Constructor */ ||
- node.kind === 153 /* ConstructSignature */) {
+ else if (node.kind === 158 /* FunctionType */ || node.kind === 224 /* FunctionDeclaration */ || node.kind === 159 /* ConstructorType */ ||
+ node.kind === 153 /* CallSignature */ || node.kind === 150 /* Constructor */ ||
+ node.kind === 154 /* ConstructSignature */) {
checkGrammarFunctionLikeDeclaration(node);
}
checkTypeParameters(node.typeParameters);
@@ -36235,10 +37497,10 @@ var ts;
checkCollisionWithArgumentsInGeneratedCode(node);
if (compilerOptions.noImplicitAny && !node.type) {
switch (node.kind) {
- case 153 /* ConstructSignature */:
+ case 154 /* ConstructSignature */:
error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
- case 152 /* CallSignature */:
+ case 153 /* CallSignature */:
error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
}
@@ -36281,7 +37543,7 @@ var ts;
var staticNames = ts.createMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 149 /* Constructor */) {
+ if (member.kind === 150 /* Constructor */) {
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var param = _c[_b];
if (ts.isParameterPropertyDeclaration(param)) {
@@ -36295,13 +37557,13 @@ var ts;
var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name);
if (memberName) {
switch (member.kind) {
- case 150 /* GetAccessor */:
+ case 151 /* GetAccessor */:
addName(names, member.name, memberName, 1 /* Getter */);
break;
- case 151 /* SetAccessor */:
+ case 152 /* SetAccessor */:
addName(names, member.name, memberName, 2 /* Setter */);
break;
- case 146 /* PropertyDeclaration */:
+ case 147 /* PropertyDeclaration */:
addName(names, member.name, memberName, 3 /* Property */);
break;
}
@@ -36327,7 +37589,7 @@ var ts;
var names = ts.createMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind == 145 /* PropertySignature */) {
+ if (member.kind == 146 /* PropertySignature */) {
var memberName = void 0;
switch (member.name.kind) {
case 9 /* StringLiteral */:
@@ -36349,7 +37611,7 @@ var ts;
}
}
function checkTypeForDuplicateIndexSignatures(node) {
- if (node.kind === 223 /* InterfaceDeclaration */) {
+ if (node.kind === 226 /* InterfaceDeclaration */) {
var nodeSymbol = getSymbolOfNode(node);
// in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration
// to prevent this run check only for the first declaration of a given kind
@@ -36369,7 +37631,7 @@ var ts;
var declaration = decl;
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
switch (declaration.parameters[0].type.kind) {
- case 133 /* StringKeyword */:
+ case 134 /* StringKeyword */:
if (!seenStringIndexer) {
seenStringIndexer = true;
}
@@ -36377,7 +37639,7 @@ var ts;
error(declaration, ts.Diagnostics.Duplicate_string_index_signature);
}
break;
- case 131 /* NumberKeyword */:
+ case 132 /* NumberKeyword */:
if (!seenNumericIndexer) {
seenNumericIndexer = true;
}
@@ -36445,12 +37707,12 @@ var ts;
if (n.kind === 98 /* ThisKeyword */) {
error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location);
}
- else if (n.kind !== 180 /* FunctionExpression */ && n.kind !== 221 /* FunctionDeclaration */) {
+ else if (n.kind !== 183 /* FunctionExpression */ && n.kind !== 224 /* FunctionDeclaration */) {
ts.forEachChild(n, markThisReferencesAsErrors);
}
}
function isInstancePropertyWithInitializer(n) {
- return n.kind === 146 /* PropertyDeclaration */ &&
+ return n.kind === 147 /* PropertyDeclaration */ &&
!(ts.getModifierFlags(n) & 32 /* Static */) &&
!!n.initializer;
}
@@ -36480,7 +37742,7 @@ var ts;
var superCallStatement = void 0;
for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
var statement = statements_2[_i];
- if (statement.kind === 203 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 206 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
superCallStatement = statement;
break;
}
@@ -36504,7 +37766,7 @@ var ts;
checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name);
checkDecorators(node);
checkSignatureDeclaration(node);
- if (node.kind === 150 /* GetAccessor */) {
+ if (node.kind === 151 /* GetAccessor */) {
if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128 /* HasImplicitReturn */)) {
if (!(node.flags & 256 /* HasExplicitReturn */)) {
error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);
@@ -36514,13 +37776,13 @@ var ts;
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 141 /* ComputedPropertyName */) {
+ if (node.name.kind === 142 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
if (!ts.hasDynamicName(node)) {
// TypeScript 1.0 spec (April 2014): 8.4.3
// Accessors for the same member name must specify the same accessibility.
- var otherKind = node.kind === 150 /* GetAccessor */ ? 151 /* SetAccessor */ : 150 /* GetAccessor */;
+ var otherKind = node.kind === 151 /* GetAccessor */ ? 152 /* SetAccessor */ : 151 /* GetAccessor */;
var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind);
if (otherAccessor) {
if ((ts.getModifierFlags(node) & 28 /* AccessibilityModifier */) !== (ts.getModifierFlags(otherAccessor) & 28 /* AccessibilityModifier */)) {
@@ -36536,11 +37798,11 @@ var ts;
}
}
var returnType = getTypeOfAccessors(getSymbolOfNode(node));
- if (node.kind === 150 /* GetAccessor */) {
+ if (node.kind === 151 /* GetAccessor */) {
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType);
}
}
- if (node.parent.kind !== 172 /* ObjectLiteralExpression */) {
+ if (node.parent.kind !== 175 /* ObjectLiteralExpression */) {
checkSourceElement(node.body);
registerForUnusedIdentifiersCheck(node);
}
@@ -36623,6 +37885,9 @@ var ts;
function checkUnionOrIntersectionType(node) {
ts.forEach(node.types, checkSourceElement);
}
+ function checkIndexedAccessType(node) {
+ getTypeFromIndexedAccessTypeNode(node);
+ }
function isPrivateWithinAmbient(node) {
return (ts.getModifierFlags(node) & 8 /* Private */) && ts.isInAmbientContext(node);
}
@@ -36630,9 +37895,9 @@ var ts;
var flags = ts.getCombinedModifierFlags(n);
// children of classes (even ambient classes) should not be marked as ambient or export
// because those flags have no useful semantics there.
- if (n.parent.kind !== 223 /* InterfaceDeclaration */ &&
- n.parent.kind !== 222 /* ClassDeclaration */ &&
- n.parent.kind !== 193 /* ClassExpression */ &&
+ if (n.parent.kind !== 226 /* InterfaceDeclaration */ &&
+ n.parent.kind !== 225 /* ClassDeclaration */ &&
+ n.parent.kind !== 196 /* ClassExpression */ &&
ts.isInAmbientContext(n)) {
if (!(flags & 2 /* Ambient */)) {
// It is nested in an ambient context, which means it is automatically exported
@@ -36720,7 +37985,7 @@ var ts;
var errorNode_1 = subsequentNode.name || subsequentNode;
// TODO(jfreeman): These are methods, so handle computed name case
if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) {
- var reportError = (node.kind === 148 /* MethodDeclaration */ || node.kind === 147 /* MethodSignature */) &&
+ var reportError = (node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */) &&
(ts.getModifierFlags(node) & 32 /* Static */) !== (ts.getModifierFlags(subsequentNode) & 32 /* Static */);
// we can get here in two cases
// 1. mixed static and instance class members
@@ -36759,7 +38024,7 @@ var ts;
var current = declarations_4[_i];
var node = current;
var inAmbientContext = ts.isInAmbientContext(node);
- var inAmbientContextOrInterface = node.parent.kind === 223 /* InterfaceDeclaration */ || node.parent.kind === 160 /* TypeLiteral */ || inAmbientContext;
+ var inAmbientContextOrInterface = node.parent.kind === 226 /* InterfaceDeclaration */ || node.parent.kind === 161 /* TypeLiteral */ || inAmbientContext;
if (inAmbientContextOrInterface) {
// check if declarations are consecutive only if they are non-ambient
// 1. ambient declarations can be interleaved
@@ -36770,7 +38035,7 @@ var ts;
// 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one
previousDeclaration = undefined;
}
- if (node.kind === 221 /* FunctionDeclaration */ || node.kind === 148 /* MethodDeclaration */ || node.kind === 147 /* MethodSignature */ || node.kind === 149 /* Constructor */) {
+ if (node.kind === 224 /* FunctionDeclaration */ || node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */ || node.kind === 150 /* Constructor */) {
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
someNodeFlags |= currentNodeFlags;
allNodeFlags &= currentNodeFlags;
@@ -36892,16 +38157,16 @@ var ts;
}
function getDeclarationSpaces(d) {
switch (d.kind) {
- case 223 /* InterfaceDeclaration */:
+ case 226 /* InterfaceDeclaration */:
return 2097152 /* ExportType */;
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */
? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */
: 4194304 /* ExportNamespace */;
- case 222 /* ClassDeclaration */:
- case 225 /* EnumDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 228 /* EnumDeclaration */:
return 2097152 /* ExportType */ | 1048576 /* ExportValue */;
- case 230 /* ImportEqualsDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
var result_2 = 0;
var target = resolveAlias(getSymbolOfNode(d));
ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); });
@@ -37065,56 +38330,19 @@ var ts;
}
}
/**
- * Checks that the return type provided is an instantiation of the global Promise type
- * and returns the awaited type of the return type.
+ * Checks the return type of an async function to ensure it is a compatible
+ * Promise implementation.
*
- * @param returnType The return type of a FunctionLikeDeclaration
- * @param location The node on which to report the error.
+ * This checks that an async function has a valid Promise-compatible return type,
+ * and returns the *awaited type* of the promise. An async function has a valid
+ * Promise-compatible return type if the resolved value of the return type has a
+ * construct signature that takes in an `initializer` function that in turn supplies
+ * a `resolve` function as one of its arguments and results in an object with a
+ * callable `then` signature.
+ *
+ * @param node The signature to check
*/
- function checkCorrectPromiseType(returnType, location, diagnostic, typeName) {
- if (returnType === unknownType) {
- // The return type already had some other error, so we ignore and return
- // the unknown type.
- return unknownType;
- }
- var globalPromiseType = getGlobalPromiseType();
- if (globalPromiseType === emptyGenericType
- || globalPromiseType === getTargetType(returnType)) {
- // Either we couldn't resolve the global promise type, which would have already
- // reported an error, or we could resolve it and the return type is a valid type
- // reference to the global type. In either case, we return the awaited type for
- // the return type.
- return checkAwaitedType(returnType, location, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type);
- }
- // The promise type was not a valid type reference to the global promise type, so we
- // report an error and return the unknown type.
- error(location, diagnostic, typeName);
- return unknownType;
- }
- /**
- * Checks the return type of an async function to ensure it is a compatible
- * Promise implementation.
- * @param node The signature to check
- * @param returnType The return type for the function
- * @remarks
- * This checks that an async function has a valid Promise-compatible return type,
- * and returns the *awaited type* of the promise. An async function has a valid
- * Promise-compatible return type if the resolved value of the return type has a
- * construct signature that takes in an `initializer` function that in turn supplies
- * a `resolve` function as one of its arguments and results in an object with a
- * callable `then` signature.
- */
function checkAsyncFunctionReturnType(node) {
- if (languageVersion >= 2 /* ES2015 */) {
- var returnType = getTypeFromTypeNode(node.type);
- return checkCorrectPromiseType(returnType, node.type, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type);
- }
- var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType();
- if (globalPromiseConstructorLikeType === emptyObjectType) {
- // If we couldn't resolve the global PromiseConstructorLike type we cannot verify
- // compatibility with __awaiter.
- return unknownType;
- }
// As part of our emit for an async function, we will need to emit the entity name of
// the return type annotation as an expression. To meet the necessary runtime semantics
// for __awaiter, we must also check that the type of the declaration (e.g. the static
@@ -37139,39 +38367,56 @@ var ts;
// then(...): Promise;
// }
//
- // When we get the type of the `Promise` symbol here, we get the type of the static
- // side of the `Promise` class, which would be `{ new (...): Promise }`.
- var promiseType = getTypeFromTypeNode(node.type);
- if (promiseType === unknownType && compilerOptions.isolatedModules) {
- // If we are compiling with isolatedModules, we may not be able to resolve the
- // type as a value. As such, we will just return unknownType;
- return unknownType;
+ var returnType = getTypeFromTypeNode(node.type);
+ if (languageVersion >= 2 /* ES2015 */) {
+ if (returnType === unknownType) {
+ return unknownType;
+ }
+ var globalPromiseType = getGlobalPromiseType();
+ if (globalPromiseType !== emptyGenericType && globalPromiseType !== getTargetType(returnType)) {
+ // The promise type was not a valid type reference to the global promise type, so we
+ // report an error and return the unknown type.
+ error(node.type, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type);
+ return unknownType;
+ }
}
- var promiseConstructor = getNodeLinks(node.type).resolvedSymbol;
- if (!promiseConstructor || !symbolIsValue(promiseConstructor)) {
- // try to fall back to global promise type.
- var typeName = promiseConstructor
- ? symbolToString(promiseConstructor)
- : typeToString(promiseType);
- return checkCorrectPromiseType(promiseType, node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName);
- }
- // If the Promise constructor, resolved locally, is an alias symbol we should mark it as referenced.
- checkReturnTypeAnnotationAsExpression(node);
- // Validate the promise constructor type.
- var promiseConstructorType = getTypeOfSymbol(promiseConstructor);
- if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type)) {
- return unknownType;
- }
- // Verify there is no local declaration that could collide with the promise constructor.
- var promiseName = ts.getEntityNameFromTypeNode(node.type);
- var promiseNameOrNamespaceRoot = getFirstIdentifier(promiseName);
- var rootSymbol = getSymbol(node.locals, promiseNameOrNamespaceRoot.text, 107455 /* Value */);
- if (rootSymbol) {
- error(rootSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, promiseNameOrNamespaceRoot.text, getFullyQualifiedName(promiseConstructor));
- return unknownType;
+ else {
+ // Always mark the type node as referenced if it points to a value
+ markTypeNodeAsReferenced(node.type);
+ if (returnType === unknownType) {
+ return unknownType;
+ }
+ var promiseConstructorName = ts.getEntityNameFromTypeNode(node.type);
+ if (promiseConstructorName === undefined) {
+ error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType));
+ return unknownType;
+ }
+ var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 107455 /* Value */, /*ignoreErrors*/ true);
+ var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType;
+ if (promiseConstructorType === unknownType) {
+ error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName));
+ return unknownType;
+ }
+ var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType();
+ if (globalPromiseConstructorLikeType === emptyObjectType) {
+ // If we couldn't resolve the global PromiseConstructorLike type we cannot verify
+ // compatibility with __awaiter.
+ error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName));
+ return unknownType;
+ }
+ if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value)) {
+ return unknownType;
+ }
+ // Verify there is no local declaration that could collide with the promise constructor.
+ var rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
+ var collidingSymbol = getSymbol(node.locals, rootName.text, 107455 /* Value */);
+ if (collidingSymbol) {
+ error(collidingSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, rootName.text, ts.entityNameToString(promiseConstructorName));
+ return unknownType;
+ }
}
// Get and return the awaited type of the return type.
- return checkAwaitedType(promiseType, node, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type);
+ return checkAwaitedType(returnType, node, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type);
}
/** Check a decorator */
function checkDecorator(node) {
@@ -37184,22 +38429,22 @@ var ts;
var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
var errorInfo;
switch (node.parent.kind) {
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
var classSymbol = getSymbolOfNode(node.parent);
var classConstructorType = getTypeOfSymbol(classSymbol);
expectedReturnType = getUnionType([classConstructorType, voidType]);
break;
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);
break;
- case 146 /* PropertyDeclaration */:
+ case 147 /* PropertyDeclaration */:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);
break;
- case 148 /* MethodDeclaration */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 149 /* MethodDeclaration */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
var methodType = getTypeOfNode(node.parent);
var descriptorType = createTypedPropertyDescriptorType(methodType);
expectedReturnType = getUnionType([descriptorType, voidType]);
@@ -37207,42 +38452,19 @@ var ts;
}
checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo);
}
- /** Checks a type reference node as an expression. */
- function checkTypeNodeAsExpression(node) {
- // When we are emitting type metadata for decorators, we need to try to check the type
- // as if it were an expression so that we can emit the type in a value position when we
- // serialize the type metadata.
- if (node && node.kind === 156 /* TypeReference */) {
- var root = getFirstIdentifier(node.typeName);
- var meaning = root.parent.kind === 156 /* TypeReference */ ? 793064 /* Type */ : 1920 /* Namespace */;
- // Resolve type so we know which symbol is referenced
- var rootSymbol = resolveName(root, root.text, meaning | 8388608 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
- // Resolved symbol is alias
- if (rootSymbol && rootSymbol.flags & 8388608 /* Alias */) {
- var aliasTarget = resolveAlias(rootSymbol);
- // If alias has value symbol - mark alias as referenced
- if (aliasTarget.flags & 107455 /* Value */ && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) {
- markAliasSymbolAsReferenced(rootSymbol);
- }
- }
- }
- }
/**
- * Checks the type annotation of an accessor declaration or property declaration as
- * an expression if it is a type reference to a type with a value declaration.
- */
- function checkTypeAnnotationAsExpression(node) {
- checkTypeNodeAsExpression(node.type);
- }
- function checkReturnTypeAnnotationAsExpression(node) {
- checkTypeNodeAsExpression(node.type);
- }
- /** Checks the type annotation of the parameters of a function/method or the constructor of a class as expressions */
- function checkParameterTypeAnnotationsAsExpressions(node) {
- // ensure all type annotations with a value declaration are checked as an expression
- for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
- var parameter = _a[_i];
- checkTypeAnnotationAsExpression(parameter);
+ * If a TypeNode can be resolved to a value symbol imported from an external module, it is
+ * marked as referenced to prevent import elision.
+ */
+ function markTypeNodeAsReferenced(node) {
+ var typeName = node && ts.getEntityNameFromTypeNode(node);
+ var rootName = typeName && getFirstIdentifier(typeName);
+ var rootSymbol = rootName && resolveName(rootName, rootName.text, (typeName.kind === 70 /* Identifier */ ? 793064 /* Type */ : 1920 /* Namespace */) | 8388608 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
+ if (rootSymbol
+ && rootSymbol.flags & 8388608 /* Alias */
+ && symbolIsValue(rootSymbol)
+ && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) {
+ markAliasSymbolAsReferenced(rootSymbol);
}
}
/** Check the decorators of a node */
@@ -37261,21 +38483,27 @@ var ts;
if (compilerOptions.emitDecoratorMetadata) {
// we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator.
switch (node.kind) {
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
var constructor = ts.getFirstConstructorWithBody(node);
if (constructor) {
- checkParameterTypeAnnotationsAsExpressions(constructor);
+ for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) {
+ var parameter = _a[_i];
+ markTypeNodeAsReferenced(parameter.type);
+ }
}
break;
- case 148 /* MethodDeclaration */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- checkParameterTypeAnnotationsAsExpressions(node);
- checkReturnTypeAnnotationAsExpression(node);
+ case 149 /* MethodDeclaration */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) {
+ var parameter = _c[_b];
+ markTypeNodeAsReferenced(parameter.type);
+ }
+ markTypeNodeAsReferenced(node.type);
break;
- case 146 /* PropertyDeclaration */:
- case 143 /* Parameter */:
- checkTypeAnnotationAsExpression(node);
+ case 147 /* PropertyDeclaration */:
+ case 144 /* Parameter */:
+ markTypeNodeAsReferenced(node.type);
break;
}
}
@@ -37297,7 +38525,7 @@ var ts;
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name && node.name.kind === 141 /* ComputedPropertyName */) {
+ if (node.name && node.name.kind === 142 /* ComputedPropertyName */) {
// This check will account for methods in class/interface declarations,
// as well as accessors in classes/object literals
checkComputedPropertyName(node.name);
@@ -37357,43 +38585,43 @@ var ts;
for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) {
var node = deferredUnusedIdentifierNodes_1[_i];
switch (node.kind) {
- case 256 /* SourceFile */:
- case 226 /* ModuleDeclaration */:
+ case 260 /* SourceFile */:
+ case 229 /* ModuleDeclaration */:
checkUnusedModuleMembers(node);
break;
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
checkUnusedClassMembers(node);
checkUnusedTypeParameters(node);
break;
- case 223 /* InterfaceDeclaration */:
+ case 226 /* InterfaceDeclaration */:
checkUnusedTypeParameters(node);
break;
- case 200 /* Block */:
- case 228 /* CaseBlock */:
- case 207 /* ForStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
+ case 203 /* Block */:
+ case 231 /* CaseBlock */:
+ case 210 /* ForStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
checkUnusedLocalsAndParameters(node);
break;
- case 149 /* Constructor */:
- case 180 /* FunctionExpression */:
- case 221 /* FunctionDeclaration */:
- case 181 /* ArrowFunction */:
- case 148 /* MethodDeclaration */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 150 /* Constructor */:
+ case 183 /* FunctionExpression */:
+ case 224 /* FunctionDeclaration */:
+ case 184 /* ArrowFunction */:
+ case 149 /* MethodDeclaration */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
if (node.body) {
checkUnusedLocalsAndParameters(node);
}
checkUnusedTypeParameters(node);
break;
- case 147 /* MethodSignature */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 154 /* IndexSignature */:
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
+ case 148 /* MethodSignature */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 155 /* IndexSignature */:
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
checkUnusedTypeParameters(node);
break;
}
@@ -37402,11 +38630,11 @@ var ts;
}
}
function checkUnusedLocalsAndParameters(node) {
- if (node.parent.kind !== 223 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) {
- var _loop_2 = function (key) {
+ if (node.parent.kind !== 226 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) {
+ var _loop_3 = function (key) {
var local = node.locals[key];
if (!local.isReferenced) {
- if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 143 /* Parameter */) {
+ if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144 /* Parameter */) {
var parameter = ts.getRootDeclaration(local.valueDeclaration);
if (compilerOptions.noUnusedParameters &&
!ts.isParameterPropertyDeclaration(parameter) &&
@@ -37421,16 +38649,16 @@ var ts;
}
};
for (var key in node.locals) {
- _loop_2(key);
+ _loop_3(key);
}
}
}
function errorUnusedLocal(node, name) {
if (isIdentifierThatStartsWithUnderScore(node)) {
var declaration = ts.getRootDeclaration(node.parent);
- if (declaration.kind === 219 /* VariableDeclaration */ &&
- (declaration.parent.parent.kind === 208 /* ForInStatement */ ||
- declaration.parent.parent.kind === 209 /* ForOfStatement */)) {
+ if (declaration.kind === 222 /* VariableDeclaration */ &&
+ (declaration.parent.parent.kind === 211 /* ForInStatement */ ||
+ declaration.parent.parent.kind === 212 /* ForOfStatement */)) {
return;
}
}
@@ -37447,12 +38675,12 @@ var ts;
if (node.members) {
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 148 /* MethodDeclaration */ || member.kind === 146 /* PropertyDeclaration */) {
+ if (member.kind === 149 /* MethodDeclaration */ || member.kind === 147 /* PropertyDeclaration */) {
if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8 /* Private */) {
error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name);
}
}
- else if (member.kind === 149 /* Constructor */) {
+ else if (member.kind === 150 /* Constructor */) {
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var parameter = _c[_b];
if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8 /* Private */) {
@@ -37500,7 +38728,7 @@ var ts;
}
function checkBlock(node) {
// Grammar checking for SyntaxKind.Block
- if (node.kind === 200 /* Block */) {
+ if (node.kind === 203 /* Block */) {
checkGrammarStatementInAmbientContext(node);
}
ts.forEach(node.statements, checkSourceElement);
@@ -37523,12 +38751,12 @@ var ts;
if (!(identifier && identifier.text === name)) {
return false;
}
- if (node.kind === 146 /* PropertyDeclaration */ ||
- node.kind === 145 /* PropertySignature */ ||
- node.kind === 148 /* MethodDeclaration */ ||
- node.kind === 147 /* MethodSignature */ ||
- node.kind === 150 /* GetAccessor */ ||
- node.kind === 151 /* SetAccessor */) {
+ if (node.kind === 147 /* PropertyDeclaration */ ||
+ node.kind === 146 /* PropertySignature */ ||
+ node.kind === 149 /* MethodDeclaration */ ||
+ node.kind === 148 /* MethodSignature */ ||
+ node.kind === 151 /* GetAccessor */ ||
+ node.kind === 152 /* SetAccessor */) {
// it is ok to have member named '_super' or '_this' - member access is always qualified
return false;
}
@@ -37537,7 +38765,7 @@ var ts;
return false;
}
var root = ts.getRootDeclaration(node);
- if (root.kind === 143 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) {
+ if (root.kind === 144 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) {
// just an overload - no codegen impact
return false;
}
@@ -37594,12 +38822,12 @@ var ts;
return;
}
// Uninstantiated modules shouldnt do this check
- if (node.kind === 226 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) {
+ if (node.kind === 229 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) {
return;
}
// In case of variable declaration, node.parent is variable statement so look at the variable statement's parent
var parent = getDeclarationContainer(node);
- if (parent.kind === 256 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) {
+ if (parent.kind === 260 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) {
// If the declaration happens to be in external module, report error that require and exports are reserved keywords
error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name));
}
@@ -37609,12 +38837,12 @@ var ts;
return;
}
// Uninstantiated modules shouldnt do this check
- if (node.kind === 226 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) {
+ if (node.kind === 229 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) {
return;
}
// In case of variable declaration, node.parent is variable statement so look at the variable statement's parent
var parent = getDeclarationContainer(node);
- if (parent.kind === 256 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 8192 /* HasAsyncFunctions */) {
+ if (parent.kind === 260 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 8192 /* HasAsyncFunctions */) {
// If the declaration happens to be in external module, report error that Promise is a reserved identifier.
error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name));
}
@@ -37649,7 +38877,7 @@ var ts;
// skip variable declarations that don't have initializers
// NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern
// so we'll always treat binding elements as initialized
- if (node.kind === 219 /* VariableDeclaration */ && !node.initializer) {
+ if (node.kind === 222 /* VariableDeclaration */ && !node.initializer) {
return;
}
var symbol = getSymbolOfNode(node);
@@ -37659,24 +38887,24 @@ var ts;
localDeclarationSymbol !== symbol &&
localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) {
if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) {
- var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 220 /* VariableDeclarationList */);
- var container = varDeclList.parent.kind === 201 /* VariableStatement */ && varDeclList.parent.parent
+ var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 223 /* VariableDeclarationList */);
+ var container = varDeclList.parent.kind === 204 /* VariableStatement */ && varDeclList.parent.parent
? varDeclList.parent.parent
: undefined;
// names of block-scoped and function scoped variables can collide only
// if block scoped variable is defined in the function\module\source file scope (because of variable hoisting)
var namesShareScope = container &&
- (container.kind === 200 /* Block */ && ts.isFunctionLike(container.parent) ||
- container.kind === 227 /* ModuleBlock */ ||
- container.kind === 226 /* ModuleDeclaration */ ||
- container.kind === 256 /* SourceFile */);
+ (container.kind === 203 /* Block */ && ts.isFunctionLike(container.parent) ||
+ container.kind === 230 /* ModuleBlock */ ||
+ container.kind === 229 /* ModuleDeclaration */ ||
+ container.kind === 260 /* SourceFile */);
// here we know that function scoped variable is shadowed by block scoped one
// if they are defined in the same scope - binder has already reported redeclaration error
// otherwise if variable has an initializer - show error that initialization will fail
// since LHS will be block scoped name instead of function scoped
if (!namesShareScope) {
- var name_20 = symbolToString(localDeclarationSymbol);
- error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_20, name_20);
+ var name_24 = symbolToString(localDeclarationSymbol);
+ error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_24, name_24);
}
}
}
@@ -37684,7 +38912,7 @@ var ts;
}
// Check that a parameter initializer contains no references to parameters declared to the right of itself
function checkParameterInitializer(node) {
- if (ts.getRootDeclaration(node).kind !== 143 /* Parameter */) {
+ if (ts.getRootDeclaration(node).kind !== 144 /* Parameter */) {
return;
}
var func = ts.getContainingFunction(node);
@@ -37695,7 +38923,7 @@ var ts;
// skip declaration names (i.e. in object literal expressions)
return;
}
- if (n.kind === 173 /* PropertyAccessExpression */) {
+ if (n.kind === 176 /* PropertyAccessExpression */) {
// skip property names in property access expression
return visit(n.expression);
}
@@ -37714,7 +38942,7 @@ var ts;
// so we need to do a bit of extra work to check if reference is legal
var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
if (enclosingContainer === func) {
- if (symbol.valueDeclaration.kind === 143 /* Parameter */) {
+ if (symbol.valueDeclaration.kind === 144 /* Parameter */) {
// it is ok to reference parameter in initializer if either
// - parameter is located strictly on the left of current parameter declaration
if (symbol.valueDeclaration.pos < node.pos) {
@@ -37728,7 +38956,7 @@ var ts;
}
// computed property names/initializers in instance property declaration of class like entities
// are executed in constructor and thus deferred
- if (current.parent.kind === 146 /* PropertyDeclaration */ &&
+ if (current.parent.kind === 147 /* PropertyDeclaration */ &&
!(ts.hasModifier(current.parent, 32 /* Static */)) &&
ts.isClassLike(current.parent.parent)) {
return;
@@ -37755,24 +38983,25 @@ var ts;
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 141 /* ComputedPropertyName */) {
+ if (node.name.kind === 142 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
if (node.initializer) {
checkExpressionCached(node.initializer);
}
}
- if (node.kind === 170 /* BindingElement */) {
+ if (node.kind === 173 /* BindingElement */) {
// check computed properties inside property names of binding elements
- if (node.propertyName && node.propertyName.kind === 141 /* ComputedPropertyName */) {
+ if (node.propertyName && node.propertyName.kind === 142 /* ComputedPropertyName */) {
checkComputedPropertyName(node.propertyName);
}
// check private/protected variable access
- var parent_13 = node.parent.parent;
- var parentType = getTypeForBindingElementParent(parent_13);
- var name_21 = node.propertyName || node.name;
- var property = getPropertyOfType(parentType, getTextOfPropertyName(name_21));
- if (parent_13.initializer && property && getParentOfSymbol(property)) {
- checkClassPropertyAccess(parent_13, parent_13.initializer, parentType, property);
+ var parent_12 = node.parent.parent;
+ var parentType = getTypeForBindingElementParent(parent_12);
+ var name_25 = node.propertyName || node.name;
+ var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_25));
+ markPropertyAsReferenced(property);
+ if (parent_12.initializer && property && getParentOfSymbol(property)) {
+ checkClassPropertyAccess(parent_12, parent_12.initializer, parentType, property);
}
}
// For a binding pattern, check contained binding elements
@@ -37780,14 +39009,14 @@ var ts;
ts.forEach(node.name.elements, checkSourceElement);
}
// For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body
- if (node.initializer && ts.getRootDeclaration(node).kind === 143 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
+ if (node.initializer && ts.getRootDeclaration(node).kind === 144 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
return;
}
// For a binding pattern, validate the initializer and exit
if (ts.isBindingPattern(node.name)) {
// Don't validate for-in initializer as it is already an error
- if (node.initializer && node.parent.parent.kind !== 208 /* ForInStatement */) {
+ if (node.initializer && node.parent.parent.kind !== 211 /* ForInStatement */) {
checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined);
checkParameterInitializer(node);
}
@@ -37798,7 +39027,7 @@ var ts;
if (node === symbol.valueDeclaration) {
// Node is the primary declaration of the symbol, just validate the initializer
// Don't validate for-in initializer as it is already an error
- if (node.initializer && node.parent.parent.kind !== 208 /* ForInStatement */) {
+ if (node.initializer && node.parent.parent.kind !== 211 /* ForInStatement */) {
checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, /*headMessage*/ undefined);
checkParameterInitializer(node);
}
@@ -37818,10 +39047,10 @@ var ts;
error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));
}
}
- if (node.kind !== 146 /* PropertyDeclaration */ && node.kind !== 145 /* PropertySignature */) {
+ if (node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 146 /* PropertySignature */) {
// We know we don't have a binding pattern or computed name here
checkExportsOnMergedDeclarations(node);
- if (node.kind === 219 /* VariableDeclaration */ || node.kind === 170 /* BindingElement */) {
+ if (node.kind === 222 /* VariableDeclaration */ || node.kind === 173 /* BindingElement */) {
checkVarDeclaredNamesNotShadowed(node);
}
checkCollisionWithCapturedSuperVariable(node, node.name);
@@ -37831,8 +39060,8 @@ var ts;
}
}
function areDeclarationFlagsIdentical(left, right) {
- if ((left.kind === 143 /* Parameter */ && right.kind === 219 /* VariableDeclaration */) ||
- (left.kind === 219 /* VariableDeclaration */ && right.kind === 143 /* Parameter */)) {
+ if ((left.kind === 144 /* Parameter */ && right.kind === 222 /* VariableDeclaration */) ||
+ (left.kind === 222 /* VariableDeclaration */ && right.kind === 144 /* Parameter */)) {
// Differences in optionality between parameters and variables are allowed.
return true;
}
@@ -37862,7 +39091,7 @@ var ts;
}
function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) {
// We only disallow modifier on a method declaration if it is a property of object-literal-expression
- if (node.modifiers && node.parent.kind === 172 /* ObjectLiteralExpression */) {
+ if (node.modifiers && node.parent.kind === 175 /* ObjectLiteralExpression */) {
if (ts.isAsyncFunctionLike(node)) {
if (node.modifiers.length > 1) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here);
@@ -37883,7 +39112,7 @@ var ts;
checkGrammarStatementInAmbientContext(node);
checkExpression(node.expression);
checkSourceElement(node.thenStatement);
- if (node.thenStatement.kind === 202 /* EmptyStatement */) {
+ if (node.thenStatement.kind === 205 /* EmptyStatement */) {
error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
}
checkSourceElement(node.elseStatement);
@@ -37903,12 +39132,12 @@ var ts;
function checkForStatement(node) {
// Grammar checking
if (!checkGrammarStatementInAmbientContext(node)) {
- if (node.initializer && node.initializer.kind === 220 /* VariableDeclarationList */) {
+ if (node.initializer && node.initializer.kind === 223 /* VariableDeclarationList */) {
checkGrammarVariableDeclarationList(node.initializer);
}
}
if (node.initializer) {
- if (node.initializer.kind === 220 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 223 /* VariableDeclarationList */) {
ts.forEach(node.initializer.declarations, checkVariableDeclaration);
}
else {
@@ -37931,14 +39160,14 @@ var ts;
// via checkRightHandSideOfForOf.
// If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference.
// Then check that the RHS is assignable to it.
- if (node.initializer.kind === 220 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 223 /* VariableDeclarationList */) {
checkForInOrForOfVariableDeclaration(node);
}
else {
var varExpr = node.initializer;
var iteratedType = checkRightHandSideOfForOf(node.expression);
// There may be a destructuring assignment on the left side
- if (varExpr.kind === 171 /* ArrayLiteralExpression */ || varExpr.kind === 172 /* ObjectLiteralExpression */) {
+ if (varExpr.kind === 174 /* ArrayLiteralExpression */ || varExpr.kind === 175 /* ObjectLiteralExpression */) {
// iteratedType may be undefined. In this case, we still want to check the structure of
// varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like
// to short circuit the type relation checking as much as possible, so we pass the unknownType.
@@ -37946,8 +39175,7 @@ var ts;
}
else {
var leftType = checkExpression(varExpr);
- checkReferenceExpression(varExpr, /*invalidReferenceMessage*/ ts.Diagnostics.Invalid_left_hand_side_in_for_of_statement,
- /*constantVariableMessage*/ ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property);
+ checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access);
// iteratedType will be undefined if the rightType was missing properties/signatures
// required to get its iteratedType (like [Symbol.iterator] or next). This may be
// because we accessed properties from anyType, or it may have led to an error inside
@@ -37970,7 +39198,7 @@ var ts;
// for (let VarDecl in Expr) Statement
// VarDecl must be a variable declaration without a type annotation that declares a variable of type Any,
// and Expr must be an expression of type Any, an object type, or a type parameter type.
- if (node.initializer.kind === 220 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 223 /* VariableDeclarationList */) {
var variable = node.initializer.declarations[0];
if (variable && ts.isBindingPattern(variable.name)) {
error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
@@ -37984,7 +39212,7 @@ var ts;
// and Expr must be an expression of type Any, an object type, or a type parameter type.
var varExpr = node.initializer;
var leftType = checkExpression(varExpr);
- if (varExpr.kind === 171 /* ArrayLiteralExpression */ || varExpr.kind === 172 /* ObjectLiteralExpression */) {
+ if (varExpr.kind === 174 /* ArrayLiteralExpression */ || varExpr.kind === 175 /* ObjectLiteralExpression */) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
}
else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34 /* StringLike */)) {
@@ -37992,7 +39220,7 @@ var ts;
}
else {
// run check only former check succeeded to avoid cascading errors
- checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_in_statement, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property);
+ checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access);
}
}
var rightType = checkNonNullExpression(node.expression);
@@ -38234,7 +39462,7 @@ var ts;
// TODO: Check that target label is valid
}
function isGetAccessorWithAnnotatedSetAccessor(node) {
- return !!(node.kind === 150 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 151 /* SetAccessor */)));
+ return !!(node.kind === 151 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 152 /* SetAccessor */)));
}
function isUnwrappedReturnTypeVoidOrAny(func, returnType) {
var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType;
@@ -38261,12 +39489,12 @@ var ts;
// for generators.
return;
}
- if (func.kind === 151 /* SetAccessor */) {
+ if (func.kind === 152 /* SetAccessor */) {
if (node.expression) {
error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value);
}
}
- else if (func.kind === 149 /* Constructor */) {
+ else if (func.kind === 150 /* Constructor */) {
if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) {
error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
}
@@ -38287,7 +39515,7 @@ var ts;
}
}
}
- else if (func.kind !== 149 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) {
+ else if (func.kind !== 150 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) {
// The function has a return type, but the return statement doesn't have an expression.
error(node, ts.Diagnostics.Not_all_code_paths_return_a_value);
}
@@ -38296,7 +39524,7 @@ var ts;
function checkWithStatement(node) {
// Grammar checking for withStatement
if (!checkGrammarStatementInAmbientContext(node)) {
- if (node.flags & 262144 /* AwaitContext */) {
+ if (node.flags & 524288 /* AwaitContext */) {
grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block);
}
}
@@ -38314,9 +39542,10 @@ var ts;
var firstDefaultClause;
var hasDuplicateDefaultClause = false;
var expressionType = checkExpression(node.expression);
+ var expressionIsLiteral = isLiteralType(expressionType);
ts.forEach(node.caseBlock.clauses, function (clause) {
// Grammar check for duplicate default clauses, skip if we already report duplicate default clause
- if (clause.kind === 250 /* DefaultClause */ && !hasDuplicateDefaultClause) {
+ if (clause.kind === 253 /* DefaultClause */ && !hasDuplicateDefaultClause) {
if (firstDefaultClause === undefined) {
firstDefaultClause = clause;
}
@@ -38328,15 +39557,21 @@ var ts;
hasDuplicateDefaultClause = true;
}
}
- if (produceDiagnostics && clause.kind === 249 /* CaseClause */) {
+ if (produceDiagnostics && clause.kind === 252 /* CaseClause */) {
var caseClause = clause;
// TypeScript 1.0 spec (April 2014): 5.9
// In a 'switch' statement, each 'case' expression must be of a type that is comparable
// to or from the type of the 'switch' expression.
var caseType = checkExpression(caseClause.expression);
- if (!isTypeEqualityComparableTo(expressionType, caseType)) {
+ var caseIsLiteral = isLiteralType(caseType);
+ var comparedExpressionType = expressionType;
+ if (!caseIsLiteral || !expressionIsLiteral) {
+ caseType = caseIsLiteral ? getBaseTypeOfLiteralType(caseType) : caseType;
+ comparedExpressionType = getBaseTypeOfLiteralType(expressionType);
+ }
+ if (!isTypeEqualityComparableTo(comparedExpressionType, caseType)) {
// expressionType is not comparable to caseType, try the reversed check and report errors if it fails
- checkTypeComparableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined);
+ checkTypeComparableTo(caseType, comparedExpressionType, caseClause.expression, /*headMessage*/ undefined);
}
}
ts.forEach(clause.statements, checkSourceElement);
@@ -38353,7 +39588,7 @@ var ts;
if (ts.isFunctionLike(current)) {
break;
}
- if (current.kind === 215 /* LabeledStatement */ && current.label.text === node.label.text) {
+ if (current.kind === 218 /* LabeledStatement */ && current.label.text === node.label.text) {
var sourceFile = ts.getSourceFileOfNode(node);
grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label));
break;
@@ -38456,7 +39691,7 @@ var ts;
// perform property check if property or indexer is declared in 'type'
// this allows to rule out cases when both property and indexer are inherited from the base class
var errorNode;
- if (prop.valueDeclaration.name.kind === 141 /* ComputedPropertyName */ || prop.parent === containingType.symbol) {
+ if (prop.valueDeclaration.name.kind === 142 /* ComputedPropertyName */ || prop.parent === containingType.symbol) {
errorNode = prop.valueDeclaration;
}
else if (indexDeclaration) {
@@ -38514,7 +39749,7 @@ var ts;
var firstDecl;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 222 /* ClassDeclaration */ || declaration.kind === 223 /* InterfaceDeclaration */) {
+ if (declaration.kind === 225 /* ClassDeclaration */ || declaration.kind === 226 /* InterfaceDeclaration */) {
if (!firstDecl) {
firstDecl = declaration;
}
@@ -38579,7 +39814,7 @@ var ts;
checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1);
if (baseType_1.symbol.valueDeclaration &&
!ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) &&
- baseType_1.symbol.valueDeclaration.kind === 222 /* ClassDeclaration */) {
+ baseType_1.symbol.valueDeclaration.kind === 225 /* ClassDeclaration */) {
if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) {
error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class);
}
@@ -38680,7 +39915,7 @@ var ts;
// If there is no declaration for the derived class (as in the case of class expressions),
// then the class cannot be declared abstract.
if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128 /* Abstract */))) {
- if (derivedClassDecl.kind === 193 /* ClassExpression */) {
+ if (derivedClassDecl.kind === 196 /* ClassExpression */) {
error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
}
else {
@@ -38728,7 +39963,7 @@ var ts;
}
}
function isAccessor(kind) {
- return kind === 150 /* GetAccessor */ || kind === 151 /* SetAccessor */;
+ return kind === 151 /* GetAccessor */ || kind === 152 /* SetAccessor */;
}
function areTypeParametersIdentical(list1, list2) {
if (!list1 && !list2) {
@@ -38769,8 +40004,8 @@ var ts;
for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) {
var base = baseTypes_2[_i];
var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType));
- for (var _a = 0, properties_5 = properties; _a < properties_5.length; _a++) {
- var prop = properties_5[_a];
+ for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) {
+ var prop = properties_6[_a];
var existing = seen[prop.name];
if (!existing) {
seen[prop.name] = { prop: prop, containingType: base };
@@ -38800,7 +40035,7 @@ var ts;
var symbol = getSymbolOfNode(node);
checkTypeParameterListsIdentical(node, symbol);
// Only check this symbol once
- var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 223 /* InterfaceDeclaration */);
+ var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 226 /* InterfaceDeclaration */);
if (node === firstInterfaceDecl) {
var type = getDeclaredTypeOfSymbol(symbol);
var typeWithThis = getTypeWithThisArgument(type);
@@ -38848,7 +40083,7 @@ var ts;
error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums);
}
else {
- var text = getTextOfPropertyName(member.name);
+ var text = ts.getTextOfPropertyName(member.name);
if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name);
}
@@ -38907,7 +40142,7 @@ var ts;
return value;
function evalConstant(e) {
switch (e.kind) {
- case 186 /* PrefixUnaryExpression */:
+ case 189 /* PrefixUnaryExpression */:
var value_1 = evalConstant(e.operand);
if (value_1 === undefined) {
return undefined;
@@ -38918,7 +40153,7 @@ var ts;
case 51 /* TildeToken */: return ~value_1;
}
return undefined;
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
var left = evalConstant(e.left);
if (left === undefined) {
return undefined;
@@ -38943,11 +40178,11 @@ var ts;
return undefined;
case 8 /* NumericLiteral */:
return +e.text;
- case 179 /* ParenthesizedExpression */:
+ case 182 /* ParenthesizedExpression */:
return evalConstant(e.expression);
case 70 /* Identifier */:
- case 174 /* ElementAccessExpression */:
- case 173 /* PropertyAccessExpression */:
+ case 177 /* ElementAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
var member = initializer.parent;
var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent));
var enumType_1;
@@ -38960,7 +40195,7 @@ var ts;
}
else {
var expression = void 0;
- if (e.kind === 174 /* ElementAccessExpression */) {
+ if (e.kind === 177 /* ElementAccessExpression */) {
if (e.argumentExpression === undefined ||
e.argumentExpression.kind !== 9 /* StringLiteral */) {
return undefined;
@@ -38978,7 +40213,7 @@ var ts;
if (current.kind === 70 /* Identifier */) {
break;
}
- else if (current.kind === 173 /* PropertyAccessExpression */) {
+ else if (current.kind === 176 /* PropertyAccessExpression */) {
current = current.expression;
}
else {
@@ -39050,7 +40285,7 @@ var ts;
var seenEnumMissingInitialInitializer_1 = false;
ts.forEach(enumSymbol.declarations, function (declaration) {
// return true if we hit a violation of the rule, false otherwise
- if (declaration.kind !== 225 /* EnumDeclaration */) {
+ if (declaration.kind !== 228 /* EnumDeclaration */) {
return false;
}
var enumDeclaration = declaration;
@@ -39073,8 +40308,8 @@ var ts;
var declarations = symbol.declarations;
for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
var declaration = declarations_5[_i];
- if ((declaration.kind === 222 /* ClassDeclaration */ ||
- (declaration.kind === 221 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) &&
+ if ((declaration.kind === 225 /* ClassDeclaration */ ||
+ (declaration.kind === 224 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) &&
!ts.isInAmbientContext(declaration)) {
return declaration;
}
@@ -39138,7 +40373,7 @@ var ts;
}
// if the module merges with a class declaration in the same lexical scope,
// we need to track this to ensure the correct emit.
- var mergedClass = ts.getDeclarationOfKind(symbol, 222 /* ClassDeclaration */);
+ var mergedClass = ts.getDeclarationOfKind(symbol, 225 /* ClassDeclaration */);
if (mergedClass &&
inSameLexicalScope(node, mergedClass)) {
getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */;
@@ -39189,26 +40424,26 @@ var ts;
}
function checkModuleAugmentationElement(node, isGlobalAugmentation) {
switch (node.kind) {
- case 201 /* VariableStatement */:
+ case 204 /* VariableStatement */:
// error each individual name in variable statement instead of marking the entire variable statement
for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
checkModuleAugmentationElement(decl, isGlobalAugmentation);
}
break;
- case 236 /* ExportAssignment */:
- case 237 /* ExportDeclaration */:
+ case 239 /* ExportAssignment */:
+ case 240 /* ExportDeclaration */:
grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
break;
- case 230 /* ImportEqualsDeclaration */:
- case 231 /* ImportDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
+ case 234 /* ImportDeclaration */:
grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
break;
- case 170 /* BindingElement */:
- case 219 /* VariableDeclaration */:
- var name_22 = node.name;
- if (ts.isBindingPattern(name_22)) {
- for (var _b = 0, _c = name_22.elements; _b < _c.length; _b++) {
+ case 173 /* BindingElement */:
+ case 222 /* VariableDeclaration */:
+ var name_26 = node.name;
+ if (ts.isBindingPattern(name_26)) {
+ for (var _b = 0, _c = name_26.elements; _b < _c.length; _b++) {
var el = _c[_b];
// mark individual names in binding pattern
checkModuleAugmentationElement(el, isGlobalAugmentation);
@@ -39216,12 +40451,12 @@ var ts;
break;
}
// fallthrough
- case 222 /* ClassDeclaration */:
- case 225 /* EnumDeclaration */:
- case 221 /* FunctionDeclaration */:
- case 223 /* InterfaceDeclaration */:
- case 226 /* ModuleDeclaration */:
- case 224 /* TypeAliasDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 224 /* FunctionDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 229 /* ModuleDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
if (isGlobalAugmentation) {
return;
}
@@ -39244,12 +40479,12 @@ var ts;
switch (node.kind) {
case 70 /* Identifier */:
return node;
- case 140 /* QualifiedName */:
+ case 141 /* QualifiedName */:
do {
node = node.left;
} while (node.kind !== 70 /* Identifier */);
return node;
- case 173 /* PropertyAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
do {
node = node.expression;
} while (node.kind !== 70 /* Identifier */);
@@ -39262,9 +40497,9 @@ var ts;
error(moduleName, ts.Diagnostics.String_literal_expected);
return false;
}
- var inAmbientExternalModule = node.parent.kind === 227 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
- if (node.parent.kind !== 256 /* SourceFile */ && !inAmbientExternalModule) {
- error(moduleName, node.kind === 237 /* ExportDeclaration */ ?
+ var inAmbientExternalModule = node.parent.kind === 230 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
+ if (node.parent.kind !== 260 /* SourceFile */ && !inAmbientExternalModule) {
+ error(moduleName, node.kind === 240 /* ExportDeclaration */ ?
ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :
ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);
return false;
@@ -39297,7 +40532,7 @@ var ts;
(symbol.flags & 793064 /* Type */ ? 793064 /* Type */ : 0) |
(symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0);
if (target.flags & excludedMeanings) {
- var message = node.kind === 239 /* ExportSpecifier */ ?
+ var message = node.kind === 242 /* ExportSpecifier */ ?
ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
error(node, message, symbolToString(symbol));
@@ -39325,7 +40560,7 @@ var ts;
checkImportBinding(importClause);
}
if (importClause.namedBindings) {
- if (importClause.namedBindings.kind === 233 /* NamespaceImport */) {
+ if (importClause.namedBindings.kind === 236 /* NamespaceImport */) {
checkImportBinding(importClause.namedBindings);
}
else {
@@ -39382,8 +40617,8 @@ var ts;
// export { x, y }
// export { x, y } from "foo"
ts.forEach(node.exportClause.elements, checkExportSpecifier);
- var inAmbientExternalModule = node.parent.kind === 227 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
- if (node.parent.kind !== 256 /* SourceFile */ && !inAmbientExternalModule) {
+ var inAmbientExternalModule = node.parent.kind === 230 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
+ if (node.parent.kind !== 260 /* SourceFile */ && !inAmbientExternalModule) {
error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
}
}
@@ -39397,7 +40632,7 @@ var ts;
}
}
function checkGrammarModuleElementContext(node, errorMessage) {
- var isInAppropriateContext = node.parent.kind === 256 /* SourceFile */ || node.parent.kind === 227 /* ModuleBlock */ || node.parent.kind === 226 /* ModuleDeclaration */;
+ var isInAppropriateContext = node.parent.kind === 260 /* SourceFile */ || node.parent.kind === 230 /* ModuleBlock */ || node.parent.kind === 229 /* ModuleDeclaration */;
if (!isInAppropriateContext) {
grammarErrorOnFirstToken(node, errorMessage);
}
@@ -39423,8 +40658,8 @@ var ts;
// If we hit an export assignment in an illegal context, just bail out to avoid cascading errors.
return;
}
- var container = node.parent.kind === 256 /* SourceFile */ ? node.parent : node.parent.parent;
- if (container.kind === 226 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
+ var container = node.parent.kind === 260 /* SourceFile */ ? node.parent : node.parent.parent;
+ if (container.kind === 229 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
return;
}
@@ -39499,7 +40734,7 @@ var ts;
links.exportsChecked = true;
}
function isNotOverload(declaration) {
- return (declaration.kind !== 221 /* FunctionDeclaration */ && declaration.kind !== 148 /* MethodDeclaration */) ||
+ return (declaration.kind !== 224 /* FunctionDeclaration */ && declaration.kind !== 149 /* MethodDeclaration */) ||
!!declaration.body;
}
}
@@ -39512,118 +40747,121 @@ var ts;
// Only bother checking on a few construct kinds. We don't want to be excessively
// hitting the cancellation token on every node we check.
switch (kind) {
- case 226 /* ModuleDeclaration */:
- case 222 /* ClassDeclaration */:
- case 223 /* InterfaceDeclaration */:
- case 221 /* FunctionDeclaration */:
+ case 229 /* ModuleDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 224 /* FunctionDeclaration */:
cancellationToken.throwIfCancellationRequested();
}
}
switch (kind) {
- case 142 /* TypeParameter */:
+ case 143 /* TypeParameter */:
return checkTypeParameter(node);
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
return checkParameter(node);
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
return checkPropertyDeclaration(node);
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
return checkSignatureDeclaration(node);
- case 154 /* IndexSignature */:
+ case 155 /* IndexSignature */:
return checkSignatureDeclaration(node);
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
return checkMethodDeclaration(node);
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
return checkConstructorDeclaration(node);
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
return checkAccessorDeclaration(node);
- case 156 /* TypeReference */:
+ case 157 /* TypeReference */:
return checkTypeReferenceNode(node);
- case 155 /* TypePredicate */:
+ case 156 /* TypePredicate */:
return checkTypePredicate(node);
- case 159 /* TypeQuery */:
+ case 160 /* TypeQuery */:
return checkTypeQuery(node);
- case 160 /* TypeLiteral */:
+ case 161 /* TypeLiteral */:
return checkTypeLiteral(node);
- case 161 /* ArrayType */:
+ case 162 /* ArrayType */:
return checkArrayType(node);
- case 162 /* TupleType */:
+ case 163 /* TupleType */:
return checkTupleType(node);
- case 163 /* UnionType */:
- case 164 /* IntersectionType */:
+ case 164 /* UnionType */:
+ case 165 /* IntersectionType */:
return checkUnionOrIntersectionType(node);
- case 165 /* ParenthesizedType */:
+ case 166 /* ParenthesizedType */:
+ case 168 /* TypeOperator */:
return checkSourceElement(node.type);
- case 221 /* FunctionDeclaration */:
+ case 169 /* IndexedAccessType */:
+ return checkIndexedAccessType(node);
+ case 224 /* FunctionDeclaration */:
return checkFunctionDeclaration(node);
- case 200 /* Block */:
- case 227 /* ModuleBlock */:
+ case 203 /* Block */:
+ case 230 /* ModuleBlock */:
return checkBlock(node);
- case 201 /* VariableStatement */:
+ case 204 /* VariableStatement */:
return checkVariableStatement(node);
- case 203 /* ExpressionStatement */:
+ case 206 /* ExpressionStatement */:
return checkExpressionStatement(node);
- case 204 /* IfStatement */:
+ case 207 /* IfStatement */:
return checkIfStatement(node);
- case 205 /* DoStatement */:
+ case 208 /* DoStatement */:
return checkDoStatement(node);
- case 206 /* WhileStatement */:
+ case 209 /* WhileStatement */:
return checkWhileStatement(node);
- case 207 /* ForStatement */:
+ case 210 /* ForStatement */:
return checkForStatement(node);
- case 208 /* ForInStatement */:
+ case 211 /* ForInStatement */:
return checkForInStatement(node);
- case 209 /* ForOfStatement */:
+ case 212 /* ForOfStatement */:
return checkForOfStatement(node);
- case 210 /* ContinueStatement */:
- case 211 /* BreakStatement */:
+ case 213 /* ContinueStatement */:
+ case 214 /* BreakStatement */:
return checkBreakOrContinueStatement(node);
- case 212 /* ReturnStatement */:
+ case 215 /* ReturnStatement */:
return checkReturnStatement(node);
- case 213 /* WithStatement */:
+ case 216 /* WithStatement */:
return checkWithStatement(node);
- case 214 /* SwitchStatement */:
+ case 217 /* SwitchStatement */:
return checkSwitchStatement(node);
- case 215 /* LabeledStatement */:
+ case 218 /* LabeledStatement */:
return checkLabeledStatement(node);
- case 216 /* ThrowStatement */:
+ case 219 /* ThrowStatement */:
return checkThrowStatement(node);
- case 217 /* TryStatement */:
+ case 220 /* TryStatement */:
return checkTryStatement(node);
- case 219 /* VariableDeclaration */:
+ case 222 /* VariableDeclaration */:
return checkVariableDeclaration(node);
- case 170 /* BindingElement */:
+ case 173 /* BindingElement */:
return checkBindingElement(node);
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
return checkClassDeclaration(node);
- case 223 /* InterfaceDeclaration */:
+ case 226 /* InterfaceDeclaration */:
return checkInterfaceDeclaration(node);
- case 224 /* TypeAliasDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
return checkTypeAliasDeclaration(node);
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
return checkEnumDeclaration(node);
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
return checkModuleDeclaration(node);
- case 231 /* ImportDeclaration */:
+ case 234 /* ImportDeclaration */:
return checkImportDeclaration(node);
- case 230 /* ImportEqualsDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
return checkImportEqualsDeclaration(node);
- case 237 /* ExportDeclaration */:
+ case 240 /* ExportDeclaration */:
return checkExportDeclaration(node);
- case 236 /* ExportAssignment */:
+ case 239 /* ExportAssignment */:
return checkExportAssignment(node);
- case 202 /* EmptyStatement */:
+ case 205 /* EmptyStatement */:
checkGrammarStatementInAmbientContext(node);
return;
- case 218 /* DebuggerStatement */:
+ case 221 /* DebuggerStatement */:
checkGrammarStatementInAmbientContext(node);
return;
- case 240 /* MissingDeclaration */:
+ case 243 /* MissingDeclaration */:
return checkMissingDeclaration(node);
}
}
@@ -39645,17 +40883,17 @@ var ts;
for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) {
var node = deferredNodes_1[_i];
switch (node.kind) {
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
checkFunctionExpressionOrObjectLiteralMethodDeferred(node);
break;
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
checkAccessorDeferred(node);
break;
- case 193 /* ClassExpression */:
+ case 196 /* ClassExpression */:
checkClassExpressionDeferred(node);
break;
}
@@ -39717,9 +40955,29 @@ var ts;
function getDiagnosticsWorker(sourceFile) {
throwIfNonDiagnosticsProducing();
if (sourceFile) {
+ // Some global diagnostics are deferred until they are needed and
+ // may not be reported in the firt call to getGlobalDiagnostics.
+ // We should catch these changes and report them.
+ var previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
+ var previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length;
checkSourceFile(sourceFile);
- return diagnostics.getDiagnostics(sourceFile.fileName);
+ var semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
+ var currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
+ if (currentGlobalDiagnostics !== previousGlobalDiagnostics) {
+ // If the arrays are not the same reference, new diagnostics were added.
+ var deferredGlobalDiagnostics = ts.relativeComplement(previousGlobalDiagnostics, currentGlobalDiagnostics, ts.compareDiagnostics);
+ return ts.concatenate(deferredGlobalDiagnostics, semanticDiagnostics);
+ }
+ else if (previousGlobalDiagnosticsSize === 0 && currentGlobalDiagnostics.length > 0) {
+ // If the arrays are the same reference, but the length has changed, a single
+ // new diagnostic was added as DiagnosticCollection attempts to reuse the
+ // same array.
+ return ts.concatenate(currentGlobalDiagnostics, semanticDiagnostics);
+ }
+ return semanticDiagnostics;
}
+ // Global diagnostics are always added when a file is not provided to
+ // getDiagnostics
ts.forEach(host.getSourceFiles(), checkSourceFile);
return diagnostics.getDiagnostics();
}
@@ -39736,7 +40994,7 @@ var ts;
function isInsideWithStatementBody(node) {
if (node) {
while (node.parent) {
- if (node.parent.kind === 213 /* WithStatement */ && node.parent.statement === node) {
+ if (node.parent.kind === 216 /* WithStatement */ && node.parent.statement === node) {
return true;
}
node = node.parent;
@@ -39759,25 +41017,25 @@ var ts;
copySymbols(location.locals, meaning);
}
switch (location.kind) {
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location)) {
break;
}
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */);
break;
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */);
break;
- case 193 /* ClassExpression */:
+ case 196 /* ClassExpression */:
var className = location.name;
if (className) {
copySymbol(location.symbol, meaning);
}
// fall through; this fall-through is necessary because we would like to handle
// type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration
- case 222 /* ClassDeclaration */:
- case 223 /* InterfaceDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 226 /* InterfaceDeclaration */:
// If we didn't come from static member of class or interface,
// add the type parameters into the symbol table
// (type parameters of classDeclaration/classExpression and interface are in member property of the symbol.
@@ -39786,7 +41044,7 @@ var ts;
copySymbols(getSymbolOfNode(location).members, meaning & 793064 /* Type */);
}
break;
- case 180 /* FunctionExpression */:
+ case 183 /* FunctionExpression */:
var funcName = location.name;
if (funcName) {
copySymbol(location.symbol, meaning);
@@ -39835,28 +41093,28 @@ var ts;
}
function isTypeDeclaration(node) {
switch (node.kind) {
- case 142 /* TypeParameter */:
- case 222 /* ClassDeclaration */:
- case 223 /* InterfaceDeclaration */:
- case 224 /* TypeAliasDeclaration */:
- case 225 /* EnumDeclaration */:
+ case 143 /* TypeParameter */:
+ case 225 /* ClassDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
+ case 228 /* EnumDeclaration */:
return true;
}
}
// True if the given identifier is part of a type reference
function isTypeReferenceIdentifier(entityName) {
var node = entityName;
- while (node.parent && node.parent.kind === 140 /* QualifiedName */) {
+ while (node.parent && node.parent.kind === 141 /* QualifiedName */) {
node = node.parent;
}
- return node.parent && (node.parent.kind === 156 /* TypeReference */ || node.parent.kind === 267 /* JSDocTypeReference */);
+ return node.parent && (node.parent.kind === 157 /* TypeReference */ || node.parent.kind === 271 /* JSDocTypeReference */);
}
function isHeritageClauseElementIdentifier(entityName) {
var node = entityName;
- while (node.parent && node.parent.kind === 173 /* PropertyAccessExpression */) {
+ while (node.parent && node.parent.kind === 176 /* PropertyAccessExpression */) {
node = node.parent;
}
- return node.parent && node.parent.kind === 195 /* ExpressionWithTypeArguments */;
+ return node.parent && node.parent.kind === 198 /* ExpressionWithTypeArguments */;
}
function forEachEnclosingClass(node, callback) {
var result;
@@ -39873,13 +41131,13 @@ var ts;
return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; });
}
function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) {
- while (nodeOnRightSide.parent.kind === 140 /* QualifiedName */) {
+ while (nodeOnRightSide.parent.kind === 141 /* QualifiedName */) {
nodeOnRightSide = nodeOnRightSide.parent;
}
- if (nodeOnRightSide.parent.kind === 230 /* ImportEqualsDeclaration */) {
+ if (nodeOnRightSide.parent.kind === 233 /* ImportEqualsDeclaration */) {
return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent;
}
- if (nodeOnRightSide.parent.kind === 236 /* ExportAssignment */) {
+ if (nodeOnRightSide.parent.kind === 239 /* ExportAssignment */) {
return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent;
}
return undefined;
@@ -39891,7 +41149,7 @@ var ts;
if (ts.isDeclarationName(entityName)) {
return getSymbolOfNode(entityName.parent);
}
- if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 173 /* PropertyAccessExpression */) {
+ if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 176 /* PropertyAccessExpression */) {
var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent);
switch (specialPropertyAssignmentKind) {
case 1 /* ExportsProperty */:
@@ -39903,13 +41161,13 @@ var ts;
default:
}
}
- if (entityName.parent.kind === 236 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
+ if (entityName.parent.kind === 239 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
return resolveEntityName(entityName,
/*all meanings*/ 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */);
}
- if (entityName.kind !== 173 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) {
+ if (entityName.kind !== 176 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) {
// Since we already checked for ExportAssignment, this really could only be an Import
- var importEqualsDeclaration = ts.getAncestor(entityName, 230 /* ImportEqualsDeclaration */);
+ var importEqualsDeclaration = ts.getAncestor(entityName, 233 /* ImportEqualsDeclaration */);
ts.Debug.assert(importEqualsDeclaration !== undefined);
return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true);
}
@@ -39919,7 +41177,7 @@ var ts;
if (isHeritageClauseElementIdentifier(entityName)) {
var meaning = 0 /* None */;
// In an interface or class, we're definitely interested in a type.
- if (entityName.parent.kind === 195 /* ExpressionWithTypeArguments */) {
+ if (entityName.parent.kind === 198 /* ExpressionWithTypeArguments */) {
meaning = 793064 /* Type */;
// In a class 'extends' clause we are also looking for a value.
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
@@ -39943,14 +41201,14 @@ var ts;
}
return resolveEntityName(entityName, 107455 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
- else if (entityName.kind === 173 /* PropertyAccessExpression */) {
+ else if (entityName.kind === 176 /* PropertyAccessExpression */) {
var symbol = getNodeLinks(entityName).resolvedSymbol;
if (!symbol) {
checkPropertyAccessExpression(entityName);
}
return getNodeLinks(entityName).resolvedSymbol;
}
- else if (entityName.kind === 140 /* QualifiedName */) {
+ else if (entityName.kind === 141 /* QualifiedName */) {
var symbol = getNodeLinks(entityName).resolvedSymbol;
if (!symbol) {
checkQualifiedName(entityName);
@@ -39959,20 +41217,20 @@ var ts;
}
}
else if (isTypeReferenceIdentifier(entityName)) {
- var meaning = (entityName.parent.kind === 156 /* TypeReference */ || entityName.parent.kind === 267 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */;
+ var meaning = (entityName.parent.kind === 157 /* TypeReference */ || entityName.parent.kind === 271 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */;
return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
- else if (entityName.parent.kind === 246 /* JsxAttribute */) {
+ else if (entityName.parent.kind === 249 /* JsxAttribute */) {
return getJsxAttributePropertySymbol(entityName.parent);
}
- if (entityName.parent.kind === 155 /* TypePredicate */) {
+ if (entityName.parent.kind === 156 /* TypePredicate */) {
return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */);
}
// Do we want to return undefined here?
return undefined;
}
function getSymbolAtLocation(node) {
- if (node.kind === 256 /* SourceFile */) {
+ if (node.kind === 260 /* SourceFile */) {
return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined;
}
if (isInsideWithStatementBody(node)) {
@@ -39990,8 +41248,8 @@ var ts;
if (isInRightSideOfImportOrExportAssignment(node)) {
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
}
- else if (node.parent.kind === 170 /* BindingElement */ &&
- node.parent.parent.kind === 168 /* ObjectBindingPattern */ &&
+ else if (node.parent.kind === 173 /* BindingElement */ &&
+ node.parent.parent.kind === 171 /* ObjectBindingPattern */ &&
node === node.parent.propertyName) {
var typeOfPattern = getTypeOfNode(node.parent.parent);
var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text);
@@ -40002,8 +41260,8 @@ var ts;
}
switch (node.kind) {
case 70 /* Identifier */:
- case 173 /* PropertyAccessExpression */:
- case 140 /* QualifiedName */:
+ case 176 /* PropertyAccessExpression */:
+ case 141 /* QualifiedName */:
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
case 98 /* ThisKeyword */:
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
@@ -40017,12 +41275,12 @@ var ts;
case 96 /* SuperKeyword */:
var type = ts.isPartOfExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node);
return type.symbol;
- case 166 /* ThisType */:
+ case 167 /* ThisType */:
return getTypeFromTypeNode(node).symbol;
case 122 /* ConstructorKeyword */:
// constructor keyword for an overload, should take us to the definition if it exist
var constructorDeclaration = node.parent;
- if (constructorDeclaration && constructorDeclaration.kind === 149 /* Constructor */) {
+ if (constructorDeclaration && constructorDeclaration.kind === 150 /* Constructor */) {
return constructorDeclaration.parent.symbol;
}
return undefined;
@@ -40030,7 +41288,7 @@ var ts;
// External module name in an import declaration
if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) &&
ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) ||
- ((node.parent.kind === 231 /* ImportDeclaration */ || node.parent.kind === 237 /* ExportDeclaration */) &&
+ ((node.parent.kind === 234 /* ImportDeclaration */ || node.parent.kind === 240 /* ExportDeclaration */) &&
node.parent.moduleSpecifier === node)) {
return resolveExternalModuleName(node, node);
}
@@ -40040,7 +41298,7 @@ var ts;
// Fall through
case 8 /* NumericLiteral */:
// index access
- if (node.parent.kind === 174 /* ElementAccessExpression */ && node.parent.argumentExpression === node) {
+ if (node.parent.kind === 177 /* ElementAccessExpression */ && node.parent.argumentExpression === node) {
var objectType = checkExpression(node.parent.expression);
if (objectType === unknownType)
return undefined;
@@ -40057,7 +41315,7 @@ var ts;
// The function returns a value symbol of an identifier in the short-hand property assignment.
// This is necessary as an identifier in short-hand property assignment can contains two meaning:
// property name and property value.
- if (location && location.kind === 254 /* ShorthandPropertyAssignment */) {
+ if (location && location.kind === 257 /* ShorthandPropertyAssignment */) {
return resolveEntityName(location.name, 107455 /* Value */ | 8388608 /* Alias */);
}
return undefined;
@@ -40119,28 +41377,28 @@ var ts;
// [ a ] from
// [a] = [ some array ...]
function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) {
- ts.Debug.assert(expr.kind === 172 /* ObjectLiteralExpression */ || expr.kind === 171 /* ArrayLiteralExpression */);
+ ts.Debug.assert(expr.kind === 175 /* ObjectLiteralExpression */ || expr.kind === 174 /* ArrayLiteralExpression */);
// If this is from "for of"
// for ( { a } of elems) {
// }
- if (expr.parent.kind === 209 /* ForOfStatement */) {
+ if (expr.parent.kind === 212 /* ForOfStatement */) {
var iteratedType = checkRightHandSideOfForOf(expr.parent.expression);
return checkDestructuringAssignment(expr, iteratedType || unknownType);
}
// If this is from "for" initializer
// for ({a } = elems[0];.....) { }
- if (expr.parent.kind === 188 /* BinaryExpression */) {
+ if (expr.parent.kind === 191 /* BinaryExpression */) {
var iteratedType = checkExpression(expr.parent.right);
return checkDestructuringAssignment(expr, iteratedType || unknownType);
}
// If this is from nested object binding pattern
// for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) {
- if (expr.parent.kind === 253 /* PropertyAssignment */) {
+ if (expr.parent.kind === 256 /* PropertyAssignment */) {
var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent);
return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent);
}
// Array literal assignment - array destructuring pattern
- ts.Debug.assert(expr.parent.kind === 171 /* ArrayLiteralExpression */);
+ ts.Debug.assert(expr.parent.kind === 174 /* ArrayLiteralExpression */);
// [{ property1: p1, property2 }] = elems;
var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent);
var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false) || unknownType;
@@ -40190,9 +41448,9 @@ var ts;
function getRootSymbols(symbol) {
if (symbol.flags & 268435456 /* SyntheticProperty */) {
var symbols_3 = [];
- var name_23 = symbol.name;
+ var name_27 = symbol.name;
ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) {
- var symbol = getPropertyOfType(t, name_23);
+ var symbol = getPropertyOfType(t, name_27);
if (symbol) {
symbols_3.push(symbol);
}
@@ -40200,6 +41458,10 @@ var ts;
return symbols_3;
}
else if (symbol.flags & 67108864 /* Transient */) {
+ if (symbol.leftSpread) {
+ var links = symbol;
+ return [links.leftSpread, links.rightSpread];
+ }
var target = void 0;
var next = symbol;
while (next = getSymbolLinks(next).target) {
@@ -40272,7 +41534,7 @@ var ts;
}
var parentSymbol = getParentOfSymbol(symbol);
if (parentSymbol) {
- if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 256 /* SourceFile */) {
+ if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 260 /* SourceFile */) {
var symbolFile = parentSymbol.valueDeclaration;
var referenceFile = ts.getSourceFileOfNode(node);
// If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined.
@@ -40329,7 +41591,7 @@ var ts;
// they will not collide with anything
var isDeclaredInLoop = nodeLinks_1.flags & 262144 /* BlockScopedBindingInLoop */;
var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false);
- var inLoopBodyBlock = container.kind === 200 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false);
+ var inLoopBodyBlock = container.kind === 203 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false);
links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock));
}
else {
@@ -40375,16 +41637,16 @@ var ts;
return true;
}
switch (node.kind) {
- case 230 /* ImportEqualsDeclaration */:
- case 232 /* ImportClause */:
- case 233 /* NamespaceImport */:
- case 235 /* ImportSpecifier */:
- case 239 /* ExportSpecifier */:
+ case 233 /* ImportEqualsDeclaration */:
+ case 235 /* ImportClause */:
+ case 236 /* NamespaceImport */:
+ case 238 /* ImportSpecifier */:
+ case 242 /* ExportSpecifier */:
return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol);
- case 237 /* ExportDeclaration */:
+ case 240 /* ExportDeclaration */:
var exportClause = node.exportClause;
return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration);
- case 236 /* ExportAssignment */:
+ case 239 /* ExportAssignment */:
return node.expression
&& node.expression.kind === 70 /* Identifier */
? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol)
@@ -40394,7 +41656,7 @@ var ts;
}
function isTopLevelValueImportEqualsWithEntityName(node) {
node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration);
- if (node === undefined || node.parent.kind !== 256 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) {
+ if (node === undefined || node.parent.kind !== 260 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) {
// parent is not source file or it is not reference to internal module
return false;
}
@@ -40460,7 +41722,7 @@ var ts;
return getNodeLinks(node).enumMemberValue;
}
function getConstantValue(node) {
- if (node.kind === 255 /* EnumMember */) {
+ if (node.kind === 259 /* EnumMember */) {
return getEnumMemberValue(node);
}
var symbol = getNodeLinks(node).resolvedSymbol;
@@ -40561,9 +41823,9 @@ var ts;
if (startInDeclarationContainer) {
// When resolving the name of a declaration as a value, we need to start resolution
// at a point outside of the declaration.
- var parent_14 = reference.parent;
- if (ts.isDeclaration(parent_14) && reference === parent_14.name) {
- location = getDeclarationContainer(parent_14);
+ var parent_13 = reference.parent;
+ if (ts.isDeclaration(parent_13) && reference === parent_13.name) {
+ location = getDeclarationContainer(parent_13);
}
}
return resolveName(location, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
@@ -40583,7 +41845,7 @@ var ts;
function isLiteralConstDeclaration(node) {
if (ts.isConst(node)) {
var type = getTypeOfSymbol(getSymbolOfNode(node));
- return !!(type.flags & 96 /* StringOrNumberLiteral */ && type.flags & 262144 /* FreshLiteral */);
+ return !!(type.flags & 96 /* StringOrNumberLiteral */ && type.flags & 1048576 /* FreshLiteral */);
}
return false;
}
@@ -40637,7 +41899,8 @@ var ts;
getTypeReferenceDirectivesForEntityName: getTypeReferenceDirectivesForEntityName,
getTypeReferenceDirectivesForSymbol: getTypeReferenceDirectivesForSymbol,
isLiteralConstDeclaration: isLiteralConstDeclaration,
- writeLiteralConstValue: writeLiteralConstValue
+ writeLiteralConstValue: writeLiteralConstValue,
+ getJsxFactoryEntity: function () { return _jsxFactoryEntity; }
};
// defined here to avoid outer scope pollution
function getTypeReferenceDirectivesForEntityName(node) {
@@ -40648,7 +41911,7 @@ var ts;
// property access can only be used as values
// qualified names can only be used as types\namespaces
// identifiers are treated as values only if they appear in type queries
- var meaning = (node.kind === 173 /* PropertyAccessExpression */) || (node.kind === 70 /* Identifier */ && isInTypeQuery(node))
+ var meaning = (node.kind === 176 /* PropertyAccessExpression */) || (node.kind === 70 /* Identifier */ && isInTypeQuery(node))
? 107455 /* Value */ | 1048576 /* ExportValue */
: 793064 /* Type */ | 1920 /* Namespace */;
var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true);
@@ -40674,6 +41937,10 @@ var ts;
if (typeReferenceDirective) {
(typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective);
}
+ else {
+ // found at least one entry that does not originate from type reference directive
+ return undefined;
+ }
}
}
return typeReferenceDirectives;
@@ -40687,15 +41954,15 @@ var ts;
// external modules cannot define or contribute to type declaration files
var current = symbol;
while (true) {
- var parent_15 = getParentOfSymbol(current);
- if (parent_15) {
- current = parent_15;
+ var parent_14 = getParentOfSymbol(current);
+ if (parent_14) {
+ current = parent_14;
}
else {
break;
}
}
- if (current.valueDeclaration && current.valueDeclaration.kind === 256 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
+ if (current.valueDeclaration && current.valueDeclaration.kind === 260 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
return false;
}
// check that at least one declaration of top level symbol originates from type declaration file
@@ -40715,7 +41982,7 @@ var ts;
if (!moduleSymbol) {
return undefined;
}
- return ts.getDeclarationOfKind(moduleSymbol, 256 /* SourceFile */);
+ return ts.getDeclarationOfKind(moduleSymbol, 260 /* SourceFile */);
}
function initializeTypeChecker() {
// Bind all source files and propagate errors
@@ -40748,7 +42015,7 @@ var ts;
}
}
if ((compilerOptions.isolatedModules || ts.isExternalModule(file)) && !file.isDeclarationFile) {
- var fileRequestedExternalEmitHelpers = file.flags & 31744 /* EmitHelperFlags */;
+ var fileRequestedExternalEmitHelpers = file.flags & 64512 /* EmitHelperFlags */;
if (fileRequestedExternalEmitHelpers) {
requestedExternalEmitHelpers |= fileRequestedExternalEmitHelpers;
if (firstFileRequestingExternalHelpers === undefined) {
@@ -40827,9 +42094,13 @@ var ts;
if (requestedExternalEmitHelpers & 1024 /* HasClassExtends */ && languageVersion < 2 /* ES2015 */) {
verifyHelperSymbol(exports, "__extends", 107455 /* Value */);
}
- if (requestedExternalEmitHelpers & 16384 /* HasJsxSpreadAttributes */ && compilerOptions.jsx !== 1 /* Preserve */) {
+ if (requestedExternalEmitHelpers & 16384 /* HasSpreadAttribute */ &&
+ (languageVersion < 5 /* ESNext */ || compilerOptions.jsx === 2 /* React */)) {
verifyHelperSymbol(exports, "__assign", 107455 /* Value */);
}
+ if (languageVersion < 5 /* ESNext */ && requestedExternalEmitHelpers & 32768 /* HasRestAttribute */) {
+ verifyHelperSymbol(exports, "__rest", 107455 /* Value */);
+ }
if (requestedExternalEmitHelpers & 2048 /* HasDecorators */) {
verifyHelperSymbol(exports, "__decorate", 107455 /* Value */);
if (compilerOptions.emitDecoratorMetadata) {
@@ -40878,14 +42149,14 @@ var ts;
return false;
}
if (!ts.nodeCanBeDecorated(node)) {
- if (node.kind === 148 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) {
+ if (node.kind === 149 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload);
}
else {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here);
}
}
- else if (node.kind === 150 /* GetAccessor */ || node.kind === 151 /* SetAccessor */) {
+ else if (node.kind === 151 /* GetAccessor */ || node.kind === 152 /* SetAccessor */) {
var accessors = ts.getAllAccessorDeclarations(node.parent.members, node);
if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
@@ -40902,17 +42173,17 @@ var ts;
var flags = 0 /* None */;
for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 129 /* ReadonlyKeyword */) {
- if (node.kind === 145 /* PropertySignature */ || node.kind === 147 /* MethodSignature */) {
+ if (modifier.kind !== 130 /* ReadonlyKeyword */) {
+ if (node.kind === 146 /* PropertySignature */ || node.kind === 148 /* MethodSignature */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind));
}
- if (node.kind === 154 /* IndexSignature */) {
+ if (node.kind === 155 /* IndexSignature */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind));
}
}
switch (modifier.kind) {
case 75 /* ConstKeyword */:
- if (node.kind !== 225 /* EnumDeclaration */ && node.parent.kind === 222 /* ClassDeclaration */) {
+ if (node.kind !== 228 /* EnumDeclaration */ && node.parent.kind === 225 /* ClassDeclaration */) {
return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75 /* ConstKeyword */));
}
break;
@@ -40938,7 +42209,7 @@ var ts;
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async");
}
- else if (node.parent.kind === 227 /* ModuleBlock */ || node.parent.kind === 256 /* SourceFile */) {
+ else if (node.parent.kind === 230 /* ModuleBlock */ || node.parent.kind === 260 /* SourceFile */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text);
}
else if (flags & 128 /* Abstract */) {
@@ -40961,10 +42232,10 @@ var ts;
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async");
}
- else if (node.parent.kind === 227 /* ModuleBlock */ || node.parent.kind === 256 /* SourceFile */) {
+ else if (node.parent.kind === 230 /* ModuleBlock */ || node.parent.kind === 260 /* SourceFile */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static");
}
- else if (node.kind === 143 /* Parameter */) {
+ else if (node.kind === 144 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static");
}
else if (flags & 128 /* Abstract */) {
@@ -40973,11 +42244,11 @@ var ts;
flags |= 32 /* Static */;
lastStatic = modifier;
break;
- case 129 /* ReadonlyKeyword */:
+ case 130 /* ReadonlyKeyword */:
if (flags & 64 /* Readonly */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly");
}
- else if (node.kind !== 146 /* PropertyDeclaration */ && node.kind !== 145 /* PropertySignature */ && node.kind !== 154 /* IndexSignature */ && node.kind !== 143 /* Parameter */) {
+ else if (node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 146 /* PropertySignature */ && node.kind !== 155 /* IndexSignature */ && node.kind !== 144 /* Parameter */) {
// If node.kind === SyntaxKind.Parameter, checkParameter report an error if it's not a parameter property.
return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
}
@@ -40997,10 +42268,10 @@ var ts;
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async");
}
- else if (node.parent.kind === 222 /* ClassDeclaration */) {
+ else if (node.parent.kind === 225 /* ClassDeclaration */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export");
}
- else if (node.kind === 143 /* Parameter */) {
+ else if (node.kind === 144 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export");
}
flags |= 1 /* Export */;
@@ -41012,13 +42283,13 @@ var ts;
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.parent.kind === 222 /* ClassDeclaration */) {
+ else if (node.parent.kind === 225 /* ClassDeclaration */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare");
}
- else if (node.kind === 143 /* Parameter */) {
+ else if (node.kind === 144 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
}
- else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 227 /* ModuleBlock */) {
+ else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 230 /* ModuleBlock */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
}
flags |= 2 /* Ambient */;
@@ -41028,14 +42299,14 @@ var ts;
if (flags & 128 /* Abstract */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract");
}
- if (node.kind !== 222 /* ClassDeclaration */) {
- if (node.kind !== 148 /* MethodDeclaration */ &&
- node.kind !== 146 /* PropertyDeclaration */ &&
- node.kind !== 150 /* GetAccessor */ &&
- node.kind !== 151 /* SetAccessor */) {
+ if (node.kind !== 225 /* ClassDeclaration */) {
+ if (node.kind !== 149 /* MethodDeclaration */ &&
+ node.kind !== 147 /* PropertyDeclaration */ &&
+ node.kind !== 151 /* GetAccessor */ &&
+ node.kind !== 152 /* SetAccessor */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
}
- if (!(node.parent.kind === 222 /* ClassDeclaration */ && ts.getModifierFlags(node.parent) & 128 /* Abstract */)) {
+ if (!(node.parent.kind === 225 /* ClassDeclaration */ && ts.getModifierFlags(node.parent) & 128 /* Abstract */)) {
return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);
}
if (flags & 32 /* Static */) {
@@ -41054,7 +42325,7 @@ var ts;
else if (flags & 2 /* Ambient */ || ts.isInAmbientContext(node.parent)) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.kind === 143 /* Parameter */) {
+ else if (node.kind === 144 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async");
}
flags |= 256 /* Async */;
@@ -41062,7 +42333,7 @@ var ts;
break;
}
}
- if (node.kind === 149 /* Constructor */) {
+ if (node.kind === 150 /* Constructor */) {
if (flags & 32 /* Static */) {
return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static");
}
@@ -41077,13 +42348,13 @@ var ts;
}
return;
}
- else if ((node.kind === 231 /* ImportDeclaration */ || node.kind === 230 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) {
+ else if ((node.kind === 234 /* ImportDeclaration */ || node.kind === 233 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) {
return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare");
}
- else if (node.kind === 143 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) {
+ else if (node.kind === 144 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern);
}
- else if (node.kind === 143 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) {
+ else if (node.kind === 144 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter);
}
if (flags & 256 /* Async */) {
@@ -41103,37 +42374,37 @@ var ts;
}
function shouldReportBadModifier(node) {
switch (node.kind) {
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 149 /* Constructor */:
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 154 /* IndexSignature */:
- case 226 /* ModuleDeclaration */:
- case 231 /* ImportDeclaration */:
- case 230 /* ImportEqualsDeclaration */:
- case 237 /* ExportDeclaration */:
- case 236 /* ExportAssignment */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
- case 143 /* Parameter */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 150 /* Constructor */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 155 /* IndexSignature */:
+ case 229 /* ModuleDeclaration */:
+ case 234 /* ImportDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
+ case 240 /* ExportDeclaration */:
+ case 239 /* ExportAssignment */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 144 /* Parameter */:
return false;
default:
- if (node.parent.kind === 227 /* ModuleBlock */ || node.parent.kind === 256 /* SourceFile */) {
+ if (node.parent.kind === 230 /* ModuleBlock */ || node.parent.kind === 260 /* SourceFile */) {
return false;
}
switch (node.kind) {
- case 221 /* FunctionDeclaration */:
+ case 224 /* FunctionDeclaration */:
return nodeHasAnyModifiersExcept(node, 119 /* AsyncKeyword */);
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
return nodeHasAnyModifiersExcept(node, 116 /* AbstractKeyword */);
- case 223 /* InterfaceDeclaration */:
- case 201 /* VariableStatement */:
- case 224 /* TypeAliasDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 204 /* VariableStatement */:
+ case 227 /* TypeAliasDeclaration */:
return true;
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
return nodeHasAnyModifiersExcept(node, 75 /* ConstKeyword */);
default:
ts.Debug.fail();
@@ -41146,10 +42417,10 @@ var ts;
}
function checkGrammarAsyncModifier(node, asyncModifier) {
switch (node.kind) {
- case 148 /* MethodDeclaration */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
+ case 149 /* MethodDeclaration */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
if (!node.asteriskToken) {
return false;
}
@@ -41212,7 +42483,7 @@ var ts;
checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file);
}
function checkGrammarArrowFunction(node, file) {
- if (node.kind === 181 /* ArrowFunction */) {
+ if (node.kind === 184 /* ArrowFunction */) {
var arrowFunction = node;
var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line;
var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line;
@@ -41247,7 +42518,7 @@ var ts;
if (!parameter.type) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);
}
- if (parameter.type.kind !== 133 /* StringKeyword */ && parameter.type.kind !== 131 /* NumberKeyword */) {
+ if (parameter.type.kind !== 134 /* StringKeyword */ && parameter.type.kind !== 132 /* NumberKeyword */) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number);
}
if (!node.type) {
@@ -41275,7 +42546,7 @@ var ts;
var sourceFile = ts.getSourceFileOfNode(node);
for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
var arg = args_4[_i];
- if (arg.kind === 194 /* OmittedExpression */) {
+ if (arg.kind === 197 /* OmittedExpression */) {
return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
}
}
@@ -41348,19 +42619,19 @@ var ts;
}
function checkGrammarComputedPropertyName(node) {
// If node is not a computedPropertyName, just skip the grammar checking
- if (node.kind !== 141 /* ComputedPropertyName */) {
+ if (node.kind !== 142 /* ComputedPropertyName */) {
return false;
}
var computedPropertyName = node;
- if (computedPropertyName.expression.kind === 188 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 25 /* CommaToken */) {
+ if (computedPropertyName.expression.kind === 191 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 25 /* CommaToken */) {
return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);
}
}
function checkGrammarForGenerator(node) {
if (node.asteriskToken) {
- ts.Debug.assert(node.kind === 221 /* FunctionDeclaration */ ||
- node.kind === 180 /* FunctionExpression */ ||
- node.kind === 148 /* MethodDeclaration */);
+ ts.Debug.assert(node.kind === 224 /* FunctionDeclaration */ ||
+ node.kind === 183 /* FunctionExpression */ ||
+ node.kind === 149 /* MethodDeclaration */);
if (ts.isInAmbientContext(node)) {
return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);
}
@@ -41385,12 +42656,15 @@ var ts;
var GetOrSetAccessor = GetAccessor | SetAccessor;
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- var name_24 = prop.name;
- if (name_24.kind === 141 /* ComputedPropertyName */) {
- // If the name is not a ComputedPropertyName, the grammar checking will skip it
- checkGrammarComputedPropertyName(name_24);
+ if (prop.kind === 258 /* SpreadAssignment */) {
+ continue;
}
- if (prop.kind === 254 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
+ var name_28 = prop.name;
+ if (name_28.kind === 142 /* ComputedPropertyName */) {
+ // If the name is not a ComputedPropertyName, the grammar checking will skip it
+ checkGrammarComputedPropertyName(name_28);
+ }
+ if (prop.kind === 257 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
// having objectAssignmentInitializer is only valid in ObjectAssignmentPattern
// outside of destructuring it is a syntax error
return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment);
@@ -41399,7 +42673,7 @@ var ts;
if (prop.modifiers) {
for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) {
var mod = _c[_b];
- if (mod.kind !== 119 /* AsyncKeyword */ || prop.kind !== 148 /* MethodDeclaration */) {
+ if (mod.kind !== 119 /* AsyncKeyword */ || prop.kind !== 149 /* MethodDeclaration */) {
grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod));
}
}
@@ -41413,27 +42687,27 @@ var ts;
// d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
var currentKind = void 0;
- if (prop.kind === 253 /* PropertyAssignment */ || prop.kind === 254 /* ShorthandPropertyAssignment */) {
+ if (prop.kind === 256 /* PropertyAssignment */ || prop.kind === 257 /* ShorthandPropertyAssignment */) {
// Grammar checking for computedPropertyName and shorthandPropertyAssignment
checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
- if (name_24.kind === 8 /* NumericLiteral */) {
- checkGrammarNumericLiteral(name_24);
+ if (name_28.kind === 8 /* NumericLiteral */) {
+ checkGrammarNumericLiteral(name_28);
}
currentKind = Property;
}
- else if (prop.kind === 148 /* MethodDeclaration */) {
+ else if (prop.kind === 149 /* MethodDeclaration */) {
currentKind = Property;
}
- else if (prop.kind === 150 /* GetAccessor */) {
+ else if (prop.kind === 151 /* GetAccessor */) {
currentKind = GetAccessor;
}
- else if (prop.kind === 151 /* SetAccessor */) {
+ else if (prop.kind === 152 /* SetAccessor */) {
currentKind = SetAccessor;
}
else {
ts.Debug.fail("Unexpected syntax kind:" + prop.kind);
}
- var effectiveName = ts.getPropertyNameForPropertyNameNode(name_24);
+ var effectiveName = ts.getPropertyNameForPropertyNameNode(name_28);
if (effectiveName === undefined) {
continue;
}
@@ -41443,18 +42717,18 @@ var ts;
else {
var existingKind = seen[effectiveName];
if (currentKind === Property && existingKind === Property) {
- grammarErrorOnNode(name_24, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_24));
+ grammarErrorOnNode(name_28, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_28));
}
else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) {
if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) {
seen[effectiveName] = currentKind | existingKind;
}
else {
- return grammarErrorOnNode(name_24, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);
+ return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);
}
}
else {
- return grammarErrorOnNode(name_24, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);
+ return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);
}
}
}
@@ -41463,19 +42737,19 @@ var ts;
var seen = ts.createMap();
for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) {
var attr = _a[_i];
- if (attr.kind === 247 /* JsxSpreadAttribute */) {
+ if (attr.kind === 250 /* JsxSpreadAttribute */) {
continue;
}
var jsxAttr = attr;
- var name_25 = jsxAttr.name;
- if (!seen[name_25.text]) {
- seen[name_25.text] = true;
+ var name_29 = jsxAttr.name;
+ if (!seen[name_29.text]) {
+ seen[name_29.text] = true;
}
else {
- return grammarErrorOnNode(name_25, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
+ return grammarErrorOnNode(name_29, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
}
var initializer = jsxAttr.initializer;
- if (initializer && initializer.kind === 248 /* JsxExpression */ && !initializer.expression) {
+ if (initializer && initializer.kind === 251 /* JsxExpression */ && !initializer.expression) {
return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression);
}
}
@@ -41484,7 +42758,7 @@ var ts;
if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) {
return true;
}
- if (forInOrOfStatement.initializer.kind === 220 /* VariableDeclarationList */) {
+ if (forInOrOfStatement.initializer.kind === 223 /* VariableDeclarationList */) {
var variableList = forInOrOfStatement.initializer;
if (!checkGrammarVariableDeclarationList(variableList)) {
var declarations = variableList.declarations;
@@ -41499,20 +42773,20 @@ var ts;
return false;
}
if (declarations.length > 1) {
- var diagnostic = forInOrOfStatement.kind === 208 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 211 /* ForInStatement */
? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement
: ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;
return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic);
}
var firstDeclaration = declarations[0];
if (firstDeclaration.initializer) {
- var diagnostic = forInOrOfStatement.kind === 208 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 211 /* ForInStatement */
? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer
: ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer;
return grammarErrorOnNode(firstDeclaration.name, diagnostic);
}
if (firstDeclaration.type) {
- var diagnostic = forInOrOfStatement.kind === 208 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 211 /* ForInStatement */
? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation
: ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation;
return grammarErrorOnNode(firstDeclaration, diagnostic);
@@ -41536,11 +42810,11 @@ var ts;
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
}
else if (!doesAccessorHaveCorrectParameterCount(accessor)) {
- return grammarErrorOnNode(accessor.name, kind === 150 /* GetAccessor */ ?
+ return grammarErrorOnNode(accessor.name, kind === 151 /* GetAccessor */ ?
ts.Diagnostics.A_get_accessor_cannot_have_parameters :
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);
}
- else if (kind === 151 /* SetAccessor */) {
+ else if (kind === 152 /* SetAccessor */) {
if (accessor.type) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);
}
@@ -41563,10 +42837,10 @@ var ts;
A get accessor has no parameters or a single `this` parameter.
A set accessor has one parameter or a `this` parameter and one more parameter */
function doesAccessorHaveCorrectParameterCount(accessor) {
- return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 150 /* GetAccessor */ ? 0 : 1);
+ return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 151 /* GetAccessor */ ? 0 : 1);
}
function getAccessorThisParameter(accessor) {
- if (accessor.parameters.length === (accessor.kind === 150 /* GetAccessor */ ? 1 : 2)) {
+ if (accessor.parameters.length === (accessor.kind === 151 /* GetAccessor */ ? 1 : 2)) {
return ts.getThisParameter(accessor);
}
}
@@ -41581,7 +42855,7 @@ var ts;
checkGrammarForGenerator(node)) {
return true;
}
- if (node.parent.kind === 172 /* ObjectLiteralExpression */) {
+ if (node.parent.kind === 175 /* ObjectLiteralExpression */) {
if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) {
return true;
}
@@ -41602,10 +42876,10 @@ var ts;
return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol);
}
}
- else if (node.parent.kind === 223 /* InterfaceDeclaration */) {
+ else if (node.parent.kind === 226 /* InterfaceDeclaration */) {
return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol);
}
- else if (node.parent.kind === 160 /* TypeLiteral */) {
+ else if (node.parent.kind === 161 /* TypeLiteral */) {
return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol);
}
}
@@ -41616,11 +42890,11 @@ var ts;
return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary);
}
switch (current.kind) {
- case 215 /* LabeledStatement */:
+ case 218 /* LabeledStatement */:
if (node.label && current.label.text === node.label.text) {
// found matching label - verify that label usage is correct
// continue can only target labels that are on iteration statements
- var isMisplacedContinueLabel = node.kind === 210 /* ContinueStatement */
+ var isMisplacedContinueLabel = node.kind === 213 /* ContinueStatement */
&& !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true);
if (isMisplacedContinueLabel) {
return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement);
@@ -41628,8 +42902,8 @@ var ts;
return false;
}
break;
- case 214 /* SwitchStatement */:
- if (node.kind === 211 /* BreakStatement */ && !node.label) {
+ case 217 /* SwitchStatement */:
+ if (node.kind === 214 /* BreakStatement */ && !node.label) {
// unlabeled break within switch statement - ok
return false;
}
@@ -41644,13 +42918,13 @@ var ts;
current = current.parent;
}
if (node.label) {
- var message = node.kind === 211 /* BreakStatement */
+ var message = node.kind === 214 /* BreakStatement */
? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement
: ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement;
return grammarErrorOnNode(node, message);
}
else {
- var message = node.kind === 211 /* BreakStatement */
+ var message = node.kind === 214 /* BreakStatement */
? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement
: ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement;
return grammarErrorOnNode(node, message);
@@ -41660,24 +42934,24 @@ var ts;
if (node.dotDotDotToken) {
var elements = node.parent.elements;
if (node !== ts.lastOrUndefined(elements)) {
- return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern);
+ return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
}
- if (node.name.kind === 169 /* ArrayBindingPattern */ || node.name.kind === 168 /* ObjectBindingPattern */) {
+ if (node.name.kind === 172 /* ArrayBindingPattern */ || node.name.kind === 171 /* ObjectBindingPattern */) {
return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);
}
if (node.initializer) {
- // Error on equals token which immediate precedes the initializer
+ // Error on equals token which immediately precedes the initializer
return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - 1, 1, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);
}
}
}
function isStringOrNumberLiteralExpression(expr) {
return expr.kind === 9 /* StringLiteral */ || expr.kind === 8 /* NumericLiteral */ ||
- expr.kind === 186 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ &&
+ expr.kind === 189 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ &&
expr.operand.kind === 8 /* NumericLiteral */;
}
function checkGrammarVariableDeclaration(node) {
- if (node.parent.parent.kind !== 208 /* ForInStatement */ && node.parent.parent.kind !== 209 /* ForOfStatement */) {
+ if (node.parent.parent.kind !== 211 /* ForInStatement */ && node.parent.parent.kind !== 212 /* ForOfStatement */) {
if (ts.isInAmbientContext(node)) {
if (node.initializer) {
if (ts.isConst(node) && !node.type) {
@@ -41742,15 +43016,15 @@ var ts;
}
function allowLetAndConstDeclarations(parent) {
switch (parent.kind) {
- case 204 /* IfStatement */:
- case 205 /* DoStatement */:
- case 206 /* WhileStatement */:
- case 213 /* WithStatement */:
- case 207 /* ForStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
+ case 207 /* IfStatement */:
+ case 208 /* DoStatement */:
+ case 209 /* WhileStatement */:
+ case 216 /* WithStatement */:
+ case 210 /* ForStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
return false;
- case 215 /* LabeledStatement */:
+ case 218 /* LabeledStatement */:
return allowLetAndConstDeclarations(parent.parent);
}
return true;
@@ -41805,7 +43079,7 @@ var ts;
return true;
}
}
- else if (node.parent.kind === 223 /* InterfaceDeclaration */) {
+ else if (node.parent.kind === 226 /* InterfaceDeclaration */) {
if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) {
return true;
}
@@ -41813,7 +43087,7 @@ var ts;
return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer);
}
}
- else if (node.parent.kind === 160 /* TypeLiteral */) {
+ else if (node.parent.kind === 161 /* TypeLiteral */) {
if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) {
return true;
}
@@ -41838,13 +43112,13 @@ var ts;
// export_opt AmbientDeclaration
//
// TODO: The spec needs to be amended to reflect this grammar.
- if (node.kind === 223 /* InterfaceDeclaration */ ||
- node.kind === 224 /* TypeAliasDeclaration */ ||
- node.kind === 231 /* ImportDeclaration */ ||
- node.kind === 230 /* ImportEqualsDeclaration */ ||
- node.kind === 237 /* ExportDeclaration */ ||
- node.kind === 236 /* ExportAssignment */ ||
- node.kind === 229 /* NamespaceExportDeclaration */ ||
+ if (node.kind === 226 /* InterfaceDeclaration */ ||
+ node.kind === 227 /* TypeAliasDeclaration */ ||
+ node.kind === 234 /* ImportDeclaration */ ||
+ node.kind === 233 /* ImportEqualsDeclaration */ ||
+ node.kind === 240 /* ExportDeclaration */ ||
+ node.kind === 239 /* ExportAssignment */ ||
+ node.kind === 232 /* NamespaceExportDeclaration */ ||
ts.getModifierFlags(node) & (2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) {
return false;
}
@@ -41853,7 +43127,7 @@ var ts;
function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) {
for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {
var decl = _a[_i];
- if (ts.isDeclaration(decl) || decl.kind === 201 /* VariableStatement */) {
+ if (ts.isDeclaration(decl) || decl.kind === 204 /* VariableStatement */) {
if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) {
return true;
}
@@ -41879,7 +43153,7 @@ var ts;
// to prevent noisiness. So use a bit on the block to indicate if
// this has already been reported, and don't report if it has.
//
- if (node.parent.kind === 200 /* Block */ || node.parent.kind === 227 /* ModuleBlock */ || node.parent.kind === 256 /* SourceFile */) {
+ if (node.parent.kind === 203 /* Block */ || node.parent.kind === 230 /* ModuleBlock */ || node.parent.kind === 260 /* SourceFile */) {
var links_1 = getNodeLinks(node.parent);
// Check if the containing block ever report this error
if (!links_1.hasReportedStatementInAmbientContext) {
@@ -41939,49 +43213,49 @@ var ts;
* significantly impacted.
*/
var nodeEdgeTraversalMap = ts.createMap((_a = {},
- _a[140 /* QualifiedName */] = [
+ _a[141 /* QualifiedName */] = [
{ name: "left", test: ts.isEntityName },
{ name: "right", test: ts.isIdentifier }
],
- _a[144 /* Decorator */] = [
+ _a[145 /* Decorator */] = [
{ name: "expression", test: ts.isLeftHandSideExpression }
],
- _a[178 /* TypeAssertionExpression */] = [
+ _a[181 /* TypeAssertionExpression */] = [
{ name: "type", test: ts.isTypeNode },
{ name: "expression", test: ts.isUnaryExpression }
],
- _a[196 /* AsExpression */] = [
+ _a[199 /* AsExpression */] = [
{ name: "expression", test: ts.isExpression },
{ name: "type", test: ts.isTypeNode }
],
- _a[197 /* NonNullExpression */] = [
+ _a[200 /* NonNullExpression */] = [
{ name: "expression", test: ts.isLeftHandSideExpression }
],
- _a[225 /* EnumDeclaration */] = [
+ _a[228 /* EnumDeclaration */] = [
{ name: "decorators", test: ts.isDecorator },
{ name: "modifiers", test: ts.isModifier },
{ name: "name", test: ts.isIdentifier },
{ name: "members", test: ts.isEnumMember }
],
- _a[226 /* ModuleDeclaration */] = [
+ _a[229 /* ModuleDeclaration */] = [
{ name: "decorators", test: ts.isDecorator },
{ name: "modifiers", test: ts.isModifier },
{ name: "name", test: ts.isModuleName },
{ name: "body", test: ts.isModuleBody }
],
- _a[227 /* ModuleBlock */] = [
+ _a[230 /* ModuleBlock */] = [
{ name: "statements", test: ts.isStatement }
],
- _a[230 /* ImportEqualsDeclaration */] = [
+ _a[233 /* ImportEqualsDeclaration */] = [
{ name: "decorators", test: ts.isDecorator },
{ name: "modifiers", test: ts.isModifier },
{ name: "name", test: ts.isIdentifier },
{ name: "moduleReference", test: ts.isModuleReference }
],
- _a[241 /* ExternalModuleReference */] = [
+ _a[244 /* ExternalModuleReference */] = [
{ name: "expression", test: ts.isExpression, optional: true }
],
- _a[255 /* EnumMember */] = [
+ _a[259 /* EnumMember */] = [
{ name: "name", test: ts.isPropertyName },
{ name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList }
],
@@ -42004,47 +43278,47 @@ var ts;
}
var kind = node.kind;
// No need to visit nodes with no children.
- if ((kind > 0 /* FirstToken */ && kind <= 139 /* LastToken */)) {
+ if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) {
return initial;
}
// We do not yet support types.
- if ((kind >= 155 /* TypePredicate */ && kind <= 167 /* LiteralType */)) {
+ if ((kind >= 156 /* TypePredicate */ && kind <= 170 /* LiteralType */)) {
return initial;
}
var result = initial;
switch (node.kind) {
// Leaf nodes
- case 199 /* SemicolonClassElement */:
- case 202 /* EmptyStatement */:
- case 194 /* OmittedExpression */:
- case 218 /* DebuggerStatement */:
- case 287 /* NotEmittedStatement */:
+ case 202 /* SemicolonClassElement */:
+ case 205 /* EmptyStatement */:
+ case 197 /* OmittedExpression */:
+ case 221 /* DebuggerStatement */:
+ case 291 /* NotEmittedStatement */:
// No need to visit nodes with no children.
break;
// Names
- case 141 /* ComputedPropertyName */:
+ case 142 /* ComputedPropertyName */:
result = reduceNode(node.expression, f, result);
break;
// Signature elements
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
result = reduceNode(node.type, f, result);
result = reduceNode(node.initializer, f, result);
break;
- case 144 /* Decorator */:
+ case 145 /* Decorator */:
result = reduceNode(node.expression, f, result);
break;
// Type member
- case 146 /* PropertyDeclaration */:
+ case 147 /* PropertyDeclaration */:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
result = reduceNode(node.type, f, result);
result = reduceNode(node.initializer, f, result);
break;
- case 148 /* MethodDeclaration */:
+ case 149 /* MethodDeclaration */:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
@@ -42053,12 +43327,12 @@ var ts;
result = reduceNode(node.type, f, result);
result = reduceNode(node.body, f, result);
break;
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
result = ts.reduceLeft(node.modifiers, f, result);
result = ts.reduceLeft(node.parameters, f, result);
result = reduceNode(node.body, f, result);
break;
- case 150 /* GetAccessor */:
+ case 151 /* GetAccessor */:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
@@ -42066,7 +43340,7 @@ var ts;
result = reduceNode(node.type, f, result);
result = reduceNode(node.body, f, result);
break;
- case 151 /* SetAccessor */:
+ case 152 /* SetAccessor */:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
@@ -42074,45 +43348,45 @@ var ts;
result = reduceNode(node.body, f, result);
break;
// Binding patterns
- case 168 /* ObjectBindingPattern */:
- case 169 /* ArrayBindingPattern */:
+ case 171 /* ObjectBindingPattern */:
+ case 172 /* ArrayBindingPattern */:
result = ts.reduceLeft(node.elements, f, result);
break;
- case 170 /* BindingElement */:
+ case 173 /* BindingElement */:
result = reduceNode(node.propertyName, f, result);
result = reduceNode(node.name, f, result);
result = reduceNode(node.initializer, f, result);
break;
// Expression
- case 171 /* ArrayLiteralExpression */:
+ case 174 /* ArrayLiteralExpression */:
result = ts.reduceLeft(node.elements, f, result);
break;
- case 172 /* ObjectLiteralExpression */:
+ case 175 /* ObjectLiteralExpression */:
result = ts.reduceLeft(node.properties, f, result);
break;
- case 173 /* PropertyAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.name, f, result);
break;
- case 174 /* ElementAccessExpression */:
+ case 177 /* ElementAccessExpression */:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.argumentExpression, f, result);
break;
- case 175 /* CallExpression */:
+ case 178 /* CallExpression */:
result = reduceNode(node.expression, f, result);
result = ts.reduceLeft(node.typeArguments, f, result);
result = ts.reduceLeft(node.arguments, f, result);
break;
- case 176 /* NewExpression */:
+ case 179 /* NewExpression */:
result = reduceNode(node.expression, f, result);
result = ts.reduceLeft(node.typeArguments, f, result);
result = ts.reduceLeft(node.arguments, f, result);
break;
- case 177 /* TaggedTemplateExpression */:
+ case 180 /* TaggedTemplateExpression */:
result = reduceNode(node.tag, f, result);
result = reduceNode(node.template, f, result);
break;
- case 180 /* FunctionExpression */:
+ case 183 /* FunctionExpression */:
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
result = ts.reduceLeft(node.typeParameters, f, result);
@@ -42120,119 +43394,119 @@ var ts;
result = reduceNode(node.type, f, result);
result = reduceNode(node.body, f, result);
break;
- case 181 /* ArrowFunction */:
+ case 184 /* ArrowFunction */:
result = ts.reduceLeft(node.modifiers, f, result);
result = ts.reduceLeft(node.typeParameters, f, result);
result = ts.reduceLeft(node.parameters, f, result);
result = reduceNode(node.type, f, result);
result = reduceNode(node.body, f, result);
break;
- case 179 /* ParenthesizedExpression */:
- case 182 /* DeleteExpression */:
- case 183 /* TypeOfExpression */:
- case 184 /* VoidExpression */:
- case 185 /* AwaitExpression */:
- case 191 /* YieldExpression */:
- case 192 /* SpreadElementExpression */:
- case 197 /* NonNullExpression */:
+ case 182 /* ParenthesizedExpression */:
+ case 185 /* DeleteExpression */:
+ case 186 /* TypeOfExpression */:
+ case 187 /* VoidExpression */:
+ case 188 /* AwaitExpression */:
+ case 194 /* YieldExpression */:
+ case 195 /* SpreadElement */:
+ case 200 /* NonNullExpression */:
result = reduceNode(node.expression, f, result);
break;
- case 186 /* PrefixUnaryExpression */:
- case 187 /* PostfixUnaryExpression */:
+ case 189 /* PrefixUnaryExpression */:
+ case 190 /* PostfixUnaryExpression */:
result = reduceNode(node.operand, f, result);
break;
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
result = reduceNode(node.left, f, result);
result = reduceNode(node.right, f, result);
break;
- case 189 /* ConditionalExpression */:
+ case 192 /* ConditionalExpression */:
result = reduceNode(node.condition, f, result);
result = reduceNode(node.whenTrue, f, result);
result = reduceNode(node.whenFalse, f, result);
break;
- case 190 /* TemplateExpression */:
+ case 193 /* TemplateExpression */:
result = reduceNode(node.head, f, result);
result = ts.reduceLeft(node.templateSpans, f, result);
break;
- case 193 /* ClassExpression */:
+ case 196 /* ClassExpression */:
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
result = ts.reduceLeft(node.typeParameters, f, result);
result = ts.reduceLeft(node.heritageClauses, f, result);
result = ts.reduceLeft(node.members, f, result);
break;
- case 195 /* ExpressionWithTypeArguments */:
+ case 198 /* ExpressionWithTypeArguments */:
result = reduceNode(node.expression, f, result);
result = ts.reduceLeft(node.typeArguments, f, result);
break;
// Misc
- case 198 /* TemplateSpan */:
+ case 201 /* TemplateSpan */:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.literal, f, result);
break;
// Element
- case 200 /* Block */:
+ case 203 /* Block */:
result = ts.reduceLeft(node.statements, f, result);
break;
- case 201 /* VariableStatement */:
+ case 204 /* VariableStatement */:
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.declarationList, f, result);
break;
- case 203 /* ExpressionStatement */:
+ case 206 /* ExpressionStatement */:
result = reduceNode(node.expression, f, result);
break;
- case 204 /* IfStatement */:
+ case 207 /* IfStatement */:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.thenStatement, f, result);
result = reduceNode(node.elseStatement, f, result);
break;
- case 205 /* DoStatement */:
+ case 208 /* DoStatement */:
result = reduceNode(node.statement, f, result);
result = reduceNode(node.expression, f, result);
break;
- case 206 /* WhileStatement */:
- case 213 /* WithStatement */:
+ case 209 /* WhileStatement */:
+ case 216 /* WithStatement */:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.statement, f, result);
break;
- case 207 /* ForStatement */:
+ case 210 /* ForStatement */:
result = reduceNode(node.initializer, f, result);
result = reduceNode(node.condition, f, result);
result = reduceNode(node.incrementor, f, result);
result = reduceNode(node.statement, f, result);
break;
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
result = reduceNode(node.initializer, f, result);
result = reduceNode(node.expression, f, result);
result = reduceNode(node.statement, f, result);
break;
- case 212 /* ReturnStatement */:
- case 216 /* ThrowStatement */:
+ case 215 /* ReturnStatement */:
+ case 219 /* ThrowStatement */:
result = reduceNode(node.expression, f, result);
break;
- case 214 /* SwitchStatement */:
+ case 217 /* SwitchStatement */:
result = reduceNode(node.expression, f, result);
result = reduceNode(node.caseBlock, f, result);
break;
- case 215 /* LabeledStatement */:
+ case 218 /* LabeledStatement */:
result = reduceNode(node.label, f, result);
result = reduceNode(node.statement, f, result);
break;
- case 217 /* TryStatement */:
+ case 220 /* TryStatement */:
result = reduceNode(node.tryBlock, f, result);
result = reduceNode(node.catchClause, f, result);
result = reduceNode(node.finallyBlock, f, result);
break;
- case 219 /* VariableDeclaration */:
+ case 222 /* VariableDeclaration */:
result = reduceNode(node.name, f, result);
result = reduceNode(node.type, f, result);
result = reduceNode(node.initializer, f, result);
break;
- case 220 /* VariableDeclarationList */:
+ case 223 /* VariableDeclarationList */:
result = ts.reduceLeft(node.declarations, f, result);
break;
- case 221 /* FunctionDeclaration */:
+ case 224 /* FunctionDeclaration */:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
@@ -42241,7 +43515,7 @@ var ts;
result = reduceNode(node.type, f, result);
result = reduceNode(node.body, f, result);
break;
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.name, f, result);
@@ -42249,94 +43523,97 @@ var ts;
result = ts.reduceLeft(node.heritageClauses, f, result);
result = ts.reduceLeft(node.members, f, result);
break;
- case 228 /* CaseBlock */:
+ case 231 /* CaseBlock */:
result = ts.reduceLeft(node.clauses, f, result);
break;
- case 231 /* ImportDeclaration */:
+ case 234 /* ImportDeclaration */:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.importClause, f, result);
result = reduceNode(node.moduleSpecifier, f, result);
break;
- case 232 /* ImportClause */:
+ case 235 /* ImportClause */:
result = reduceNode(node.name, f, result);
result = reduceNode(node.namedBindings, f, result);
break;
- case 233 /* NamespaceImport */:
+ case 236 /* NamespaceImport */:
result = reduceNode(node.name, f, result);
break;
- case 234 /* NamedImports */:
- case 238 /* NamedExports */:
+ case 237 /* NamedImports */:
+ case 241 /* NamedExports */:
result = ts.reduceLeft(node.elements, f, result);
break;
- case 235 /* ImportSpecifier */:
- case 239 /* ExportSpecifier */:
+ case 238 /* ImportSpecifier */:
+ case 242 /* ExportSpecifier */:
result = reduceNode(node.propertyName, f, result);
result = reduceNode(node.name, f, result);
break;
- case 236 /* ExportAssignment */:
+ case 239 /* ExportAssignment */:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.expression, f, result);
break;
- case 237 /* ExportDeclaration */:
+ case 240 /* ExportDeclaration */:
result = ts.reduceLeft(node.decorators, f, result);
result = ts.reduceLeft(node.modifiers, f, result);
result = reduceNode(node.exportClause, f, result);
result = reduceNode(node.moduleSpecifier, f, result);
break;
// JSX
- case 242 /* JsxElement */:
+ case 245 /* JsxElement */:
result = reduceNode(node.openingElement, f, result);
result = ts.reduceLeft(node.children, f, result);
result = reduceNode(node.closingElement, f, result);
break;
- case 243 /* JsxSelfClosingElement */:
- case 244 /* JsxOpeningElement */:
+ case 246 /* JsxSelfClosingElement */:
+ case 247 /* JsxOpeningElement */:
result = reduceNode(node.tagName, f, result);
result = ts.reduceLeft(node.attributes, f, result);
break;
- case 245 /* JsxClosingElement */:
+ case 248 /* JsxClosingElement */:
result = reduceNode(node.tagName, f, result);
break;
- case 246 /* JsxAttribute */:
+ case 249 /* JsxAttribute */:
result = reduceNode(node.name, f, result);
result = reduceNode(node.initializer, f, result);
break;
- case 247 /* JsxSpreadAttribute */:
+ case 250 /* JsxSpreadAttribute */:
result = reduceNode(node.expression, f, result);
break;
- case 248 /* JsxExpression */:
+ case 251 /* JsxExpression */:
result = reduceNode(node.expression, f, result);
break;
// Clauses
- case 249 /* CaseClause */:
+ case 252 /* CaseClause */:
result = reduceNode(node.expression, f, result);
// fall-through
- case 250 /* DefaultClause */:
+ case 253 /* DefaultClause */:
result = ts.reduceLeft(node.statements, f, result);
break;
- case 251 /* HeritageClause */:
+ case 254 /* HeritageClause */:
result = ts.reduceLeft(node.types, f, result);
break;
- case 252 /* CatchClause */:
+ case 255 /* CatchClause */:
result = reduceNode(node.variableDeclaration, f, result);
result = reduceNode(node.block, f, result);
break;
// Property assignments
- case 253 /* PropertyAssignment */:
+ case 256 /* PropertyAssignment */:
result = reduceNode(node.name, f, result);
result = reduceNode(node.initializer, f, result);
break;
- case 254 /* ShorthandPropertyAssignment */:
+ case 257 /* ShorthandPropertyAssignment */:
result = reduceNode(node.name, f, result);
result = reduceNode(node.objectAssignmentInitializer, f, result);
break;
+ case 258 /* SpreadAssignment */:
+ result = reduceNode(node.expression, f, result);
+ break;
// Top-level nodes
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
result = ts.reduceLeft(node.statements, f, result);
break;
- case 288 /* PartiallyEmittedExpression */:
+ case 292 /* PartiallyEmittedExpression */:
result = reduceNode(node.expression, f, result);
break;
default:
@@ -42361,6 +43638,7 @@ var ts;
if (node === undefined) {
return undefined;
}
+ aggregateTransformFlags(node);
var visited = visitor(node);
if (visited === node) {
return node;
@@ -42409,6 +43687,7 @@ var ts;
// Visit each original node.
for (var i = 0; i < count; i++) {
var node = nodes[i + start];
+ aggregateTransformFlags(node);
var visited = node !== undefined ? visitor(node) : undefined;
if (updated !== undefined || visited === undefined || visited !== node) {
if (updated === undefined) {
@@ -42447,192 +43726,194 @@ var ts;
}
var kind = node.kind;
// No need to visit nodes with no children.
- if ((kind > 0 /* FirstToken */ && kind <= 139 /* LastToken */)) {
+ if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) {
return node;
}
// We do not yet support types.
- if ((kind >= 155 /* TypePredicate */ && kind <= 167 /* LiteralType */)) {
+ if ((kind >= 156 /* TypePredicate */ && kind <= 170 /* LiteralType */)) {
return node;
}
switch (node.kind) {
- case 199 /* SemicolonClassElement */:
- case 202 /* EmptyStatement */:
- case 194 /* OmittedExpression */:
- case 218 /* DebuggerStatement */:
+ case 202 /* SemicolonClassElement */:
+ case 205 /* EmptyStatement */:
+ case 197 /* OmittedExpression */:
+ case 221 /* DebuggerStatement */:
// No need to visit nodes with no children.
return node;
// Names
- case 141 /* ComputedPropertyName */:
+ case 142 /* ComputedPropertyName */:
return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));
// Signature elements
- case 143 /* Parameter */:
- return ts.updateParameterDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));
+ case 144 /* Parameter */:
+ return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));
// Type member
- case 146 /* PropertyDeclaration */:
+ case 147 /* PropertyDeclaration */:
return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));
- case 148 /* MethodDeclaration */:
+ case 149 /* MethodDeclaration */:
return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
- case 150 /* GetAccessor */:
+ case 151 /* GetAccessor */:
return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
- case 151 /* SetAccessor */:
+ case 152 /* SetAccessor */:
return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
// Binding patterns
- case 168 /* ObjectBindingPattern */:
+ case 171 /* ObjectBindingPattern */:
return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement));
- case 169 /* ArrayBindingPattern */:
+ case 172 /* ArrayBindingPattern */:
return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement));
- case 170 /* BindingElement */:
+ case 173 /* BindingElement */:
return ts.updateBindingElement(node, visitNode(node.propertyName, visitor, ts.isPropertyName, /*optional*/ true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));
// Expression
- case 171 /* ArrayLiteralExpression */:
+ case 174 /* ArrayLiteralExpression */:
return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression));
- case 172 /* ObjectLiteralExpression */:
+ case 175 /* ObjectLiteralExpression */:
return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike));
- case 173 /* PropertyAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier));
- case 174 /* ElementAccessExpression */:
+ case 177 /* ElementAccessExpression */:
return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression));
- case 175 /* CallExpression */:
+ case 178 /* CallExpression */:
return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression));
- case 176 /* NewExpression */:
+ case 179 /* NewExpression */:
return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression));
- case 177 /* TaggedTemplateExpression */:
+ case 180 /* TaggedTemplateExpression */:
return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral));
- case 179 /* ParenthesizedExpression */:
+ case 182 /* ParenthesizedExpression */:
return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
- case 180 /* FunctionExpression */:
+ case 183 /* FunctionExpression */:
return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
- case 181 /* ArrowFunction */:
+ case 184 /* ArrowFunction */:
return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isConciseBody, /*optional*/ true), context.endLexicalEnvironment()));
- case 182 /* DeleteExpression */:
+ case 185 /* DeleteExpression */:
return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
- case 183 /* TypeOfExpression */:
+ case 186 /* TypeOfExpression */:
return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression));
- case 184 /* VoidExpression */:
+ case 187 /* VoidExpression */:
return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression));
- case 185 /* AwaitExpression */:
+ case 188 /* AwaitExpression */:
return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression));
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression));
- case 186 /* PrefixUnaryExpression */:
+ case 189 /* PrefixUnaryExpression */:
return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression));
- case 187 /* PostfixUnaryExpression */:
+ case 190 /* PostfixUnaryExpression */:
return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression));
- case 189 /* ConditionalExpression */:
+ case 192 /* ConditionalExpression */:
return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression));
- case 190 /* TemplateExpression */:
+ case 193 /* TemplateExpression */:
return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan));
- case 191 /* YieldExpression */:
+ case 194 /* YieldExpression */:
return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression));
- case 192 /* SpreadElementExpression */:
+ case 195 /* SpreadElement */:
return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression));
- case 193 /* ClassExpression */:
+ case 196 /* ClassExpression */:
return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));
- case 195 /* ExpressionWithTypeArguments */:
+ case 198 /* ExpressionWithTypeArguments */:
return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
// Misc
- case 198 /* TemplateSpan */:
+ case 201 /* TemplateSpan */:
return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail));
// Element
- case 200 /* Block */:
+ case 203 /* Block */:
return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement));
- case 201 /* VariableStatement */:
+ case 204 /* VariableStatement */:
return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList));
- case 203 /* ExpressionStatement */:
+ case 206 /* ExpressionStatement */:
return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression));
- case 204 /* IfStatement */:
+ case 207 /* IfStatement */:
return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, /*optional*/ true, liftToBlock));
- case 205 /* DoStatement */:
+ case 208 /* DoStatement */:
return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression));
- case 206 /* WhileStatement */:
+ case 209 /* WhileStatement */:
return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock));
- case 207 /* ForStatement */:
+ case 210 /* ForStatement */:
return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock));
- case 208 /* ForInStatement */:
+ case 211 /* ForInStatement */:
return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock));
- case 209 /* ForOfStatement */:
+ case 212 /* ForOfStatement */:
return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock));
- case 210 /* ContinueStatement */:
+ case 213 /* ContinueStatement */:
return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true));
- case 211 /* BreakStatement */:
+ case 214 /* BreakStatement */:
return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true));
- case 212 /* ReturnStatement */:
+ case 215 /* ReturnStatement */:
return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true));
- case 213 /* WithStatement */:
+ case 216 /* WithStatement */:
return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock));
- case 214 /* SwitchStatement */:
+ case 217 /* SwitchStatement */:
return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock));
- case 215 /* LabeledStatement */:
+ case 218 /* LabeledStatement */:
return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock));
- case 216 /* ThrowStatement */:
+ case 219 /* ThrowStatement */:
return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression));
- case 217 /* TryStatement */:
+ case 220 /* TryStatement */:
return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, /*optional*/ true), visitNode(node.finallyBlock, visitor, ts.isBlock, /*optional*/ true));
- case 219 /* VariableDeclaration */:
+ case 222 /* VariableDeclaration */:
return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));
- case 220 /* VariableDeclarationList */:
+ case 223 /* VariableDeclarationList */:
return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration));
- case 221 /* FunctionDeclaration */:
+ case 224 /* FunctionDeclaration */:
return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));
- case 228 /* CaseBlock */:
+ case 231 /* CaseBlock */:
return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause));
- case 231 /* ImportDeclaration */:
+ case 234 /* ImportDeclaration */:
return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
- case 232 /* ImportClause */:
+ case 235 /* ImportClause */:
return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, /*optional*/ true));
- case 233 /* NamespaceImport */:
+ case 236 /* NamespaceImport */:
return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier));
- case 234 /* NamedImports */:
+ case 237 /* NamedImports */:
return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier));
- case 235 /* ImportSpecifier */:
+ case 238 /* ImportSpecifier */:
return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier));
- case 236 /* ExportAssignment */:
+ case 239 /* ExportAssignment */:
return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression));
- case 237 /* ExportDeclaration */:
+ case 240 /* ExportDeclaration */:
return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, /*optional*/ true));
- case 238 /* NamedExports */:
+ case 241 /* NamedExports */:
return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier));
- case 239 /* ExportSpecifier */:
+ case 242 /* ExportSpecifier */:
return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier));
// JSX
- case 242 /* JsxElement */:
+ case 245 /* JsxElement */:
return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement));
- case 243 /* JsxSelfClosingElement */:
+ case 246 /* JsxSelfClosingElement */:
return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike));
- case 244 /* JsxOpeningElement */:
+ case 247 /* JsxOpeningElement */:
return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike));
- case 245 /* JsxClosingElement */:
+ case 248 /* JsxClosingElement */:
return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression));
- case 246 /* JsxAttribute */:
+ case 249 /* JsxAttribute */:
return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression));
- case 247 /* JsxSpreadAttribute */:
+ case 250 /* JsxSpreadAttribute */:
return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression));
- case 248 /* JsxExpression */:
+ case 251 /* JsxExpression */:
return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression));
// Clauses
- case 249 /* CaseClause */:
+ case 252 /* CaseClause */:
return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement));
- case 250 /* DefaultClause */:
+ case 253 /* DefaultClause */:
return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement));
- case 251 /* HeritageClause */:
+ case 254 /* HeritageClause */:
return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments));
- case 252 /* CatchClause */:
+ case 255 /* CatchClause */:
return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock));
// Property assignments
- case 253 /* PropertyAssignment */:
+ case 256 /* PropertyAssignment */:
return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));
- case 254 /* ShorthandPropertyAssignment */:
+ case 257 /* ShorthandPropertyAssignment */:
return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression));
+ case 258 /* SpreadAssignment */:
+ return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression));
// Top-level nodes
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
context.startLexicalEnvironment();
return ts.updateSourceFileNode(node, ts.createNodeArray(ts.concatenate(visitNodes(node.statements, visitor, ts.isStatement), context.endLexicalEnvironment()), node.statements));
// Transformation nodes
- case 288 /* PartiallyEmittedExpression */:
+ case 292 /* PartiallyEmittedExpression */:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
default:
var updated = void 0;
@@ -42781,7 +44062,7 @@ var ts;
* @param recordTempVariable A callback used to record new temporary variables.
* @param visitor An optional visitor to use to visit expressions.
*/
- function flattenDestructuringAssignment(context, node, needsValue, recordTempVariable, visitor) {
+ function flattenDestructuringAssignment(context, node, needsValue, recordTempVariable, visitor, transformRest) {
if (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) {
var right = node.right;
if (ts.isDestructuringAssignment(right)) {
@@ -42812,7 +44093,7 @@ var ts;
// location should point to the right-hand value of the expression.
location = value;
}
- flattenDestructuring(node, value, location, emitAssignment, emitTempVariableAssignment, visitor);
+ flattenDestructuring(node, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor);
if (needsValue) {
expressions.push(value);
}
@@ -42832,6 +44113,9 @@ var ts;
emitAssignment(name, value, location);
return name;
}
+ function emitRestAssignment(elements, value, location) {
+ emitAssignment(ts.createObjectLiteral(elements), value, location);
+ }
}
ts.flattenDestructuringAssignment = flattenDestructuringAssignment;
/**
@@ -42841,9 +44125,9 @@ var ts;
* @param value The rhs value for the binding pattern.
* @param visitor An optional visitor to use to visit expressions.
*/
- function flattenParameterDestructuring(node, value, visitor) {
+ function flattenParameterDestructuring(node, value, visitor, transformRest) {
var declarations = [];
- flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, visitor);
+ flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, transformRest, visitor);
return declarations;
function emitAssignment(name, value, location) {
var declaration = ts.createVariableDeclaration(name, /*type*/ undefined, value, location);
@@ -42858,6 +44142,9 @@ var ts;
emitAssignment(name, value, location);
return name;
}
+ function emitRestAssignment(elements, value, location) {
+ emitAssignment(ts.createObjectBindingPattern(elements), value, location);
+ }
}
ts.flattenParameterDestructuring = flattenParameterDestructuring;
/**
@@ -42867,10 +44154,10 @@ var ts;
* @param value An optional rhs value for the binding pattern.
* @param visitor An optional visitor to use to visit expressions.
*/
- function flattenVariableDestructuring(node, value, visitor, recordTempVariable) {
+ function flattenVariableDestructuring(node, value, visitor, recordTempVariable, transformRest) {
var declarations = [];
var pendingAssignments;
- flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, visitor);
+ flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor);
return declarations;
function emitAssignment(name, value, location, original) {
if (pendingAssignments) {
@@ -42902,6 +44189,9 @@ var ts;
}
return name;
}
+ function emitRestAssignment(elements, value, location, original) {
+ emitAssignment(ts.createObjectBindingPattern(elements), value, location, original);
+ }
}
ts.flattenVariableDestructuring = flattenVariableDestructuring;
/**
@@ -42909,36 +44199,40 @@ var ts;
*
* @param node The VariableDeclaration to flatten.
* @param recordTempVariable A callback used to record new temporary variables.
- * @param nameSubstitution An optional callback used to substitute binding names.
+ * @param createAssignmentCallback An optional callback used to create assignment expressions
+ * for non-temporary variables.
* @param visitor An optional visitor to use to visit expressions.
*/
- function flattenVariableDestructuringToExpression(node, recordTempVariable, nameSubstitution, visitor) {
+ function flattenVariableDestructuringToExpression(node, recordTempVariable, createAssignmentCallback, visitor) {
var pendingAssignments = [];
- flattenDestructuring(node, /*value*/ undefined, node, emitAssignment, emitTempVariableAssignment, visitor);
+ flattenDestructuring(node, /*value*/ undefined, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, /*transformRest*/ false, visitor);
var expression = ts.inlineExpressions(pendingAssignments);
ts.aggregateTransformFlags(expression);
return expression;
function emitAssignment(name, value, location, original) {
- var left = nameSubstitution && nameSubstitution(name) || name;
- emitPendingAssignment(left, value, location, original);
+ var expression = createAssignmentCallback
+ ? createAssignmentCallback(name.kind === 70 /* Identifier */ ? name : emitTempVariableAssignment(name, location), value, location)
+ : ts.createAssignment(name, value, location);
+ emitPendingAssignment(expression, original);
}
function emitTempVariableAssignment(value, location) {
var name = ts.createTempVariable(recordTempVariable);
- emitPendingAssignment(name, value, location, /*original*/ undefined);
+ emitPendingAssignment(ts.createAssignment(name, value, location), /*original*/ undefined);
return name;
}
- function emitPendingAssignment(name, value, location, original) {
- var expression = ts.createAssignment(name, value, location);
+ function emitRestAssignment(elements, value, location, original) {
+ emitAssignment(ts.createObjectLiteral(elements), value, location, original);
+ }
+ function emitPendingAssignment(expression, original) {
expression.original = original;
// NOTE: this completely disables source maps, but aligns with the behavior of
// `emitAssignment` in the old emitter.
ts.setEmitFlags(expression, 2048 /* NoNestedSourceMaps */);
pendingAssignments.push(expression);
- return expression;
}
}
ts.flattenVariableDestructuringToExpression = flattenVariableDestructuringToExpression;
- function flattenDestructuring(root, value, location, emitAssignment, emitTempVariableAssignment, visitor) {
+ function flattenDestructuring(root, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor) {
if (value && visitor) {
value = ts.visitNode(value, visitor, ts.isExpression);
}
@@ -42970,17 +44264,17 @@ var ts;
else {
target = bindingTarget;
}
- if (target.kind === 172 /* ObjectLiteralExpression */) {
+ if (target.kind === 175 /* ObjectLiteralExpression */) {
emitObjectLiteralAssignment(target, value, location);
}
- else if (target.kind === 171 /* ArrayLiteralExpression */) {
+ else if (target.kind === 174 /* ArrayLiteralExpression */) {
emitArrayLiteralAssignment(target, value, location);
}
else {
- var name_26 = ts.getMutableClone(target);
- ts.setSourceMapRange(name_26, target);
- ts.setCommentRange(name_26, target);
- emitAssignment(name_26, value, location, /*original*/ undefined);
+ var name_30 = ts.getMutableClone(target);
+ ts.setSourceMapRange(name_30, target);
+ ts.setCommentRange(name_30, target);
+ emitAssignment(name_30, value, location, /*original*/ undefined);
}
}
function emitObjectLiteralAssignment(target, value, location) {
@@ -42991,30 +44285,95 @@ var ts;
// When doing so we want to hightlight the passed in source map node since thats the one needing this temp assignment
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment);
}
- for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) {
- var p = properties_6[_i];
- if (p.kind === 253 /* PropertyAssignment */ || p.kind === 254 /* ShorthandPropertyAssignment */) {
- var propName = p.name;
- var target_1 = p.kind === 254 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName;
- // Assignment for target = value.propName should highligh whole property, hence use p as source map node
- emitDestructuringAssignment(target_1, createDestructuringPropertyAccess(value, propName), p);
+ var bindingElements = [];
+ for (var i = 0; i < properties.length; i++) {
+ var p = properties[i];
+ if (p.kind === 256 /* PropertyAssignment */ || p.kind === 257 /* ShorthandPropertyAssignment */) {
+ if (!transformRest ||
+ p.transformFlags & 8388608 /* ContainsSpreadExpression */ ||
+ (p.kind === 256 /* PropertyAssignment */ && p.initializer.transformFlags & 8388608 /* ContainsSpreadExpression */)) {
+ if (bindingElements.length) {
+ emitRestAssignment(bindingElements, value, location, target);
+ bindingElements = [];
+ }
+ var propName = p.name;
+ var bindingTarget = p.kind === 257 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName;
+ // Assignment for bindingTarget = value.propName should highlight whole property, hence use p as source map node
+ emitDestructuringAssignment(bindingTarget, createDestructuringPropertyAccess(value, propName), p);
+ }
+ else {
+ bindingElements.push(p);
+ }
}
+ else if (i === properties.length - 1 && p.kind === 258 /* SpreadAssignment */) {
+ ts.Debug.assert(p.expression.kind === 70 /* Identifier */);
+ if (bindingElements.length) {
+ emitRestAssignment(bindingElements, value, location, target);
+ bindingElements = [];
+ }
+ var propName = p.expression;
+ var restCall = createRestCall(value, target.properties, function (p) { return p.name; }, target);
+ emitDestructuringAssignment(propName, restCall, p);
+ }
+ }
+ if (bindingElements.length) {
+ emitRestAssignment(bindingElements, value, location, target);
+ bindingElements = [];
}
}
function emitArrayLiteralAssignment(target, value, location) {
+ if (transformRest) {
+ emitESNextArrayLiteralAssignment(target, value, location);
+ }
+ else {
+ emitES2015ArrayLiteralAssignment(target, value, location);
+ }
+ }
+ function emitESNextArrayLiteralAssignment(target, value, location) {
var elements = target.elements;
var numElements = elements.length;
if (numElements !== 1) {
// For anything but a single element destructuring we need to generate a temporary
// to ensure value is evaluated exactly once.
- // When doing so we want to hightlight the passed in source map node since thats the one needing this temp assignment
+ // When doing so we want to highlight the passed-in source map node since thats the one needing this temp assignment
+ value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment);
+ }
+ var expressions = [];
+ var spreadContainingExpressions = [];
+ for (var i = 0; i < numElements; i++) {
+ var e = elements[i];
+ if (e.kind === 197 /* OmittedExpression */) {
+ continue;
+ }
+ if (e.transformFlags & 8388608 /* ContainsSpreadExpression */ && i < numElements - 1) {
+ var tmp = ts.createTempVariable(recordTempVariable);
+ spreadContainingExpressions.push([e, tmp]);
+ expressions.push(tmp);
+ }
+ else {
+ expressions.push(e);
+ }
+ }
+ emitAssignment(ts.updateArrayLiteral(target, expressions), value, undefined, undefined);
+ for (var _i = 0, spreadContainingExpressions_1 = spreadContainingExpressions; _i < spreadContainingExpressions_1.length; _i++) {
+ var _a = spreadContainingExpressions_1[_i], e = _a[0], tmp = _a[1];
+ emitDestructuringAssignment(e, tmp, e);
+ }
+ }
+ function emitES2015ArrayLiteralAssignment(target, value, location) {
+ var elements = target.elements;
+ var numElements = elements.length;
+ if (numElements !== 1) {
+ // For anything but a single element destructuring we need to generate a temporary
+ // to ensure value is evaluated exactly once.
+ // When doing so we want to highlight the passed-in source map node since thats the one needing this temp assignment
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment);
}
for (var i = 0; i < numElements; i++) {
var e = elements[i];
- if (e.kind !== 194 /* OmittedExpression */) {
+ if (e.kind !== 197 /* OmittedExpression */) {
// Assignment for target = value.propName should highligh whole property, hence use e as source map node
- if (e.kind !== 192 /* SpreadElementExpression */) {
+ if (e.kind !== 195 /* SpreadElement */) {
emitDestructuringAssignment(e, ts.createElementAccess(value, ts.createLiteral(i)), e);
}
else if (i === numElements - 1) {
@@ -43023,10 +44382,30 @@ var ts;
}
}
}
+ /** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement
+ * `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`*/
+ function createRestCall(value, elements, getPropertyName, location) {
+ var propertyNames = [];
+ for (var i = 0; i < elements.length - 1; i++) {
+ if (ts.isOmittedExpression(elements[i])) {
+ continue;
+ }
+ var str = ts.createSynthesizedNode(9 /* StringLiteral */);
+ str.pos = location.pos;
+ str.end = location.end;
+ str.text = ts.getTextOfPropertyName(getPropertyName(elements[i]));
+ propertyNames.push(str);
+ }
+ var args = ts.createSynthesizedNodeArray([value, ts.createArrayLiteral(propertyNames, location)]);
+ return ts.createCall(ts.createIdentifier("__rest"), undefined, args);
+ }
function emitBindingElement(target, value) {
// Any temporary assignments needed to emit target = value should point to target
var initializer = visitor ? ts.visitNode(target.initializer, visitor, ts.isExpression) : target.initializer;
- if (initializer) {
+ if (transformRest) {
+ value = value || initializer;
+ }
+ else if (initializer) {
// Combine value and initializer
value = value ? createDefaultValueCheck(value, initializer, target) : initializer;
}
@@ -43035,9 +44414,11 @@ var ts;
value = ts.createVoidZero();
}
var name = target.name;
- if (ts.isBindingPattern(name)) {
- var elements = name.elements;
- var numElements = elements.length;
+ if (!ts.isBindingPattern(name)) {
+ emitAssignment(name, value, target, target);
+ }
+ else {
+ var numElements = name.elements.length;
if (numElements !== 1) {
// For anything other than a single-element destructuring we need to generate a temporary
// to ensure value is evaluated exactly once. Additionally, if we have zero elements
@@ -43045,29 +44426,98 @@ var ts;
// so in that case, we'll intentionally create that temporary.
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0, target, emitTempVariableAssignment);
}
- for (var i = 0; i < numElements; i++) {
- var element = elements[i];
- if (ts.isOmittedExpression(element)) {
- continue;
- }
- else if (name.kind === 168 /* ObjectBindingPattern */) {
- // Rewrite element to a declaration with an initializer that fetches property
- var propName = element.propertyName || element.name;
- emitBindingElement(element, createDestructuringPropertyAccess(value, propName));
- }
- else {
- if (!element.dotDotDotToken) {
- // Rewrite element to a declaration that accesses array element at index i
- emitBindingElement(element, ts.createElementAccess(value, i));
- }
- else if (i === numElements - 1) {
- emitBindingElement(element, ts.createArraySlice(value, i));
- }
- }
+ if (name.kind === 172 /* ArrayBindingPattern */) {
+ emitArrayBindingElement(name, value);
+ }
+ else {
+ emitObjectBindingElement(target, value);
}
}
+ }
+ function emitArrayBindingElement(name, value) {
+ if (transformRest) {
+ emitESNextArrayBindingElement(name, value);
+ }
else {
- emitAssignment(name, value, target, target);
+ emitES2015ArrayBindingElement(name, value);
+ }
+ }
+ function emitES2015ArrayBindingElement(name, value) {
+ var elements = name.elements;
+ var numElements = elements.length;
+ for (var i = 0; i < numElements; i++) {
+ var element = elements[i];
+ if (ts.isOmittedExpression(element)) {
+ continue;
+ }
+ if (!element.dotDotDotToken) {
+ // Rewrite element to a declaration that accesses array element at index i
+ emitBindingElement(element, ts.createElementAccess(value, i));
+ }
+ else if (i === numElements - 1) {
+ emitBindingElement(element, ts.createArraySlice(value, i));
+ }
+ }
+ }
+ function emitESNextArrayBindingElement(name, value) {
+ var elements = name.elements;
+ var numElements = elements.length;
+ var bindingElements = [];
+ var spreadContainingElements = [];
+ for (var i = 0; i < numElements; i++) {
+ var element = elements[i];
+ if (ts.isOmittedExpression(element)) {
+ continue;
+ }
+ if (element.transformFlags & 8388608 /* ContainsSpreadExpression */ && i < numElements - 1) {
+ spreadContainingElements.push(element);
+ bindingElements.push(ts.createBindingElement(undefined, undefined, ts.getGeneratedNameForNode(element), undefined, value));
+ }
+ else {
+ bindingElements.push(element);
+ }
+ }
+ emitAssignment(ts.updateArrayBindingPattern(name, bindingElements), value, undefined, undefined);
+ for (var _i = 0, spreadContainingElements_1 = spreadContainingElements; _i < spreadContainingElements_1.length; _i++) {
+ var element = spreadContainingElements_1[_i];
+ emitBindingElement(element, ts.getGeneratedNameForNode(element));
+ }
+ }
+ function emitObjectBindingElement(target, value) {
+ var name = target.name;
+ var elements = name.elements;
+ var numElements = elements.length;
+ var bindingElements = [];
+ for (var i = 0; i < numElements; i++) {
+ var element = elements[i];
+ if (ts.isOmittedExpression(element)) {
+ continue;
+ }
+ if (i === numElements - 1 && element.dotDotDotToken) {
+ if (bindingElements.length) {
+ emitRestAssignment(bindingElements, value, target, target);
+ bindingElements = [];
+ }
+ var restCall = createRestCall(value, name.elements, function (element) { return element.propertyName || element.name; }, name);
+ emitBindingElement(element, restCall);
+ }
+ else if (transformRest && !(element.transformFlags & 8388608 /* ContainsSpreadExpression */)) {
+ // do not emit until we have a complete bundle of ES2015 syntax
+ bindingElements.push(element);
+ }
+ else {
+ if (bindingElements.length) {
+ emitRestAssignment(bindingElements, value, target, target);
+ bindingElements = [];
+ }
+ // Rewrite element to a declaration with an initializer that fetches property
+ var propName = element.propertyName || element.name;
+ emitBindingElement(element, createDestructuringPropertyAccess(value, propName));
+ }
+ }
+ if (bindingElements.length) {
+ emitRestAssignment(bindingElements, value, target, target);
+ bindingElements = [];
}
}
function createDefaultValueCheck(value, defaultValue, location) {
@@ -43158,15 +44608,15 @@ var ts;
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
// Enable substitution for property/element access to emit const enum values.
- context.enableSubstitution(173 /* PropertyAccessExpression */);
- context.enableSubstitution(174 /* ElementAccessExpression */);
+ context.enableSubstitution(176 /* PropertyAccessExpression */);
+ context.enableSubstitution(177 /* ElementAccessExpression */);
// These variables contain state that changes as we descend into the tree.
var currentSourceFile;
var currentNamespace;
var currentNamespaceContainerName;
var currentScope;
var currentScopeFirstDeclarationsOfName;
- var currentSourceFileExternalHelpersModuleName;
+ var currentExternalHelpersModuleName;
/**
* Keeps track of whether expression substitution has been enabled for specific edge cases.
* They are persisted between each SourceFile transformation and should not be reset.
@@ -43227,7 +44677,7 @@ var ts;
* @param node The node to visit.
*/
function visitorWorker(node) {
- if (node.kind === 256 /* SourceFile */) {
+ if (node.kind === 260 /* SourceFile */) {
return visitSourceFile(node);
}
else if (node.transformFlags & 1 /* TypeScript */) {
@@ -43255,13 +44705,13 @@ var ts;
*/
function sourceElementVisitorWorker(node) {
switch (node.kind) {
- case 231 /* ImportDeclaration */:
+ case 234 /* ImportDeclaration */:
return visitImportDeclaration(node);
- case 230 /* ImportEqualsDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
return visitImportEqualsDeclaration(node);
- case 236 /* ExportAssignment */:
+ case 239 /* ExportAssignment */:
return visitExportAssignment(node);
- case 237 /* ExportDeclaration */:
+ case 240 /* ExportDeclaration */:
return visitExportDeclaration(node);
default:
return visitorWorker(node);
@@ -43281,11 +44731,11 @@ var ts;
* @param node The node to visit.
*/
function namespaceElementVisitorWorker(node) {
- if (node.kind === 237 /* ExportDeclaration */ ||
- node.kind === 231 /* ImportDeclaration */ ||
- node.kind === 232 /* ImportClause */ ||
- (node.kind === 230 /* ImportEqualsDeclaration */ &&
- node.moduleReference.kind === 241 /* ExternalModuleReference */)) {
+ if (node.kind === 240 /* ExportDeclaration */ ||
+ node.kind === 234 /* ImportDeclaration */ ||
+ node.kind === 235 /* ImportClause */ ||
+ (node.kind === 233 /* ImportEqualsDeclaration */ &&
+ node.moduleReference.kind === 244 /* ExternalModuleReference */)) {
// do not emit ES6 imports and exports since they are illegal inside a namespace
return undefined;
}
@@ -43315,25 +44765,34 @@ var ts;
*/
function classElementVisitorWorker(node) {
switch (node.kind) {
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
// TypeScript constructors are transformed in `visitClassDeclaration`.
// We elide them here as `visitorWorker` checks transform flags, which could
// erronously include an ES6 constructor without TypeScript syntax.
return undefined;
- case 146 /* PropertyDeclaration */:
- case 154 /* IndexSignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 148 /* MethodDeclaration */:
+ case 147 /* PropertyDeclaration */:
+ case 155 /* IndexSignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 149 /* MethodDeclaration */:
// Fallback to the default visit behavior.
return visitorWorker(node);
- case 199 /* SemicolonClassElement */:
+ case 202 /* SemicolonClassElement */:
return node;
default:
ts.Debug.failBadSyntaxKind(node);
return undefined;
}
}
+ function modifierVisitor(node) {
+ if (ts.modifierToFlag(node.kind) & 2270 /* TypeScriptModifier */) {
+ return undefined;
+ }
+ else if (currentNamespace && node.kind === 83 /* ExportKeyword */) {
+ return undefined;
+ }
+ return node;
+ }
/**
* Branching visitor, visits a TypeScript syntax node.
*
@@ -43356,45 +44815,47 @@ var ts;
case 116 /* AbstractKeyword */:
case 75 /* ConstKeyword */:
case 123 /* DeclareKeyword */:
- case 129 /* ReadonlyKeyword */:
+ case 130 /* ReadonlyKeyword */:
// TypeScript accessibility and readonly modifiers are elided.
- case 161 /* ArrayType */:
- case 162 /* TupleType */:
- case 160 /* TypeLiteral */:
- case 155 /* TypePredicate */:
- case 142 /* TypeParameter */:
+ case 162 /* ArrayType */:
+ case 163 /* TupleType */:
+ case 161 /* TypeLiteral */:
+ case 156 /* TypePredicate */:
+ case 143 /* TypeParameter */:
case 118 /* AnyKeyword */:
case 121 /* BooleanKeyword */:
- case 133 /* StringKeyword */:
- case 131 /* NumberKeyword */:
- case 128 /* NeverKeyword */:
+ case 134 /* StringKeyword */:
+ case 132 /* NumberKeyword */:
+ case 129 /* NeverKeyword */:
case 104 /* VoidKeyword */:
- case 134 /* SymbolKeyword */:
- case 158 /* ConstructorType */:
- case 157 /* FunctionType */:
- case 159 /* TypeQuery */:
- case 156 /* TypeReference */:
- case 163 /* UnionType */:
- case 164 /* IntersectionType */:
- case 165 /* ParenthesizedType */:
- case 166 /* ThisType */:
- case 167 /* LiteralType */:
+ case 135 /* SymbolKeyword */:
+ case 159 /* ConstructorType */:
+ case 158 /* FunctionType */:
+ case 160 /* TypeQuery */:
+ case 157 /* TypeReference */:
+ case 164 /* UnionType */:
+ case 165 /* IntersectionType */:
+ case 166 /* ParenthesizedType */:
+ case 167 /* ThisType */:
+ case 168 /* TypeOperator */:
+ case 169 /* IndexedAccessType */:
+ case 170 /* LiteralType */:
// TypeScript type nodes are elided.
- case 154 /* IndexSignature */:
+ case 155 /* IndexSignature */:
// TypeScript index signatures are elided.
- case 144 /* Decorator */:
+ case 145 /* Decorator */:
// TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration.
- case 224 /* TypeAliasDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
// TypeScript type-only declarations are elided.
- case 146 /* PropertyDeclaration */:
+ case 147 /* PropertyDeclaration */:
// TypeScript property declarations are elided.
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
return visitConstructor(node);
- case 223 /* InterfaceDeclaration */:
+ case 226 /* InterfaceDeclaration */:
// TypeScript interfaces are elided, but some comments may be preserved.
// See the implementation of `getLeadingComments` in comments.ts for more details.
return ts.createNotEmittedStatement(node);
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
// This is a class declaration with TypeScript syntax extensions.
//
// TypeScript class syntax extensions include:
@@ -43405,7 +44866,7 @@ var ts;
// - index signatures
// - method overload signatures
return visitClassDeclaration(node);
- case 193 /* ClassExpression */:
+ case 196 /* ClassExpression */:
// This is a class expression with TypeScript syntax extensions.
//
// TypeScript class syntax extensions include:
@@ -43416,35 +44877,35 @@ var ts;
// - index signatures
// - method overload signatures
return visitClassExpression(node);
- case 251 /* HeritageClause */:
+ case 254 /* HeritageClause */:
// This is a heritage clause with TypeScript syntax extensions.
//
// TypeScript heritage clause extensions include:
// - `implements` clause
return visitHeritageClause(node);
- case 195 /* ExpressionWithTypeArguments */:
+ case 198 /* ExpressionWithTypeArguments */:
// TypeScript supports type arguments on an expression in an `extends` heritage clause.
return visitExpressionWithTypeArguments(node);
- case 148 /* MethodDeclaration */:
+ case 149 /* MethodDeclaration */:
// TypeScript method declarations may have decorators, modifiers
// or type annotations.
return visitMethodDeclaration(node);
- case 150 /* GetAccessor */:
+ case 151 /* GetAccessor */:
// Get Accessors can have TypeScript modifiers, decorators, and type annotations.
return visitGetAccessor(node);
- case 151 /* SetAccessor */:
+ case 152 /* SetAccessor */:
// Set Accessors can have TypeScript modifiers and type annotations.
return visitSetAccessor(node);
- case 221 /* FunctionDeclaration */:
+ case 224 /* FunctionDeclaration */:
// Typescript function declarations can have modifiers, decorators, and type annotations.
return visitFunctionDeclaration(node);
- case 180 /* FunctionExpression */:
+ case 183 /* FunctionExpression */:
// TypeScript function expressions can have modifiers and type annotations.
return visitFunctionExpression(node);
- case 181 /* ArrowFunction */:
+ case 184 /* ArrowFunction */:
// TypeScript arrow functions can have modifiers and type annotations.
return visitArrowFunction(node);
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
// This is a parameter declaration with TypeScript syntax extensions.
//
// TypeScript parameter declaration syntax extensions include:
@@ -43454,33 +44915,33 @@ var ts;
// - type annotations
// - this parameters
return visitParameter(node);
- case 179 /* ParenthesizedExpression */:
+ case 182 /* ParenthesizedExpression */:
// ParenthesizedExpressions are TypeScript if their expression is a
// TypeAssertion or AsExpression
return visitParenthesizedExpression(node);
- case 178 /* TypeAssertionExpression */:
- case 196 /* AsExpression */:
+ case 181 /* TypeAssertionExpression */:
+ case 199 /* AsExpression */:
// TypeScript type assertions are removed, but their subtrees are preserved.
return visitAssertionExpression(node);
- case 175 /* CallExpression */:
+ case 178 /* CallExpression */:
return visitCallExpression(node);
- case 176 /* NewExpression */:
+ case 179 /* NewExpression */:
return visitNewExpression(node);
- case 197 /* NonNullExpression */:
+ case 200 /* NonNullExpression */:
// TypeScript non-null expressions are removed, but their subtrees are preserved.
return visitNonNullExpression(node);
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
// TypeScript enum declarations do not exist in ES6 and must be rewritten.
return visitEnumDeclaration(node);
- case 201 /* VariableStatement */:
+ case 204 /* VariableStatement */:
// TypeScript namespace exports for variable statements must be transformed.
return visitVariableStatement(node);
- case 219 /* VariableDeclaration */:
+ case 222 /* VariableDeclaration */:
return visitVariableDeclaration(node);
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
// TypeScript namespace declarations must be transformed.
return visitModuleDeclaration(node);
- case 230 /* ImportEqualsDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
// TypeScript namespace or external module import.
return visitImportEqualsDeclaration(node);
default:
@@ -43495,15 +44956,15 @@ var ts;
*/
function onBeforeVisitNode(node) {
switch (node.kind) {
- case 256 /* SourceFile */:
- case 228 /* CaseBlock */:
- case 227 /* ModuleBlock */:
- case 200 /* Block */:
+ case 260 /* SourceFile */:
+ case 231 /* CaseBlock */:
+ case 230 /* ModuleBlock */:
+ case 203 /* Block */:
currentScope = node;
currentScopeFirstDeclarationsOfName = undefined;
break;
- case 222 /* ClassDeclaration */:
- case 221 /* FunctionDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 224 /* FunctionDeclaration */:
if (ts.hasModifier(node, 2 /* Ambient */)) {
break;
}
@@ -43514,13 +44975,17 @@ var ts;
function visitSourceFile(node) {
currentSourceFile = node;
// ensure "use strict" is emitted in all scenarios in alwaysStrict mode
- if (compilerOptions.alwaysStrict) {
+ // There is no need to emit "use strict" in the following cases:
+ // 1. The file is an external module and target is es2015 or higher
+ // or 2. The file is an external module and module-kind is es6 or es2015 as such value is not allowed when targeting es5 or lower
+ if (compilerOptions.alwaysStrict &&
+ !(ts.isExternalModule(node) && (compilerOptions.target >= 2 /* ES2015 */ || compilerOptions.module === ts.ModuleKind.ES2015))) {
node = ts.ensureUseStrict(node);
}
// If the source file requires any helpers and is an external module, and
// the importHelpers compiler option is enabled, emit a synthesized import
// statement for the helpers library.
- if (node.flags & 31744 /* EmitHelperFlags */
+ if (node.flags & 64512 /* EmitHelperFlags */
&& compilerOptions.importHelpers
&& (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {
startLexicalEnvironment();
@@ -43533,10 +44998,10 @@ var ts;
externalHelpersModuleImport.parent = node;
externalHelpersModuleImport.flags &= ~8 /* Synthesized */;
statements.push(externalHelpersModuleImport);
- currentSourceFileExternalHelpersModuleName = externalHelpersModuleName;
+ currentExternalHelpersModuleName = externalHelpersModuleName;
ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
ts.addRange(statements, endLexicalEnvironment());
- currentSourceFileExternalHelpersModuleName = undefined;
+ currentExternalHelpersModuleName = undefined;
node = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
node.externalHelpersModuleName = externalHelpersModuleName;
}
@@ -43580,7 +45045,6 @@ var ts;
var staticProperties = getInitializedProperties(node, /*isStatic*/ true);
var hasExtendsClause = ts.getClassExtendsHeritageClauseElement(node) !== undefined;
var isDecoratedClass = shouldEmitDecorateCallForClass(node);
- var classAlias;
// emit name if
// - node has a name
// - node has static initializers
@@ -43589,38 +45053,22 @@ var ts;
if (!name && staticProperties.length > 0) {
name = ts.getGeneratedNameForNode(node);
}
- var statements = [];
- if (!isDecoratedClass) {
- // ${modifiers} class ${name} ${heritageClauses} {
- // ${members}
- // }
- var classDeclaration = ts.createClassDeclaration(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), name,
- /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause),
- /*location*/ node);
- ts.setOriginalNode(classDeclaration, node);
- // To better align with the old emitter, we should not emit a trailing source map
- // entry if the class has static properties.
- if (staticProperties.length > 0) {
- ts.setEmitFlags(classDeclaration, 1024 /* NoTrailingSourceMap */ | ts.getEmitFlags(classDeclaration));
- }
- statements.push(classDeclaration);
- }
- else {
- classAlias = addClassDeclarationHeadWithDecorators(statements, node, name, hasExtendsClause);
- }
+ var classStatement = isDecoratedClass
+ ? createClassDeclarationHeadWithDecorators(node, name, hasExtendsClause)
+ : createClassDeclarationHeadWithoutDecorators(node, name, hasExtendsClause, staticProperties.length > 0);
+ var statements = [classStatement];
// Emit static property assignment. Because classDeclaration is lexically evaluated,
// it is safe to emit static property assignment after classDeclaration
// From ES6 specification:
// HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using
// a lexical declaration such as a LexicalDeclaration or a ClassDeclaration.
if (staticProperties.length) {
- addInitializedPropertyStatements(statements, staticProperties, getLocalName(node, /*noSourceMaps*/ true));
+ addInitializedPropertyStatements(statements, staticProperties, ts.getLocalName(node));
}
// Write any decorators of the node.
addClassElementDecorationStatements(statements, node, /*isStatic*/ false);
addClassElementDecorationStatements(statements, node, /*isStatic*/ true);
- addConstructorDecorationStatement(statements, node, classAlias);
+ addConstructorDecorationStatement(statements, node);
// If the class is exported as part of a TypeScript namespace, emit the namespace export.
// Otherwise, if the class was exported at the top level and was decorated, emit an export
// declaration or export default for the class.
@@ -43629,26 +45077,54 @@ var ts;
}
else if (isDecoratedClass) {
if (isDefaultExternalModuleExport(node)) {
- statements.push(ts.createExportAssignment(
- /*decorators*/ undefined,
- /*modifiers*/ undefined,
- /*isExportEquals*/ false, getLocalName(node)));
+ statements.push(ts.createExportDefault(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)));
}
else if (isNamedExternalModuleExport(node)) {
- statements.push(createExternalModuleExport(name));
+ statements.push(ts.createExternalModuleExport(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)));
}
}
- return statements;
+ if (statements.length > 1) {
+ // Add a DeclarationMarker as a marker for the end of the declaration
+ statements.push(ts.createEndOfDeclarationMarker(node));
+ ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 33554432 /* HasEndOfDeclarationMarker */);
+ }
+ return ts.singleOrMany(statements);
+ }
+ /**
+ * Transforms a non-decorated class declaration and appends the resulting statements.
+ *
+ * @param node A ClassDeclaration node.
+ * @param name The name of the class.
+ * @param hasExtendsClause A value indicating whether the class has an extends clause.
+ * @param hasStaticProperties A value indicating whether the class has static properties.
+ */
+ function createClassDeclarationHeadWithoutDecorators(node, name, hasExtendsClause, hasStaticProperties) {
+ // ${modifiers} class ${name} ${heritageClauses} {
+ // ${members}
+ // }
+ var classDeclaration = ts.createClassDeclaration(
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name,
+ /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause), node);
+ var emitFlags = ts.getEmitFlags(node);
+ // To better align with the old emitter, we should not emit a trailing source map
+ // entry if the class has static properties.
+ if (hasStaticProperties) {
+ emitFlags |= 1024 /* NoTrailingSourceMap */;
+ }
+ ts.setOriginalNode(classDeclaration, node);
+ ts.setEmitFlags(classDeclaration, emitFlags);
+ return classDeclaration;
}
/**
* Transforms a decorated class declaration and appends the resulting statements. If
* the class requires an alias to avoid issues with double-binding, the alias is returned.
*
+ * @param statements A statement list to which to add the declaration.
* @param node A ClassDeclaration node.
* @param name The name of the class.
- * @param hasExtendsClause A value indicating whether
+ * @param hasExtendsClause A value indicating whether the class has an extends clause.
*/
- function addClassDeclarationHeadWithDecorators(statements, node, name, hasExtendsClause) {
+ function createClassDeclarationHeadWithDecorators(node, name, hasExtendsClause) {
// When we emit an ES6 class that has a class decorator, we must tailor the
// emit to certain specific cases.
//
@@ -43683,20 +45159,20 @@ var ts;
// ---------------------------------------------------------------------
// TypeScript | Javascript
// ---------------------------------------------------------------------
- // @dec | let C_1 = class C {
+ // @dec | let C = C_1 = class C {
// class C { | static x() { return C_1.y; }
// static x() { return C.y; } | }
- // static y = 1; | let C = C_1;
- // } | C.y = 1;
- // | C = C_1 = __decorate([dec], C);
+ // static y = 1; | C.y = 1;
+ // } | C = C_1 = __decorate([dec], C);
+ // | var C_1;
// ---------------------------------------------------------------------
- // @dec | let C_1 = class C {
+ // @dec | let C = class C {
// export class C { | static x() { return C_1.y; }
// static x() { return C.y; } | }
- // static y = 1; | let C = C_1;
- // } | C.y = 1;
- // | C = C_1 = __decorate([dec], C);
+ // static y = 1; | C.y = 1;
+ // } | C = C_1 = __decorate([dec], C);
// | export { C };
+ // | var C_1;
// ---------------------------------------------------------------------
//
// If a class declaration is the default export of a module, we instead emit
@@ -43725,59 +45201,31 @@ var ts;
// ---------------------------------------------------------------------
// TypeScript | Javascript
// ---------------------------------------------------------------------
- // @dec | let C_1 = class C {
+ // @dec | let C = class C {
// export default class C { | static x() { return C_1.y; }
// static x() { return C.y; } | }
- // static y = 1; | let C = C_1;
- // } | C.y = 1;
- // | C = C_1 = __decorate([dec], C);
+ // static y = 1; | C.y = 1;
+ // } | C = C_1 = __decorate([dec], C);
// | export default C;
+ // | var C_1;
// ---------------------------------------------------------------------
//
var location = ts.moveRangePastDecorators(node);
+ var classAlias = getClassAliasIfNeeded(node);
+ var declName = ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true);
// ... = class ${name} ${heritageClauses} {
// ${members}
// }
- var classExpression = ts.setOriginalNode(ts.createClassExpression(
- /*modifiers*/ undefined, name,
- /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause),
- /*location*/ location), node);
- if (!name) {
- name = ts.getGeneratedNameForNode(node);
- }
- // Record an alias to avoid class double-binding.
- var classAlias;
- if (resolver.getNodeCheckFlags(node) & 8388608 /* ClassWithConstructorReference */) {
- enableSubstitutionForClassAliases();
- classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? node.name.text : "default");
- classAliases[ts.getOriginalNodeId(node)] = classAlias;
- }
- var declaredName = getDeclarationName(node, /*allowComments*/ true);
+ var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
+ var members = transformClassMembers(node, hasExtendsClause);
+ var classExpression = ts.createClassExpression(/*modifiers*/ undefined, name, /*typeParameters*/ undefined, heritageClauses, members, location);
+ ts.setOriginalNode(classExpression, node);
// let ${name} = ${classExpression} where name is either declaredName if the class doesn't contain self-reference
// or decoratedClassAlias if the class contain self-reference.
- var transformedClassExpression = ts.createVariableStatement(
- /*modifiers*/ undefined, ts.createLetDeclarationList([
- ts.createVariableDeclaration(classAlias || declaredName,
- /*type*/ undefined, classExpression)
- ]),
- /*location*/ location);
- ts.setCommentRange(transformedClassExpression, node);
- statements.push(ts.setOriginalNode(
- /*node*/ transformedClassExpression,
- /*original*/ node));
- if (classAlias) {
- // We emit the class alias as a `let` declaration here so that it has the same
- // TDZ as the class.
- // let ${declaredName} = ${decoratedClassAlias}
- statements.push(ts.setOriginalNode(ts.createVariableStatement(
- /*modifiers*/ undefined, ts.createLetDeclarationList([
- ts.createVariableDeclaration(declaredName,
- /*type*/ undefined, classAlias)
- ]),
- /*location*/ location),
- /*original*/ node));
- }
- return classAlias;
+ var statement = ts.createLetStatement(declName, classAlias ? ts.createAssignment(classAlias, classExpression) : classExpression, location);
+ ts.setOriginalNode(statement, node);
+ ts.setCommentRange(statement, node);
+ return statement;
}
/**
* Transforms a class expression with TypeScript syntax into compatible ES6.
@@ -43840,7 +45288,7 @@ var ts;
// If there is a property assignment, we need to emit constructor whether users define it or not
// If there is no property assignment, we can omit constructor if users do not define it
var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty);
- var hasParameterPropertyAssignments = node.transformFlags & 524288 /* ContainsParameterPropertyAssignments */;
+ var hasParameterPropertyAssignments = node.transformFlags & 4194304 /* ContainsParameterPropertyAssignments */;
var constructor = ts.getFirstConstructorWithBody(node);
// If the class does not contain nodes that require a synthesized constructor,
// accept the current constructor if it exists.
@@ -43960,7 +45408,7 @@ var ts;
return index;
}
var statement = statements[index];
- if (statement.kind === 203 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 206 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
result.push(ts.visitNode(statement, visitor, ts.isStatement));
return index + 1;
}
@@ -44033,7 +45481,7 @@ var ts;
* @param isStatic A value indicating whether the member should be a static or instance member.
*/
function isInitializedProperty(member, isStatic) {
- return member.kind === 146 /* PropertyDeclaration */
+ return member.kind === 147 /* PropertyDeclaration */
&& isStatic === ts.hasModifier(member, 32 /* Static */)
&& member.initializer !== undefined;
}
@@ -44168,12 +45616,12 @@ var ts;
*/
function getAllDecoratorsOfClassElement(node, member) {
switch (member.kind) {
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
return getAllDecoratorsOfAccessors(node, member);
- case 148 /* MethodDeclaration */:
+ case 149 /* MethodDeclaration */:
return getAllDecoratorsOfMethod(member);
- case 146 /* PropertyDeclaration */:
+ case 147 /* PropertyDeclaration */:
return getAllDecoratorsOfProperty(member);
default:
return undefined;
@@ -44325,11 +45773,11 @@ var ts;
var prefix = getClassMemberPrefix(node, member);
var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ true);
var descriptor = languageVersion > 0 /* ES3 */
- ? member.kind === 146 /* PropertyDeclaration */
+ ? member.kind === 147 /* PropertyDeclaration */
? ts.createVoidZero()
: ts.createNull()
: undefined;
- var helper = ts.createDecorateHelper(currentSourceFileExternalHelpersModuleName, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member));
+ var helper = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member));
ts.setEmitFlags(helper, 49152 /* NoComments */);
return helper;
}
@@ -44338,8 +45786,8 @@ var ts;
*
* @param node The class node.
*/
- function addConstructorDecorationStatement(statements, node, decoratedClassAlias) {
- var expression = generateConstructorDecorationExpression(node, decoratedClassAlias);
+ function addConstructorDecorationStatement(statements, node) {
+ var expression = generateConstructorDecorationExpression(node);
if (expression) {
statements.push(ts.setOriginalNode(ts.createStatement(expression), node));
}
@@ -44349,33 +45797,19 @@ var ts;
*
* @param node The class node.
*/
- function generateConstructorDecorationExpression(node, decoratedClassAlias) {
+ function generateConstructorDecorationExpression(node) {
var allDecorators = getAllDecoratorsOfConstructor(node);
var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators);
if (!decoratorExpressions) {
return undefined;
}
- // Emit the call to __decorate. Given the class:
- //
- // @dec
- // class C {
- // }
- //
- // The emit for the class is:
- //
- // C = C_1 = __decorate([dec], C);
- //
- if (decoratedClassAlias) {
- var expression = ts.createAssignment(decoratedClassAlias, ts.createDecorateHelper(currentSourceFileExternalHelpersModuleName, decoratorExpressions, getDeclarationName(node)));
- var result = ts.createAssignment(getDeclarationName(node), expression, ts.moveRangePastDecorators(node));
- ts.setEmitFlags(result, 49152 /* NoComments */);
- return result;
- }
- else {
- var result = ts.createAssignment(getDeclarationName(node), ts.createDecorateHelper(currentSourceFileExternalHelpersModuleName, decoratorExpressions, getDeclarationName(node)), ts.moveRangePastDecorators(node));
- ts.setEmitFlags(result, 49152 /* NoComments */);
- return result;
- }
+ var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)];
+ var localName = ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true);
+ var decorate = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, localName);
+ var expression = ts.createAssignment(localName, classAlias ? ts.createAssignment(classAlias, decorate) : decorate);
+ ts.setEmitFlags(expression, 49152 /* NoComments */);
+ ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node));
+ return expression;
}
/**
* Transforms a decorator into an expression.
@@ -44397,7 +45831,7 @@ var ts;
expressions = [];
for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) {
var decorator = decorators_1[_i];
- var helper = ts.createParamHelper(currentSourceFileExternalHelpersModuleName, transformDecorator(decorator), parameterOffset,
+ var helper = ts.createParamHelper(currentExternalHelpersModuleName, transformDecorator(decorator), parameterOffset,
/*location*/ decorator.expression);
ts.setEmitFlags(helper, 49152 /* NoComments */);
expressions.push(helper);
@@ -44422,13 +45856,13 @@ var ts;
function addOldTypeMetadata(node, decoratorExpressions) {
if (compilerOptions.emitDecoratorMetadata) {
if (shouldAddTypeMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentSourceFileExternalHelpersModuleName, "design:type", serializeTypeOfNode(node)));
+ decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:type", serializeTypeOfNode(node)));
}
if (shouldAddParamTypesMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentSourceFileExternalHelpersModuleName, "design:paramtypes", serializeParameterTypesOfNode(node)));
+ decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:paramtypes", serializeParameterTypesOfNode(node)));
}
if (shouldAddReturnTypeMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentSourceFileExternalHelpersModuleName, "design:returntype", serializeReturnTypeOfNode(node)));
+ decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:returntype", serializeReturnTypeOfNode(node)));
}
}
}
@@ -44436,16 +45870,16 @@ var ts;
if (compilerOptions.emitDecoratorMetadata) {
var properties = void 0;
if (shouldAddTypeMetadata(node)) {
- (properties || (properties = [])).push(ts.createPropertyAssignment("type", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, /*equalsGreaterThanToken*/ undefined, serializeTypeOfNode(node))));
+ (properties || (properties = [])).push(ts.createPropertyAssignment("type", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeTypeOfNode(node))));
}
if (shouldAddParamTypesMetadata(node)) {
- (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, /*equalsGreaterThanToken*/ undefined, serializeParameterTypesOfNode(node))));
+ (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeParameterTypesOfNode(node))));
}
if (shouldAddReturnTypeMetadata(node)) {
- (properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, /*equalsGreaterThanToken*/ undefined, serializeReturnTypeOfNode(node))));
+ (properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeReturnTypeOfNode(node))));
}
if (properties) {
- decoratorExpressions.push(ts.createMetadataHelper(currentSourceFileExternalHelpersModuleName, "design:typeinfo", ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true)));
+ decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:typeinfo", ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true)));
}
}
}
@@ -44458,10 +45892,10 @@ var ts;
*/
function shouldAddTypeMetadata(node) {
var kind = node.kind;
- return kind === 148 /* MethodDeclaration */
- || kind === 150 /* GetAccessor */
- || kind === 151 /* SetAccessor */
- || kind === 146 /* PropertyDeclaration */;
+ return kind === 149 /* MethodDeclaration */
+ || kind === 151 /* GetAccessor */
+ || kind === 152 /* SetAccessor */
+ || kind === 147 /* PropertyDeclaration */;
}
/**
* Determines whether to emit the "design:returntype" metadata based on the node's kind.
@@ -44471,7 +45905,7 @@ var ts;
* @param node The node to test.
*/
function shouldAddReturnTypeMetadata(node) {
- return node.kind === 148 /* MethodDeclaration */;
+ return node.kind === 149 /* MethodDeclaration */;
}
/**
* Determines whether to emit the "design:paramtypes" metadata based on the node's kind.
@@ -44482,11 +45916,11 @@ var ts;
*/
function shouldAddParamTypesMetadata(node) {
var kind = node.kind;
- return kind === 222 /* ClassDeclaration */
- || kind === 193 /* ClassExpression */
- || kind === 148 /* MethodDeclaration */
- || kind === 150 /* GetAccessor */
- || kind === 151 /* SetAccessor */;
+ return kind === 225 /* ClassDeclaration */
+ || kind === 196 /* ClassExpression */
+ || kind === 149 /* MethodDeclaration */
+ || kind === 151 /* GetAccessor */
+ || kind === 152 /* SetAccessor */;
}
/**
* Serializes the type of a node for use with decorator type metadata.
@@ -44495,15 +45929,15 @@ var ts;
*/
function serializeTypeOfNode(node) {
switch (node.kind) {
- case 146 /* PropertyDeclaration */:
- case 143 /* Parameter */:
- case 150 /* GetAccessor */:
+ case 147 /* PropertyDeclaration */:
+ case 144 /* Parameter */:
+ case 151 /* GetAccessor */:
return serializeTypeNode(node.type);
- case 151 /* SetAccessor */:
+ case 152 /* SetAccessor */:
return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node));
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 148 /* MethodDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 149 /* MethodDeclaration */:
return ts.createIdentifier("Function");
default:
return ts.createVoidZero();
@@ -44516,10 +45950,10 @@ var ts;
* @param node The type node.
*/
function getRestParameterElementType(node) {
- if (node && node.kind === 161 /* ArrayType */) {
+ if (node && node.kind === 162 /* ArrayType */) {
return node.elementType;
}
- else if (node && node.kind === 156 /* TypeReference */) {
+ else if (node && node.kind === 157 /* TypeReference */) {
return ts.singleOrUndefined(node.typeArguments);
}
else {
@@ -44595,20 +46029,20 @@ var ts;
switch (node.kind) {
case 104 /* VoidKeyword */:
return ts.createVoidZero();
- case 165 /* ParenthesizedType */:
+ case 166 /* ParenthesizedType */:
return serializeTypeNode(node.type);
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
return ts.createIdentifier("Function");
- case 161 /* ArrayType */:
- case 162 /* TupleType */:
+ case 162 /* ArrayType */:
+ case 163 /* TupleType */:
return ts.createIdentifier("Array");
- case 155 /* TypePredicate */:
+ case 156 /* TypePredicate */:
case 121 /* BooleanKeyword */:
return ts.createIdentifier("Boolean");
- case 133 /* StringKeyword */:
+ case 134 /* StringKeyword */:
return ts.createIdentifier("String");
- case 167 /* LiteralType */:
+ case 170 /* LiteralType */:
switch (node.literal.kind) {
case 9 /* StringLiteral */:
return ts.createIdentifier("String");
@@ -44622,16 +46056,16 @@ var ts;
break;
}
break;
- case 131 /* NumberKeyword */:
+ case 132 /* NumberKeyword */:
return ts.createIdentifier("Number");
- case 134 /* SymbolKeyword */:
+ case 135 /* SymbolKeyword */:
return languageVersion < 2 /* ES2015 */
? getGlobalSymbolNameWithFallback()
: ts.createIdentifier("Symbol");
- case 156 /* TypeReference */:
+ case 157 /* TypeReference */:
return serializeTypeReferenceNode(node);
- case 164 /* IntersectionType */:
- case 163 /* UnionType */:
+ case 165 /* IntersectionType */:
+ case 164 /* UnionType */:
{
var unionOrIntersection = node;
var serializedUnion = void 0;
@@ -44660,10 +46094,12 @@ var ts;
}
}
// Fallthrough
- case 159 /* TypeQuery */:
- case 160 /* TypeLiteral */:
+ case 160 /* TypeQuery */:
+ case 168 /* TypeOperator */:
+ case 169 /* IndexedAccessType */:
+ case 161 /* TypeLiteral */:
case 118 /* AnyKeyword */:
- case 166 /* ThisType */:
+ case 167 /* ThisType */:
break;
default:
ts.Debug.failBadSyntaxKind(node);
@@ -44720,15 +46156,15 @@ var ts;
case 70 /* Identifier */:
// Create a clone of the name with a new parent, and treat it as if it were
// a source tree node for the purposes of the checker.
- var name_27 = ts.getMutableClone(node);
- name_27.flags &= ~8 /* Synthesized */;
- name_27.original = undefined;
- name_27.parent = currentScope;
+ var name_31 = ts.getMutableClone(node);
+ name_31.flags &= ~8 /* Synthesized */;
+ name_31.original = undefined;
+ name_31.parent = currentScope;
if (useFallback) {
- return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_27), ts.createLiteral("undefined")), name_27);
+ return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_31), ts.createLiteral("undefined")), name_31);
}
- return name_27;
- case 140 /* QualifiedName */:
+ return name_31;
+ case 141 /* QualifiedName */:
return serializeQualifiedNameAsExpression(node, useFallback);
}
}
@@ -44861,7 +46297,7 @@ var ts;
return undefined;
}
var method = ts.createMethod(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node),
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node),
/*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
/*type*/ undefined, transformFunctionBody(node),
/*location*/ node);
@@ -44895,14 +46331,14 @@ var ts;
return undefined;
}
var accessor = ts.createGetAccessor(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter),
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter),
/*type*/ undefined, node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]),
/*location*/ node);
// While we emit the source map for the node after skipping decorators and modifiers,
// we need to emit the comments for the original range.
+ ts.setOriginalNode(accessor, node);
ts.setCommentRange(accessor, node);
ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node));
- ts.setOriginalNode(accessor, node);
return accessor;
}
/**
@@ -44919,13 +46355,13 @@ var ts;
return undefined;
}
var accessor = ts.createSetAccessor(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]),
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]),
/*location*/ node);
// While we emit the source map for the node after skipping decorators and modifiers,
// we need to emit the comments for the original range.
+ ts.setOriginalNode(accessor, node);
ts.setCommentRange(accessor, node);
ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node));
- ts.setOriginalNode(accessor, node);
return accessor;
}
/**
@@ -44943,7 +46379,7 @@ var ts;
return ts.createNotEmittedStatement(node);
}
var func = ts.createFunctionDeclaration(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name,
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name,
/*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
/*type*/ undefined, transformFunctionBody(node),
/*location*/ node);
@@ -44967,7 +46403,7 @@ var ts;
if (ts.nodeIsMissing(node.body)) {
return ts.createOmittedExpression();
}
- var func = ts.createFunctionExpression(ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name,
+ var func = ts.createFunctionExpression(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name,
/*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
/*type*/ undefined, transformFunctionBody(node),
/*location*/ node);
@@ -44980,7 +46416,7 @@ var ts;
* - The node has type annotations
*/
function visitArrowFunction(node) {
- var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, visitor, ts.isModifier),
+ var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier),
/*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
/*type*/ undefined, node.equalsGreaterThanToken, transformConciseBody(node),
/*location*/ node);
@@ -45040,7 +46476,7 @@ var ts;
if (ts.parameterIsThisKeyword(node)) {
return undefined;
}
- var parameter = ts.createParameterDeclaration(
+ var parameter = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined, node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName),
/*questionToken*/ undefined,
@@ -45077,7 +46513,7 @@ var ts;
function transformInitializedVariable(node) {
var name = node.name;
if (ts.isBindingPattern(name)) {
- return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, getNamespaceMemberNameWithSourceMapsAndWithoutComments, visitor);
+ return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createNamespaceExportExpression, visitor);
}
else {
return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression),
@@ -45143,21 +46579,6 @@ var ts;
|| compilerOptions.preserveConstEnums
|| compilerOptions.isolatedModules;
}
- function shouldEmitVarForEnumDeclaration(node) {
- return isFirstEmittedDeclarationInScope(node)
- && (!ts.hasModifier(node, 1 /* Export */)
- || isES6ExportedDeclaration(node));
- }
- /*
- * Adds a trailing VariableStatement for an enum or module declaration.
- */
- function addVarForEnumExportedFromNamespace(statements, node) {
- var statement = ts.createVariableStatement(
- /*modifiers*/ undefined, [ts.createVariableDeclaration(getDeclarationName(node),
- /*type*/ undefined, getExportName(node))]);
- ts.setSourceMapRange(statement, node);
- statements.push(statement);
- }
/**
* Visits an enum declaration.
*
@@ -45176,9 +46597,7 @@ var ts;
// If needed, we should emit a variable declaration for the enum. If we emit
// a leading variable declaration, we should not emit leading comments for the
// enum body.
- recordEmittedDeclarationInScope(node);
- if (shouldEmitVarForEnumDeclaration(node)) {
- addVarForEnumOrModuleDeclaration(statements, node);
+ if (addVarForEnumOrModuleDeclaration(statements, node)) {
// We should still emit the comments if we are emitting a system module.
if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {
emitFlags |= 16384 /* NoLeadingComments */;
@@ -45189,7 +46608,18 @@ var ts;
// `containerName` is the expression used inside of the enum for assignments.
var containerName = getNamespaceContainerName(node);
// `exportName` is the expression used within this node's container for any exported references.
- var exportName = getExportName(node);
+ var exportName = ts.hasModifier(node, 1 /* Export */)
+ ? ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true)
+ : ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true);
+ // x || (x = {})
+ // exports.x || (exports.x = {})
+ var moduleArg = ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral()));
+ if (hasNamespaceQualifiedExportName(node)) {
+ // `localName` is the expression used within this node's containing scope for any local references.
+ var localName = ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true);
+ // x = (exports.x || (exports.x = {}))
+ moduleArg = ts.createAssignment(localName, moduleArg);
+ }
// (function (x) {
// x[x["y"] = 0] = "y";
// ...
@@ -45198,16 +46628,16 @@ var ts;
/*modifiers*/ undefined,
/*asteriskToken*/ undefined,
/*name*/ undefined,
- /*typeParameters*/ undefined, [ts.createParameter(parameterName)],
+ /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)],
/*type*/ undefined, transformEnumBody(node, containerName)),
- /*typeArguments*/ undefined, [ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral()))]),
+ /*typeArguments*/ undefined, [moduleArg]),
/*location*/ node);
ts.setOriginalNode(enumStatement, node);
ts.setEmitFlags(enumStatement, emitFlags);
statements.push(enumStatement);
- if (isNamespaceExport(node)) {
- addVarForEnumExportedFromNamespace(statements, node);
- }
+ // Add a DeclarationMarker for the enum to preserve trailing comments and mark
+ // the end of the declaration.
+ statements.push(ts.createEndOfDeclarationMarker(node));
return statements;
}
/**
@@ -45269,9 +46699,15 @@ var ts;
function shouldEmitModuleDeclaration(node) {
return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules);
}
- function isES6ExportedDeclaration(node) {
- return isExternalModuleExport(node)
- && moduleKind === ts.ModuleKind.ES2015;
+ /**
+ * Determines whether an exported declaration will have a qualified export name (e.g. `f.x`
+ * or `exports.x`).
+ */
+ function hasNamespaceQualifiedExportName(node) {
+ return isNamespaceExport(node)
+ || (isExternalModuleExport(node)
+ && moduleKind !== ts.ModuleKind.ES2015
+ && moduleKind !== ts.ModuleKind.System);
}
/**
* Records that a declaration was emitted in the current scope, if it was the first
@@ -45297,55 +46733,64 @@ var ts;
*/
function isFirstEmittedDeclarationInScope(node) {
if (currentScopeFirstDeclarationsOfName) {
- var name_28 = node.symbol && node.symbol.name;
- if (name_28) {
- return currentScopeFirstDeclarationsOfName[name_28] === node;
+ var name_32 = node.symbol && node.symbol.name;
+ if (name_32) {
+ return currentScopeFirstDeclarationsOfName[name_32] === node;
}
}
return false;
}
- function shouldEmitVarForModuleDeclaration(node) {
- return isFirstEmittedDeclarationInScope(node);
- }
/**
* Adds a leading VariableStatement for a enum or module declaration.
*/
function addVarForEnumOrModuleDeclaration(statements, node) {
// Emit a variable statement for the module.
- var statement = ts.createVariableStatement(isES6ExportedDeclaration(node)
- ? ts.visitNodes(node.modifiers, visitor, ts.isModifier)
- : undefined, [
- ts.createVariableDeclaration(getDeclarationName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))
+ var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), [
+ ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))
]);
- ts.setOriginalNode(statement, /*original*/ node);
- // Adjust the source map emit to match the old emitter.
- if (node.kind === 225 /* EnumDeclaration */) {
- ts.setSourceMapRange(statement.declarationList, node);
+ ts.setOriginalNode(statement, node);
+ recordEmittedDeclarationInScope(node);
+ if (isFirstEmittedDeclarationInScope(node)) {
+ // Adjust the source map emit to match the old emitter.
+ if (node.kind === 228 /* EnumDeclaration */) {
+ ts.setSourceMapRange(statement.declarationList, node);
+ }
+ else {
+ ts.setSourceMapRange(statement, node);
+ }
+ // Trailing comments for module declaration should be emitted after the function closure
+ // instead of the variable statement:
+ //
+ // /** Module comment*/
+ // module m1 {
+ // function foo4Export() {
+ // }
+ // } // trailing comment module
+ //
+ // Should emit:
+ //
+ // /** Module comment*/
+ // var m1;
+ // (function (m1) {
+ // function foo4Export() {
+ // }
+ // })(m1 || (m1 = {})); // trailing comment module
+ //
+ ts.setCommentRange(statement, node);
+ ts.setEmitFlags(statement, 32768 /* NoTrailingComments */ | 33554432 /* HasEndOfDeclarationMarker */);
+ statements.push(statement);
+ return true;
}
else {
- ts.setSourceMapRange(statement, node);
+ // For an EnumDeclaration or ModuleDeclaration that merges with a preceeding
+ // declaration we do not emit a leading variable declaration. To preserve the
+ // begin/end semantics of the declararation and to properly handle exports
+ // we wrap the leading variable declaration in a `MergeDeclarationMarker`.
+ var mergeMarker = ts.createMergeDeclarationMarker(statement);
+ ts.setEmitFlags(mergeMarker, 49152 /* NoComments */ | 33554432 /* HasEndOfDeclarationMarker */);
+ statements.push(mergeMarker);
+ return false;
}
- // Trailing comments for module declaration should be emitted after the function closure
- // instead of the variable statement:
- //
- // /** Module comment*/
- // module m1 {
- // function foo4Export() {
- // }
- // } // trailing comment module
- //
- // Should emit:
- //
- // /** Module comment*/
- // var m1;
- // (function (m1) {
- // function foo4Export() {
- // }
- // })(m1 || (m1 = {})); // trailing comment module
- //
- ts.setCommentRange(statement, node);
- ts.setEmitFlags(statement, 32768 /* NoTrailingComments */);
- statements.push(statement);
}
/**
* Visits a module declaration node.
@@ -45367,9 +46812,7 @@ var ts;
// If needed, we should emit a variable declaration for the module. If we emit
// a leading variable declaration, we should not emit leading comments for the
// module body.
- recordEmittedDeclarationInScope(node);
- if (shouldEmitVarForModuleDeclaration(node)) {
- addVarForEnumOrModuleDeclaration(statements, node);
+ if (addVarForEnumOrModuleDeclaration(statements, node)) {
// We should still emit the comments if we are emitting a system module.
if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {
emitFlags |= 16384 /* NoLeadingComments */;
@@ -45380,13 +46823,15 @@ var ts;
// `containerName` is the expression used inside of the namespace for exports.
var containerName = getNamespaceContainerName(node);
// `exportName` is the expression used within this node's container for any exported references.
- var exportName = getExportName(node);
+ var exportName = ts.hasModifier(node, 1 /* Export */)
+ ? ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true)
+ : ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true);
// x || (x = {})
// exports.x || (exports.x = {})
var moduleArg = ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral()));
- if (ts.hasModifier(node, 1 /* Export */) && !isES6ExportedDeclaration(node)) {
+ if (hasNamespaceQualifiedExportName(node)) {
// `localName` is the expression used within this node's containing scope for any local references.
- var localName = getLocalName(node);
+ var localName = ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true);
// x = (exports.x || (exports.x = {}))
moduleArg = ts.createAssignment(localName, moduleArg);
}
@@ -45397,13 +46842,16 @@ var ts;
/*modifiers*/ undefined,
/*asteriskToken*/ undefined,
/*name*/ undefined,
- /*typeParameters*/ undefined, [ts.createParameter(parameterName)],
+ /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)],
/*type*/ undefined, transformModuleBody(node, containerName)),
/*typeArguments*/ undefined, [moduleArg]),
/*location*/ node);
ts.setOriginalNode(moduleStatement, node);
ts.setEmitFlags(moduleStatement, emitFlags);
statements.push(moduleStatement);
+ // Add a DeclarationMarker for the namespace to preserve trailing comments and mark
+ // the end of the declaration.
+ statements.push(ts.createEndOfDeclarationMarker(node));
return statements;
}
/**
@@ -45423,7 +46871,7 @@ var ts;
var statementsLocation;
var blockLocation;
var body = node.body;
- if (body.kind === 227 /* ModuleBlock */) {
+ if (body.kind === 230 /* ModuleBlock */) {
ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement));
statementsLocation = body.statements;
blockLocation = body;
@@ -45469,13 +46917,13 @@ var ts;
// })(hi = hello.hi || (hello.hi = {}));
// })(hello || (hello = {}));
// We only want to emit comment on the namespace which contains block body itself, not the containing namespaces.
- if (body.kind !== 227 /* ModuleBlock */) {
+ if (body.kind !== 230 /* ModuleBlock */) {
ts.setEmitFlags(block, ts.getEmitFlags(block) | 49152 /* NoComments */);
}
return block;
}
function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) {
- if (moduleDeclaration.body.kind === 226 /* ModuleDeclaration */) {
+ if (moduleDeclaration.body.kind === 229 /* ModuleDeclaration */) {
var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body);
return recursiveInnerModule || moduleDeclaration.body;
}
@@ -45516,7 +46964,7 @@ var ts;
* @param node The named import bindings node.
*/
function visitNamedImportBindings(node) {
- if (node.kind === 233 /* NamespaceImport */) {
+ if (node.kind === 236 /* NamespaceImport */) {
// Elide a namespace import if it is not referenced.
return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
}
@@ -45623,9 +47071,9 @@ var ts;
if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) {
// export var ${name} = ${moduleReference};
// var ${name} = ${moduleReference};
- return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, visitor, ts.isModifier), ts.createVariableDeclarationList([
- ts.createVariableDeclaration(node.name,
- /*type*/ undefined, moduleReference)
+ return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([
+ ts.setOriginalNode(ts.createVariableDeclaration(node.name,
+ /*type*/ undefined, moduleReference), node)
]), node), node);
}
else {
@@ -45674,38 +47122,20 @@ var ts;
return ts.createStatement(expression, /*location*/ undefined);
}
function addExportMemberAssignment(statements, node) {
- var expression = ts.createAssignment(getExportName(node), getLocalName(node, /*noSourceMaps*/ true));
+ var expression = ts.createAssignment(ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), ts.getLocalName(node));
ts.setSourceMapRange(expression, ts.createRange(node.name.pos, node.end));
var statement = ts.createStatement(expression);
ts.setSourceMapRange(statement, ts.createRange(-1, node.end));
statements.push(statement);
}
function createNamespaceExport(exportName, exportValue, location) {
- return ts.createStatement(ts.createAssignment(getNamespaceMemberName(exportName, /*allowComments*/ false, /*allowSourceMaps*/ true), exportValue), location);
+ return ts.createStatement(ts.createAssignment(ts.getNamespaceMemberName(currentNamespaceContainerName, exportName, /*allowComments*/ false, /*allowSourceMaps*/ true), exportValue), location);
}
- function createExternalModuleExport(exportName) {
- return ts.createExportDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, ts.createNamedExports([
- ts.createExportSpecifier(exportName)
- ]));
- }
- function getNamespaceMemberName(name, allowComments, allowSourceMaps) {
- var qualifiedName = ts.createPropertyAccess(currentNamespaceContainerName, ts.getSynthesizedClone(name), /*location*/ name);
- var emitFlags;
- if (!allowComments) {
- emitFlags |= 49152 /* NoComments */;
- }
- if (!allowSourceMaps) {
- emitFlags |= 1536 /* NoSourceMap */;
- }
- if (emitFlags) {
- ts.setEmitFlags(qualifiedName, emitFlags);
- }
- return qualifiedName;
+ function createNamespaceExportExpression(exportName, exportValue, location) {
+ return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue, location);
}
function getNamespaceMemberNameWithSourceMapsAndWithoutComments(name) {
- return getNamespaceMemberName(name, /*allowComments*/ false, /*allowSourceMaps*/ true);
+ return ts.getNamespaceMemberName(currentNamespaceContainerName, name, /*allowComments*/ false, /*allowSourceMaps*/ true);
}
/**
* Gets the declaration name used inside of a namespace or enum.
@@ -45723,67 +47153,25 @@ var ts;
return ts.getGeneratedNameForNode(node);
}
/**
- * Gets the local name for a declaration for use in expressions.
- *
- * A local name will *never* be prefixed with an module or namespace export modifier like
- * "exports.".
- *
- * @param node The declaration.
- * @param noSourceMaps A value indicating whether source maps may not be emitted for the name.
- * @param allowComments A value indicating whether comments may be emitted for the name.
+ * Gets a local alias for a class declaration if it is a decorated class with an internal
+ * reference to the static side of the class. This is necessary to avoid issues with
+ * double-binding semantics for the class name.
*/
- function getLocalName(node, noSourceMaps, allowComments) {
- return getDeclarationName(node, allowComments, !noSourceMaps, 262144 /* LocalName */);
- }
- /**
- * Gets the export name for a declaration for use in expressions.
- *
- * An export name will *always* be prefixed with an module or namespace export modifier
- * like "exports." if one is required.
- *
- * @param node The declaration.
- * @param noSourceMaps A value indicating whether source maps may not be emitted for the name.
- * @param allowComments A value indicating whether comments may be emitted for the name.
- */
- function getExportName(node, noSourceMaps, allowComments) {
- if (isNamespaceExport(node)) {
- return getNamespaceMemberName(getDeclarationName(node), allowComments, !noSourceMaps);
- }
- return getDeclarationName(node, allowComments, !noSourceMaps, 131072 /* ExportName */);
- }
- /**
- * Gets the name for a declaration for use in declarations.
- *
- * @param node The declaration.
- * @param allowComments A value indicating whether comments may be emitted for the name.
- * @param allowSourceMaps A value indicating whether source maps may be emitted for the name.
- * @param emitFlags Additional NodeEmitFlags to specify for the name.
- */
- function getDeclarationName(node, allowComments, allowSourceMaps, emitFlags) {
- if (node.name) {
- var name_29 = ts.getMutableClone(node.name);
- emitFlags |= ts.getEmitFlags(node.name);
- if (!allowSourceMaps) {
- emitFlags |= 1536 /* NoSourceMap */;
- }
- if (!allowComments) {
- emitFlags |= 49152 /* NoComments */;
- }
- if (emitFlags) {
- ts.setEmitFlags(name_29, emitFlags);
- }
- return name_29;
- }
- else {
- return ts.getGeneratedNameForNode(node);
+ function getClassAliasIfNeeded(node) {
+ if (resolver.getNodeCheckFlags(node) & 8388608 /* ClassWithConstructorReference */) {
+ enableSubstitutionForClassAliases();
+ var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? node.name.text : "default");
+ classAliases[ts.getOriginalNodeId(node)] = classAlias;
+ hoistVariableDeclaration(classAlias);
+ return classAlias;
}
}
function getClassPrototype(node) {
- return ts.createPropertyAccess(getDeclarationName(node), "prototype");
+ return ts.createPropertyAccess(ts.getDeclarationName(node), "prototype");
}
function getClassMemberPrefix(node, member) {
return ts.hasModifier(member, 32 /* Static */)
- ? getDeclarationName(node)
+ ? ts.getDeclarationName(node)
: getClassPrototype(node);
}
function enableSubstitutionForNonQualifiedEnumMembers() {
@@ -45808,20 +47196,21 @@ var ts;
// We need to enable substitutions for identifiers and shorthand property assignments. This allows us to
// substitute the names of exported members of a namespace.
context.enableSubstitution(70 /* Identifier */);
- context.enableSubstitution(254 /* ShorthandPropertyAssignment */);
+ context.enableSubstitution(257 /* ShorthandPropertyAssignment */);
// We need to be notified when entering and exiting namespaces.
- context.enableEmitNotification(226 /* ModuleDeclaration */);
+ context.enableEmitNotification(229 /* ModuleDeclaration */);
}
}
function isTransformedModuleDeclaration(node) {
- return ts.getOriginalNode(node).kind === 226 /* ModuleDeclaration */;
+ return ts.getOriginalNode(node).kind === 229 /* ModuleDeclaration */;
}
function isTransformedEnumDeclaration(node) {
- return ts.getOriginalNode(node).kind === 225 /* EnumDeclaration */;
+ return ts.getOriginalNode(node).kind === 228 /* EnumDeclaration */;
}
/**
* Hook for node emit.
*
+ * @param emitContext A context hint for the emitter.
* @param node The node to emit.
* @param emit A callback used to emit the node in the printer.
*/
@@ -45839,9 +47228,8 @@ var ts;
/**
* Hooks node substitutions.
*
+ * @param emitContext A context hint for the emitter.
* @param node The node to substitute.
- * @param isExpression A value indicating whether the node is to be used in an expression
- * position.
*/
function onSubstituteNode(emitContext, node) {
node = previousOnSubstituteNode(emitContext, node);
@@ -45855,16 +47243,16 @@ var ts;
}
function substituteShorthandPropertyAssignment(node) {
if (enabledSubstitutions & 2 /* NamespaceExports */) {
- var name_30 = node.name;
- var exportedName = trySubstituteNamespaceExportedName(name_30);
+ var name_33 = node.name;
+ var exportedName = trySubstituteNamespaceExportedName(name_33);
if (exportedName) {
// A shorthand property with an assignment initializer is probably part of a
// destructuring assignment
if (node.objectAssignmentInitializer) {
var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer);
- return ts.createPropertyAssignment(name_30, initializer, /*location*/ node);
+ return ts.createPropertyAssignment(name_33, initializer, /*location*/ node);
}
- return ts.createPropertyAssignment(name_30, exportedName, /*location*/ node);
+ return ts.createPropertyAssignment(name_33, exportedName, /*location*/ node);
}
}
return node;
@@ -45873,9 +47261,9 @@ var ts;
switch (node.kind) {
case 70 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 173 /* PropertyAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 174 /* ElementAccessExpression */:
+ case 177 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
}
return node;
@@ -45909,13 +47297,13 @@ var ts;
}
function trySubstituteNamespaceExportedName(node) {
// If this is explicitly a local name, do not substitute.
- if (enabledSubstitutions & applicableSubstitutions && (ts.getEmitFlags(node) & 262144 /* LocalName */) === 0) {
+ if (enabledSubstitutions & applicableSubstitutions && !ts.isLocalName(node)) {
// If we are nested within a namespace declaration, we may need to qualifiy
// an identifier that is exported from a merged namespace.
var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false);
- if (container) {
- var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 226 /* ModuleDeclaration */) ||
- (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 225 /* EnumDeclaration */);
+ if (container && container.kind !== 260 /* SourceFile */) {
+ var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 229 /* ModuleDeclaration */) ||
+ (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 228 /* EnumDeclaration */);
if (substitute) {
return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, /*location*/ node);
}
@@ -45957,1909 +47345,6 @@ var ts;
}
ts.transformTypeScript = transformTypeScript;
})(ts || (ts = {}));
-///
-///
-/*@internal*/
-var ts;
-(function (ts) {
- function transformES2015Module(context) {
- var compilerOptions = context.getCompilerOptions();
- return transformSourceFile;
- function transformSourceFile(node) {
- if (ts.isDeclarationFile(node)) {
- return node;
- }
- if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- return ts.visitEachChild(node, visitor, context);
- }
- return node;
- }
- function visitor(node) {
- switch (node.kind) {
- case 230 /* ImportEqualsDeclaration */:
- // Elide `import=` as it is not legal with --module ES6
- return undefined;
- case 236 /* ExportAssignment */:
- return visitExportAssignment(node);
- }
- return node;
- }
- function visitExportAssignment(node) {
- // Elide `export=` as it is not legal with --module ES6
- return node.isExportEquals ? undefined : node;
- }
- }
- ts.transformES2015Module = transformES2015Module;
-})(ts || (ts = {}));
-///
-///
-/*@internal*/
-var ts;
-(function (ts) {
- function transformSystemModule(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration, hoistFunctionDeclaration = context.hoistFunctionDeclaration;
- var compilerOptions = context.getCompilerOptions();
- var resolver = context.getEmitResolver();
- var host = context.getEmitHost();
- var previousOnSubstituteNode = context.onSubstituteNode;
- var previousOnEmitNode = context.onEmitNode;
- context.onSubstituteNode = onSubstituteNode;
- context.onEmitNode = onEmitNode;
- context.enableSubstitution(70 /* Identifier */);
- context.enableSubstitution(188 /* BinaryExpression */);
- context.enableSubstitution(186 /* PrefixUnaryExpression */);
- context.enableSubstitution(187 /* PostfixUnaryExpression */);
- context.enableEmitNotification(256 /* SourceFile */);
- var exportFunctionForFileMap = [];
- var currentSourceFile;
- var externalImports;
- var exportSpecifiers;
- var exportEquals;
- var hasExportStarsToExportValues;
- var exportFunctionForFile;
- var contextObjectForFile;
- var exportedLocalNames;
- var exportedFunctionDeclarations;
- var enclosingBlockScopedContainer;
- var currentParent;
- var currentNode;
- return transformSourceFile;
- function transformSourceFile(node) {
- if (ts.isDeclarationFile(node)) {
- return node;
- }
- if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- currentSourceFile = node;
- currentNode = node;
- // Perform the transformation.
- var updated = transformSystemModuleWorker(node);
- ts.aggregateTransformFlags(updated);
- currentSourceFile = undefined;
- externalImports = undefined;
- exportSpecifiers = undefined;
- exportEquals = undefined;
- hasExportStarsToExportValues = false;
- exportFunctionForFile = undefined;
- contextObjectForFile = undefined;
- exportedLocalNames = undefined;
- exportedFunctionDeclarations = undefined;
- return updated;
- }
- return node;
- }
- function transformSystemModuleWorker(node) {
- // System modules have the following shape:
- //
- // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */})
- //
- // The parameter 'exports' here is a callback '(name: string, value: T) => T' that
- // is used to publish exported values. 'exports' returns its 'value' argument so in
- // most cases expressions that mutate exported values can be rewritten as:
- //
- // expr -> exports('name', expr)
- //
- // The only exception in this rule is postfix unary operators,
- // see comment to 'substitutePostfixUnaryExpression' for more details
- ts.Debug.assert(!exportFunctionForFile);
- // Collect information about the external module and dependency groups.
- (_a = ts.collectExternalModuleInfo(node), externalImports = _a.externalImports, exportSpecifiers = _a.exportSpecifiers, exportEquals = _a.exportEquals, hasExportStarsToExportValues = _a.hasExportStarsToExportValues, _a);
- // Make sure that the name of the 'exports' function does not conflict with
- // existing identifiers.
- exportFunctionForFile = ts.createUniqueName("exports");
- contextObjectForFile = ts.createUniqueName("context");
- exportFunctionForFileMap[ts.getOriginalNodeId(node)] = exportFunctionForFile;
- var dependencyGroups = collectDependencyGroups(externalImports);
- var statements = [];
- // Add the body of the module.
- addSystemModuleBody(statements, node, dependencyGroups);
- var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);
- var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, getNameOfDependencyGroup));
- var body = ts.createFunctionExpression(
- /*modifiers*/ undefined,
- /*asteriskToken*/ undefined,
- /*name*/ undefined,
- /*typeParameters*/ undefined, [
- ts.createParameter(exportFunctionForFile),
- ts.createParameter(contextObjectForFile)
- ],
- /*type*/ undefined, ts.setEmitFlags(ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true), 1 /* EmitEmitHelpers */));
- // Write the call to `System.register`
- // Clear the emit-helpers flag for later passes since we'll have already used it in the module body
- // So the helper will be emit at the correct position instead of at the top of the source-file
- return updateSourceFile(node, [
- ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"),
- /*typeArguments*/ undefined, moduleName
- ? [moduleName, dependencies, body]
- : [dependencies, body]))
- ], /*nodeEmitFlags*/ ~1 /* EmitEmitHelpers */ & ts.getEmitFlags(node));
- var _a;
- }
- /**
- * Adds the statements for the module body function for the source file.
- *
- * @param statements The output statements for the module body.
- * @param node The source file for the module.
- * @param statementOffset The offset at which to begin visiting the statements of the SourceFile.
- */
- function addSystemModuleBody(statements, node, dependencyGroups) {
- // Shape of the body in system modules:
- //
- // function (exports) {
- //
- //
- //
- // return {
- // setters: [
- //
- // ],
- // execute: function() {
- //
- // }
- // }
- //
- // }
- //
- // i.e:
- //
- // import {x} from 'file1'
- // var y = 1;
- // export function foo() { return y + x(); }
- // console.log(y);
- //
- // Will be transformed to:
- //
- // function(exports) {
- // var file_1; // local alias
- // var y;
- // function foo() { return y + file_1.x(); }
- // exports("foo", foo);
- // return {
- // setters: [
- // function(v) { file_1 = v }
- // ],
- // execute(): function() {
- // y = 1;
- // console.log(y);
- // }
- // };
- // }
- // We start a new lexical environment in this function body, but *not* in the
- // body of the execute function. This allows us to emit temporary declarations
- // only in the outer module body and not in the inner one.
- startLexicalEnvironment();
- // Add any prologue directives.
- var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, visitSourceElement);
- // var __moduleName = context_1 && context_1.id;
- statements.push(ts.createVariableStatement(
- /*modifiers*/ undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration("__moduleName",
- /*type*/ undefined, ts.createLogicalAnd(contextObjectForFile, ts.createPropertyAccess(contextObjectForFile, "id")))
- ])));
- // Visit the statements of the source file, emitting any transformations into
- // the `executeStatements` array. We do this *before* we fill the `setters` array
- // as we both emit transformations as well as aggregate some data used when creating
- // setters. This allows us to reduce the number of times we need to loop through the
- // statements of the source file.
- var executeStatements = ts.visitNodes(node.statements, visitSourceElement, ts.isStatement, statementOffset);
- // We emit the lexical environment (hoisted variables and function declarations)
- // early to align roughly with our previous emit output.
- // Two key differences in this approach are:
- // - Temporary variables will appear at the top rather than at the bottom of the file
- // - Calls to the exporter for exported function declarations are grouped after
- // the declarations.
- ts.addRange(statements, endLexicalEnvironment());
- // Emit early exports for function declarations.
- ts.addRange(statements, exportedFunctionDeclarations);
- var exportStarFunction = addExportStarIfNeeded(statements);
- statements.push(ts.createReturn(ts.setMultiLine(ts.createObjectLiteral([
- ts.createPropertyAssignment("setters", generateSetters(exportStarFunction, dependencyGroups)),
- ts.createPropertyAssignment("execute", ts.createFunctionExpression(
- /*modifiers*/ undefined,
- /*asteriskToken*/ undefined,
- /*name*/ undefined,
- /*typeParameters*/ undefined,
- /*parameters*/ [],
- /*type*/ undefined, ts.createBlock(executeStatements,
- /*location*/ undefined,
- /*multiLine*/ true)))
- ]),
- /*multiLine*/ true)));
- }
- function addExportStarIfNeeded(statements) {
- if (!hasExportStarsToExportValues) {
- return;
- }
- // when resolving exports local exported entries/indirect exported entries in the module
- // should always win over entries with similar names that were added via star exports
- // to support this we store names of local/indirect exported entries in a set.
- // this set is used to filter names brought by star expors.
- // local names set should only be added if we have anything exported
- if (!exportedLocalNames && ts.isEmpty(exportSpecifiers)) {
- // no exported declarations (export var ...) or export specifiers (export {x})
- // check if we have any non star export declarations.
- var hasExportDeclarationWithExportClause = false;
- for (var _i = 0, externalImports_1 = externalImports; _i < externalImports_1.length; _i++) {
- var externalImport = externalImports_1[_i];
- if (externalImport.kind === 237 /* ExportDeclaration */ && externalImport.exportClause) {
- hasExportDeclarationWithExportClause = true;
- break;
- }
- }
- if (!hasExportDeclarationWithExportClause) {
- // we still need to emit exportStar helper
- return addExportStarFunction(statements, /*localNames*/ undefined);
- }
- }
- var exportedNames = [];
- if (exportedLocalNames) {
- for (var _a = 0, exportedLocalNames_1 = exportedLocalNames; _a < exportedLocalNames_1.length; _a++) {
- var exportedLocalName = exportedLocalNames_1[_a];
- // write name of exported declaration, i.e 'export var x...'
- exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName.text), ts.createLiteral(true)));
- }
- }
- for (var _b = 0, externalImports_2 = externalImports; _b < externalImports_2.length; _b++) {
- var externalImport = externalImports_2[_b];
- if (externalImport.kind !== 237 /* ExportDeclaration */) {
- continue;
- }
- var exportDecl = externalImport;
- if (!exportDecl.exportClause) {
- // export * from ...
- continue;
- }
- for (var _c = 0, _d = exportDecl.exportClause.elements; _c < _d.length; _c++) {
- var element = _d[_c];
- // write name of indirectly exported entry, i.e. 'export {x} from ...'
- exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createLiteral(true)));
- }
- }
- var exportedNamesStorageRef = ts.createUniqueName("exportedNames");
- statements.push(ts.createVariableStatement(
- /*modifiers*/ undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(exportedNamesStorageRef,
- /*type*/ undefined, ts.createObjectLiteral(exportedNames, /*location*/ undefined, /*multiline*/ true))
- ])));
- return addExportStarFunction(statements, exportedNamesStorageRef);
- }
- /**
- * Emits a setter callback for each dependency group.
- * @param write The callback used to write each callback.
- */
- function generateSetters(exportStarFunction, dependencyGroups) {
- var setters = [];
- for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) {
- var group = dependencyGroups_1[_i];
- // derive a unique name for parameter from the first named entry in the group
- var localName = ts.forEach(group.externalImports, function (i) { return ts.getLocalNameForExternalImport(i, currentSourceFile); });
- var parameterName = localName ? ts.getGeneratedNameForNode(localName) : ts.createUniqueName("");
- var statements = [];
- for (var _a = 0, _b = group.externalImports; _a < _b.length; _a++) {
- var entry = _b[_a];
- var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile);
- switch (entry.kind) {
- case 231 /* ImportDeclaration */:
- if (!entry.importClause) {
- // 'import "..."' case
- // module is imported only for side-effects, no emit required
- break;
- }
- // fall-through
- case 230 /* ImportEqualsDeclaration */:
- ts.Debug.assert(importVariableName !== undefined);
- // save import into the local
- statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName)));
- break;
- case 237 /* ExportDeclaration */:
- ts.Debug.assert(importVariableName !== undefined);
- if (entry.exportClause) {
- // export {a, b as c} from 'foo'
- //
- // emit as:
- //
- // exports_({
- // "a": _["a"],
- // "c": _["b"]
- // });
- var properties = [];
- for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) {
- var e = _d[_c];
- properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text))));
- }
- statements.push(ts.createStatement(ts.createCall(exportFunctionForFile,
- /*typeArguments*/ undefined, [ts.createObjectLiteral(properties, /*location*/ undefined, /*multiline*/ true)])));
- }
- else {
- // export * from 'foo'
- //
- // emit as:
- //
- // exportStar(foo_1_1);
- statements.push(ts.createStatement(ts.createCall(exportStarFunction,
- /*typeArguments*/ undefined, [parameterName])));
- }
- break;
- }
- }
- setters.push(ts.createFunctionExpression(
- /*modifiers*/ undefined,
- /*asteriskToken*/ undefined,
- /*name*/ undefined,
- /*typeParameters*/ undefined, [ts.createParameter(parameterName)],
- /*type*/ undefined, ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true)));
- }
- return ts.createArrayLiteral(setters, /*location*/ undefined, /*multiLine*/ true);
- }
- function visitSourceElement(node) {
- switch (node.kind) {
- case 231 /* ImportDeclaration */:
- return visitImportDeclaration(node);
- case 230 /* ImportEqualsDeclaration */:
- return visitImportEqualsDeclaration(node);
- case 237 /* ExportDeclaration */:
- return visitExportDeclaration(node);
- case 236 /* ExportAssignment */:
- return visitExportAssignment(node);
- default:
- return visitNestedNode(node);
- }
- }
- function visitNestedNode(node) {
- var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;
- var savedCurrentParent = currentParent;
- var savedCurrentNode = currentNode;
- var currentGrandparent = currentParent;
- currentParent = currentNode;
- currentNode = node;
- if (currentParent && ts.isBlockScope(currentParent, currentGrandparent)) {
- enclosingBlockScopedContainer = currentParent;
- }
- var result = visitNestedNodeWorker(node);
- enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;
- currentParent = savedCurrentParent;
- currentNode = savedCurrentNode;
- return result;
- }
- function visitNestedNodeWorker(node) {
- switch (node.kind) {
- case 201 /* VariableStatement */:
- return visitVariableStatement(node);
- case 221 /* FunctionDeclaration */:
- return visitFunctionDeclaration(node);
- case 222 /* ClassDeclaration */:
- return visitClassDeclaration(node);
- case 207 /* ForStatement */:
- return visitForStatement(node);
- case 208 /* ForInStatement */:
- return visitForInStatement(node);
- case 209 /* ForOfStatement */:
- return visitForOfStatement(node);
- case 205 /* DoStatement */:
- return visitDoStatement(node);
- case 206 /* WhileStatement */:
- return visitWhileStatement(node);
- case 215 /* LabeledStatement */:
- return visitLabeledStatement(node);
- case 213 /* WithStatement */:
- return visitWithStatement(node);
- case 214 /* SwitchStatement */:
- return visitSwitchStatement(node);
- case 228 /* CaseBlock */:
- return visitCaseBlock(node);
- case 249 /* CaseClause */:
- return visitCaseClause(node);
- case 250 /* DefaultClause */:
- return visitDefaultClause(node);
- case 217 /* TryStatement */:
- return visitTryStatement(node);
- case 252 /* CatchClause */:
- return visitCatchClause(node);
- case 200 /* Block */:
- return visitBlock(node);
- case 203 /* ExpressionStatement */:
- return visitExpressionStatement(node);
- default:
- return node;
- }
- }
- function visitImportDeclaration(node) {
- if (node.importClause && ts.contains(externalImports, node)) {
- hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile));
- }
- return undefined;
- }
- function visitImportEqualsDeclaration(node) {
- if (ts.contains(externalImports, node)) {
- hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile));
- }
- // NOTE(rbuckton): Do we support export import = require('') in System?
- return undefined;
- }
- function visitExportDeclaration(node) {
- if (!node.moduleSpecifier) {
- var statements = [];
- ts.addRange(statements, ts.map(node.exportClause.elements, visitExportSpecifier));
- return statements;
- }
- return undefined;
- }
- function visitExportSpecifier(specifier) {
- recordExportName(specifier.name);
- return createExportStatement(specifier.name, specifier.propertyName || specifier.name);
- }
- function visitExportAssignment(node) {
- if (node.isExportEquals) {
- // Elide `export=` as it is illegal in a SystemJS module.
- return undefined;
- }
- return createExportStatement(ts.createLiteral("default"), node.expression);
- }
- /**
- * Visits a variable statement, hoisting declared names to the top-level module body.
- * Each declaration is rewritten into an assignment expression.
- *
- * @param node The variable statement to visit.
- */
- function visitVariableStatement(node) {
- // hoist only non-block scoped declarations or block scoped declarations parented by source file
- var shouldHoist = ((ts.getCombinedNodeFlags(ts.getOriginalNode(node.declarationList)) & 3 /* BlockScoped */) == 0) ||
- enclosingBlockScopedContainer.kind === 256 /* SourceFile */;
- if (!shouldHoist) {
- return node;
- }
- var isExported = ts.hasModifier(node, 1 /* Export */);
- var expressions = [];
- for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
- var variable = _a[_i];
- var visited = transformVariable(variable, isExported);
- if (visited) {
- expressions.push(visited);
- }
- }
- if (expressions.length) {
- return ts.createStatement(ts.inlineExpressions(expressions), node);
- }
- return undefined;
- }
- /**
- * Transforms a VariableDeclaration into one or more assignment expressions.
- *
- * @param node The VariableDeclaration to transform.
- * @param isExported A value used to indicate whether the containing statement was exported.
- */
- function transformVariable(node, isExported) {
- // Hoist any bound names within the declaration.
- hoistBindingElement(node, isExported);
- if (!node.initializer) {
- // If the variable has no initializer, ignore it.
- return;
- }
- var name = node.name;
- if (ts.isIdentifier(name)) {
- // If the variable has an IdentifierName, write out an assignment expression in its place.
- return ts.createAssignment(name, node.initializer);
- }
- else {
- // If the variable has a BindingPattern, flatten the variable into multiple assignment expressions.
- return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration);
- }
- }
- /**
- * Visits a FunctionDeclaration, hoisting it to the outer module body function.
- *
- * @param node The function declaration to visit.
- */
- function visitFunctionDeclaration(node) {
- if (ts.hasModifier(node, 1 /* Export */)) {
- // If the function is exported, ensure it has a name and rewrite the function without any export flags.
- var name_31 = node.name || ts.getGeneratedNameForNode(node);
- // Keep async modifier for ES2017 transformer
- var isAsync = ts.hasModifier(node, 256 /* Async */);
- var newNode = ts.createFunctionDeclaration(
- /*decorators*/ undefined, isAsync ? [ts.createNode(119 /* AsyncKeyword */)] : undefined, node.asteriskToken, name_31,
- /*typeParameters*/ undefined, node.parameters,
- /*type*/ undefined, node.body,
- /*location*/ node);
- // Record a declaration export in the outer module body function.
- recordExportedFunctionDeclaration(node);
- if (!ts.hasModifier(node, 512 /* Default */)) {
- recordExportName(name_31);
- }
- ts.setOriginalNode(newNode, node);
- node = newNode;
- }
- // Hoist the function declaration to the outer module body function.
- hoistFunctionDeclaration(node);
- return undefined;
- }
- function visitExpressionStatement(node) {
- var originalNode = ts.getOriginalNode(node);
- if ((originalNode.kind === 226 /* ModuleDeclaration */ || originalNode.kind === 225 /* EnumDeclaration */) && ts.hasModifier(originalNode, 1 /* Export */)) {
- var name_32 = getDeclarationName(originalNode);
- // We only need to hoistVariableDeclaration for EnumDeclaration
- // as ModuleDeclaration is already hoisted when the transformer call visitVariableStatement
- // which then call transformsVariable for each declaration in declarationList
- if (originalNode.kind === 225 /* EnumDeclaration */) {
- hoistVariableDeclaration(name_32);
- }
- return [
- node,
- createExportStatement(name_32, name_32)
- ];
- }
- return node;
- }
- /**
- * Visits a ClassDeclaration, hoisting its name to the outer module body function.
- *
- * @param node The class declaration to visit.
- */
- function visitClassDeclaration(node) {
- // Hoist the name of the class declaration to the outer module body function.
- var name = getDeclarationName(node);
- hoistVariableDeclaration(name);
- var statements = [];
- // Rewrite the class declaration into an assignment of a class expression.
- statements.push(ts.createStatement(ts.createAssignment(name, ts.createClassExpression(
- /*modifiers*/ undefined, node.name,
- /*typeParameters*/ undefined, node.heritageClauses, node.members,
- /*location*/ node)),
- /*location*/ node));
- // If the class was exported, write a declaration export to the inner module body function.
- if (ts.hasModifier(node, 1 /* Export */)) {
- if (!ts.hasModifier(node, 512 /* Default */)) {
- recordExportName(name);
- }
- statements.push(createDeclarationExport(node));
- }
- return statements;
- }
- function shouldHoistLoopInitializer(node) {
- return ts.isVariableDeclarationList(node) && (ts.getCombinedNodeFlags(node) & 3 /* BlockScoped */) === 0;
- }
- /**
- * Visits the body of a ForStatement to hoist declarations.
- *
- * @param node The statement to visit.
- */
- function visitForStatement(node) {
- var initializer = node.initializer;
- if (shouldHoistLoopInitializer(initializer)) {
- var expressions = [];
- for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {
- var variable = _a[_i];
- var visited = transformVariable(variable, /*isExported*/ false);
- if (visited) {
- expressions.push(visited);
- }
- }
- ;
- return ts.createFor(expressions.length
- ? ts.inlineExpressions(expressions)
- : ts.createSynthesizedNode(194 /* OmittedExpression */), node.condition, node.incrementor, ts.visitNode(node.statement, visitNestedNode, ts.isStatement),
- /*location*/ node);
- }
- else {
- return ts.visitEachChild(node, visitNestedNode, context);
- }
- }
- /**
- * Transforms and hoists the declaration list of a ForInStatement or ForOfStatement into an expression.
- *
- * @param node The decalaration list to transform.
- */
- function transformForBinding(node) {
- var firstDeclaration = ts.firstOrUndefined(node.declarations);
- hoistBindingElement(firstDeclaration, /*isExported*/ false);
- var name = firstDeclaration.name;
- return ts.isIdentifier(name)
- ? name
- : ts.flattenVariableDestructuringToExpression(firstDeclaration, hoistVariableDeclaration);
- }
- /**
- * Visits the body of a ForInStatement to hoist declarations.
- *
- * @param node The statement to visit.
- */
- function visitForInStatement(node) {
- var initializer = node.initializer;
- if (shouldHoistLoopInitializer(initializer)) {
- var updated = ts.getMutableClone(node);
- updated.initializer = transformForBinding(initializer);
- updated.statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, /*optional*/ false, ts.liftToBlock);
- return updated;
- }
- else {
- return ts.visitEachChild(node, visitNestedNode, context);
- }
- }
- /**
- * Visits the body of a ForOfStatement to hoist declarations.
- *
- * @param node The statement to visit.
- */
- function visitForOfStatement(node) {
- var initializer = node.initializer;
- if (shouldHoistLoopInitializer(initializer)) {
- var updated = ts.getMutableClone(node);
- updated.initializer = transformForBinding(initializer);
- updated.statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, /*optional*/ false, ts.liftToBlock);
- return updated;
- }
- else {
- return ts.visitEachChild(node, visitNestedNode, context);
- }
- }
- /**
- * Visits the body of a DoStatement to hoist declarations.
- *
- * @param node The statement to visit.
- */
- function visitDoStatement(node) {
- var statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, /*optional*/ false, ts.liftToBlock);
- if (statement !== node.statement) {
- var updated = ts.getMutableClone(node);
- updated.statement = statement;
- return updated;
- }
- return node;
- }
- /**
- * Visits the body of a WhileStatement to hoist declarations.
- *
- * @param node The statement to visit.
- */
- function visitWhileStatement(node) {
- var statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, /*optional*/ false, ts.liftToBlock);
- if (statement !== node.statement) {
- var updated = ts.getMutableClone(node);
- updated.statement = statement;
- return updated;
- }
- return node;
- }
- /**
- * Visits the body of a LabeledStatement to hoist declarations.
- *
- * @param node The statement to visit.
- */
- function visitLabeledStatement(node) {
- var statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, /*optional*/ false, ts.liftToBlock);
- if (statement !== node.statement) {
- var updated = ts.getMutableClone(node);
- updated.statement = statement;
- return updated;
- }
- return node;
- }
- /**
- * Visits the body of a WithStatement to hoist declarations.
- *
- * @param node The statement to visit.
- */
- function visitWithStatement(node) {
- var statement = ts.visitNode(node.statement, visitNestedNode, ts.isStatement, /*optional*/ false, ts.liftToBlock);
- if (statement !== node.statement) {
- var updated = ts.getMutableClone(node);
- updated.statement = statement;
- return updated;
- }
- return node;
- }
- /**
- * Visits the body of a SwitchStatement to hoist declarations.
- *
- * @param node The statement to visit.
- */
- function visitSwitchStatement(node) {
- var caseBlock = ts.visitNode(node.caseBlock, visitNestedNode, ts.isCaseBlock);
- if (caseBlock !== node.caseBlock) {
- var updated = ts.getMutableClone(node);
- updated.caseBlock = caseBlock;
- return updated;
- }
- return node;
- }
- /**
- * Visits the body of a CaseBlock to hoist declarations.
- *
- * @param node The node to visit.
- */
- function visitCaseBlock(node) {
- var clauses = ts.visitNodes(node.clauses, visitNestedNode, ts.isCaseOrDefaultClause);
- if (clauses !== node.clauses) {
- var updated = ts.getMutableClone(node);
- updated.clauses = clauses;
- return updated;
- }
- return node;
- }
- /**
- * Visits the body of a CaseClause to hoist declarations.
- *
- * @param node The clause to visit.
- */
- function visitCaseClause(node) {
- var statements = ts.visitNodes(node.statements, visitNestedNode, ts.isStatement);
- if (statements !== node.statements) {
- var updated = ts.getMutableClone(node);
- updated.statements = statements;
- return updated;
- }
- return node;
- }
- /**
- * Visits the body of a DefaultClause to hoist declarations.
- *
- * @param node The clause to visit.
- */
- function visitDefaultClause(node) {
- return ts.visitEachChild(node, visitNestedNode, context);
- }
- /**
- * Visits the body of a TryStatement to hoist declarations.
- *
- * @param node The statement to visit.
- */
- function visitTryStatement(node) {
- return ts.visitEachChild(node, visitNestedNode, context);
- }
- /**
- * Visits the body of a CatchClause to hoist declarations.
- *
- * @param node The clause to visit.
- */
- function visitCatchClause(node) {
- var block = ts.visitNode(node.block, visitNestedNode, ts.isBlock);
- if (block !== node.block) {
- var updated = ts.getMutableClone(node);
- updated.block = block;
- return updated;
- }
- return node;
- }
- /**
- * Visits the body of a Block to hoist declarations.
- *
- * @param node The block to visit.
- */
- function visitBlock(node) {
- return ts.visitEachChild(node, visitNestedNode, context);
- }
- //
- // Substitutions
- //
- function onEmitNode(emitContext, node, emitCallback) {
- if (node.kind === 256 /* SourceFile */) {
- exportFunctionForFile = exportFunctionForFileMap[ts.getOriginalNodeId(node)];
- previousOnEmitNode(emitContext, node, emitCallback);
- exportFunctionForFile = undefined;
- }
- else {
- previousOnEmitNode(emitContext, node, emitCallback);
- }
- }
- /**
- * Hooks node substitutions.
- *
- * @param node The node to substitute.
- * @param isExpression A value indicating whether the node is to be used in an expression
- * position.
- */
- function onSubstituteNode(emitContext, node) {
- node = previousOnSubstituteNode(emitContext, node);
- if (emitContext === 1 /* Expression */) {
- return substituteExpression(node);
- }
- return node;
- }
- /**
- * Substitute the expression, if necessary.
- *
- * @param node The node to substitute.
- */
- function substituteExpression(node) {
- switch (node.kind) {
- case 70 /* Identifier */:
- return substituteExpressionIdentifier(node);
- case 188 /* BinaryExpression */:
- return substituteBinaryExpression(node);
- case 186 /* PrefixUnaryExpression */:
- case 187 /* PostfixUnaryExpression */:
- return substituteUnaryExpression(node);
- }
- return node;
- }
- /**
- * Substitution for identifiers exported at the top level of a module.
- */
- function substituteExpressionIdentifier(node) {
- var importDeclaration = resolver.getReferencedImportDeclaration(node);
- if (importDeclaration) {
- var importBinding = createImportBinding(importDeclaration);
- if (importBinding) {
- return importBinding;
- }
- }
- return node;
- }
- function substituteBinaryExpression(node) {
- if (ts.isAssignmentOperator(node.operatorToken.kind)) {
- return substituteAssignmentExpression(node);
- }
- return node;
- }
- function substituteAssignmentExpression(node) {
- ts.setEmitFlags(node, 128 /* NoSubstitution */);
- var left = node.left;
- switch (left.kind) {
- case 70 /* Identifier */:
- var exportDeclaration = resolver.getReferencedExportContainer(left);
- if (exportDeclaration) {
- return createExportExpression(left, node);
- }
- break;
- case 172 /* ObjectLiteralExpression */:
- case 171 /* ArrayLiteralExpression */:
- if (hasExportedReferenceInDestructuringPattern(left)) {
- return substituteDestructuring(node);
- }
- break;
- }
- return node;
- }
- function isExportedBinding(name) {
- var container = resolver.getReferencedExportContainer(name);
- return container && container.kind === 256 /* SourceFile */;
- }
- function hasExportedReferenceInDestructuringPattern(node) {
- switch (node.kind) {
- case 70 /* Identifier */:
- return isExportedBinding(node);
- case 172 /* ObjectLiteralExpression */:
- for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
- var property = _a[_i];
- if (hasExportedReferenceInObjectDestructuringElement(property)) {
- return true;
- }
- }
- break;
- case 171 /* ArrayLiteralExpression */:
- for (var _b = 0, _c = node.elements; _b < _c.length; _b++) {
- var element = _c[_b];
- if (hasExportedReferenceInArrayDestructuringElement(element)) {
- return true;
- }
- }
- break;
- }
- return false;
- }
- function hasExportedReferenceInObjectDestructuringElement(node) {
- if (ts.isShorthandPropertyAssignment(node)) {
- return isExportedBinding(node.name);
- }
- else if (ts.isPropertyAssignment(node)) {
- return hasExportedReferenceInDestructuringElement(node.initializer);
- }
- else {
- return false;
- }
- }
- function hasExportedReferenceInArrayDestructuringElement(node) {
- if (ts.isSpreadElementExpression(node)) {
- var expression = node.expression;
- return ts.isIdentifier(expression) && isExportedBinding(expression);
- }
- else {
- return hasExportedReferenceInDestructuringElement(node);
- }
- }
- function hasExportedReferenceInDestructuringElement(node) {
- if (ts.isBinaryExpression(node)) {
- var left = node.left;
- return node.operatorToken.kind === 57 /* EqualsToken */
- && isDestructuringPattern(left)
- && hasExportedReferenceInDestructuringPattern(left);
- }
- else if (ts.isIdentifier(node)) {
- return isExportedBinding(node);
- }
- else if (ts.isSpreadElementExpression(node)) {
- var expression = node.expression;
- return ts.isIdentifier(expression) && isExportedBinding(expression);
- }
- else if (isDestructuringPattern(node)) {
- return hasExportedReferenceInDestructuringPattern(node);
- }
- else {
- return false;
- }
- }
- function isDestructuringPattern(node) {
- var kind = node.kind;
- return kind === 70 /* Identifier */
- || kind === 172 /* ObjectLiteralExpression */
- || kind === 171 /* ArrayLiteralExpression */;
- }
- function substituteDestructuring(node) {
- return ts.flattenDestructuringAssignment(context, node, /*needsValue*/ true, hoistVariableDeclaration);
- }
- function substituteUnaryExpression(node) {
- var operand = node.operand;
- var operator = node.operator;
- var substitute = ts.isIdentifier(operand) &&
- (node.kind === 187 /* PostfixUnaryExpression */ ||
- (node.kind === 186 /* PrefixUnaryExpression */ && (operator === 42 /* PlusPlusToken */ || operator === 43 /* MinusMinusToken */)));
- if (substitute) {
- var exportDeclaration = resolver.getReferencedExportContainer(operand);
- if (exportDeclaration) {
- var expr = ts.createPrefix(node.operator, operand, node);
- ts.setEmitFlags(expr, 128 /* NoSubstitution */);
- var call = createExportExpression(operand, expr);
- if (node.kind === 186 /* PrefixUnaryExpression */) {
- return call;
- }
- else {
- // export function returns the value that was passes as the second argument
- // however for postfix unary expressions result value should be the value before modification.
- // emit 'x++' as '(export('x', ++x) - 1)' and 'x--' as '(export('x', --x) + 1)'
- return operator === 42 /* PlusPlusToken */
- ? ts.createSubtract(call, ts.createLiteral(1))
- : ts.createAdd(call, ts.createLiteral(1));
- }
- }
- }
- return node;
- }
- /**
- * Gets a name to use for a DeclarationStatement.
- * @param node The declaration statement.
- */
- function getDeclarationName(node) {
- return node.name ? ts.getSynthesizedClone(node.name) : ts.getGeneratedNameForNode(node);
- }
- function addExportStarFunction(statements, localNames) {
- var exportStarFunction = ts.createUniqueName("exportStar");
- var m = ts.createIdentifier("m");
- var n = ts.createIdentifier("n");
- var exports = ts.createIdentifier("exports");
- var condition = ts.createStrictInequality(n, ts.createLiteral("default"));
- if (localNames) {
- condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createHasOwnProperty(localNames, n)));
- }
- statements.push(ts.createFunctionDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined,
- /*asteriskToken*/ undefined, exportStarFunction,
- /*typeParameters*/ undefined, [ts.createParameter(m)],
- /*type*/ undefined, ts.createBlock([
- ts.createVariableStatement(
- /*modifiers*/ undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(exports,
- /*type*/ undefined, ts.createObjectLiteral([]))
- ])),
- ts.createForIn(ts.createVariableDeclarationList([
- ts.createVariableDeclaration(n, /*type*/ undefined)
- ]), m, ts.createBlock([
- ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 32 /* SingleLine */)
- ])),
- ts.createStatement(ts.createCall(exportFunctionForFile,
- /*typeArguments*/ undefined, [exports]))
- ],
- /*location*/ undefined,
- /*multiline*/ true)));
- return exportStarFunction;
- }
- /**
- * Creates a call to the current file's export function to export a value.
- * @param name The bound name of the export.
- * @param value The exported value.
- */
- function createExportExpression(name, value) {
- var exportName = ts.isIdentifier(name) ? ts.createLiteral(name.text) : name;
- return ts.createCall(exportFunctionForFile, /*typeArguments*/ undefined, [exportName, value]);
- }
- /**
- * Creates a call to the current file's export function to export a value.
- * @param name The bound name of the export.
- * @param value The exported value.
- */
- function createExportStatement(name, value) {
- return ts.createStatement(createExportExpression(name, value));
- }
- /**
- * Creates a call to the current file's export function to export a declaration.
- * @param node The declaration to export.
- */
- function createDeclarationExport(node) {
- var declarationName = getDeclarationName(node);
- var exportName = ts.hasModifier(node, 512 /* Default */) ? ts.createLiteral("default") : declarationName;
- return createExportStatement(exportName, declarationName);
- }
- function createImportBinding(importDeclaration) {
- var importAlias;
- var name;
- if (ts.isImportClause(importDeclaration)) {
- importAlias = ts.getGeneratedNameForNode(importDeclaration.parent);
- name = ts.createIdentifier("default");
- }
- else if (ts.isImportSpecifier(importDeclaration)) {
- importAlias = ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent);
- name = importDeclaration.propertyName || importDeclaration.name;
- }
- else {
- return undefined;
- }
- return ts.createPropertyAccess(importAlias, ts.getSynthesizedClone(name));
- }
- function collectDependencyGroups(externalImports) {
- var groupIndices = ts.createMap();
- var dependencyGroups = [];
- for (var i = 0; i < externalImports.length; i++) {
- var externalImport = externalImports[i];
- var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions);
- var text = externalModuleName.text;
- if (ts.hasProperty(groupIndices, text)) {
- // deduplicate/group entries in dependency list by the dependency name
- var groupIndex = groupIndices[text];
- dependencyGroups[groupIndex].externalImports.push(externalImport);
- continue;
- }
- else {
- groupIndices[text] = dependencyGroups.length;
- dependencyGroups.push({
- name: externalModuleName,
- externalImports: [externalImport]
- });
- }
- }
- return dependencyGroups;
- }
- function getNameOfDependencyGroup(dependencyGroup) {
- return dependencyGroup.name;
- }
- function recordExportName(name) {
- if (!exportedLocalNames) {
- exportedLocalNames = [];
- }
- exportedLocalNames.push(name);
- }
- function recordExportedFunctionDeclaration(node) {
- if (!exportedFunctionDeclarations) {
- exportedFunctionDeclarations = [];
- }
- exportedFunctionDeclarations.push(createDeclarationExport(node));
- }
- function hoistBindingElement(node, isExported) {
- if (ts.isOmittedExpression(node)) {
- return;
- }
- var name = node.name;
- if (ts.isIdentifier(name)) {
- hoistVariableDeclaration(ts.getSynthesizedClone(name));
- if (isExported) {
- recordExportName(name);
- }
- }
- else if (ts.isBindingPattern(name)) {
- ts.forEach(name.elements, isExported ? hoistExportedBindingElement : hoistNonExportedBindingElement);
- }
- }
- function hoistExportedBindingElement(node) {
- hoistBindingElement(node, /*isExported*/ true);
- }
- function hoistNonExportedBindingElement(node) {
- hoistBindingElement(node, /*isExported*/ false);
- }
- function updateSourceFile(node, statements, nodeEmitFlags) {
- var updated = ts.getMutableClone(node);
- updated.statements = ts.createNodeArray(statements, node.statements);
- ts.setEmitFlags(updated, nodeEmitFlags);
- return updated;
- }
- }
- ts.transformSystemModule = transformSystemModule;
-})(ts || (ts = {}));
-///
-///
-/*@internal*/
-var ts;
-(function (ts) {
- function transformModule(context) {
- var transformModuleDelegates = ts.createMap((_a = {},
- _a[ts.ModuleKind.None] = transformCommonJSModule,
- _a[ts.ModuleKind.CommonJS] = transformCommonJSModule,
- _a[ts.ModuleKind.AMD] = transformAMDModule,
- _a[ts.ModuleKind.UMD] = transformUMDModule,
- _a));
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
- var compilerOptions = context.getCompilerOptions();
- var resolver = context.getEmitResolver();
- var host = context.getEmitHost();
- var languageVersion = ts.getEmitScriptTarget(compilerOptions);
- var moduleKind = ts.getEmitModuleKind(compilerOptions);
- var previousOnSubstituteNode = context.onSubstituteNode;
- var previousOnEmitNode = context.onEmitNode;
- context.onSubstituteNode = onSubstituteNode;
- context.onEmitNode = onEmitNode;
- context.enableSubstitution(70 /* Identifier */);
- context.enableSubstitution(188 /* BinaryExpression */);
- context.enableSubstitution(186 /* PrefixUnaryExpression */);
- context.enableSubstitution(187 /* PostfixUnaryExpression */);
- context.enableSubstitution(254 /* ShorthandPropertyAssignment */);
- context.enableEmitNotification(256 /* SourceFile */);
- var currentSourceFile;
- var externalImports;
- var exportSpecifiers;
- var exportEquals;
- var bindingNameExportSpecifiersMap;
- // Subset of exportSpecifiers that is a binding-name.
- // This is to reduce amount of memory we have to keep around even after we done with module-transformer
- var bindingNameExportSpecifiersForFileMap = ts.createMap();
- var hasExportStarsToExportValues;
- return transformSourceFile;
- /**
- * Transforms the module aspects of a SourceFile.
- *
- * @param node The SourceFile node.
- */
- function transformSourceFile(node) {
- if (ts.isDeclarationFile(node)) {
- return node;
- }
- if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- currentSourceFile = node;
- // Collect information about the external module.
- (_a = ts.collectExternalModuleInfo(node), externalImports = _a.externalImports, exportSpecifiers = _a.exportSpecifiers, exportEquals = _a.exportEquals, hasExportStarsToExportValues = _a.hasExportStarsToExportValues, _a);
- // Perform the transformation.
- var transformModule_1 = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None];
- var updated = transformModule_1(node);
- ts.aggregateTransformFlags(updated);
- currentSourceFile = undefined;
- externalImports = undefined;
- exportSpecifiers = undefined;
- exportEquals = undefined;
- hasExportStarsToExportValues = false;
- return updated;
- }
- return node;
- var _a;
- }
- /**
- * Transforms a SourceFile into a CommonJS module.
- *
- * @param node The SourceFile node.
- */
- function transformCommonJSModule(node) {
- startLexicalEnvironment();
- var statements = [];
- var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, visitor);
- ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
- ts.addRange(statements, endLexicalEnvironment());
- addExportEqualsIfNeeded(statements, /*emitAsReturn*/ false);
- var updated = updateSourceFile(node, statements);
- if (hasExportStarsToExportValues) {
- ts.setEmitFlags(updated, 2 /* EmitExportStar */ | ts.getEmitFlags(node));
- }
- return updated;
- }
- /**
- * Transforms a SourceFile into an AMD module.
- *
- * @param node The SourceFile node.
- */
- function transformAMDModule(node) {
- var define = ts.createIdentifier("define");
- var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);
- return transformAsynchronousModule(node, define, moduleName, /*includeNonAmdDependencies*/ true);
- }
- /**
- * Transforms a SourceFile into a UMD module.
- *
- * @param node The SourceFile node.
- */
- function transformUMDModule(node) {
- var define = ts.createIdentifier("define");
- ts.setEmitFlags(define, 16 /* UMDDefine */);
- return transformAsynchronousModule(node, define, /*moduleName*/ undefined, /*includeNonAmdDependencies*/ false);
- }
- /**
- * Transforms a SourceFile into an AMD or UMD module.
- *
- * @param node The SourceFile node.
- * @param define The expression used to define the module.
- * @param moduleName An expression for the module name, if available.
- * @param includeNonAmdDependencies A value indicating whether to incldue any non-AMD dependencies.
- */
- function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) {
- // An AMD define function has the following shape:
- //
- // define(id?, dependencies?, factory);
- //
- // This has the shape of the following:
- //
- // define(name, ["module1", "module2"], function (module1Alias) { ... }
- //
- // The location of the alias in the parameter list in the factory function needs to
- // match the position of the module name in the dependency list.
- //
- // To ensure this is true in cases of modules with no aliases, e.g.:
- //
- // import "module"
- //
- // or
- //
- // ///
- //
- // we need to add modules without alias names to the end of the dependencies list
- var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames;
- // Create an updated SourceFile:
- //
- // define(moduleName?, ["module1", "module2"], function ...
- return updateSourceFile(node, [
- ts.createStatement(ts.createCall(define,
- /*typeArguments*/ undefined, (moduleName ? [moduleName] : []).concat([
- // Add the dependency array argument:
- //
- // ["require", "exports", module1", "module2", ...]
- ts.createArrayLiteral([
- ts.createLiteral("require"),
- ts.createLiteral("exports")
- ].concat(aliasedModuleNames, unaliasedModuleNames)),
- // Add the module body function argument:
- //
- // function (require, exports, module1, module2) ...
- ts.createFunctionExpression(
- /*modifiers*/ undefined,
- /*asteriskToken*/ undefined,
- /*name*/ undefined,
- /*typeParameters*/ undefined, [
- ts.createParameter("require"),
- ts.createParameter("exports")
- ].concat(importAliasNames),
- /*type*/ undefined, transformAsynchronousModuleBody(node))
- ])))
- ]);
- }
- /**
- * Transforms a SourceFile into an AMD or UMD module body.
- *
- * @param node The SourceFile node.
- */
- function transformAsynchronousModuleBody(node) {
- startLexicalEnvironment();
- var statements = [];
- var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, visitor);
- // Visit each statement of the module body.
- ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
- // End the lexical environment for the module body
- // and merge any new lexical declarations.
- ts.addRange(statements, endLexicalEnvironment());
- // Append the 'export =' statement if provided.
- addExportEqualsIfNeeded(statements, /*emitAsReturn*/ true);
- var body = ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true);
- if (hasExportStarsToExportValues) {
- // If we have any `export * from ...` declarations
- // we need to inform the emitter to add the __export helper.
- ts.setEmitFlags(body, 2 /* EmitExportStar */);
- }
- return body;
- }
- function addExportEqualsIfNeeded(statements, emitAsReturn) {
- if (exportEquals) {
- if (emitAsReturn) {
- var statement = ts.createReturn(exportEquals.expression,
- /*location*/ exportEquals);
- ts.setEmitFlags(statement, 12288 /* NoTokenSourceMaps */ | 49152 /* NoComments */);
- statements.push(statement);
- }
- else {
- var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), exportEquals.expression),
- /*location*/ exportEquals);
- ts.setEmitFlags(statement, 49152 /* NoComments */);
- statements.push(statement);
- }
- }
- }
- /**
- * Visits a node at the top level of the source file.
- *
- * @param node The node.
- */
- function visitor(node) {
- switch (node.kind) {
- case 231 /* ImportDeclaration */:
- return visitImportDeclaration(node);
- case 230 /* ImportEqualsDeclaration */:
- return visitImportEqualsDeclaration(node);
- case 237 /* ExportDeclaration */:
- return visitExportDeclaration(node);
- case 236 /* ExportAssignment */:
- return visitExportAssignment(node);
- case 201 /* VariableStatement */:
- return visitVariableStatement(node);
- case 221 /* FunctionDeclaration */:
- return visitFunctionDeclaration(node);
- case 222 /* ClassDeclaration */:
- return visitClassDeclaration(node);
- case 203 /* ExpressionStatement */:
- return visitExpressionStatement(node);
- default:
- // This visitor does not descend into the tree, as export/import statements
- // are only transformed at the top level of a file.
- return node;
- }
- }
- /**
- * Visits an ImportDeclaration node.
- *
- * @param node The ImportDeclaration node.
- */
- function visitImportDeclaration(node) {
- if (!ts.contains(externalImports, node)) {
- return undefined;
- }
- var statements = [];
- var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);
- if (moduleKind !== ts.ModuleKind.AMD) {
- if (!node.importClause) {
- // import "mod";
- statements.push(ts.createStatement(createRequireCall(node),
- /*location*/ node));
- }
- else {
- var variables = [];
- if (namespaceDeclaration && !ts.isDefaultImport(node)) {
- // import * as n from "mod";
- variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name),
- /*type*/ undefined, createRequireCall(node)));
- }
- else {
- // import d from "mod";
- // import { x, y } from "mod";
- // import d, { x, y } from "mod";
- // import d, * as n from "mod";
- variables.push(ts.createVariableDeclaration(ts.getGeneratedNameForNode(node),
- /*type*/ undefined, createRequireCall(node)));
- if (namespaceDeclaration && ts.isDefaultImport(node)) {
- variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name),
- /*type*/ undefined, ts.getGeneratedNameForNode(node)));
- }
- }
- statements.push(ts.createVariableStatement(
- /*modifiers*/ undefined, ts.createConstDeclarationList(variables),
- /*location*/ node));
- }
- }
- else if (namespaceDeclaration && ts.isDefaultImport(node)) {
- // import d, * as n from "mod";
- statements.push(ts.createVariableStatement(
- /*modifiers*/ undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name),
- /*type*/ undefined, ts.getGeneratedNameForNode(node),
- /*location*/ node)
- ])));
- }
- addExportImportAssignments(statements, node);
- return ts.singleOrMany(statements);
- }
- function visitImportEqualsDeclaration(node) {
- if (!ts.contains(externalImports, node)) {
- return undefined;
- }
- // Set emitFlags on the name of the importEqualsDeclaration
- // This is so the printer will not substitute the identifier
- ts.setEmitFlags(node.name, 128 /* NoSubstitution */);
- var statements = [];
- if (moduleKind !== ts.ModuleKind.AMD) {
- if (ts.hasModifier(node, 1 /* Export */)) {
- statements.push(ts.createStatement(createExportAssignment(node.name, createRequireCall(node)),
- /*location*/ node));
- }
- else {
- statements.push(ts.createVariableStatement(
- /*modifiers*/ undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(ts.getSynthesizedClone(node.name),
- /*type*/ undefined, createRequireCall(node))
- ],
- /*location*/ undefined,
- /*flags*/ languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */),
- /*location*/ node));
- }
- }
- else {
- if (ts.hasModifier(node, 1 /* Export */)) {
- statements.push(ts.createStatement(createExportAssignment(node.name, node.name),
- /*location*/ node));
- }
- }
- addExportImportAssignments(statements, node);
- return statements;
- }
- function visitExportDeclaration(node) {
- if (!ts.contains(externalImports, node)) {
- return undefined;
- }
- var generatedName = ts.getGeneratedNameForNode(node);
- if (node.exportClause) {
- var statements = [];
- // export { x, y } from "mod";
- if (moduleKind !== ts.ModuleKind.AMD) {
- statements.push(ts.createVariableStatement(
- /*modifiers*/ undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(generatedName,
- /*type*/ undefined, createRequireCall(node))
- ]),
- /*location*/ node));
- }
- for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) {
- var specifier = _a[_i];
- var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name);
- statements.push(ts.createStatement(createExportAssignment(specifier.name, exportedValue),
- /*location*/ specifier));
- }
- return ts.singleOrMany(statements);
- }
- else {
- // export * from "mod";
- return ts.createStatement(ts.createCall(ts.createIdentifier("__export"),
- /*typeArguments*/ undefined, [
- moduleKind !== ts.ModuleKind.AMD
- ? createRequireCall(node)
- : generatedName
- ]),
- /*location*/ node);
- }
- }
- function visitExportAssignment(node) {
- if (node.isExportEquals) {
- // Elide as `export=` is handled in addExportEqualsIfNeeded
- return undefined;
- }
- var statements = [];
- addExportDefault(statements, node.expression, /*location*/ node);
- return statements;
- }
- function addExportDefault(statements, expression, location) {
- tryAddExportDefaultCompat(statements);
- statements.push(ts.createStatement(createExportAssignment(ts.createIdentifier("default"), expression), location));
- }
- function tryAddExportDefaultCompat(statements) {
- var original = ts.getOriginalNode(currentSourceFile);
- ts.Debug.assert(original.kind === 256 /* SourceFile */);
- if (!original.symbol.exports["___esModule"]) {
- if (languageVersion === 0 /* ES3 */) {
- statements.push(ts.createStatement(createExportAssignment(ts.createIdentifier("__esModule"), ts.createLiteral(true))));
- }
- else {
- statements.push(ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"),
- /*typeArguments*/ undefined, [
- ts.createIdentifier("exports"),
- ts.createLiteral("__esModule"),
- ts.createObjectLiteral([
- ts.createPropertyAssignment("value", ts.createLiteral(true))
- ])
- ])));
- }
- }
- }
- function addExportImportAssignments(statements, node) {
- if (ts.isImportEqualsDeclaration(node)) {
- addExportMemberAssignments(statements, node.name);
- }
- else {
- var names = ts.reduceEachChild(node, collectExportMembers, []);
- for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
- var name_33 = names_1[_i];
- addExportMemberAssignments(statements, name_33);
- }
- }
- }
- function collectExportMembers(names, node) {
- if (ts.isAliasSymbolDeclaration(node) && ts.isDeclaration(node)) {
- var name_34 = node.name;
- if (ts.isIdentifier(name_34)) {
- names.push(name_34);
- }
- }
- return ts.reduceEachChild(node, collectExportMembers, names);
- }
- function addExportMemberAssignments(statements, name) {
- if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) {
- for (var _i = 0, _a = exportSpecifiers[name.text]; _i < _a.length; _i++) {
- var specifier = _a[_i];
- statements.push(ts.startOnNewLine(ts.createStatement(createExportAssignment(specifier.name, name),
- /*location*/ specifier.name)));
- }
- }
- }
- function addExportMemberAssignment(statements, node) {
- if (ts.hasModifier(node, 512 /* Default */)) {
- addExportDefault(statements, getDeclarationName(node), /*location*/ node);
- }
- else {
- statements.push(createExportStatement(node.name, ts.setEmitFlags(ts.getSynthesizedClone(node.name), 262144 /* LocalName */), /*location*/ node));
- }
- }
- function visitVariableStatement(node) {
- // If the variable is for a generated declaration,
- // we should maintain it and just strip off the 'export' modifier if necessary.
- var originalKind = ts.getOriginalNode(node).kind;
- if (originalKind === 226 /* ModuleDeclaration */ ||
- originalKind === 225 /* EnumDeclaration */ ||
- originalKind === 222 /* ClassDeclaration */) {
- if (!ts.hasModifier(node, 1 /* Export */)) {
- return node;
- }
- return ts.setOriginalNode(ts.createVariableStatement(
- /*modifiers*/ undefined, node.declarationList), node);
- }
- var resultStatements = [];
- // If we're exporting these variables, then these just become assignments to 'exports.blah'.
- // We only want to emit assignments for variables with initializers.
- if (ts.hasModifier(node, 1 /* Export */)) {
- var variables = ts.getInitializedVariables(node.declarationList);
- if (variables.length > 0) {
- var inlineAssignments = ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable)), node);
- resultStatements.push(inlineAssignments);
- }
- }
- else {
- resultStatements.push(node);
- }
- // While we might not have been exported here, each variable might have been exported
- // later on in an export specifier (e.g. `export {foo as blah, bar}`).
- for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
- var decl = _a[_i];
- addExportMemberAssignmentsForBindingName(resultStatements, decl.name);
- }
- return resultStatements;
- }
- /**
- * Creates appropriate assignments for each binding identifier that is exported in an export specifier,
- * and inserts it into 'resultStatements'.
- */
- function addExportMemberAssignmentsForBindingName(resultStatements, name) {
- if (ts.isBindingPattern(name)) {
- for (var _i = 0, _a = name.elements; _i < _a.length; _i++) {
- var element = _a[_i];
- if (!ts.isOmittedExpression(element)) {
- addExportMemberAssignmentsForBindingName(resultStatements, element.name);
- }
- }
- }
- else {
- if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) {
- var sourceFileId = ts.getOriginalNodeId(currentSourceFile);
- if (!bindingNameExportSpecifiersForFileMap[sourceFileId]) {
- bindingNameExportSpecifiersForFileMap[sourceFileId] = ts.createMap();
- }
- bindingNameExportSpecifiersForFileMap[sourceFileId][name.text] = exportSpecifiers[name.text];
- addExportMemberAssignments(resultStatements, name);
- }
- }
- }
- function transformInitializedVariable(node) {
- var name = node.name;
- if (ts.isBindingPattern(name)) {
- return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, getModuleMemberName, visitor);
- }
- else {
- return ts.createAssignment(getModuleMemberName(name), ts.visitNode(node.initializer, visitor, ts.isExpression));
- }
- }
- function visitFunctionDeclaration(node) {
- var statements = [];
- var name = node.name || ts.getGeneratedNameForNode(node);
- if (ts.hasModifier(node, 1 /* Export */)) {
- // Keep async modifier for ES2017 transformer
- var isAsync = ts.hasModifier(node, 256 /* Async */);
- statements.push(ts.setOriginalNode(ts.createFunctionDeclaration(
- /*decorators*/ undefined, isAsync ? [ts.createNode(119 /* AsyncKeyword */)] : undefined, node.asteriskToken, name,
- /*typeParameters*/ undefined, node.parameters,
- /*type*/ undefined, node.body,
- /*location*/ node),
- /*original*/ node));
- addExportMemberAssignment(statements, node);
- }
- else {
- statements.push(node);
- }
- if (node.name) {
- addExportMemberAssignments(statements, node.name);
- }
- return ts.singleOrMany(statements);
- }
- function visitClassDeclaration(node) {
- var statements = [];
- var name = node.name || ts.getGeneratedNameForNode(node);
- if (ts.hasModifier(node, 1 /* Export */)) {
- statements.push(ts.setOriginalNode(ts.createClassDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, name,
- /*typeParameters*/ undefined, node.heritageClauses, node.members,
- /*location*/ node),
- /*original*/ node));
- addExportMemberAssignment(statements, node);
- }
- else {
- statements.push(node);
- }
- // Decorators end up creating a series of assignment expressions which overwrite
- // the local binding that we export, so we need to defer from exporting decorated classes
- // until the decoration assignments take place. We do this when visiting expression-statements.
- if (node.name && !(node.decorators && node.decorators.length)) {
- addExportMemberAssignments(statements, node.name);
- }
- return ts.singleOrMany(statements);
- }
- function visitExpressionStatement(node) {
- var original = ts.getOriginalNode(node);
- var origKind = original.kind;
- if (origKind === 225 /* EnumDeclaration */ || origKind === 226 /* ModuleDeclaration */) {
- return visitExpressionStatementForEnumOrNamespaceDeclaration(node, original);
- }
- else if (origKind === 222 /* ClassDeclaration */) {
- // The decorated assignment for a class name may need to be transformed.
- var classDecl = original;
- if (classDecl.name) {
- var statements = [node];
- addExportMemberAssignments(statements, classDecl.name);
- return statements;
- }
- }
- return node;
- }
- function visitExpressionStatementForEnumOrNamespaceDeclaration(node, original) {
- var statements = [node];
- // Preserve old behavior for enums in which a variable statement is emitted after the body itself.
- if (ts.hasModifier(original, 1 /* Export */) &&
- original.kind === 225 /* EnumDeclaration */ &&
- ts.isFirstDeclarationOfKind(original, 225 /* EnumDeclaration */)) {
- addVarForExportedEnumOrNamespaceDeclaration(statements, original);
- }
- addExportMemberAssignments(statements, original.name);
- return statements;
- }
- /**
- * Adds a trailing VariableStatement for an enum or module declaration.
- */
- function addVarForExportedEnumOrNamespaceDeclaration(statements, node) {
- var transformedStatement = ts.createVariableStatement(
- /*modifiers*/ undefined, [ts.createVariableDeclaration(getDeclarationName(node),
- /*type*/ undefined, ts.createPropertyAccess(ts.createIdentifier("exports"), getDeclarationName(node)))],
- /*location*/ node);
- ts.setEmitFlags(transformedStatement, 49152 /* NoComments */);
- statements.push(transformedStatement);
- }
- function getDeclarationName(node) {
- return node.name ? ts.getSynthesizedClone(node.name) : ts.getGeneratedNameForNode(node);
- }
- function onEmitNode(emitContext, node, emitCallback) {
- if (node.kind === 256 /* SourceFile */) {
- bindingNameExportSpecifiersMap = bindingNameExportSpecifiersForFileMap[ts.getOriginalNodeId(node)];
- previousOnEmitNode(emitContext, node, emitCallback);
- bindingNameExportSpecifiersMap = undefined;
- }
- else {
- previousOnEmitNode(emitContext, node, emitCallback);
- }
- }
- /**
- * Hooks node substitutions.
- *
- * @param node The node to substitute.
- * @param isExpression A value indicating whether the node is to be used in an expression
- * position.
- */
- function onSubstituteNode(emitContext, node) {
- node = previousOnSubstituteNode(emitContext, node);
- if (emitContext === 1 /* Expression */) {
- return substituteExpression(node);
- }
- else if (ts.isShorthandPropertyAssignment(node)) {
- return substituteShorthandPropertyAssignment(node);
- }
- return node;
- }
- function substituteShorthandPropertyAssignment(node) {
- var name = node.name;
- var exportedOrImportedName = substituteExpressionIdentifier(name);
- if (exportedOrImportedName !== name) {
- // A shorthand property with an assignment initializer is probably part of a
- // destructuring assignment
- if (node.objectAssignmentInitializer) {
- var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer);
- return ts.createPropertyAssignment(name, initializer, /*location*/ node);
- }
- return ts.createPropertyAssignment(name, exportedOrImportedName, /*location*/ node);
- }
- return node;
- }
- function substituteExpression(node) {
- switch (node.kind) {
- case 70 /* Identifier */:
- return substituteExpressionIdentifier(node);
- case 188 /* BinaryExpression */:
- return substituteBinaryExpression(node);
- case 187 /* PostfixUnaryExpression */:
- case 186 /* PrefixUnaryExpression */:
- return substituteUnaryExpression(node);
- }
- return node;
- }
- function substituteExpressionIdentifier(node) {
- return trySubstituteExportedName(node)
- || trySubstituteImportedName(node)
- || node;
- }
- function substituteBinaryExpression(node) {
- var left = node.left;
- // If the left-hand-side of the binaryExpression is an identifier and its is export through export Specifier
- if (ts.isIdentifier(left) && ts.isAssignmentOperator(node.operatorToken.kind)) {
- if (bindingNameExportSpecifiersMap && ts.hasProperty(bindingNameExportSpecifiersMap, left.text)) {
- ts.setEmitFlags(node, 128 /* NoSubstitution */);
- var nestedExportAssignment = void 0;
- for (var _i = 0, _a = bindingNameExportSpecifiersMap[left.text]; _i < _a.length; _i++) {
- var specifier = _a[_i];
- nestedExportAssignment = nestedExportAssignment ?
- createExportAssignment(specifier.name, nestedExportAssignment) :
- createExportAssignment(specifier.name, node);
- }
- return nestedExportAssignment;
- }
- }
- return node;
- }
- function substituteUnaryExpression(node) {
- // Because how the compiler only parse plusplus and minusminus to be either prefixUnaryExpression or postFixUnaryExpression depended on where they are
- // We don't need to check that the operator has SyntaxKind.plusplus or SyntaxKind.minusminus
- var operator = node.operator;
- var operand = node.operand;
- if (ts.isIdentifier(operand) && bindingNameExportSpecifiersForFileMap) {
- if (bindingNameExportSpecifiersMap && ts.hasProperty(bindingNameExportSpecifiersMap, operand.text)) {
- ts.setEmitFlags(node, 128 /* NoSubstitution */);
- var transformedUnaryExpression = void 0;
- if (node.kind === 187 /* PostfixUnaryExpression */) {
- transformedUnaryExpression = ts.createBinary(operand, ts.createToken(operator === 42 /* PlusPlusToken */ ? 58 /* PlusEqualsToken */ : 59 /* MinusEqualsToken */), ts.createLiteral(1),
- /*location*/ node);
- // We have to set no substitution flag here to prevent visit the binary expression and substitute it again as we will preform all necessary substitution in here
- ts.setEmitFlags(transformedUnaryExpression, 128 /* NoSubstitution */);
- }
- var nestedExportAssignment = void 0;
- for (var _i = 0, _a = bindingNameExportSpecifiersMap[operand.text]; _i < _a.length; _i++) {
- var specifier = _a[_i];
- nestedExportAssignment = nestedExportAssignment ?
- createExportAssignment(specifier.name, nestedExportAssignment) :
- createExportAssignment(specifier.name, transformedUnaryExpression || node);
- }
- return nestedExportAssignment;
- }
- }
- return node;
- }
- function trySubstituteExportedName(node) {
- var emitFlags = ts.getEmitFlags(node);
- if ((emitFlags & 262144 /* LocalName */) === 0) {
- var container = resolver.getReferencedExportContainer(node, (emitFlags & 131072 /* ExportName */) !== 0);
- if (container) {
- if (container.kind === 256 /* SourceFile */) {
- return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node),
- /*location*/ node);
- }
- }
- }
- return undefined;
- }
- function trySubstituteImportedName(node) {
- if ((ts.getEmitFlags(node) & 262144 /* LocalName */) === 0) {
- var declaration = resolver.getReferencedImportDeclaration(node);
- if (declaration) {
- if (ts.isImportClause(declaration)) {
- return ts.createPropertyAccess(ts.getGeneratedNameForNode(declaration.parent), ts.createIdentifier("default"),
- /*location*/ node);
- }
- else if (ts.isImportSpecifier(declaration)) {
- var name_35 = declaration.propertyName || declaration.name;
- return ts.createPropertyAccess(ts.getGeneratedNameForNode(declaration.parent.parent.parent), ts.getSynthesizedClone(name_35),
- /*location*/ node);
- }
- }
- }
- return undefined;
- }
- function getModuleMemberName(name) {
- return ts.createPropertyAccess(ts.createIdentifier("exports"), name,
- /*location*/ name);
- }
- function createRequireCall(importNode) {
- var moduleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);
- var args = [];
- if (ts.isDefined(moduleName)) {
- args.push(moduleName);
- }
- return ts.createCall(ts.createIdentifier("require"), /*typeArguments*/ undefined, args);
- }
- function createExportStatement(name, value, location) {
- var statement = ts.createStatement(createExportAssignment(name, value));
- statement.startsOnNewLine = true;
- if (location) {
- ts.setSourceMapRange(statement, location);
- }
- return statement;
- }
- function createExportAssignment(name, value) {
- return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value);
- }
- function collectAsynchronousDependencies(node, includeNonAmdDependencies) {
- // names of modules with corresponding parameter in the factory function
- var aliasedModuleNames = [];
- // names of modules with no corresponding parameters in factory function
- var unaliasedModuleNames = [];
- // names of the parameters in the factory function; these
- // parameters need to match the indexes of the corresponding
- // module names in aliasedModuleNames.
- var importAliasNames = [];
- // Fill in amd-dependency tags
- for (var _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) {
- var amdDependency = _a[_i];
- if (amdDependency.name) {
- aliasedModuleNames.push(ts.createLiteral(amdDependency.path));
- importAliasNames.push(ts.createParameter(amdDependency.name));
- }
- else {
- unaliasedModuleNames.push(ts.createLiteral(amdDependency.path));
- }
- }
- for (var _b = 0, externalImports_3 = externalImports; _b < externalImports_3.length; _b++) {
- var importNode = externalImports_3[_b];
- // Find the name of the external module
- var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);
- // Find the name of the module alias, if there is one
- var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile);
- if (includeNonAmdDependencies && importAliasName) {
- // Set emitFlags on the name of the classDeclaration
- // This is so that when printer will not substitute the identifier
- ts.setEmitFlags(importAliasName, 128 /* NoSubstitution */);
- aliasedModuleNames.push(externalModuleName);
- importAliasNames.push(ts.createParameter(importAliasName));
- }
- else {
- unaliasedModuleNames.push(externalModuleName);
- }
- }
- return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames };
- }
- function updateSourceFile(node, statements) {
- var updated = ts.getMutableClone(node);
- updated.statements = ts.createNodeArray(statements, node.statements);
- return updated;
- }
- var _a;
- }
- ts.transformModule = transformModule;
-})(ts || (ts = {}));
///
///
/*@internal*/
@@ -47897,11 +47382,11 @@ var ts;
}
function visitorWorker(node) {
switch (node.kind) {
- case 242 /* JsxElement */:
+ case 245 /* JsxElement */:
return visitJsxElement(node, /*isChild*/ false);
- case 243 /* JsxSelfClosingElement */:
+ case 246 /* JsxSelfClosingElement */:
return visitJsxSelfClosingElement(node, /*isChild*/ false);
- case 248 /* JsxExpression */:
+ case 251 /* JsxExpression */:
return visitJsxExpression(node);
default:
ts.Debug.failBadSyntaxKind(node);
@@ -47912,11 +47397,11 @@ var ts;
switch (node.kind) {
case 10 /* JsxText */:
return visitJsxText(node);
- case 248 /* JsxExpression */:
+ case 251 /* JsxExpression */:
return visitJsxExpression(node);
- case 242 /* JsxElement */:
+ case 245 /* JsxElement */:
return visitJsxElement(node, /*isChild*/ true);
- case 243 /* JsxSelfClosingElement */:
+ case 246 /* JsxSelfClosingElement */:
return visitJsxSelfClosingElement(node, /*isChild*/ true);
default:
ts.Debug.failBadSyntaxKind(node);
@@ -47953,7 +47438,7 @@ var ts;
objectProperties = ts.singleOrUndefined(segments)
|| ts.createAssignHelper(currentSourceFile.externalHelpersModuleName, segments);
}
- var element = ts.createReactCreateElement(compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location);
+ var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location);
if (isChild) {
ts.startOnNewLine(element);
}
@@ -47975,7 +47460,7 @@ var ts;
var decoded = tryDecodeEntities(node.text);
return decoded ? ts.createLiteral(decoded, /*location*/ node) : node;
}
- else if (node.kind === 248 /* JsxExpression */) {
+ else if (node.kind === 251 /* JsxExpression */) {
return visitJsxExpression(node);
}
else {
@@ -48057,16 +47542,16 @@ var ts;
return decoded === text ? undefined : decoded;
}
function getTagName(node) {
- if (node.kind === 242 /* JsxElement */) {
+ if (node.kind === 245 /* JsxElement */) {
return getTagName(node.openingElement);
}
else {
- var name_36 = node.tagName;
- if (ts.isIdentifier(name_36) && ts.isIntrinsicJsxName(name_36.text)) {
- return ts.createLiteral(name_36.text);
+ var name_34 = node.tagName;
+ if (ts.isIdentifier(name_34) && ts.isIntrinsicJsxName(name_34.text)) {
+ return ts.createLiteral(name_34.text);
}
else {
- return ts.createExpressionFromEntityName(name_36);
+ return ts.createExpressionFromEntityName(name_34);
}
}
}
@@ -48351,6 +47836,232 @@ var ts;
///
/*@internal*/
var ts;
+(function (ts) {
+ function transformESNext(context) {
+ var hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var currentSourceFile;
+ return transformSourceFile;
+ function transformSourceFile(node) {
+ currentSourceFile = node;
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitor(node) {
+ if (node.transformFlags & 16 /* ESNext */) {
+ return visitorWorker(node);
+ }
+ else if (node.transformFlags & 32 /* ContainsESNext */) {
+ return ts.visitEachChild(node, visitor, context);
+ }
+ else {
+ return node;
+ }
+ }
+ function visitorWorker(node) {
+ switch (node.kind) {
+ case 175 /* ObjectLiteralExpression */:
+ return visitObjectLiteralExpression(node);
+ case 191 /* BinaryExpression */:
+ return visitBinaryExpression(node);
+ case 222 /* VariableDeclaration */:
+ return visitVariableDeclaration(node);
+ case 212 /* ForOfStatement */:
+ return visitForOfStatement(node);
+ case 171 /* ObjectBindingPattern */:
+ case 172 /* ArrayBindingPattern */:
+ return node;
+ case 224 /* FunctionDeclaration */:
+ return visitFunctionDeclaration(node);
+ case 183 /* FunctionExpression */:
+ return visitFunctionExpression(node);
+ case 184 /* ArrowFunction */:
+ return visitArrowFunction(node);
+ case 144 /* Parameter */:
+ return visitParameter(node);
+ default:
+ ts.Debug.failBadSyntaxKind(node);
+ return ts.visitEachChild(node, visitor, context);
+ }
+ }
+ function chunkObjectLiteralElements(elements) {
+ var chunkObject;
+ var objects = [];
+ for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
+ var e = elements_3[_i];
+ if (e.kind === 258 /* SpreadAssignment */) {
+ if (chunkObject) {
+ objects.push(ts.createObjectLiteral(chunkObject));
+ chunkObject = undefined;
+ }
+ var target = e.expression;
+ objects.push(ts.visitNode(target, visitor, ts.isExpression));
+ }
+ else {
+ if (!chunkObject) {
+ chunkObject = [];
+ }
+ if (e.kind === 256 /* PropertyAssignment */) {
+ var p = e;
+ chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression)));
+ }
+ else {
+ chunkObject.push(e);
+ }
+ }
+ }
+ if (chunkObject) {
+ objects.push(ts.createObjectLiteral(chunkObject));
+ }
+ return objects;
+ }
+ function visitObjectLiteralExpression(node) {
+ // spread elements emit like so:
+ // non-spread elements are chunked together into object literals, and then all are passed to __assign:
+ // { a, ...o, b } => __assign({a}, o, {b});
+ // If the first element is a spread element, then the first argument to __assign is {}:
+ // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
+ var objects = chunkObjectLiteralElements(node.properties);
+ if (objects.length && objects[0].kind !== 175 /* ObjectLiteralExpression */) {
+ objects.unshift(ts.createObjectLiteral());
+ }
+ return ts.createCall(ts.createIdentifier("__assign"), undefined, objects);
+ }
+ /**
+ * Visits a BinaryExpression that contains a destructuring assignment.
+ *
+ * @param node A BinaryExpression node.
+ */
+ function visitBinaryExpression(node) {
+ if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 48 /* AssertESNext */) {
+ return ts.flattenDestructuringAssignment(context, node, /*needsDestructuringValue*/ true, hoistVariableDeclaration, visitor, /*transformRest*/ true);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ /**
+ * Visits a VariableDeclaration node with a binding pattern.
+ *
+ * @param node A VariableDeclaration node.
+ */
+ function visitVariableDeclaration(node) {
+ // If we are here it is because the name contains a binding pattern with a rest somewhere in it.
+ if (ts.isBindingPattern(node.name) && node.name.transformFlags & 48 /* AssertESNext */) {
+ var result = ts.flattenVariableDestructuring(node, /*value*/ undefined, visitor, /*recordTempVariable*/ undefined, /*transformRest*/ true);
+ return result;
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ /**
+ * Visits a ForOfStatement and converts it into a ES2015-compatible ForOfStatement.
+ *
+ * @param node A ForOfStatement.
+ */
+ function visitForOfStatement(node) {
+ // The following ESNext code:
+ //
+ // for (let { x, y, ...rest } of expr) { }
+ //
+ // should be emitted as
+ //
+ // for (var _a of expr) {
+ // let { x, y } = _a, rest = __rest(_a, ["x", "y"]);
+ // }
+ //
+ // where _a is a temp emitted to capture the RHS.
+ // When the left hand side is an expression instead of a let declaration,
+ // the `let` before the `{ x, y }` is not emitted.
+ // When the left hand side is a let/const, the v is renamed if there is
+ // another v in scope.
+ // Note that all assignments to the LHS are emitted in the body, including
+ // all destructuring.
+ // Note also that because an extra statement is needed to assign to the LHS,
+ // for-of bodies are always emitted as blocks.
+ // for ( of )
+ // where is [let] variabledeclarationlist | expression
+ var initializer = node.initializer;
+ if (!isRestBindingPattern(initializer) && !isRestAssignment(initializer)) {
+ return ts.visitEachChild(node, visitor, context);
+ }
+ return ts.convertForOf(node, undefined, visitor, ts.noop, context, /*transformRest*/ true);
+ }
+ function isRestBindingPattern(initializer) {
+ if (ts.isVariableDeclarationList(initializer)) {
+ var declaration = ts.firstOrUndefined(initializer.declarations);
+ return declaration && declaration.name &&
+ declaration.name.kind === 171 /* ObjectBindingPattern */ &&
+ !!(declaration.name.transformFlags & 8388608 /* ContainsSpreadExpression */);
+ }
+ return false;
+ }
+ function isRestAssignment(initializer) {
+ return initializer.kind === 175 /* ObjectLiteralExpression */ &&
+ initializer.transformFlags & 8388608 /* ContainsSpreadExpression */;
+ }
+ function visitParameter(node) {
+ if (isObjectRestParameter(node)) {
+ // Binding patterns are converted into a generated name and are
+ // evaluated inside the function body.
+ return ts.setOriginalNode(ts.createParameter(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined,
+ /*dotDotDotToken*/ undefined, ts.getGeneratedNameForNode(node),
+ /*questionToken*/ undefined,
+ /*type*/ undefined, node.initializer,
+ /*location*/ node),
+ /*original*/ node);
+ }
+ else {
+ return node;
+ }
+ }
+ function isObjectRestParameter(node) {
+ return node.name &&
+ node.name.kind === 171 /* ObjectBindingPattern */ &&
+ !!(node.name.transformFlags & 8388608 /* ContainsSpreadExpression */);
+ }
+ function visitFunctionDeclaration(node) {
+ var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
+ var body = hasRest ?
+ ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, /*convertObjectRest*/ true) :
+ ts.visitEachChild(node.body, visitor, context);
+ return ts.setOriginalNode(ts.createFunctionDeclaration(
+ /*decorators*/ undefined, node.modifiers, node.asteriskToken, node.name,
+ /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
+ /*type*/ undefined, body,
+ /*location*/ node),
+ /*original*/ node);
+ }
+ function visitArrowFunction(node) {
+ var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
+ var body = hasRest ?
+ ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, /*convertObjectRest*/ true) :
+ ts.visitEachChild(node.body, visitor, context);
+ var func = ts.setOriginalNode(ts.createArrowFunction(
+ /*modifiers*/ undefined,
+ /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
+ /*type*/ undefined, node.equalsGreaterThanToken, body,
+ /*location*/ node),
+ /*original*/ node);
+ ts.setEmitFlags(func, 256 /* CapturesThis */);
+ return func;
+ }
+ function visitFunctionExpression(node) {
+ var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
+ var body = hasRest ?
+ ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, /*convertObjectRest*/ true) :
+ ts.visitEachChild(node.body, visitor, context);
+ return ts.setOriginalNode(ts.createFunctionExpression(
+ /*modifiers*/ undefined, node.asteriskToken, name,
+ /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
+ /*type*/ undefined, body,
+ /*location*/ node),
+ /*original*/ node);
+ }
+ }
+ ts.transformESNext = transformESNext;
+})(ts || (ts = {}));
+///
+///
+/*@internal*/
+var ts;
(function (ts) {
function transformES2017(context) {
var ES2017SubstitutionFlags;
@@ -48395,10 +48106,10 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
function visitor(node) {
- if (node.transformFlags & 16 /* ES2017 */) {
+ if (node.transformFlags & 64 /* ES2017 */) {
return visitorWorker(node);
}
- else if (node.transformFlags & 32 /* ContainsES2017 */) {
+ else if (node.transformFlags & 128 /* ContainsES2017 */) {
return ts.visitEachChild(node, visitor, context);
}
return node;
@@ -48408,19 +48119,19 @@ var ts;
case 119 /* AsyncKeyword */:
// ES2017 async modifier should be elided for targets < ES2017
return undefined;
- case 185 /* AwaitExpression */:
+ case 188 /* AwaitExpression */:
// ES2017 'await' expressions must be transformed for targets < ES2017.
return visitAwaitExpression(node);
- case 148 /* MethodDeclaration */:
+ case 149 /* MethodDeclaration */:
// ES2017 method declarations may be 'async'
return visitMethodDeclaration(node);
- case 221 /* FunctionDeclaration */:
+ case 224 /* FunctionDeclaration */:
// ES2017 function declarations may be 'async'
return visitFunctionDeclaration(node);
- case 180 /* FunctionExpression */:
+ case 183 /* FunctionExpression */:
// ES2017 function expressions may be 'async'
return visitFunctionExpression(node);
- case 181 /* ArrowFunction */:
+ case 184 /* ArrowFunction */:
// ES2017 arrow functions may be 'async'
return visitArrowFunction(node);
default:
@@ -48541,9 +48252,10 @@ var ts;
return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
}
function transformAsyncFunctionBody(node) {
- var nodeType = node.original ? node.original.type : node.type;
+ var original = ts.getOriginalNode(node, ts.isFunctionLike);
+ var nodeType = original.type;
var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined;
- var isArrowFunction = node.kind === 181 /* ArrowFunction */;
+ var isArrowFunction = node.kind === 184 /* ArrowFunction */;
var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0;
// An async function is emit as an outer function that calls an inner
// generator function. To preserve lexical bindings, we pass the current
@@ -48593,12 +48305,14 @@ var ts;
}
}
function getPromiseConstructor(type) {
- var typeName = ts.getEntityNameFromTypeNode(type);
- if (typeName && ts.isEntityName(typeName)) {
- var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
- if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
- || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
- return typeName;
+ if (type) {
+ var typeName = ts.getEntityNameFromTypeNode(type);
+ if (typeName && ts.isEntityName(typeName)) {
+ var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
+ if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
+ || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
+ return typeName;
+ }
}
}
return undefined;
@@ -48608,24 +48322,24 @@ var ts;
enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */;
// We need to enable substitutions for call, property access, and element access
// if we need to rewrite super calls.
- context.enableSubstitution(175 /* CallExpression */);
- context.enableSubstitution(173 /* PropertyAccessExpression */);
- context.enableSubstitution(174 /* ElementAccessExpression */);
+ context.enableSubstitution(178 /* CallExpression */);
+ context.enableSubstitution(176 /* PropertyAccessExpression */);
+ context.enableSubstitution(177 /* ElementAccessExpression */);
// We need to be notified when entering and exiting declarations that bind super.
- context.enableEmitNotification(222 /* ClassDeclaration */);
- context.enableEmitNotification(148 /* MethodDeclaration */);
- context.enableEmitNotification(150 /* GetAccessor */);
- context.enableEmitNotification(151 /* SetAccessor */);
- context.enableEmitNotification(149 /* Constructor */);
+ context.enableEmitNotification(225 /* ClassDeclaration */);
+ context.enableEmitNotification(149 /* MethodDeclaration */);
+ context.enableEmitNotification(151 /* GetAccessor */);
+ context.enableEmitNotification(152 /* SetAccessor */);
+ context.enableEmitNotification(150 /* Constructor */);
}
}
function substituteExpression(node) {
switch (node.kind) {
- case 173 /* PropertyAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 174 /* ElementAccessExpression */:
+ case 177 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
- case 175 /* CallExpression */:
+ case 178 /* CallExpression */:
if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) {
return substituteCallExpression(node);
}
@@ -48669,11 +48383,11 @@ var ts;
}
function isSuperContainer(node) {
var kind = node.kind;
- return kind === 222 /* ClassDeclaration */
- || kind === 149 /* Constructor */
- || kind === 148 /* MethodDeclaration */
- || kind === 150 /* GetAccessor */
- || kind === 151 /* SetAccessor */;
+ return kind === 225 /* ClassDeclaration */
+ || kind === 150 /* Constructor */
+ || kind === 149 /* MethodDeclaration */
+ || kind === 151 /* GetAccessor */
+ || kind === 152 /* SetAccessor */;
}
/**
* Hook for node emit.
@@ -48739,10 +48453,10 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
function visitor(node) {
- if (node.transformFlags & 64 /* ES2016 */) {
+ if (node.transformFlags & 256 /* ES2016 */) {
return visitorWorker(node);
}
- else if (node.transformFlags & 128 /* ContainsES2016 */) {
+ else if (node.transformFlags & 512 /* ContainsES2016 */) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -48751,7 +48465,7 @@ var ts;
}
function visitorWorker(node) {
switch (node.kind) {
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
return visitBinaryExpression(node);
default:
ts.Debug.failBadSyntaxKind(node);
@@ -48927,11 +48641,11 @@ var ts;
return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node);
}
function isReturnVoidStatementInConstructorWithCapturedSuper(node) {
- return isInConstructorWithCapturedSuper && node.kind === 212 /* ReturnStatement */ && !node.expression;
+ return isInConstructorWithCapturedSuper && node.kind === 215 /* ReturnStatement */ && !node.expression;
}
function shouldCheckNode(node) {
- return (node.transformFlags & 256 /* ES2015 */) !== 0 ||
- node.kind === 215 /* LabeledStatement */ ||
+ return (node.transformFlags & 1024 /* ES2015 */) !== 0 ||
+ node.kind === 218 /* LabeledStatement */ ||
(ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node));
}
function visitorWorker(node) {
@@ -48941,7 +48655,7 @@ var ts;
else if (shouldCheckNode(node)) {
return visitJavaScript(node);
}
- else if (node.transformFlags & 512 /* ContainsES2015 */ || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) {
+ else if (node.transformFlags & 2048 /* ContainsES2015 */ || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) {
// we want to dive in this branch either if node has children with ES2015 specific syntax
// or we are inside constructor that captures result of the super call so all returns without expression should be
// rewritten. Note: we skip expressions since returns should never appear there
@@ -48963,15 +48677,15 @@ var ts;
}
function visitNodesInConvertedLoop(node) {
switch (node.kind) {
- case 212 /* ReturnStatement */:
+ case 215 /* ReturnStatement */:
node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node;
return visitReturnStatement(node);
- case 201 /* VariableStatement */:
+ case 204 /* VariableStatement */:
return visitVariableStatement(node);
- case 214 /* SwitchStatement */:
+ case 217 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 211 /* BreakStatement */:
- case 210 /* ContinueStatement */:
+ case 214 /* BreakStatement */:
+ case 213 /* ContinueStatement */:
return visitBreakOrContinueStatement(node);
case 98 /* ThisKeyword */:
return visitThisKeyword(node);
@@ -48983,77 +48697,77 @@ var ts;
}
function visitJavaScript(node) {
switch (node.kind) {
- case 83 /* ExportKeyword */:
- return node;
- case 222 /* ClassDeclaration */:
+ case 114 /* StaticKeyword */:
+ return undefined; // elide static keyword
+ case 225 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 193 /* ClassExpression */:
+ case 196 /* ClassExpression */:
return visitClassExpression(node);
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
return visitParameter(node);
- case 221 /* FunctionDeclaration */:
+ case 224 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 181 /* ArrowFunction */:
+ case 184 /* ArrowFunction */:
return visitArrowFunction(node);
- case 180 /* FunctionExpression */:
+ case 183 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 219 /* VariableDeclaration */:
+ case 222 /* VariableDeclaration */:
return visitVariableDeclaration(node);
case 70 /* Identifier */:
return visitIdentifier(node);
- case 220 /* VariableDeclarationList */:
+ case 223 /* VariableDeclarationList */:
return visitVariableDeclarationList(node);
- case 215 /* LabeledStatement */:
+ case 218 /* LabeledStatement */:
return visitLabeledStatement(node);
- case 205 /* DoStatement */:
+ case 208 /* DoStatement */:
return visitDoStatement(node);
- case 206 /* WhileStatement */:
+ case 209 /* WhileStatement */:
return visitWhileStatement(node);
- case 207 /* ForStatement */:
+ case 210 /* ForStatement */:
return visitForStatement(node);
- case 208 /* ForInStatement */:
+ case 211 /* ForInStatement */:
return visitForInStatement(node);
- case 209 /* ForOfStatement */:
+ case 212 /* ForOfStatement */:
return visitForOfStatement(node);
- case 203 /* ExpressionStatement */:
+ case 206 /* ExpressionStatement */:
return visitExpressionStatement(node);
- case 172 /* ObjectLiteralExpression */:
+ case 175 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 252 /* CatchClause */:
+ case 255 /* CatchClause */:
return visitCatchClause(node);
- case 254 /* ShorthandPropertyAssignment */:
+ case 257 /* ShorthandPropertyAssignment */:
return visitShorthandPropertyAssignment(node);
- case 171 /* ArrayLiteralExpression */:
+ case 174 /* ArrayLiteralExpression */:
return visitArrayLiteralExpression(node);
- case 175 /* CallExpression */:
+ case 178 /* CallExpression */:
return visitCallExpression(node);
- case 176 /* NewExpression */:
+ case 179 /* NewExpression */:
return visitNewExpression(node);
- case 179 /* ParenthesizedExpression */:
+ case 182 /* ParenthesizedExpression */:
return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true);
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
return visitBinaryExpression(node, /*needsDestructuringValue*/ true);
case 12 /* NoSubstitutionTemplateLiteral */:
case 13 /* TemplateHead */:
case 14 /* TemplateMiddle */:
case 15 /* TemplateTail */:
return visitTemplateLiteral(node);
- case 177 /* TaggedTemplateExpression */:
+ case 180 /* TaggedTemplateExpression */:
return visitTaggedTemplateExpression(node);
- case 190 /* TemplateExpression */:
+ case 193 /* TemplateExpression */:
return visitTemplateExpression(node);
- case 191 /* YieldExpression */:
+ case 194 /* YieldExpression */:
return visitYieldExpression(node);
case 96 /* SuperKeyword */:
return visitSuperKeyword();
- case 191 /* YieldExpression */:
+ case 194 /* YieldExpression */:
// `yield` will be handled by a generators transform.
return ts.visitEachChild(node, visitor, context);
- case 148 /* MethodDeclaration */:
+ case 149 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
return visitSourceFileNode(node);
- case 201 /* VariableStatement */:
+ case 204 /* VariableStatement */:
return visitVariableStatement(node);
default:
ts.Debug.failBadSyntaxKind(node);
@@ -49068,7 +48782,7 @@ var ts;
}
if (ts.isFunctionLike(currentNode)) {
enclosingFunction = currentNode;
- if (currentNode.kind !== 181 /* ArrowFunction */) {
+ if (currentNode.kind !== 184 /* ArrowFunction */) {
enclosingNonArrowFunction = currentNode;
if (!(ts.getEmitFlags(currentNode) & 2097152 /* AsyncFunctionBody */)) {
enclosingNonAsyncFunctionBody = currentNode;
@@ -49079,14 +48793,14 @@ var ts;
// variable statements, variable declarations, binding elements, and binding
// patterns.
switch (currentNode.kind) {
- case 201 /* VariableStatement */:
+ case 204 /* VariableStatement */:
enclosingVariableStatement = currentNode;
break;
- case 220 /* VariableDeclarationList */:
- case 219 /* VariableDeclaration */:
- case 170 /* BindingElement */:
- case 168 /* ObjectBindingPattern */:
- case 169 /* ArrayBindingPattern */:
+ case 223 /* VariableDeclarationList */:
+ case 222 /* VariableDeclaration */:
+ case 173 /* BindingElement */:
+ case 171 /* ObjectBindingPattern */:
+ case 172 /* ArrayBindingPattern */:
break;
default:
enclosingVariableStatement = undefined;
@@ -49115,7 +48829,7 @@ var ts;
}
function visitThisKeyword(node) {
ts.Debug.assert(convertedLoopState !== undefined);
- if (enclosingFunction && enclosingFunction.kind === 181 /* ArrowFunction */) {
+ if (enclosingFunction && enclosingFunction.kind === 184 /* ArrowFunction */) {
// if the enclosing function is an ArrowFunction is then we use the captured 'this' keyword.
convertedLoopState.containsLexicalThis = true;
return node;
@@ -49140,13 +48854,13 @@ var ts;
// it is possible if either
// - break/continue is labeled and label is located inside the converted loop
// - break/continue is non-labeled and located in non-converted loop/switch statement
- var jump = node.kind === 211 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */;
+ var jump = node.kind === 214 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */;
var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) ||
(!node.label && (convertedLoopState.allowedNonLabeledJumps & jump));
if (!canUseBreakOrContinue) {
var labelMarker = void 0;
if (!node.label) {
- if (node.kind === 211 /* BreakStatement */) {
+ if (node.kind === 214 /* BreakStatement */) {
convertedLoopState.nonLocalJumps |= 2 /* Break */;
labelMarker = "break";
}
@@ -49157,7 +48871,7 @@ var ts;
}
}
else {
- if (node.kind === 211 /* BreakStatement */) {
+ if (node.kind === 214 /* BreakStatement */) {
labelMarker = "break-" + node.label.text;
setLabeledJump(convertedLoopState, /*isBreak*/ true, node.label.text, labelMarker);
}
@@ -49201,33 +48915,29 @@ var ts;
// }
// return C;
// }());
- var modifierFlags = ts.getModifierFlags(node);
- var isExported = modifierFlags & 1 /* Export */;
- var isDefault = modifierFlags & 512 /* Default */;
- // Add an `export` modifier to the statement if needed (for `--target es5 --module es6`)
- var modifiers = isExported && !isDefault
- ? ts.filter(node.modifiers, isExportModifier)
- : undefined;
- var statement = ts.createVariableStatement(modifiers, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(getDeclarationName(node, /*allowComments*/ true),
- /*type*/ undefined, transformClassLikeDeclarationToExpression(node))
- ]),
- /*location*/ node);
+ var variable = ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ true),
+ /*type*/ undefined, transformClassLikeDeclarationToExpression(node));
+ ts.setOriginalNode(variable, node);
+ var statements = [];
+ var statement = ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([variable]), /*location*/ node);
ts.setOriginalNode(statement, node);
ts.startOnNewLine(statement);
+ statements.push(statement);
// Add an `export default` statement for default exports (for `--target es5 --module es6`)
- if (isExported && isDefault) {
- var statements = [statement];
- statements.push(ts.createExportAssignment(
- /*decorators*/ undefined,
- /*modifiers*/ undefined,
- /*isExportEquals*/ false, getDeclarationName(node, /*allowComments*/ false)));
- return statements;
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ var exportStatement = ts.hasModifier(node, 512 /* Default */)
+ ? ts.createExportDefault(ts.getLocalName(node))
+ : ts.createExternalModuleExport(ts.getLocalName(node));
+ ts.setOriginalNode(exportStatement, statement);
+ statements.push(exportStatement);
}
- return statement;
- }
- function isExportModifier(node) {
- return node.kind === 83 /* ExportKeyword */;
+ var emitFlags = ts.getEmitFlags(node);
+ if ((emitFlags & 33554432 /* HasEndOfDeclarationMarker */) === 0) {
+ // Add a DeclarationMarker as a marker for the end of the declaration
+ statements.push(ts.createEndOfDeclarationMarker(node));
+ ts.setEmitFlags(statement, emitFlags | 33554432 /* HasEndOfDeclarationMarker */);
+ }
+ return ts.singleOrMany(statements);
}
/**
* Visits a ClassExpression and transforms it into an expression.
@@ -49282,7 +48992,7 @@ var ts;
/*modifiers*/ undefined,
/*asteriskToken*/ undefined,
/*name*/ undefined,
- /*typeParameters*/ undefined, extendsClauseElement ? [ts.createParameter("_super")] : [],
+ /*typeParameters*/ undefined, extendsClauseElement ? [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "_super")] : [],
/*type*/ undefined, transformClassBody(node, extendsClauseElement));
// To preserve the behavior of the old emitter, we explicitly indent
// the body of the function here if it was requested in an earlier
@@ -49317,7 +49027,7 @@ var ts;
addClassMembers(statements, node);
// Create a synthetic text range for the return statement.
var closingBraceLocation = ts.createTokenRange(ts.skipTrivia(currentText, node.members.end), 17 /* CloseBraceToken */);
- var localName = getLocalName(node);
+ var localName = ts.getLocalName(node);
// The following partially-emitted expression exists purely to align our sourcemap
// emit with the original emitter.
var outer = ts.createPartiallyEmittedExpression(localName);
@@ -49341,7 +49051,7 @@ var ts;
*/
function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) {
if (extendsClauseElement) {
- statements.push(ts.createStatement(ts.createExtendsHelper(currentSourceFile.externalHelpersModuleName, getDeclarationName(node)),
+ statements.push(ts.createStatement(ts.createExtendsHelper(currentSourceFile.externalHelpersModuleName, ts.getLocalName(node)),
/*location*/ extendsClauseElement));
}
}
@@ -49358,7 +49068,7 @@ var ts;
var constructorFunction = ts.createFunctionDeclaration(
/*decorators*/ undefined,
/*modifiers*/ undefined,
- /*asteriskToken*/ undefined, getDeclarationName(node),
+ /*asteriskToken*/ undefined, ts.getDeclarationName(node),
/*typeParameters*/ undefined, transformConstructorParameters(constructor, hasSynthesizedSuper),
/*type*/ undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper),
/*location*/ constructor || node);
@@ -49409,8 +49119,8 @@ var ts;
statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, /*ensureUseStrict*/ false, visitor);
}
if (constructor) {
- addDefaultValueAssignmentsIfNeeded(statements, constructor);
- addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
+ ts.addDefaultValueAssignmentsIfNeeded(statements, constructor, visitor, /*convertObjectRest*/ false);
+ ts.addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!");
}
var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);
@@ -49449,17 +49159,17 @@ var ts;
*/
function isSufficientlyCoveredByReturnStatements(statement) {
// A return statement is considered covered.
- if (statement.kind === 212 /* ReturnStatement */) {
+ if (statement.kind === 215 /* ReturnStatement */) {
return true;
}
- else if (statement.kind === 204 /* IfStatement */) {
+ else if (statement.kind === 207 /* IfStatement */) {
var ifStatement = statement;
if (ifStatement.elseStatement) {
return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) &&
isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement);
}
}
- else if (statement.kind === 200 /* Block */) {
+ else if (statement.kind === 203 /* Block */) {
var lastStatement = ts.lastOrUndefined(statement.statements);
if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) {
return true;
@@ -49476,7 +49186,7 @@ var ts;
// If this isn't a derived class, just capture 'this' for arrow functions if necessary.
if (!hasExtendsClause) {
if (ctor) {
- addCaptureThisForNodeIfNeeded(statements, ctor);
+ ts.addCaptureThisForNodeIfNeeded(statements, ctor, enableSubstitutionsForCapturedThis);
}
return 0 /* NoReplacement */;
}
@@ -49491,7 +49201,7 @@ var ts;
// for something like property initializers.
// Create a captured '_this' variable and assume it will subsequently be used.
if (hasSynthesizedSuper) {
- captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());
+ ts.captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());
enableSubstitutionsForCapturedThis();
return 1 /* ReplaceSuperCapture */;
}
@@ -49517,7 +49227,7 @@ var ts;
var ctorStatements = ctor.body.statements;
if (statementOffset < ctorStatements.length) {
firstStatement = ctorStatements[statementOffset];
- if (firstStatement.kind === 203 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) {
+ if (firstStatement.kind === 206 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) {
var superCall = firstStatement.expression;
superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall);
}
@@ -49528,7 +49238,7 @@ var ts;
return 2 /* ReplaceWithReturn */;
}
// Perform the capture.
- captureThisForNode(statements, ctor, superCallExpression, firstStatement);
+ ts.captureThisForNode(statements, ctor, superCallExpression, enableSubstitutionsForCapturedThis, firstStatement);
// If we're actually replacing the original statement, we need to signal this to the caller.
if (superCallExpression) {
return 1 /* ReplaceSuperCapture */;
@@ -49554,14 +49264,24 @@ var ts;
else if (ts.isBindingPattern(node.name)) {
// Binding patterns are converted into a generated name and are
// evaluated inside the function body.
- return ts.setOriginalNode(ts.createParameter(ts.getGeneratedNameForNode(node),
+ return ts.setOriginalNode(ts.createParameter(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined,
+ /*dotDotDotToken*/ undefined, ts.getGeneratedNameForNode(node),
+ /*questionToken*/ undefined,
+ /*type*/ undefined,
/*initializer*/ undefined,
/*location*/ node),
/*original*/ node);
}
else if (node.initializer) {
// Initializers are elided
- return ts.setOriginalNode(ts.createParameter(node.name,
+ return ts.setOriginalNode(ts.createParameter(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined,
+ /*dotDotDotToken*/ undefined, node.name,
+ /*questionToken*/ undefined,
+ /*type*/ undefined,
/*initializer*/ undefined,
/*location*/ node),
/*original*/ node);
@@ -49570,158 +49290,6 @@ var ts;
return node;
}
}
- /**
- * Gets a value indicating whether we need to add default value assignments for a
- * function-like node.
- *
- * @param node A function-like node.
- */
- function shouldAddDefaultValueAssignments(node) {
- return (node.transformFlags & 262144 /* ContainsDefaultValueAssignments */) !== 0;
- }
- /**
- * Adds statements to the body of a function-like node if it contains parameters with
- * binding patterns or initializers.
- *
- * @param statements The statements for the new function body.
- * @param node A function-like node.
- */
- function addDefaultValueAssignmentsIfNeeded(statements, node) {
- if (!shouldAddDefaultValueAssignments(node)) {
- return;
- }
- for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
- var parameter = _a[_i];
- var name_37 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
- // A rest parameter cannot have a binding pattern or an initializer,
- // so let's just ignore it.
- if (dotDotDotToken) {
- continue;
- }
- if (ts.isBindingPattern(name_37)) {
- addDefaultValueAssignmentForBindingPattern(statements, parameter, name_37, initializer);
- }
- else if (initializer) {
- addDefaultValueAssignmentForInitializer(statements, parameter, name_37, initializer);
- }
- }
- }
- /**
- * Adds statements to the body of a function-like node for parameters with binding patterns
- *
- * @param statements The statements for the new function body.
- * @param parameter The parameter for the function.
- * @param name The name of the parameter.
- * @param initializer The initializer for the parameter.
- */
- function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) {
- var temp = ts.getGeneratedNameForNode(parameter);
- // In cases where a binding pattern is simply '[]' or '{}',
- // we usually don't want to emit a var declaration; however, in the presence
- // of an initializer, we must emit that expression to preserve side effects.
- if (name.elements.length > 0) {
- statements.push(ts.setEmitFlags(ts.createVariableStatement(
- /*modifiers*/ undefined, ts.createVariableDeclarationList(ts.flattenParameterDestructuring(parameter, temp, visitor))), 8388608 /* CustomPrologue */));
- }
- else if (initializer) {
- statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 8388608 /* CustomPrologue */));
- }
- }
- /**
- * Adds statements to the body of a function-like node for parameters with initializers.
- *
- * @param statements The statements for the new function body.
- * @param parameter The parameter for the function.
- * @param name The name of the parameter.
- * @param initializer The initializer for the parameter.
- */
- function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) {
- initializer = ts.visitNode(initializer, visitor, ts.isExpression);
- var statement = ts.createIf(ts.createStrictEquality(ts.getSynthesizedClone(name), ts.createVoidZero()), ts.setEmitFlags(ts.createBlock([
- ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 1536 /* NoSourceMap */), ts.setEmitFlags(initializer, 1536 /* NoSourceMap */ | ts.getEmitFlags(initializer)),
- /*location*/ parameter))
- ], /*location*/ parameter), 32 /* SingleLine */ | 1024 /* NoTrailingSourceMap */ | 12288 /* NoTokenSourceMaps */),
- /*elseStatement*/ undefined,
- /*location*/ parameter);
- statement.startsOnNewLine = true;
- ts.setEmitFlags(statement, 12288 /* NoTokenSourceMaps */ | 1024 /* NoTrailingSourceMap */ | 8388608 /* CustomPrologue */);
- statements.push(statement);
- }
- /**
- * Gets a value indicating whether we need to add statements to handle a rest parameter.
- *
- * @param node A ParameterDeclaration node.
- * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is
- * part of a constructor declaration with a
- * synthesized call to `super`
- */
- function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {
- return node && node.dotDotDotToken && node.name.kind === 70 /* Identifier */ && !inConstructorWithSynthesizedSuper;
- }
- /**
- * Adds statements to the body of a function-like node if it contains a rest parameter.
- *
- * @param statements The statements for the new function body.
- * @param node A function-like node.
- * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is
- * part of a constructor declaration with a
- * synthesized call to `super`
- */
- function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {
- var parameter = ts.lastOrUndefined(node.parameters);
- if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {
- return;
- }
- // `declarationName` is the name of the local declaration for the parameter.
- var declarationName = ts.getMutableClone(parameter.name);
- ts.setEmitFlags(declarationName, 1536 /* NoSourceMap */);
- // `expressionName` is the name of the parameter used in expressions.
- var expressionName = ts.getSynthesizedClone(parameter.name);
- var restIndex = node.parameters.length - 1;
- var temp = ts.createLoopVariable();
- // var param = [];
- statements.push(ts.setEmitFlags(ts.createVariableStatement(
- /*modifiers*/ undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(declarationName,
- /*type*/ undefined, ts.createArrayLiteral([]))
- ]),
- /*location*/ parameter), 8388608 /* CustomPrologue */));
- // for (var _i = restIndex; _i < arguments.length; _i++) {
- // param[_i - restIndex] = arguments[_i];
- // }
- var forStatement = ts.createFor(ts.createVariableDeclarationList([
- ts.createVariableDeclaration(temp, /*type*/ undefined, ts.createLiteral(restIndex))
- ], /*location*/ parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"),
- /*location*/ parameter), ts.createPostfixIncrement(temp, /*location*/ parameter), ts.createBlock([
- ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)),
- /*location*/ parameter))
- ]));
- ts.setEmitFlags(forStatement, 8388608 /* CustomPrologue */);
- ts.startOnNewLine(forStatement);
- statements.push(forStatement);
- }
- /**
- * Adds a statement to capture the `this` of a function declaration if it is needed.
- *
- * @param statements The statements for the new function body.
- * @param node A node.
- */
- function addCaptureThisForNodeIfNeeded(statements, node) {
- if (node.transformFlags & 65536 /* ContainsCapturedLexicalThis */ && node.kind !== 181 /* ArrowFunction */) {
- captureThisForNode(statements, node, ts.createThis());
- }
- }
- function captureThisForNode(statements, node, initializer, originalStatement) {
- enableSubstitutionsForCapturedThis();
- var captureThisStatement = ts.createVariableStatement(
- /*modifiers*/ undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration("_this",
- /*type*/ undefined, initializer)
- ]), originalStatement);
- ts.setEmitFlags(captureThisStatement, 49152 /* NoComments */ | 8388608 /* CustomPrologue */);
- ts.setSourceMapRange(captureThisStatement, node);
- statements.push(captureThisStatement);
- }
/**
* Adds statements to the class body function for a class to define the members of the
* class.
@@ -49733,20 +49301,20 @@ var ts;
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
switch (member.kind) {
- case 199 /* SemicolonClassElement */:
+ case 202 /* SemicolonClassElement */:
statements.push(transformSemicolonClassElementToStatement(member));
break;
- case 148 /* MethodDeclaration */:
+ case 149 /* MethodDeclaration */:
statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member));
break;
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
var accessors = ts.getAllAccessorDeclarations(node.members, member);
if (member === accessors.firstAccessor) {
statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors));
}
break;
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
// Constructors are handled in visitClassExpression/visitClassDeclaration
break;
default:
@@ -49852,7 +49420,7 @@ var ts;
* @param node An ArrowFunction node.
*/
function visitArrowFunction(node) {
- if (node.transformFlags & 32768 /* ContainsLexicalThis */) {
+ if (node.transformFlags & 262144 /* ContainsLexicalThis */) {
enableSubstitutionsForCapturedThis();
}
var func = transformFunctionLikeToExpression(node, /*location*/ node, /*name*/ undefined);
@@ -49876,7 +49444,7 @@ var ts;
return ts.setOriginalNode(ts.createFunctionDeclaration(
/*decorators*/ undefined, node.modifiers, node.asteriskToken, node.name,
/*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, transformFunctionBody(node),
+ /*type*/ undefined, ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis),
/*location*/ node),
/*original*/ node);
}
@@ -49889,91 +49457,17 @@ var ts;
*/
function transformFunctionLikeToExpression(node, location, name) {
var savedContainingNonArrowFunction = enclosingNonArrowFunction;
- if (node.kind !== 181 /* ArrowFunction */) {
+ if (node.kind !== 184 /* ArrowFunction */) {
enclosingNonArrowFunction = node;
}
var expression = ts.setOriginalNode(ts.createFunctionExpression(
/*modifiers*/ undefined, node.asteriskToken, name,
/*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, saveStateAndInvoke(node, transformFunctionBody), location),
+ /*type*/ undefined, saveStateAndInvoke(node, function (node) { return ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis); }), location),
/*original*/ node);
enclosingNonArrowFunction = savedContainingNonArrowFunction;
return expression;
}
- /**
- * Transforms the body of a function-like node.
- *
- * @param node A function-like node.
- */
- function transformFunctionBody(node) {
- var multiLine = false; // indicates whether the block *must* be emitted as multiple lines
- var singleLine = false; // indicates whether the block *may* be emitted as a single line
- var statementsLocation;
- var closeBraceLocation;
- var statements = [];
- var body = node.body;
- var statementOffset;
- startLexicalEnvironment();
- if (ts.isBlock(body)) {
- // ensureUseStrict is false because no new prologue-directive should be added.
- // addPrologueDirectives will simply put already-existing directives at the beginning of the target statement-array
- statementOffset = ts.addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor);
- }
- addCaptureThisForNodeIfNeeded(statements, node);
- addDefaultValueAssignmentsIfNeeded(statements, node);
- addRestParameterIfNeeded(statements, node, /*inConstructorWithSynthesizedSuper*/ false);
- // If we added any generated statements, this must be a multi-line block.
- if (!multiLine && statements.length > 0) {
- multiLine = true;
- }
- if (ts.isBlock(body)) {
- statementsLocation = body.statements;
- ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));
- // If the original body was a multi-line block, this must be a multi-line block.
- if (!multiLine && body.multiLine) {
- multiLine = true;
- }
- }
- else {
- ts.Debug.assert(node.kind === 181 /* ArrowFunction */);
- // To align with the old emitter, we use a synthetic end position on the location
- // for the statement list we synthesize when we down-level an arrow function with
- // an expression function body. This prevents both comments and source maps from
- // being emitted for the end position only.
- statementsLocation = ts.moveRangeEnd(body, -1);
- var equalsGreaterThanToken = node.equalsGreaterThanToken;
- if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
- if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {
- singleLine = true;
- }
- else {
- multiLine = true;
- }
- }
- var expression = ts.visitNode(body, visitor, ts.isExpression);
- var returnStatement = ts.createReturn(expression, /*location*/ body);
- ts.setEmitFlags(returnStatement, 12288 /* NoTokenSourceMaps */ | 1024 /* NoTrailingSourceMap */ | 32768 /* NoTrailingComments */);
- statements.push(returnStatement);
- // To align with the source map emit for the old emitter, we set a custom
- // source map location for the close brace.
- closeBraceLocation = body;
- }
- var lexicalEnvironment = endLexicalEnvironment();
- ts.addRange(statements, lexicalEnvironment);
- // If we added any final generated statements, this must be a multi-line block
- if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {
- multiLine = true;
- }
- var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine);
- if (!multiLine && singleLine) {
- ts.setEmitFlags(block, 32 /* SingleLine */);
- }
- if (closeBraceLocation) {
- ts.setTokenSourceMapRange(block, 17 /* CloseBraceToken */, closeBraceLocation);
- }
- ts.setOriginalNode(block, node.body);
- return block;
- }
/**
* Visits an ExpressionStatement that contains a destructuring assignment.
*
@@ -49982,9 +49476,9 @@ var ts;
function visitExpressionStatement(node) {
// If we are here it is most likely because our expression is a destructuring assignment.
switch (node.expression.kind) {
- case 179 /* ParenthesizedExpression */:
+ case 182 /* ParenthesizedExpression */:
return ts.updateStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false));
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
return ts.updateStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false));
}
return ts.visitEachChild(node, visitor, context);
@@ -50000,10 +49494,10 @@ var ts;
// If we are here it is most likely because our expression is a destructuring assignment.
if (needsDestructuringValue) {
switch (node.expression.kind) {
- case 179 /* ParenthesizedExpression */:
+ case 182 /* ParenthesizedExpression */:
return ts.createParen(visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ true),
/*location*/ node);
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
return ts.createParen(visitBinaryExpression(node.expression, /*needsDestructuringValue*/ true),
/*location*/ node);
}
@@ -50032,7 +49526,7 @@ var ts;
if (decl.initializer) {
var assignment = void 0;
if (ts.isBindingPattern(decl.name)) {
- assignment = ts.flattenVariableDestructuringToExpression(decl, hoistVariableDeclaration, /*nameSubstitution*/ undefined, visitor);
+ assignment = ts.flattenVariableDestructuringToExpression(decl, hoistVariableDeclaration, /*createAssignmentCallback*/ undefined, visitor);
}
else {
assignment = ts.createBinary(decl.name, 57 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression));
@@ -50065,7 +49559,7 @@ var ts;
var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ node);
ts.setOriginalNode(declarationList, node);
ts.setCommentRange(declarationList, node);
- if (node.transformFlags & 8388608 /* ContainsBindingPattern */
+ if (node.transformFlags & 67108864 /* ContainsBindingPattern */
&& (ts.isBindingPattern(node.declarations[0].name)
|| ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) {
// If the first or last declaration is a binding pattern, we need to modify
@@ -50131,8 +49625,8 @@ var ts;
&& ts.isBlock(enclosingBlockScopeContainer)
&& ts.isIterationStatement(enclosingBlockScopeContainerParent, /*lookInLabeledStatements*/ false));
var emitExplicitInitializer = !emittedAsTopLevel
- && enclosingBlockScopeContainer.kind !== 208 /* ForInStatement */
- && enclosingBlockScopeContainer.kind !== 209 /* ForOfStatement */
+ && enclosingBlockScopeContainer.kind !== 211 /* ForInStatement */
+ && enclosingBlockScopeContainer.kind !== 212 /* ForOfStatement */
&& (!resolver.isDeclarationWithCollidingName(node)
|| (isDeclaredInLoop
&& !isCapturedInFunction
@@ -50213,118 +49707,7 @@ var ts;
return convertIterationStatementBodyIfNecessary(node, convertForOfToFor);
}
function convertForOfToFor(node, convertedLoopBodyStatements) {
- // The following ES6 code:
- //
- // for (let v of expr) { }
- //
- // should be emitted as
- //
- // for (var _i = 0, _a = expr; _i < _a.length; _i++) {
- // var v = _a[_i];
- // }
- //
- // where _a and _i are temps emitted to capture the RHS and the counter,
- // respectively.
- // When the left hand side is an expression instead of a let declaration,
- // the "let v" is not emitted.
- // When the left hand side is a let/const, the v is renamed if there is
- // another v in scope.
- // Note that all assignments to the LHS are emitted in the body, including
- // all destructuring.
- // Note also that because an extra statement is needed to assign to the LHS,
- // for-of bodies are always emitted as blocks.
- var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
- var initializer = node.initializer;
- var statements = [];
- // In the case where the user wrote an identifier as the RHS, like this:
- //
- // for (let v of arr) { }
- //
- // we don't want to emit a temporary variable for the RHS, just use it directly.
- var counter = ts.createLoopVariable();
- var rhsReference = expression.kind === 70 /* Identifier */
- ? ts.createUniqueName(expression.text)
- : ts.createTempVariable(/*recordTempVariable*/ undefined);
- // Initialize LHS
- // var v = _a[_i];
- if (ts.isVariableDeclarationList(initializer)) {
- if (initializer.flags & 3 /* BlockScoped */) {
- enableSubstitutionsForBlockScopedBindings();
- }
- var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);
- if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {
- // This works whether the declaration is a var, let, or const.
- // It will use rhsIterationValue _a[_i] as the initializer.
- var declarations = ts.flattenVariableDestructuring(firstOriginalDeclaration, ts.createElementAccess(rhsReference, counter), visitor);
- var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ initializer);
- ts.setOriginalNode(declarationList, initializer);
- // Adjust the source map range for the first declaration to align with the old
- // emitter.
- var firstDeclaration = declarations[0];
- var lastDeclaration = ts.lastOrUndefined(declarations);
- ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));
- statements.push(ts.createVariableStatement(
- /*modifiers*/ undefined, declarationList));
- }
- else {
- // The following call does not include the initializer, so we have
- // to emit it separately.
- statements.push(ts.createVariableStatement(
- /*modifiers*/ undefined, ts.createVariableDeclarationList([
- ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(/*recordTempVariable*/ undefined),
- /*type*/ undefined, ts.createElementAccess(rhsReference, counter))
- ], /*location*/ ts.moveRangePos(initializer, -1)),
- /*location*/ ts.moveRangeEnd(initializer, -1)));
- }
- }
- else {
- // Initializer is an expression. Emit the expression in the body, so that it's
- // evaluated on every iteration.
- var assignment = ts.createAssignment(initializer, ts.createElementAccess(rhsReference, counter));
- if (ts.isDestructuringAssignment(assignment)) {
- // This is a destructuring pattern, so we flatten the destructuring instead.
- statements.push(ts.createStatement(ts.flattenDestructuringAssignment(context, assignment,
- /*needsValue*/ false, hoistVariableDeclaration, visitor)));
- }
- else {
- // Currently there is not way to check that assignment is binary expression of destructing assignment
- // so we have to cast never type to binaryExpression
- assignment.end = initializer.end;
- statements.push(ts.createStatement(assignment, /*location*/ ts.moveRangeEnd(initializer, -1)));
- }
- }
- var bodyLocation;
- var statementsLocation;
- if (convertedLoopBodyStatements) {
- ts.addRange(statements, convertedLoopBodyStatements);
- }
- else {
- var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
- if (ts.isBlock(statement)) {
- ts.addRange(statements, statement.statements);
- bodyLocation = statement;
- statementsLocation = statement.statements;
- }
- else {
- statements.push(statement);
- }
- }
- // The old emitter does not emit source maps for the expression
- ts.setEmitFlags(expression, 1536 /* NoSourceMap */ | ts.getEmitFlags(expression));
- // The old emitter does not emit source maps for the block.
- // We add the location to preserve comments.
- var body = ts.createBlock(ts.createNodeArray(statements, /*location*/ statementsLocation),
- /*location*/ bodyLocation);
- ts.setEmitFlags(body, 1536 /* NoSourceMap */ | 12288 /* NoTokenSourceMaps */);
- var forStatement = ts.createFor(ts.createVariableDeclarationList([
- ts.createVariableDeclaration(counter, /*type*/ undefined, ts.createLiteral(0), /*location*/ ts.moveRangePos(node.expression, -1)),
- ts.createVariableDeclaration(rhsReference, /*type*/ undefined, expression, /*location*/ node.expression)
- ], /*location*/ node.expression), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"),
- /*location*/ node.expression), ts.createPostfixIncrement(counter, /*location*/ node.expression), body,
- /*location*/ node);
- // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter.
- ts.setEmitFlags(forStatement, 8192 /* NoTokenTrailingSourceMaps */);
- return forStatement;
+ return ts.convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, /*transformRest*/ false);
}
/**
* Visits an ObjectLiteralExpression with computed propety names.
@@ -50340,8 +49723,8 @@ var ts;
var numInitialProperties = numProperties;
for (var i = 0; i < numProperties; i++) {
var property = properties[i];
- if (property.transformFlags & 16777216 /* ContainsYield */
- || property.name.kind === 141 /* ComputedPropertyName */) {
+ if (property.transformFlags & 134217728 /* ContainsYield */
+ || property.name.kind === 142 /* ComputedPropertyName */) {
numInitialProperties = i;
break;
}
@@ -50407,11 +49790,11 @@ var ts;
var functionName = ts.createUniqueName("_loop");
var loopInitializer;
switch (node.kind) {
- case 207 /* ForStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
+ case 210 /* ForStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
var initializer = node.initializer;
- if (initializer && initializer.kind === 220 /* VariableDeclarationList */) {
+ if (initializer && initializer.kind === 223 /* VariableDeclarationList */) {
loopInitializer = initializer;
}
break;
@@ -50460,7 +49843,7 @@ var ts;
}
var isAsyncBlockContainingAwait = enclosingNonArrowFunction
&& (ts.getEmitFlags(enclosingNonArrowFunction) & 2097152 /* AsyncFunctionBody */) !== 0
- && (node.statement.transformFlags & 16777216 /* ContainsYield */) !== 0;
+ && (node.statement.transformFlags & 134217728 /* ContainsYield */) !== 0;
var loopBodyFlags = 0;
if (currentState.containsLexicalThis) {
loopBodyFlags |= 256 /* CapturesThis */;
@@ -50469,14 +49852,14 @@ var ts;
loopBodyFlags |= 2097152 /* AsyncFunctionBody */;
}
var convertedLoopVariable = ts.createVariableStatement(
- /*modifiers*/ undefined, ts.createVariableDeclarationList([
+ /*modifiers*/ undefined, ts.setEmitFlags(ts.createVariableDeclarationList([
ts.createVariableDeclaration(functionName,
/*type*/ undefined, ts.setEmitFlags(ts.createFunctionExpression(
/*modifiers*/ undefined, isAsyncBlockContainingAwait ? ts.createToken(38 /* AsteriskToken */) : undefined,
/*name*/ undefined,
/*typeParameters*/ undefined, loopParameters,
/*type*/ undefined, loopBody), loopBodyFlags))
- ]));
+ ]), 16777216 /* NoHoisting */));
var statements = [convertedLoopVariable];
var extraVariableDeclarations;
// propagate state from the inner loop to the outer loop if necessary
@@ -50558,7 +49941,7 @@ var ts;
loop.transformFlags = 0;
ts.aggregateTransformFlags(loop);
}
- statements.push(currentParent.kind === 215 /* LabeledStatement */
+ statements.push(currentParent.kind === 218 /* LabeledStatement */
? ts.createLabel(currentParent.label, loop)
: loop);
return statements;
@@ -50664,7 +50047,7 @@ var ts;
}
}
else {
- loopParameters.push(ts.createParameter(name));
+ loopParameters.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, name));
if (resolver.getNodeCheckFlags(decl) & 2097152 /* NeedsLoopOutParameter */) {
var outParamName = ts.createUniqueName("out_" + name.text);
loopOutParameters.push({ originalName: name, outParamName: outParamName });
@@ -50686,20 +50069,20 @@ var ts;
for (var i = start; i < numProperties; i++) {
var property = properties[i];
switch (property.kind) {
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
var accessors = ts.getAllAccessorDeclarations(node.properties, property);
if (property === accessors.firstAccessor) {
expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine));
}
break;
- case 253 /* PropertyAssignment */:
+ case 256 /* PropertyAssignment */:
expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine));
break;
- case 254 /* ShorthandPropertyAssignment */:
+ case 257 /* ShorthandPropertyAssignment */:
expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine));
break;
- case 148 /* MethodDeclaration */:
+ case 149 /* MethodDeclaration */:
expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine));
break;
default:
@@ -50828,7 +50211,7 @@ var ts;
ts.setEmitFlags(thisArg, 128 /* NoSubstitution */);
}
var resultingCall;
- if (node.transformFlags & 1048576 /* ContainsSpreadElementExpression */) {
+ if (node.transformFlags & 8388608 /* ContainsSpreadExpression */) {
// [source]
// f(...a, b)
// x.m(...a, b)
@@ -50874,7 +50257,7 @@ var ts;
*/
function visitNewExpression(node) {
// We are here because we contain a SpreadElementExpression.
- ts.Debug.assert((node.transformFlags & 1048576 /* ContainsSpreadElementExpression */) !== 0);
+ ts.Debug.assert((node.transformFlags & 8388608 /* ContainsSpreadExpression */) !== 0);
// [source]
// new C(...a)
//
@@ -50885,7 +50268,7 @@ var ts;
/*typeArguments*/ undefined, []);
}
/**
- * Transforms an array of Expression nodes that contains a SpreadElementExpression.
+ * Transforms an array of Expression nodes that contains a SpreadExpression.
*
* @param elements The array of Expression nodes.
* @param needsUniqueCopy A value indicating whether to ensure that the result is a fresh array.
@@ -50900,36 +50283,36 @@ var ts;
// Map spans of spread expressions into their expressions and spans of other
// expressions into an array literal.
var numElements = elements.length;
- var segments = ts.flatten(ts.spanMap(elements, partitionSpreadElement, function (partition, visitPartition, _start, end) {
+ var segments = ts.flatten(ts.spanMap(elements, partitionSpread, function (partition, visitPartition, _start, end) {
return visitPartition(partition, multiLine, hasTrailingComma && end === numElements);
}));
if (segments.length === 1) {
var firstElement = elements[0];
- return needsUniqueCopy && ts.isSpreadElementExpression(firstElement) && firstElement.expression.kind !== 171 /* ArrayLiteralExpression */
+ return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 174 /* ArrayLiteralExpression */
? ts.createArraySlice(segments[0])
: segments[0];
}
// Rewrite using the pattern .concat(, , ...)
return ts.createArrayConcat(segments.shift(), segments);
}
- function partitionSpreadElement(node) {
- return ts.isSpreadElementExpression(node)
- ? visitSpanOfSpreadElements
- : visitSpanOfNonSpreadElements;
+ function partitionSpread(node) {
+ return ts.isSpreadExpression(node)
+ ? visitSpanOfSpreads
+ : visitSpanOfNonSpreads;
}
- function visitSpanOfSpreadElements(chunk) {
- return ts.map(chunk, visitExpressionOfSpreadElement);
+ function visitSpanOfSpreads(chunk) {
+ return ts.map(chunk, visitExpressionOfSpread);
}
- function visitSpanOfNonSpreadElements(chunk, multiLine, hasTrailingComma) {
+ function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) {
return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, /*location*/ undefined, hasTrailingComma), visitor, ts.isExpression),
/*location*/ undefined, multiLine);
}
/**
- * Transforms the expression of a SpreadElementExpression node.
+ * Transforms the expression of a SpreadExpression node.
*
- * @param node A SpreadElementExpression node.
+ * @param node A SpreadExpression node.
*/
- function visitExpressionOfSpreadElement(node) {
+ function visitExpressionOfSpread(node) {
return ts.visitNode(node.expression, visitor, ts.isExpression);
}
/**
@@ -51086,7 +50469,7 @@ var ts;
return enclosingNonAsyncFunctionBody
&& ts.isClassElement(enclosingNonAsyncFunctionBody)
&& !ts.hasModifier(enclosingNonAsyncFunctionBody, 32 /* Static */)
- && currentParent.kind !== 175 /* CallExpression */
+ && currentParent.kind !== 178 /* CallExpression */
? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype")
: ts.createIdentifier("_super");
}
@@ -51095,7 +50478,7 @@ var ts;
var statements = [];
startLexicalEnvironment();
ts.addRange(statements, prologue);
- addCaptureThisForNodeIfNeeded(statements, node);
+ ts.addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis);
ts.addRange(statements, ts.visitNodes(ts.createNodeArray(remaining), visitor, ts.isStatement));
ts.addRange(statements, endLexicalEnvironment());
var clone = ts.getMutableClone(node);
@@ -51134,21 +50517,20 @@ var ts;
if ((enabledSubstitutions & 1 /* CapturedThis */) === 0) {
enabledSubstitutions |= 1 /* CapturedThis */;
context.enableSubstitution(98 /* ThisKeyword */);
- context.enableEmitNotification(149 /* Constructor */);
- context.enableEmitNotification(148 /* MethodDeclaration */);
- context.enableEmitNotification(150 /* GetAccessor */);
- context.enableEmitNotification(151 /* SetAccessor */);
- context.enableEmitNotification(181 /* ArrowFunction */);
- context.enableEmitNotification(180 /* FunctionExpression */);
- context.enableEmitNotification(221 /* FunctionDeclaration */);
+ context.enableEmitNotification(150 /* Constructor */);
+ context.enableEmitNotification(149 /* MethodDeclaration */);
+ context.enableEmitNotification(151 /* GetAccessor */);
+ context.enableEmitNotification(152 /* SetAccessor */);
+ context.enableEmitNotification(184 /* ArrowFunction */);
+ context.enableEmitNotification(183 /* FunctionExpression */);
+ context.enableEmitNotification(224 /* FunctionDeclaration */);
}
}
/**
* Hooks node substitutions.
*
+ * @param emitContext The context for the emitter.
* @param node The node to substitute.
- * @param isExpression A value indicating whether the node is to be used in an expression
- * position.
*/
function onSubstituteNode(emitContext, node) {
node = previousOnSubstituteNode(emitContext, node);
@@ -51183,10 +50565,10 @@ var ts;
function isNameOfDeclarationWithCollidingName(node) {
var parent = node.parent;
switch (parent.kind) {
- case 170 /* BindingElement */:
- case 222 /* ClassDeclaration */:
- case 225 /* EnumDeclaration */:
- case 219 /* VariableDeclaration */:
+ case 173 /* BindingElement */:
+ case 225 /* ClassDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 222 /* VariableDeclaration */:
return parent.name === node
&& resolver.isDeclarationWithCollidingName(parent);
}
@@ -51233,44 +50615,8 @@ var ts;
}
return node;
}
- /**
- * Gets the local name for a declaration for use in expressions.
- *
- * A local name will *never* be prefixed with an module or namespace export modifier like
- * "exports.".
- *
- * @param node The declaration.
- * @param allowComments A value indicating whether comments may be emitted for the name.
- * @param allowSourceMaps A value indicating whether source maps may be emitted for the name.
- */
- function getLocalName(node, allowComments, allowSourceMaps) {
- return getDeclarationName(node, allowComments, allowSourceMaps, 262144 /* LocalName */);
- }
- /**
- * Gets the name of a declaration, without source map or comments.
- *
- * @param node The declaration.
- * @param allowComments Allow comments for the name.
- */
- function getDeclarationName(node, allowComments, allowSourceMaps, emitFlags) {
- if (node.name && !ts.isGeneratedIdentifier(node.name)) {
- var name_38 = ts.getMutableClone(node.name);
- emitFlags |= ts.getEmitFlags(node.name);
- if (!allowSourceMaps) {
- emitFlags |= 1536 /* NoSourceMap */;
- }
- if (!allowComments) {
- emitFlags |= 49152 /* NoComments */;
- }
- if (emitFlags) {
- ts.setEmitFlags(name_38, emitFlags);
- }
- return name_38;
- }
- return ts.getGeneratedNameForNode(node);
- }
function getClassMemberPrefix(node, member) {
- var expression = getLocalName(node);
+ var expression = ts.getLocalName(node);
return ts.hasModifier(member, 32 /* Static */) ? expression : ts.createPropertyAccess(expression, "prototype");
}
function hasSynthesizedDefaultSuperCall(constructor, hasExtendsClause) {
@@ -51282,11 +50628,11 @@ var ts;
return false;
}
var statement = ts.firstOrUndefined(constructor.body.statements);
- if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 203 /* ExpressionStatement */) {
+ if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 206 /* ExpressionStatement */) {
return false;
}
var statementExpression = statement.expression;
- if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 175 /* CallExpression */) {
+ if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 178 /* CallExpression */) {
return false;
}
var callTarget = statementExpression.expression;
@@ -51294,7 +50640,7 @@ var ts;
return false;
}
var callArgument = ts.singleOrUndefined(statementExpression.arguments);
- if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 192 /* SpreadElementExpression */) {
+ if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 195 /* SpreadElement */) {
return false;
}
var expression = callArgument.expression;
@@ -51536,7 +50882,7 @@ var ts;
if (ts.isDeclarationFile(node)) {
return node;
}
- if (node.transformFlags & 4096 /* ContainsGenerator */) {
+ if (node.transformFlags & 8192 /* ContainsGenerator */) {
currentSourceFile = node;
node = ts.visitEachChild(node, visitor, context);
currentSourceFile = undefined;
@@ -51556,10 +50902,10 @@ var ts;
else if (inGeneratorFunctionBody) {
return visitJavaScriptInGeneratorFunctionBody(node);
}
- else if (transformFlags & 2048 /* Generator */) {
+ else if (transformFlags & 4096 /* Generator */) {
return visitGenerator(node);
}
- else if (transformFlags & 4096 /* ContainsGenerator */) {
+ else if (transformFlags & 8192 /* ContainsGenerator */) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -51573,13 +50919,13 @@ var ts;
*/
function visitJavaScriptInStatementContainingYield(node) {
switch (node.kind) {
- case 205 /* DoStatement */:
+ case 208 /* DoStatement */:
return visitDoStatement(node);
- case 206 /* WhileStatement */:
+ case 209 /* WhileStatement */:
return visitWhileStatement(node);
- case 214 /* SwitchStatement */:
+ case 217 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 215 /* LabeledStatement */:
+ case 218 /* LabeledStatement */:
return visitLabeledStatement(node);
default:
return visitJavaScriptInGeneratorFunctionBody(node);
@@ -51592,30 +50938,30 @@ var ts;
*/
function visitJavaScriptInGeneratorFunctionBody(node) {
switch (node.kind) {
- case 221 /* FunctionDeclaration */:
+ case 224 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 180 /* FunctionExpression */:
+ case 183 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
return visitAccessorDeclaration(node);
- case 201 /* VariableStatement */:
+ case 204 /* VariableStatement */:
return visitVariableStatement(node);
- case 207 /* ForStatement */:
+ case 210 /* ForStatement */:
return visitForStatement(node);
- case 208 /* ForInStatement */:
+ case 211 /* ForInStatement */:
return visitForInStatement(node);
- case 211 /* BreakStatement */:
+ case 214 /* BreakStatement */:
return visitBreakStatement(node);
- case 210 /* ContinueStatement */:
+ case 213 /* ContinueStatement */:
return visitContinueStatement(node);
- case 212 /* ReturnStatement */:
+ case 215 /* ReturnStatement */:
return visitReturnStatement(node);
default:
- if (node.transformFlags & 16777216 /* ContainsYield */) {
+ if (node.transformFlags & 134217728 /* ContainsYield */) {
return visitJavaScriptContainingYield(node);
}
- else if (node.transformFlags & (4096 /* ContainsGenerator */ | 33554432 /* ContainsHoistedDeclarationOrCompletion */)) {
+ else if (node.transformFlags & (8192 /* ContainsGenerator */ | 268435456 /* ContainsHoistedDeclarationOrCompletion */)) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -51630,21 +50976,21 @@ var ts;
*/
function visitJavaScriptContainingYield(node) {
switch (node.kind) {
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
return visitBinaryExpression(node);
- case 189 /* ConditionalExpression */:
+ case 192 /* ConditionalExpression */:
return visitConditionalExpression(node);
- case 191 /* YieldExpression */:
+ case 194 /* YieldExpression */:
return visitYieldExpression(node);
- case 171 /* ArrayLiteralExpression */:
+ case 174 /* ArrayLiteralExpression */:
return visitArrayLiteralExpression(node);
- case 172 /* ObjectLiteralExpression */:
+ case 175 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 174 /* ElementAccessExpression */:
+ case 177 /* ElementAccessExpression */:
return visitElementAccessExpression(node);
- case 175 /* CallExpression */:
+ case 178 /* CallExpression */:
return visitCallExpression(node);
- case 176 /* NewExpression */:
+ case 179 /* NewExpression */:
return visitNewExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -51657,9 +51003,9 @@ var ts;
*/
function visitGenerator(node) {
switch (node.kind) {
- case 221 /* FunctionDeclaration */:
+ case 224 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 180 /* FunctionExpression */:
+ case 183 /* FunctionExpression */:
return visitFunctionExpression(node);
default:
ts.Debug.failBadSyntaxKind(node);
@@ -51820,7 +51166,7 @@ var ts;
* @param node The node to visit.
*/
function visitVariableStatement(node) {
- if (node.transformFlags & 16777216 /* ContainsYield */) {
+ if (node.transformFlags & 134217728 /* ContainsYield */) {
transformAndEmitVariableDeclarationList(node.declarationList);
return undefined;
}
@@ -51888,7 +51234,7 @@ var ts;
if (containsYield(right)) {
var target = void 0;
switch (left.kind) {
- case 173 /* PropertyAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
// [source]
// a.b = yield;
//
@@ -51900,7 +51246,7 @@ var ts;
// _a.b = %sent%;
target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name);
break;
- case 174 /* ElementAccessExpression */:
+ case 177 /* ElementAccessExpression */:
// [source]
// a[b] = yield;
//
@@ -52269,35 +51615,35 @@ var ts;
}
function transformAndEmitStatementWorker(node) {
switch (node.kind) {
- case 200 /* Block */:
+ case 203 /* Block */:
return transformAndEmitBlock(node);
- case 203 /* ExpressionStatement */:
+ case 206 /* ExpressionStatement */:
return transformAndEmitExpressionStatement(node);
- case 204 /* IfStatement */:
+ case 207 /* IfStatement */:
return transformAndEmitIfStatement(node);
- case 205 /* DoStatement */:
+ case 208 /* DoStatement */:
return transformAndEmitDoStatement(node);
- case 206 /* WhileStatement */:
+ case 209 /* WhileStatement */:
return transformAndEmitWhileStatement(node);
- case 207 /* ForStatement */:
+ case 210 /* ForStatement */:
return transformAndEmitForStatement(node);
- case 208 /* ForInStatement */:
+ case 211 /* ForInStatement */:
return transformAndEmitForInStatement(node);
- case 210 /* ContinueStatement */:
+ case 213 /* ContinueStatement */:
return transformAndEmitContinueStatement(node);
- case 211 /* BreakStatement */:
+ case 214 /* BreakStatement */:
return transformAndEmitBreakStatement(node);
- case 212 /* ReturnStatement */:
+ case 215 /* ReturnStatement */:
return transformAndEmitReturnStatement(node);
- case 213 /* WithStatement */:
+ case 216 /* WithStatement */:
return transformAndEmitWithStatement(node);
- case 214 /* SwitchStatement */:
+ case 217 /* SwitchStatement */:
return transformAndEmitSwitchStatement(node);
- case 215 /* LabeledStatement */:
+ case 218 /* LabeledStatement */:
return transformAndEmitLabeledStatement(node);
- case 216 /* ThrowStatement */:
+ case 219 /* ThrowStatement */:
return transformAndEmitThrowStatement(node);
- case 217 /* TryStatement */:
+ case 220 /* TryStatement */:
return transformAndEmitTryStatement(node);
default:
return emitStatement(ts.visitNode(node, visitor, ts.isStatement, /*optional*/ true));
@@ -52717,7 +52063,7 @@ var ts;
for (var i = 0; i < numClauses; i++) {
var clause = caseBlock.clauses[i];
clauseLabels.push(defineLabel());
- if (clause.kind === 250 /* DefaultClause */ && defaultClauseIndex === -1) {
+ if (clause.kind === 253 /* DefaultClause */ && defaultClauseIndex === -1) {
defaultClauseIndex = i;
}
}
@@ -52730,7 +52076,7 @@ var ts;
var defaultClausesSkipped = 0;
for (var i = clausesWritten; i < numClauses; i++) {
var clause = caseBlock.clauses[i];
- if (clause.kind === 249 /* CaseClause */) {
+ if (clause.kind === 252 /* CaseClause */) {
var caseClause = clause;
if (containsYield(caseClause.expression) && pendingClauses.length > 0) {
break;
@@ -52861,7 +52207,7 @@ var ts;
}
}
function containsYield(node) {
- return node && (node.transformFlags & 16777216 /* ContainsYield */) !== 0;
+ return node && (node.transformFlags & 134217728 /* ContainsYield */) !== 0;
}
function countInitialNodesWithoutYield(nodes) {
var numNodes = nodes.length;
@@ -52891,9 +52237,9 @@ var ts;
if (ts.isIdentifier(original) && original.parent) {
var declaration = resolver.getReferencedValueDeclaration(original);
if (declaration) {
- var name_39 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));
- if (name_39) {
- var clone_8 = ts.getMutableClone(name_39);
+ var name_35 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));
+ if (name_35) {
+ var clone_8 = ts.getMutableClone(name_35);
ts.setSourceMapRange(clone_8, node);
ts.setCommentRange(clone_8, node);
return clone_8;
@@ -53295,7 +52641,7 @@ var ts;
if (labelExpressions === undefined) {
labelExpressions = [];
}
- var expression = ts.createSynthesizedNode(8 /* NumericLiteral */);
+ var expression = ts.createLiteral(-1);
if (labelExpressions[label] === undefined) {
labelExpressions[label] = [expression];
}
@@ -53304,7 +52650,7 @@ var ts;
}
return expression;
}
- return ts.createNode(194 /* OmittedExpression */);
+ return ts.createOmittedExpression();
}
/**
* Creates a numeric literal for the provided instruction.
@@ -53489,7 +52835,7 @@ var ts;
/*modifiers*/ undefined,
/*asteriskToken*/ undefined,
/*name*/ undefined,
- /*typeParameters*/ undefined, [ts.createParameter(state)],
+ /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, state)],
/*type*/ undefined, ts.createBlock(buildResult,
/*location*/ undefined,
/*multiLine*/ buildResult.length > 0)), 4194304 /* ReuseTempVariableScope */)
@@ -53879,8 +53225,8 @@ var ts;
function transformES5(context) {
var previousOnSubstituteNode = context.onSubstituteNode;
context.onSubstituteNode = onSubstituteNode;
- context.enableSubstitution(173 /* PropertyAccessExpression */);
- context.enableSubstitution(253 /* PropertyAssignment */);
+ context.enableSubstitution(176 /* PropertyAccessExpression */);
+ context.enableSubstitution(256 /* PropertyAssignment */);
return transformSourceFile;
/**
* Transforms an ES5 source file to ES3.
@@ -53945,9 +53291,2452 @@ var ts;
}
ts.transformES5 = transformES5;
})(ts || (ts = {}));
+///
+///
+/*@internal*/
+var ts;
+(function (ts) {
+ function transformES2015Module(context) {
+ var compilerOptions = context.getCompilerOptions();
+ return transformSourceFile;
+ function transformSourceFile(node) {
+ if (ts.isDeclarationFile(node)) {
+ return node;
+ }
+ if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
+ return ts.visitEachChild(node, visitor, context);
+ }
+ return node;
+ }
+ function visitor(node) {
+ switch (node.kind) {
+ case 233 /* ImportEqualsDeclaration */:
+ // Elide `import=` as it is not legal with --module ES6
+ return undefined;
+ case 239 /* ExportAssignment */:
+ return visitExportAssignment(node);
+ }
+ return node;
+ }
+ function visitExportAssignment(node) {
+ // Elide `export=` as it is not legal with --module ES6
+ return node.isExportEquals ? undefined : node;
+ }
+ }
+ ts.transformES2015Module = transformES2015Module;
+})(ts || (ts = {}));
+///
+///
+/*@internal*/
+var ts;
+(function (ts) {
+ function transformSystemModule(context) {
+ var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var compilerOptions = context.getCompilerOptions();
+ var resolver = context.getEmitResolver();
+ var host = context.getEmitHost();
+ var previousOnSubstituteNode = context.onSubstituteNode;
+ var previousOnEmitNode = context.onEmitNode;
+ context.onSubstituteNode = onSubstituteNode;
+ context.onEmitNode = onEmitNode;
+ context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers for imported symbols.
+ context.enableSubstitution(191 /* BinaryExpression */); // Substitutes assignments to exported symbols.
+ context.enableSubstitution(189 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(190 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableEmitNotification(260 /* SourceFile */); // Restore state when substituting nodes in a file.
+ var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file.
+ var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found.
+ var exportFunctionsMap = ts.createMap(); // The export function associated with a source file.
+ var noSubstitutionMap = ts.createMap(); // Set of nodes for which substitution rules should be ignored for each file.
+ var currentSourceFile; // The current file.
+ var moduleInfo; // ExternalModuleInfo for the current file.
+ var exportFunction; // The export function for the current file.
+ var contextObject; // The context object for the current file.
+ var hoistedStatements;
+ var enclosingBlockScopedContainer;
+ var noSubstitution; // Set of nodes for which substitution rules should be ignored.
+ return transformSourceFile;
+ /**
+ * Transforms the module aspects of a SourceFile.
+ *
+ * @param node The SourceFile node.
+ */
+ function transformSourceFile(node) {
+ if (ts.isDeclarationFile(node)
+ || !(ts.isExternalModule(node)
+ || compilerOptions.isolatedModules)) {
+ return node;
+ }
+ var id = ts.getOriginalNodeId(node);
+ currentSourceFile = node;
+ enclosingBlockScopedContainer = node;
+ // System modules have the following shape:
+ //
+ // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */})
+ //
+ // The parameter 'exports' here is a callback '(name: string, value: T) => T' that
+ // is used to publish exported values. 'exports' returns its 'value' argument so in
+ // most cases expressions that mutate exported values can be rewritten as:
+ //
+ // expr -> exports('name', expr)
+ //
+ // The only exception in this rule is postfix unary operators,
+ // see comment to 'substitutePostfixUnaryExpression' for more details
+ // Collect information about the external module and dependency groups.
+ moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver);
+ // Make sure that the name of the 'exports' function does not conflict with
+ // existing identifiers.
+ exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports");
+ contextObject = ts.createUniqueName("context");
+ // Add the body of the module.
+ var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports);
+ var moduleBodyFunction = ts.createFunctionExpression(
+ /*modifiers*/ undefined,
+ /*asteriskToken*/ undefined,
+ /*name*/ undefined,
+ /*typeParameters*/ undefined, [
+ ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, exportFunction),
+ ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, contextObject)
+ ],
+ /*type*/ undefined, createSystemModuleBody(node, dependencyGroups));
+ // Write the call to `System.register`
+ // Clear the emit-helpers flag for later passes since we'll have already used it in the module body
+ // So the helper will be emit at the correct position instead of at the top of the source-file
+ var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);
+ var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; }));
+ var updated = ts.updateSourceFileNode(node, ts.createNodeArray([
+ ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"),
+ /*typeArguments*/ undefined, moduleName
+ ? [moduleName, dependencies, moduleBodyFunction]
+ : [dependencies, moduleBodyFunction]))
+ ], node.statements));
+ ts.setEmitFlags(updated, ts.getEmitFlags(node) & ~1 /* EmitEmitHelpers */);
+ if (noSubstitution) {
+ noSubstitutionMap[id] = noSubstitution;
+ noSubstitution = undefined;
+ }
+ currentSourceFile = undefined;
+ moduleInfo = undefined;
+ exportFunction = undefined;
+ contextObject = undefined;
+ hoistedStatements = undefined;
+ enclosingBlockScopedContainer = undefined;
+ return ts.aggregateTransformFlags(updated);
+ }
+ /**
+ * Collects the dependency groups for this files imports.
+ *
+ * @param externalImports The imports for the file.
+ */
+ function collectDependencyGroups(externalImports) {
+ var groupIndices = ts.createMap();
+ var dependencyGroups = [];
+ for (var i = 0; i < externalImports.length; i++) {
+ var externalImport = externalImports[i];
+ var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions);
+ var text = externalModuleName.text;
+ if (ts.hasProperty(groupIndices, text)) {
+ // deduplicate/group entries in dependency list by the dependency name
+ var groupIndex = groupIndices[text];
+ dependencyGroups[groupIndex].externalImports.push(externalImport);
+ }
+ else {
+ groupIndices[text] = dependencyGroups.length;
+ dependencyGroups.push({
+ name: externalModuleName,
+ externalImports: [externalImport]
+ });
+ }
+ }
+ return dependencyGroups;
+ }
+ /**
+ * Adds the statements for the module body function for the source file.
+ *
+ * @param node The source file for the module.
+ * @param dependencyGroups The grouped dependencies of the module.
+ */
+ function createSystemModuleBody(node, dependencyGroups) {
+ // Shape of the body in system modules:
+ //
+ // function (exports) {
+ //
+ //
+ //
+ // return {
+ // setters: [
+ //
+ // ],
+ // execute: function() {
+ //
+ // }
+ // }
+ //
+ // }
+ //
+ // i.e:
+ //
+ // import {x} from 'file1'
+ // var y = 1;
+ // export function foo() { return y + x(); }
+ // console.log(y);
+ //
+ // Will be transformed to:
+ //
+ // function(exports) {
+ // function foo() { return y + file_1.x(); }
+ // exports("foo", foo);
+ // var file_1, y;
+ // return {
+ // setters: [
+ // function(v) { file_1 = v }
+ // ],
+ // execute(): function() {
+ // y = 1;
+ // console.log(y);
+ // }
+ // };
+ // }
+ var statements = [];
+ // We start a new lexical environment in this function body, but *not* in the
+ // body of the execute function. This allows us to emit temporary declarations
+ // only in the outer module body and not in the inner one.
+ startLexicalEnvironment();
+ // Add any prologue directives.
+ var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor);
+ // var __moduleName = context_1 && context_1.id;
+ statements.push(ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration("__moduleName",
+ /*type*/ undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id")))
+ ])));
+ // Visit the statements of the source file, emitting any transformations into
+ // the `executeStatements` array. We do this *before* we fill the `setters` array
+ // as we both emit transformations as well as aggregate some data used when creating
+ // setters. This allows us to reduce the number of times we need to loop through the
+ // statements of the source file.
+ var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset);
+ // Emit early exports for function declarations.
+ ts.addRange(statements, hoistedStatements);
+ // We emit hoisted variables early to align roughly with our previous emit output.
+ // Two key differences in this approach are:
+ // - Temporary variables will appear at the top rather than at the bottom of the file
+ ts.addRange(statements, endLexicalEnvironment());
+ var exportStarFunction = addExportStarIfNeeded(statements);
+ statements.push(ts.createReturn(ts.setMultiLine(ts.createObjectLiteral([
+ ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)),
+ ts.createPropertyAssignment("execute", ts.createFunctionExpression(
+ /*modifiers*/ undefined,
+ /*asteriskToken*/ undefined,
+ /*name*/ undefined,
+ /*typeParameters*/ undefined,
+ /*parameters*/ [],
+ /*type*/ undefined, ts.createBlock(executeStatements,
+ /*location*/ undefined,
+ /*multiLine*/ true)))
+ ]),
+ /*multiLine*/ true)));
+ var body = ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true);
+ ts.setEmitFlags(body, 1 /* EmitEmitHelpers */);
+ return body;
+ }
+ /**
+ * Adds an exportStar function to a statement list if it is needed for the file.
+ *
+ * @param statements A statement list.
+ */
+ function addExportStarIfNeeded(statements) {
+ if (!moduleInfo.hasExportStarsToExportValues) {
+ return;
+ }
+ // when resolving exports local exported entries/indirect exported entries in the module
+ // should always win over entries with similar names that were added via star exports
+ // to support this we store names of local/indirect exported entries in a set.
+ // this set is used to filter names brought by star expors.
+ // local names set should only be added if we have anything exported
+ if (!moduleInfo.exportedNames && ts.isEmpty(moduleInfo.exportSpecifiers)) {
+ // no exported declarations (export var ...) or export specifiers (export {x})
+ // check if we have any non star export declarations.
+ var hasExportDeclarationWithExportClause = false;
+ for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) {
+ var externalImport = _a[_i];
+ if (externalImport.kind === 240 /* ExportDeclaration */ && externalImport.exportClause) {
+ hasExportDeclarationWithExportClause = true;
+ break;
+ }
+ }
+ if (!hasExportDeclarationWithExportClause) {
+ // we still need to emit exportStar helper
+ var exportStarFunction_1 = createExportStarFunction(/*localNames*/ undefined);
+ statements.push(exportStarFunction_1);
+ return exportStarFunction_1.name;
+ }
+ }
+ var exportedNames = [];
+ if (moduleInfo.exportedNames) {
+ for (var _b = 0, _c = moduleInfo.exportedNames; _b < _c.length; _b++) {
+ var exportedLocalName = _c[_b];
+ if (exportedLocalName.text === "default") {
+ continue;
+ }
+ // write name of exported declaration, i.e 'export var x...'
+ exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createLiteral(true)));
+ }
+ }
+ for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) {
+ var externalImport = _e[_d];
+ if (externalImport.kind !== 240 /* ExportDeclaration */) {
+ continue;
+ }
+ var exportDecl = externalImport;
+ if (!exportDecl.exportClause) {
+ // export * from ...
+ continue;
+ }
+ for (var _f = 0, _g = exportDecl.exportClause.elements; _f < _g.length; _f++) {
+ var element = _g[_f];
+ // write name of indirectly exported entry, i.e. 'export {x} from ...'
+ exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createLiteral(true)));
+ }
+ }
+ var exportedNamesStorageRef = ts.createUniqueName("exportedNames");
+ statements.push(ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(exportedNamesStorageRef,
+ /*type*/ undefined, ts.createObjectLiteral(exportedNames, /*location*/ undefined, /*multiline*/ true))
+ ])));
+ var exportStarFunction = createExportStarFunction(exportedNamesStorageRef);
+ statements.push(exportStarFunction);
+ return exportStarFunction.name;
+ }
+ /**
+ * Creates an exportStar function for the file, with an optional set of excluded local
+ * names.
+ *
+ * @param localNames An optional reference to an object containing a set of excluded local
+ * names.
+ */
+ function createExportStarFunction(localNames) {
+ var exportStarFunction = ts.createUniqueName("exportStar");
+ var m = ts.createIdentifier("m");
+ var n = ts.createIdentifier("n");
+ var exports = ts.createIdentifier("exports");
+ var condition = ts.createStrictInequality(n, ts.createLiteral("default"));
+ if (localNames) {
+ condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createHasOwnProperty(localNames, n)));
+ }
+ return ts.createFunctionDeclaration(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined,
+ /*asteriskToken*/ undefined, exportStarFunction,
+ /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, m)],
+ /*type*/ undefined, ts.createBlock([
+ ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(exports,
+ /*type*/ undefined, ts.createObjectLiteral([]))
+ ])),
+ ts.createForIn(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(n, /*type*/ undefined)
+ ]), m, ts.createBlock([
+ ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 32 /* SingleLine */)
+ ])),
+ ts.createStatement(ts.createCall(exportFunction,
+ /*typeArguments*/ undefined, [exports]))
+ ],
+ /*location*/ undefined,
+ /*multiline*/ true));
+ }
+ /**
+ * Creates an array setter callbacks for each dependency group.
+ *
+ * @param exportStarFunction A reference to an exportStarFunction for the file.
+ * @param dependencyGroups An array of grouped dependencies.
+ */
+ function createSettersArray(exportStarFunction, dependencyGroups) {
+ var setters = [];
+ for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) {
+ var group = dependencyGroups_1[_i];
+ // derive a unique name for parameter from the first named entry in the group
+ var localName = ts.forEach(group.externalImports, function (i) { return ts.getLocalNameForExternalImport(i, currentSourceFile); });
+ var parameterName = localName ? ts.getGeneratedNameForNode(localName) : ts.createUniqueName("");
+ var statements = [];
+ for (var _a = 0, _b = group.externalImports; _a < _b.length; _a++) {
+ var entry = _b[_a];
+ var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile);
+ switch (entry.kind) {
+ case 234 /* ImportDeclaration */:
+ if (!entry.importClause) {
+ // 'import "..."' case
+ // module is imported only for side-effects, no emit required
+ break;
+ }
+ // fall-through
+ case 233 /* ImportEqualsDeclaration */:
+ ts.Debug.assert(importVariableName !== undefined);
+ // save import into the local
+ statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName)));
+ break;
+ case 240 /* ExportDeclaration */:
+ ts.Debug.assert(importVariableName !== undefined);
+ if (entry.exportClause) {
+ // export {a, b as c} from 'foo'
+ //
+ // emit as:
+ //
+ // exports_({
+ // "a": _["a"],
+ // "c": _["b"]
+ // });
+ var properties = [];
+ for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) {
+ var e = _d[_c];
+ properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text))));
+ }
+ statements.push(ts.createStatement(ts.createCall(exportFunction,
+ /*typeArguments*/ undefined, [ts.createObjectLiteral(properties, /*location*/ undefined, /*multiline*/ true)])));
+ }
+ else {
+ // export * from 'foo'
+ //
+ // emit as:
+ //
+ // exportStar(foo_1_1);
+ statements.push(ts.createStatement(ts.createCall(exportStarFunction,
+ /*typeArguments*/ undefined, [parameterName])));
+ }
+ break;
+ }
+ }
+ setters.push(ts.createFunctionExpression(
+ /*modifiers*/ undefined,
+ /*asteriskToken*/ undefined,
+ /*name*/ undefined,
+ /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)],
+ /*type*/ undefined, ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true)));
+ }
+ return ts.createArrayLiteral(setters, /*location*/ undefined, /*multiLine*/ true);
+ }
+ //
+ // Top-level Source Element Visitors
+ //
+ /**
+ * Visit source elements at the top-level of a module.
+ *
+ * @param node The node to visit.
+ */
+ function sourceElementVisitor(node) {
+ switch (node.kind) {
+ case 234 /* ImportDeclaration */:
+ return visitImportDeclaration(node);
+ case 233 /* ImportEqualsDeclaration */:
+ return visitImportEqualsDeclaration(node);
+ case 240 /* ExportDeclaration */:
+ // ExportDeclarations are elided as they are handled via
+ // `appendExportsOfDeclaration`.
+ return undefined;
+ case 239 /* ExportAssignment */:
+ return visitExportAssignment(node);
+ default:
+ return nestedElementVisitor(node);
+ }
+ }
+ /**
+ * Visits an ImportDeclaration node.
+ *
+ * @param node The node to visit.
+ */
+ function visitImportDeclaration(node) {
+ var statements;
+ if (node.importClause) {
+ hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile));
+ }
+ if (hasAssociatedEndOfDeclarationMarker(node)) {
+ // Defer exports until we encounter an EndOfDeclarationMarker node
+ var id = ts.getOriginalNodeId(node);
+ deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node);
+ }
+ else {
+ statements = appendExportsOfImportDeclaration(statements, node);
+ }
+ return ts.singleOrMany(statements);
+ }
+ /**
+ * Visits an ImportEqualsDeclaration node.
+ *
+ * @param node The node to visit.
+ */
+ function visitImportEqualsDeclaration(node) {
+ ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer.");
+ var statements;
+ hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile));
+ if (hasAssociatedEndOfDeclarationMarker(node)) {
+ // Defer exports until we encounter an EndOfDeclarationMarker node
+ var id = ts.getOriginalNodeId(node);
+ deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node);
+ }
+ else {
+ statements = appendExportsOfImportEqualsDeclaration(statements, node);
+ }
+ return ts.singleOrMany(statements);
+ }
+ /**
+ * Visits an ExportAssignment node.
+ *
+ * @param node The node to visit.
+ */
+ function visitExportAssignment(node) {
+ if (node.isExportEquals) {
+ // Elide `export=` as it is illegal in a SystemJS module.
+ return undefined;
+ }
+ var expression = ts.visitNode(node.expression, destructuringVisitor, ts.isExpression);
+ var original = node.original;
+ if (original && hasAssociatedEndOfDeclarationMarker(original)) {
+ // Defer exports until we encounter an EndOfDeclarationMarker node
+ var id = ts.getOriginalNodeId(node);
+ deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), expression, /*allowComments*/ true);
+ }
+ else {
+ return createExportStatement(ts.createIdentifier("default"), expression, /*allowComments*/ true);
+ }
+ }
+ /**
+ * Visits a FunctionDeclaration, hoisting it to the outer module body function.
+ *
+ * @param node The node to visit.
+ */
+ function visitFunctionDeclaration(node) {
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ hoistedStatements = ts.append(hoistedStatements, ts.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true),
+ /*typeParameters*/ undefined, ts.visitNodes(node.parameters, destructuringVisitor, ts.isParameterDeclaration),
+ /*type*/ undefined, ts.visitNode(node.body, destructuringVisitor, ts.isBlock)));
+ }
+ else {
+ hoistedStatements = ts.append(hoistedStatements, node);
+ }
+ if (hasAssociatedEndOfDeclarationMarker(node)) {
+ // Defer exports until we encounter an EndOfDeclarationMarker node
+ var id = ts.getOriginalNodeId(node);
+ deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);
+ }
+ else {
+ hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node);
+ }
+ return undefined;
+ }
+ /**
+ * Visits a ClassDeclaration, hoisting its name to the outer module body function.
+ *
+ * @param node The node to visit.
+ */
+ function visitClassDeclaration(node) {
+ var statements;
+ // Hoist the name of the class declaration to the outer module body function.
+ var name = ts.getLocalName(node);
+ hoistVariableDeclaration(name);
+ // Rewrite the class declaration into an assignment of a class expression.
+ statements = ts.append(statements, ts.createStatement(ts.createAssignment(name, ts.createClassExpression(
+ /*modifiers*/ undefined, node.name,
+ /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, destructuringVisitor, ts.isHeritageClause), ts.visitNodes(node.members, destructuringVisitor, ts.isClassElement),
+ /*location*/ node)),
+ /*location*/ node));
+ if (hasAssociatedEndOfDeclarationMarker(node)) {
+ // Defer exports until we encounter an EndOfDeclarationMarker node
+ var id = ts.getOriginalNodeId(node);
+ deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);
+ }
+ else {
+ statements = appendExportsOfHoistedDeclaration(statements, node);
+ }
+ return ts.singleOrMany(statements);
+ }
+ /**
+ * Visits a variable statement, hoisting declared names to the top-level module body.
+ * Each declaration is rewritten into an assignment expression.
+ *
+ * @param node The node to visit.
+ */
+ function visitVariableStatement(node) {
+ if (!shouldHoistVariableDeclarationList(node.declarationList)) {
+ return ts.visitNode(node, destructuringVisitor, ts.isStatement);
+ }
+ var expressions;
+ var isExportedDeclaration = ts.hasModifier(node, 1 /* Export */);
+ var isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node);
+ for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
+ var variable = _a[_i];
+ if (variable.initializer) {
+ expressions = ts.append(expressions, transformInitializedVariable(variable, isExportedDeclaration && !isMarkedDeclaration));
+ }
+ else {
+ hoistBindingElement(variable);
+ }
+ }
+ var statements;
+ if (expressions) {
+ statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), /*location*/ node));
+ }
+ if (isMarkedDeclaration) {
+ // Defer exports until we encounter an EndOfDeclarationMarker node
+ var id = ts.getOriginalNodeId(node);
+ deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration);
+ }
+ else {
+ statements = appendExportsOfVariableStatement(statements, node, /*exportSelf*/ false);
+ }
+ return ts.singleOrMany(statements);
+ }
+ /**
+ * Hoists the declared names of a VariableDeclaration or BindingElement.
+ *
+ * @param node The declaration to hoist.
+ */
+ function hoistBindingElement(node) {
+ if (ts.isBindingPattern(node.name)) {
+ for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) {
+ var element = _a[_i];
+ if (!ts.isOmittedExpression(element)) {
+ hoistBindingElement(element);
+ }
+ }
+ }
+ else {
+ hoistVariableDeclaration(ts.getSynthesizedClone(node.name));
+ }
+ }
+ /**
+ * Determines whether a VariableDeclarationList should be hoisted.
+ *
+ * @param node The node to test.
+ */
+ function shouldHoistVariableDeclarationList(node) {
+ // hoist only non-block scoped declarations or block scoped declarations parented by source file
+ return (ts.getEmitFlags(node) & 16777216 /* NoHoisting */) === 0
+ && (enclosingBlockScopedContainer.kind === 260 /* SourceFile */
+ || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0);
+ }
+ /**
+ * Transform an initialized variable declaration into an expression.
+ *
+ * @param node The node to transform.
+ * @param isExportedDeclaration A value indicating whether the variable is exported.
+ */
+ function transformInitializedVariable(node, isExportedDeclaration) {
+ var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment;
+ return ts.isBindingPattern(node.name)
+ ? ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createAssignment, destructuringVisitor)
+ : createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression));
+ }
+ /**
+ * Creates an assignment expression for an exported variable declaration.
+ *
+ * @param name The name of the variable.
+ * @param value The value of the variable's initializer.
+ * @param location The source map location for the assignment.
+ */
+ function createExportedVariableAssignment(name, value, location) {
+ return createVariableAssignment(name, value, location, /*isExportedDeclaration*/ true);
+ }
+ /**
+ * Creates an assignment expression for a non-exported variable declaration.
+ *
+ * @param name The name of the variable.
+ * @param value The value of the variable's initializer.
+ * @param location The source map location for the assignment.
+ */
+ function createNonExportedVariableAssignment(name, value, location) {
+ return createVariableAssignment(name, value, location, /*isExportedDeclaration*/ false);
+ }
+ /**
+ * Creates an assignment expression for a variable declaration.
+ *
+ * @param name The name of the variable.
+ * @param value The value of the variable's initializer.
+ * @param location The source map location for the assignment.
+ * @param isExportedDeclaration A value indicating whether the variable is exported.
+ */
+ function createVariableAssignment(name, value, location, isExportedDeclaration) {
+ hoistVariableDeclaration(ts.getSynthesizedClone(name));
+ return isExportedDeclaration
+ ? createExportExpression(name, preventSubstitution(ts.createAssignment(name, value, location)))
+ : preventSubstitution(ts.createAssignment(name, value, location));
+ }
+ /**
+ * Visits a MergeDeclarationMarker used as a placeholder for the beginning of a merged
+ * and transformed declaration.
+ *
+ * @param node The node to visit.
+ */
+ function visitMergeDeclarationMarker(node) {
+ // For an EnumDeclaration or ModuleDeclaration that merges with a preceeding
+ // declaration we do not emit a leading variable declaration. To preserve the
+ // begin/end semantics of the declararation and to properly handle exports
+ // we wrapped the leading variable declaration in a `MergeDeclarationMarker`.
+ //
+ // To balance the declaration, we defer the exports of the elided variable
+ // statement until we visit this declaration's `EndOfDeclarationMarker`.
+ if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 204 /* VariableStatement */) {
+ var id = ts.getOriginalNodeId(node);
+ var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */);
+ deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration);
+ }
+ return node;
+ }
+ /**
+ * Determines whether a node has an associated EndOfDeclarationMarker.
+ *
+ * @param node The node to test.
+ */
+ function hasAssociatedEndOfDeclarationMarker(node) {
+ return (ts.getEmitFlags(node) & 33554432 /* HasEndOfDeclarationMarker */) !== 0;
+ }
+ /**
+ * Visits a DeclarationMarker used as a placeholder for the end of a transformed
+ * declaration.
+ *
+ * @param node The node to visit.
+ */
+ function visitEndOfDeclarationMarker(node) {
+ // For some transformations we emit an `EndOfDeclarationMarker` to mark the actual
+ // end of the transformed declaration. We use this marker to emit any deferred exports
+ // of the declaration.
+ var id = ts.getOriginalNodeId(node);
+ var statements = deferredExports[id];
+ if (statements) {
+ delete deferredExports[id];
+ return ts.append(statements, node);
+ }
+ return node;
+ }
+ /**
+ * Appends the exports of an ImportDeclaration to a statement list, returning the
+ * statement list.
+ *
+ * @param statements A statement list to which the down-level export statements are to be
+ * appended. If `statements` is `undefined`, a new array is allocated if statements are
+ * appended.
+ * @param decl The declaration whose exports are to be recorded.
+ */
+ function appendExportsOfImportDeclaration(statements, decl) {
+ if (moduleInfo.exportEquals) {
+ return statements;
+ }
+ var importClause = decl.importClause;
+ if (!importClause) {
+ return statements;
+ }
+ if (importClause.name) {
+ statements = appendExportsOfDeclaration(statements, importClause);
+ }
+ var namedBindings = importClause.namedBindings;
+ if (namedBindings) {
+ switch (namedBindings.kind) {
+ case 236 /* NamespaceImport */:
+ statements = appendExportsOfDeclaration(statements, namedBindings);
+ break;
+ case 237 /* NamedImports */:
+ for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {
+ var importBinding = _a[_i];
+ statements = appendExportsOfDeclaration(statements, importBinding);
+ }
+ break;
+ }
+ }
+ return statements;
+ }
+ /**
+ * Appends the export of an ImportEqualsDeclaration to a statement list, returning the
+ * statement list.
+ *
+ * @param statements A statement list to which the down-level export statements are to be
+ * appended. If `statements` is `undefined`, a new array is allocated if statements are
+ * appended.
+ * @param decl The declaration whose exports are to be recorded.
+ */
+ function appendExportsOfImportEqualsDeclaration(statements, decl) {
+ if (moduleInfo.exportEquals) {
+ return statements;
+ }
+ return appendExportsOfDeclaration(statements, decl);
+ }
+ /**
+ * Appends the exports of a VariableStatement to a statement list, returning the statement
+ * list.
+ *
+ * @param statements A statement list to which the down-level export statements are to be
+ * appended. If `statements` is `undefined`, a new array is allocated if statements are
+ * appended.
+ * @param node The VariableStatement whose exports are to be recorded.
+ * @param exportSelf A value indicating whether to also export each VariableDeclaration of
+ * `nodes` declaration list.
+ */
+ function appendExportsOfVariableStatement(statements, node, exportSelf) {
+ if (moduleInfo.exportEquals) {
+ return statements;
+ }
+ for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
+ var decl = _a[_i];
+ if (decl.initializer || exportSelf) {
+ statements = appendExportsOfBindingElement(statements, decl, exportSelf);
+ }
+ }
+ return statements;
+ }
+ /**
+ * Appends the exports of a VariableDeclaration or BindingElement to a statement list,
+ * returning the statement list.
+ *
+ * @param statements A statement list to which the down-level export statements are to be
+ * appended. If `statements` is `undefined`, a new array is allocated if statements are
+ * appended.
+ * @param decl The declaration whose exports are to be recorded.
+ * @param exportSelf A value indicating whether to also export the declaration itself.
+ */
+ function appendExportsOfBindingElement(statements, decl, exportSelf) {
+ if (moduleInfo.exportEquals) {
+ return statements;
+ }
+ if (ts.isBindingPattern(decl.name)) {
+ for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {
+ var element = _a[_i];
+ if (!ts.isOmittedExpression(element)) {
+ statements = appendExportsOfBindingElement(statements, element, exportSelf);
+ }
+ }
+ }
+ else if (!ts.isGeneratedIdentifier(decl.name)) {
+ var excludeName = void 0;
+ if (exportSelf) {
+ statements = appendExportStatement(statements, decl.name, ts.getLocalName(decl));
+ excludeName = decl.name.text;
+ }
+ statements = appendExportsOfDeclaration(statements, decl, excludeName);
+ }
+ return statements;
+ }
+ /**
+ * Appends the exports of a ClassDeclaration or FunctionDeclaration to a statement list,
+ * returning the statement list.
+ *
+ * @param statements A statement list to which the down-level export statements are to be
+ * appended. If `statements` is `undefined`, a new array is allocated if statements are
+ * appended.
+ * @param decl The declaration whose exports are to be recorded.
+ */
+ function appendExportsOfHoistedDeclaration(statements, decl) {
+ if (moduleInfo.exportEquals) {
+ return statements;
+ }
+ var excludeName;
+ if (ts.hasModifier(decl, 1 /* Export */)) {
+ var exportName = ts.hasModifier(decl, 512 /* Default */) ? ts.createLiteral("default") : decl.name;
+ statements = appendExportStatement(statements, exportName, ts.getLocalName(decl));
+ excludeName = exportName.text;
+ }
+ if (decl.name) {
+ statements = appendExportsOfDeclaration(statements, decl, excludeName);
+ }
+ return statements;
+ }
+ /**
+ * Appends the exports of a declaration to a statement list, returning the statement list.
+ *
+ * @param statements A statement list to which the down-level export statements are to be
+ * appended. If `statements` is `undefined`, a new array is allocated if statements are
+ * appended.
+ * @param decl The declaration to export.
+ * @param excludeName An optional name to exclude from exports.
+ */
+ function appendExportsOfDeclaration(statements, decl, excludeName) {
+ if (moduleInfo.exportEquals) {
+ return statements;
+ }
+ var name = ts.getDeclarationName(decl);
+ var exportSpecifiers = moduleInfo.exportSpecifiers[name.text];
+ if (exportSpecifiers) {
+ for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) {
+ var exportSpecifier = exportSpecifiers_1[_i];
+ if (exportSpecifier.name.text !== excludeName) {
+ statements = appendExportStatement(statements, exportSpecifier.name, name);
+ }
+ }
+ }
+ return statements;
+ }
+ /**
+ * Appends the down-level representation of an export to a statement list, returning the
+ * statement list.
+ *
+ * @param statements A statement list to which the down-level export statements are to be
+ * appended. If `statements` is `undefined`, a new array is allocated if statements are
+ * appended.
+ * @param exportName The name of the export.
+ * @param expression The expression to export.
+ * @param allowComments Whether to allow comments on the export.
+ */
+ function appendExportStatement(statements, exportName, expression, allowComments) {
+ statements = ts.append(statements, createExportStatement(exportName, expression, allowComments));
+ return statements;
+ }
+ /**
+ * Creates a call to the current file's export function to export a value.
+ *
+ * @param name The bound name of the export.
+ * @param value The exported value.
+ * @param allowComments An optional value indicating whether to emit comments for the statement.
+ */
+ function createExportStatement(name, value, allowComments) {
+ var statement = ts.createStatement(createExportExpression(name, value));
+ ts.startOnNewLine(statement);
+ if (!allowComments) {
+ ts.setEmitFlags(statement, 49152 /* NoComments */);
+ }
+ return statement;
+ }
+ /**
+ * Creates a call to the current file's export function to export a value.
+ *
+ * @param name The bound name of the export.
+ * @param value The exported value.
+ */
+ function createExportExpression(name, value) {
+ var exportName = ts.isIdentifier(name) ? ts.createLiteral(name) : name;
+ return ts.createCall(exportFunction, /*typeArguments*/ undefined, [exportName, value]);
+ }
+ //
+ // Top-Level or Nested Source Element Visitors
+ //
+ /**
+ * Visit nested elements at the top-level of a module.
+ *
+ * @param node The node to visit.
+ */
+ function nestedElementVisitor(node) {
+ switch (node.kind) {
+ case 204 /* VariableStatement */:
+ return visitVariableStatement(node);
+ case 224 /* FunctionDeclaration */:
+ return visitFunctionDeclaration(node);
+ case 225 /* ClassDeclaration */:
+ return visitClassDeclaration(node);
+ case 210 /* ForStatement */:
+ return visitForStatement(node);
+ case 211 /* ForInStatement */:
+ return visitForInStatement(node);
+ case 212 /* ForOfStatement */:
+ return visitForOfStatement(node);
+ case 208 /* DoStatement */:
+ return visitDoStatement(node);
+ case 209 /* WhileStatement */:
+ return visitWhileStatement(node);
+ case 218 /* LabeledStatement */:
+ return visitLabeledStatement(node);
+ case 216 /* WithStatement */:
+ return visitWithStatement(node);
+ case 217 /* SwitchStatement */:
+ return visitSwitchStatement(node);
+ case 231 /* CaseBlock */:
+ return visitCaseBlock(node);
+ case 252 /* CaseClause */:
+ return visitCaseClause(node);
+ case 253 /* DefaultClause */:
+ return visitDefaultClause(node);
+ case 220 /* TryStatement */:
+ return visitTryStatement(node);
+ case 255 /* CatchClause */:
+ return visitCatchClause(node);
+ case 203 /* Block */:
+ return visitBlock(node);
+ case 293 /* MergeDeclarationMarker */:
+ return visitMergeDeclarationMarker(node);
+ case 294 /* EndOfDeclarationMarker */:
+ return visitEndOfDeclarationMarker(node);
+ default:
+ return destructuringVisitor(node);
+ }
+ }
+ /**
+ * Visits the body of a ForStatement to hoist declarations.
+ *
+ * @param node The node to visit.
+ */
+ function visitForStatement(node) {
+ var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;
+ enclosingBlockScopedContainer = node;
+ node = ts.updateFor(node, visitForInitializer(node.initializer), ts.visitNode(node.condition, destructuringVisitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.incrementor, destructuringVisitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement));
+ enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;
+ return node;
+ }
+ /**
+ * Visits the body of a ForInStatement to hoist declarations.
+ *
+ * @param node The node to visit.
+ */
+ function visitForInStatement(node) {
+ var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;
+ enclosingBlockScopedContainer = node;
+ node = ts.updateForIn(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock));
+ enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;
+ return node;
+ }
+ /**
+ * Visits the body of a ForOfStatement to hoist declarations.
+ *
+ * @param node The node to visit.
+ */
+ function visitForOfStatement(node) {
+ var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;
+ enclosingBlockScopedContainer = node;
+ node = ts.updateForOf(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock));
+ enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;
+ return node;
+ }
+ /**
+ * Determines whether to hoist the initializer of a ForStatement, ForInStatement, or
+ * ForOfStatement.
+ *
+ * @param node The node to test.
+ */
+ function shouldHoistForInitializer(node) {
+ return ts.isVariableDeclarationList(node)
+ && shouldHoistVariableDeclarationList(node);
+ }
+ /**
+ * Visits the initializer of a ForStatement, ForInStatement, or ForOfStatement
+ *
+ * @param node The node to visit.
+ */
+ function visitForInitializer(node) {
+ if (shouldHoistForInitializer(node)) {
+ var expressions = void 0;
+ for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) {
+ var variable = _a[_i];
+ expressions = ts.append(expressions, transformInitializedVariable(variable, /*isExportedDeclaration*/ false));
+ }
+ return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression();
+ }
+ else {
+ return ts.visitEachChild(node, nestedElementVisitor, context);
+ }
+ }
+ /**
+ * Visits the body of a DoStatement to hoist declarations.
+ *
+ * @param node The node to visit.
+ */
+ function visitDoStatement(node) {
+ return ts.updateDo(node, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression));
+ }
+ /**
+ * Visits the body of a WhileStatement to hoist declarations.
+ *
+ * @param node The node to visit.
+ */
+ function visitWhileStatement(node) {
+ return ts.updateWhile(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock));
+ }
+ /**
+ * Visits the body of a LabeledStatement to hoist declarations.
+ *
+ * @param node The node to visit.
+ */
+ function visitLabeledStatement(node) {
+ return ts.updateLabel(node, node.label, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock));
+ }
+ /**
+ * Visits the body of a WithStatement to hoist declarations.
+ *
+ * @param node The node to visit.
+ */
+ function visitWithStatement(node) {
+ return ts.updateWith(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock));
+ }
+ /**
+ * Visits the body of a SwitchStatement to hoist declarations.
+ *
+ * @param node The node to visit.
+ */
+ function visitSwitchStatement(node) {
+ return ts.updateSwitch(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.caseBlock, nestedElementVisitor, ts.isCaseBlock));
+ }
+ /**
+ * Visits the body of a CaseBlock to hoist declarations.
+ *
+ * @param node The node to visit.
+ */
+ function visitCaseBlock(node) {
+ var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;
+ enclosingBlockScopedContainer = node;
+ node = ts.updateCaseBlock(node, ts.visitNodes(node.clauses, nestedElementVisitor, ts.isCaseOrDefaultClause));
+ enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;
+ return node;
+ }
+ /**
+ * Visits the body of a CaseClause to hoist declarations.
+ *
+ * @param node The node to visit.
+ */
+ function visitCaseClause(node) {
+ return ts.updateCaseClause(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNodes(node.statements, nestedElementVisitor, ts.isStatement));
+ }
+ /**
+ * Visits the body of a DefaultClause to hoist declarations.
+ *
+ * @param node The node to visit.
+ */
+ function visitDefaultClause(node) {
+ return ts.visitEachChild(node, nestedElementVisitor, context);
+ }
+ /**
+ * Visits the body of a TryStatement to hoist declarations.
+ *
+ * @param node The node to visit.
+ */
+ function visitTryStatement(node) {
+ return ts.visitEachChild(node, nestedElementVisitor, context);
+ }
+ /**
+ * Visits the body of a CatchClause to hoist declarations.
+ *
+ * @param node The node to visit.
+ */
+ function visitCatchClause(node) {
+ var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;
+ enclosingBlockScopedContainer = node;
+ node = ts.updateCatchClause(node, node.variableDeclaration, ts.visitNode(node.block, nestedElementVisitor, ts.isBlock));
+ enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;
+ return node;
+ }
+ /**
+ * Visits the body of a Block to hoist declarations.
+ *
+ * @param node The node to visit.
+ */
+ function visitBlock(node) {
+ var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;
+ enclosingBlockScopedContainer = node;
+ node = ts.visitEachChild(node, nestedElementVisitor, context);
+ enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;
+ return node;
+ }
+ //
+ // Destructuring Assignment Visitors
+ //
+ /**
+ * Visit nodes to flatten destructuring assignments to exported symbols.
+ *
+ * @param node The node to visit.
+ */
+ function destructuringVisitor(node) {
+ if (node.transformFlags & 16384 /* DestructuringAssignment */
+ && node.kind === 191 /* BinaryExpression */) {
+ return visitDestructuringAssignment(node);
+ }
+ else if (node.transformFlags & 32768 /* ContainsDestructuringAssignment */) {
+ return ts.visitEachChild(node, destructuringVisitor, context);
+ }
+ else {
+ return node;
+ }
+ }
+ /**
+ * Visits a DestructuringAssignment to flatten destructuring to exported symbols.
+ *
+ * @param node The node to visit.
+ */
+ function visitDestructuringAssignment(node) {
+ if (hasExportedReferenceInDestructuringTarget(node.left)) {
+ return ts.flattenDestructuringAssignment(context, node, /*needsValue*/ true, hoistVariableDeclaration, destructuringVisitor);
+ }
+ return ts.visitEachChild(node, destructuringVisitor, context);
+ }
+ /**
+ * Determines whether the target of a destructuring assigment refers to an exported symbol.
+ *
+ * @param node The destructuring target.
+ */
+ function hasExportedReferenceInDestructuringTarget(node) {
+ if (ts.isAssignmentExpression(node)) {
+ return hasExportedReferenceInDestructuringTarget(node.left);
+ }
+ else if (ts.isSpreadExpression(node)) {
+ return hasExportedReferenceInDestructuringTarget(node.expression);
+ }
+ else if (ts.isObjectLiteralExpression(node)) {
+ return ts.some(node.properties, hasExportedReferenceInDestructuringTarget);
+ }
+ else if (ts.isArrayLiteralExpression(node)) {
+ return ts.some(node.elements, hasExportedReferenceInDestructuringTarget);
+ }
+ else if (ts.isShorthandPropertyAssignment(node)) {
+ return hasExportedReferenceInDestructuringTarget(node.name);
+ }
+ else if (ts.isPropertyAssignment(node)) {
+ return hasExportedReferenceInDestructuringTarget(node.initializer);
+ }
+ else if (ts.isIdentifier(node)) {
+ var container = resolver.getReferencedExportContainer(node);
+ return container !== undefined && container.kind === 260 /* SourceFile */;
+ }
+ else {
+ return false;
+ }
+ }
+ //
+ // Modifier Visitors
+ //
+ /**
+ * Visit nodes to elide module-specific modifiers.
+ *
+ * @param node The node to visit.
+ */
+ function modifierVisitor(node) {
+ switch (node.kind) {
+ case 83 /* ExportKeyword */:
+ case 78 /* DefaultKeyword */:
+ return undefined;
+ }
+ return node;
+ }
+ //
+ // Emit Notification
+ //
+ /**
+ * Hook for node emit notifications.
+ *
+ * @param emitContext A context hint for the emitter.
+ * @param node The node to emit.
+ * @param emit A callback used to emit the node in the printer.
+ */
+ function onEmitNode(emitContext, node, emitCallback) {
+ if (node.kind === 260 /* SourceFile */) {
+ var id = ts.getOriginalNodeId(node);
+ currentSourceFile = node;
+ moduleInfo = moduleInfoMap[id];
+ exportFunction = exportFunctionsMap[id];
+ noSubstitution = noSubstitutionMap[id];
+ if (noSubstitution) {
+ delete noSubstitutionMap[id];
+ }
+ previousOnEmitNode(emitContext, node, emitCallback);
+ currentSourceFile = undefined;
+ moduleInfo = undefined;
+ exportFunction = undefined;
+ noSubstitution = undefined;
+ }
+ else {
+ previousOnEmitNode(emitContext, node, emitCallback);
+ }
+ }
+ //
+ // Substitutions
+ //
+ /**
+ * Hooks node substitutions.
+ *
+ * @param emitContext A context hint for the emitter.
+ * @param node The node to substitute.
+ */
+ function onSubstituteNode(emitContext, node) {
+ node = previousOnSubstituteNode(emitContext, node);
+ if (isSubstitutionPrevented(node)) {
+ return node;
+ }
+ if (emitContext === 1 /* Expression */) {
+ return substituteExpression(node);
+ }
+ return node;
+ }
+ /**
+ * Substitute the expression, if necessary.
+ *
+ * @param node The node to substitute.
+ */
+ function substituteExpression(node) {
+ switch (node.kind) {
+ case 70 /* Identifier */:
+ return substituteExpressionIdentifier(node);
+ case 191 /* BinaryExpression */:
+ return substituteBinaryExpression(node);
+ case 189 /* PrefixUnaryExpression */:
+ case 190 /* PostfixUnaryExpression */:
+ return substituteUnaryExpression(node);
+ }
+ return node;
+ }
+ /**
+ * Substitution for an Identifier expression that may contain an imported or exported symbol.
+ *
+ * @param node The node to substitute.
+ */
+ function substituteExpressionIdentifier(node) {
+ // When we see an identifier in an expression position that
+ // points to an imported symbol, we should substitute a qualified
+ // reference to the imported symbol if one is needed.
+ //
+ // - We do not substitute generated identifiers for any reason.
+ // - We do not substitute identifiers tagged with the LocalName flag.
+ if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
+ var importDeclaration = resolver.getReferencedImportDeclaration(node);
+ if (importDeclaration) {
+ if (ts.isImportClause(importDeclaration)) {
+ return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"),
+ /*location*/ node);
+ }
+ else if (ts.isImportSpecifier(importDeclaration)) {
+ return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name),
+ /*location*/ node);
+ }
+ }
+ }
+ return node;
+ }
+ /**
+ * Substitution for a BinaryExpression that may contain an imported or exported symbol.
+ *
+ * @param node The node to substitute.
+ */
+ function substituteBinaryExpression(node) {
+ // When we see an assignment expression whose left-hand side is an exported symbol,
+ // we should ensure all exports of that symbol are updated with the correct value.
+ //
+ // - We do not substitute generated identifiers for any reason.
+ // - We do not substitute identifiers tagged with the LocalName flag.
+ // - We do not substitute identifiers that were originally the name of an enum or
+ // namespace due to how they are transformed in TypeScript.
+ // - We only substitute identifiers that are exported at the top level.
+ if (ts.isAssignmentOperator(node.operatorToken.kind)
+ && ts.isIdentifier(node.left)
+ && !ts.isGeneratedIdentifier(node.left)
+ && !ts.isLocalName(node.left)
+ && !ts.isDeclarationNameOfEnumOrNamespace(node.left)) {
+ var exportedNames = getExports(node.left);
+ if (exportedNames) {
+ // For each additional export of the declaration, apply an export assignment.
+ var expression = node;
+ for (var _i = 0, exportedNames_1 = exportedNames; _i < exportedNames_1.length; _i++) {
+ var exportName = exportedNames_1[_i];
+ expression = createExportExpression(exportName, preventSubstitution(expression));
+ }
+ return expression;
+ }
+ }
+ return node;
+ }
+ /**
+ * Substitution for a UnaryExpression that may contain an imported or exported symbol.
+ *
+ * @param node The node to substitute.
+ */
+ function substituteUnaryExpression(node) {
+ // When we see a prefix or postfix increment expression whose operand is an exported
+ // symbol, we should ensure all exports of that symbol are updated with the correct
+ // value.
+ //
+ // - We do not substitute generated identifiers for any reason.
+ // - We do not substitute identifiers tagged with the LocalName flag.
+ // - We do not substitute identifiers that were originally the name of an enum or
+ // namespace due to how they are transformed in TypeScript.
+ // - We only substitute identifiers that are exported at the top level.
+ if ((node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */)
+ && ts.isIdentifier(node.operand)
+ && !ts.isGeneratedIdentifier(node.operand)
+ && !ts.isLocalName(node.operand)
+ && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {
+ var exportedNames = getExports(node.operand);
+ if (exportedNames) {
+ var expression = node.kind === 190 /* PostfixUnaryExpression */
+ ? ts.createPrefix(node.operator, node.operand,
+ /*location*/ node)
+ : node;
+ for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) {
+ var exportName = exportedNames_2[_i];
+ expression = createExportExpression(exportName, preventSubstitution(expression));
+ }
+ if (node.kind === 190 /* PostfixUnaryExpression */) {
+ expression = node.operator === 42 /* PlusPlusToken */
+ ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1))
+ : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1));
+ }
+ return expression;
+ }
+ }
+ return node;
+ }
+ /**
+ * Gets the exports of a name.
+ *
+ * @param name The name.
+ */
+ function getExports(name) {
+ var exportedNames;
+ if (!ts.isGeneratedIdentifier(name)) {
+ var valueDeclaration = resolver.getReferencedImportDeclaration(name)
+ || resolver.getReferencedValueDeclaration(name);
+ if (valueDeclaration) {
+ var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false);
+ if (exportContainer && exportContainer.kind === 260 /* SourceFile */) {
+ exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration));
+ }
+ exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]);
+ }
+ }
+ return exportedNames;
+ }
+ /**
+ * Prevent substitution of a node for this transformer.
+ *
+ * @param node The node which should not be substituted.
+ */
+ function preventSubstitution(node) {
+ if (noSubstitution === undefined)
+ noSubstitution = ts.createMap();
+ noSubstitution[ts.getNodeId(node)] = true;
+ return node;
+ }
+ /**
+ * Determines whether a node should not be substituted.
+ *
+ * @param node The node to test.
+ */
+ function isSubstitutionPrevented(node) {
+ return noSubstitution && node.id && noSubstitution[node.id];
+ }
+ }
+ ts.transformSystemModule = transformSystemModule;
+})(ts || (ts = {}));
+///
+///
+/*@internal*/
+var ts;
+(function (ts) {
+ function transformModule(context) {
+ var transformModuleDelegates = ts.createMap((_a = {},
+ _a[ts.ModuleKind.None] = transformCommonJSModule,
+ _a[ts.ModuleKind.CommonJS] = transformCommonJSModule,
+ _a[ts.ModuleKind.AMD] = transformAMDModule,
+ _a[ts.ModuleKind.UMD] = transformUMDModule,
+ _a));
+ var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var compilerOptions = context.getCompilerOptions();
+ var resolver = context.getEmitResolver();
+ var host = context.getEmitHost();
+ var languageVersion = ts.getEmitScriptTarget(compilerOptions);
+ var moduleKind = ts.getEmitModuleKind(compilerOptions);
+ var previousOnSubstituteNode = context.onSubstituteNode;
+ var previousOnEmitNode = context.onEmitNode;
+ context.onSubstituteNode = onSubstituteNode;
+ context.onEmitNode = onEmitNode;
+ context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols.
+ context.enableSubstitution(191 /* BinaryExpression */); // Substitutes assignments to exported symbols.
+ context.enableSubstitution(189 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(190 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(257 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols.
+ context.enableEmitNotification(260 /* SourceFile */); // Restore state when substituting nodes in a file.
+ var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file.
+ var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found.
+ var currentSourceFile; // The current file.
+ var currentModuleInfo; // The ExternalModuleInfo for the current file.
+ var noSubstitution; // Set of nodes for which substitution rules should be ignored.
+ return transformSourceFile;
+ /**
+ * Transforms the module aspects of a SourceFile.
+ *
+ * @param node The SourceFile node.
+ */
+ function transformSourceFile(node) {
+ if (ts.isDeclarationFile(node)
+ || !(ts.isExternalModule(node)
+ || compilerOptions.isolatedModules)) {
+ return node;
+ }
+ currentSourceFile = node;
+ currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver);
+ // Perform the transformation.
+ var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None];
+ var updated = transformModule(node);
+ currentSourceFile = undefined;
+ currentModuleInfo = undefined;
+ return ts.aggregateTransformFlags(updated);
+ }
+ /**
+ * Transforms a SourceFile into a CommonJS module.
+ *
+ * @param node The SourceFile node.
+ */
+ function transformCommonJSModule(node) {
+ startLexicalEnvironment();
+ var statements = [];
+ var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor);
+ ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
+ ts.addRange(statements, endLexicalEnvironment());
+ addExportEqualsIfNeeded(statements, /*emitAsReturn*/ false);
+ var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
+ if (currentModuleInfo.hasExportStarsToExportValues) {
+ ts.setEmitFlags(updated, 2 /* EmitExportStar */ | ts.getEmitFlags(node));
+ }
+ return updated;
+ }
+ /**
+ * Transforms a SourceFile into an AMD module.
+ *
+ * @param node The SourceFile node.
+ */
+ function transformAMDModule(node) {
+ var define = ts.createIdentifier("define");
+ var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);
+ return transformAsynchronousModule(node, define, moduleName, /*includeNonAmdDependencies*/ true);
+ }
+ /**
+ * Transforms a SourceFile into a UMD module.
+ *
+ * @param node The SourceFile node.
+ */
+ function transformUMDModule(node) {
+ var define = ts.createIdentifier("define");
+ ts.setEmitFlags(define, 16 /* UMDDefine */);
+ return transformAsynchronousModule(node, define, /*moduleName*/ undefined, /*includeNonAmdDependencies*/ false);
+ }
+ /**
+ * Transforms a SourceFile into an AMD or UMD module.
+ *
+ * @param node The SourceFile node.
+ * @param define The expression used to define the module.
+ * @param moduleName An expression for the module name, if available.
+ * @param includeNonAmdDependencies A value indicating whether to incldue any non-AMD dependencies.
+ */
+ function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) {
+ // An AMD define function has the following shape:
+ //
+ // define(id?, dependencies?, factory);
+ //
+ // This has the shape of the following:
+ //
+ // define(name, ["module1", "module2"], function (module1Alias) { ... }
+ //
+ // The location of the alias in the parameter list in the factory function needs to
+ // match the position of the module name in the dependency list.
+ //
+ // To ensure this is true in cases of modules with no aliases, e.g.:
+ //
+ // import "module"
+ //
+ // or
+ //
+ // ///
+ //
+ // we need to add modules without alias names to the end of the dependencies list
+ var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames;
+ // Create an updated SourceFile:
+ //
+ // define(moduleName?, ["module1", "module2"], function ...
+ return ts.updateSourceFileNode(node, ts.createNodeArray([
+ ts.createStatement(ts.createCall(define,
+ /*typeArguments*/ undefined, (moduleName ? [moduleName] : []).concat([
+ // Add the dependency array argument:
+ //
+ // ["require", "exports", module1", "module2", ...]
+ ts.createArrayLiteral([
+ ts.createLiteral("require"),
+ ts.createLiteral("exports")
+ ].concat(aliasedModuleNames, unaliasedModuleNames)),
+ // Add the module body function argument:
+ //
+ // function (require, exports, module1, module2) ...
+ ts.createFunctionExpression(
+ /*modifiers*/ undefined,
+ /*asteriskToken*/ undefined,
+ /*name*/ undefined,
+ /*typeParameters*/ undefined, [
+ ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "require"),
+ ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "exports")
+ ].concat(importAliasNames),
+ /*type*/ undefined, transformAsynchronousModuleBody(node))
+ ])))
+ ],
+ /*location*/ node.statements));
+ }
+ /**
+ * Collect the additional asynchronous dependencies for the module.
+ *
+ * @param node The source file.
+ * @param includeNonAmdDependencies A value indicating whether to include non-AMD dependencies.
+ */
+ function collectAsynchronousDependencies(node, includeNonAmdDependencies) {
+ // names of modules with corresponding parameter in the factory function
+ var aliasedModuleNames = [];
+ // names of modules with no corresponding parameters in factory function
+ var unaliasedModuleNames = [];
+ // names of the parameters in the factory function; these
+ // parameters need to match the indexes of the corresponding
+ // module names in aliasedModuleNames.
+ var importAliasNames = [];
+ // Fill in amd-dependency tags
+ for (var _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) {
+ var amdDependency = _a[_i];
+ if (amdDependency.name) {
+ aliasedModuleNames.push(ts.createLiteral(amdDependency.path));
+ importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, amdDependency.name));
+ }
+ else {
+ unaliasedModuleNames.push(ts.createLiteral(amdDependency.path));
+ }
+ }
+ for (var _b = 0, _c = currentModuleInfo.externalImports; _b < _c.length; _b++) {
+ var importNode = _c[_b];
+ // Find the name of the external module
+ var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);
+ // Find the name of the module alias, if there is one
+ var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile);
+ if (includeNonAmdDependencies && importAliasName) {
+ // Set emitFlags on the name of the classDeclaration
+ // This is so that when printer will not substitute the identifier
+ ts.setEmitFlags(importAliasName, 128 /* NoSubstitution */);
+ aliasedModuleNames.push(externalModuleName);
+ importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, importAliasName));
+ }
+ else {
+ unaliasedModuleNames.push(externalModuleName);
+ }
+ }
+ return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames };
+ }
+ /**
+ * Transforms a SourceFile into an AMD or UMD module body.
+ *
+ * @param node The SourceFile node.
+ */
+ function transformAsynchronousModuleBody(node) {
+ startLexicalEnvironment();
+ var statements = [];
+ var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor);
+ // Visit each statement of the module body.
+ ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
+ // End the lexical environment for the module body
+ // and merge any new lexical declarations.
+ ts.addRange(statements, endLexicalEnvironment());
+ // Append the 'export =' statement if provided.
+ addExportEqualsIfNeeded(statements, /*emitAsReturn*/ true);
+ var body = ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true);
+ if (currentModuleInfo.hasExportStarsToExportValues) {
+ // If we have any `export * from ...` declarations
+ // we need to inform the emitter to add the __export helper.
+ ts.setEmitFlags(body, 2 /* EmitExportStar */);
+ }
+ return body;
+ }
+ /**
+ * Adds the down-level representation of `export=` to the statement list if one exists
+ * in the source file.
+ *
+ * @param statements The Statement list to modify.
+ * @param emitAsReturn A value indicating whether to emit the `export=` statement as a
+ * return statement.
+ */
+ function addExportEqualsIfNeeded(statements, emitAsReturn) {
+ if (currentModuleInfo.exportEquals) {
+ if (emitAsReturn) {
+ var statement = ts.createReturn(currentModuleInfo.exportEquals.expression,
+ /*location*/ currentModuleInfo.exportEquals);
+ ts.setEmitFlags(statement, 12288 /* NoTokenSourceMaps */ | 49152 /* NoComments */);
+ statements.push(statement);
+ }
+ else {
+ var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression),
+ /*location*/ currentModuleInfo.exportEquals);
+ ts.setEmitFlags(statement, 49152 /* NoComments */);
+ statements.push(statement);
+ }
+ }
+ }
+ //
+ // Top-Level Source Element Visitors
+ //
+ /**
+ * Visits a node at the top level of the source file.
+ *
+ * @param node The node to visit.
+ */
+ function sourceElementVisitor(node) {
+ switch (node.kind) {
+ case 234 /* ImportDeclaration */:
+ return visitImportDeclaration(node);
+ case 233 /* ImportEqualsDeclaration */:
+ return visitImportEqualsDeclaration(node);
+ case 240 /* ExportDeclaration */:
+ return visitExportDeclaration(node);
+ case 239 /* ExportAssignment */:
+ return visitExportAssignment(node);
+ case 204 /* VariableStatement */:
+ return visitVariableStatement(node);
+ case 224 /* FunctionDeclaration */:
+ return visitFunctionDeclaration(node);
+ case 225 /* ClassDeclaration */:
+ return visitClassDeclaration(node);
+ case 293 /* MergeDeclarationMarker */:
+ return visitMergeDeclarationMarker(node);
+ case 294 /* EndOfDeclarationMarker */:
+ return visitEndOfDeclarationMarker(node);
+ default:
+ // This visitor does not descend into the tree, as export/import statements
+ // are only transformed at the top level of a file.
+ return node;
+ }
+ }
+ /**
+ * Visits an ImportDeclaration node.
+ *
+ * @param node The node to visit.
+ */
+ function visitImportDeclaration(node) {
+ var statements;
+ var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);
+ if (moduleKind !== ts.ModuleKind.AMD) {
+ if (!node.importClause) {
+ // import "mod";
+ return ts.createStatement(createRequireCall(node), /*location*/ node);
+ }
+ else {
+ var variables = [];
+ if (namespaceDeclaration && !ts.isDefaultImport(node)) {
+ // import * as n from "mod";
+ variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name),
+ /*type*/ undefined, createRequireCall(node)));
+ }
+ else {
+ // import d from "mod";
+ // import { x, y } from "mod";
+ // import d, { x, y } from "mod";
+ // import d, * as n from "mod";
+ variables.push(ts.createVariableDeclaration(ts.getGeneratedNameForNode(node),
+ /*type*/ undefined, createRequireCall(node)));
+ if (namespaceDeclaration && ts.isDefaultImport(node)) {
+ variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name),
+ /*type*/ undefined, ts.getGeneratedNameForNode(node)));
+ }
+ }
+ statements = ts.append(statements, ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.createVariableDeclarationList(variables,
+ /*location*/ undefined, languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */),
+ /*location*/ node));
+ }
+ }
+ else if (namespaceDeclaration && ts.isDefaultImport(node)) {
+ // import d, * as n from "mod";
+ statements = ts.append(statements, ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name),
+ /*type*/ undefined, ts.getGeneratedNameForNode(node),
+ /*location*/ node)
+ ],
+ /*location*/ undefined, languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */)));
+ }
+ if (hasAssociatedEndOfDeclarationMarker(node)) {
+ // Defer exports until we encounter an EndOfDeclarationMarker node
+ var id = ts.getOriginalNodeId(node);
+ deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node);
+ }
+ else {
+ statements = appendExportsOfImportDeclaration(statements, node);
+ }
+ return ts.singleOrMany(statements);
+ }
+ /**
+ * Creates a `require()` call to import an external module.
+ *
+ * @param importNode The declararation to import.
+ */
+ function createRequireCall(importNode) {
+ var moduleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);
+ var args = [];
+ if (moduleName) {
+ args.push(moduleName);
+ }
+ return ts.createCall(ts.createIdentifier("require"), /*typeArguments*/ undefined, args);
+ }
+ /**
+ * Visits an ImportEqualsDeclaration node.
+ *
+ * @param node The node to visit.
+ */
+ function visitImportEqualsDeclaration(node) {
+ ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer.");
+ var statements;
+ if (moduleKind !== ts.ModuleKind.AMD) {
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ statements = ts.append(statements, ts.createStatement(createExportExpression(node.name, createRequireCall(node)),
+ /*location*/ node));
+ }
+ else {
+ statements = ts.append(statements, ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(ts.getSynthesizedClone(node.name),
+ /*type*/ undefined, createRequireCall(node))
+ ],
+ /*location*/ undefined,
+ /*flags*/ languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */),
+ /*location*/ node));
+ }
+ }
+ else {
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ statements = ts.append(statements, ts.createStatement(createExportExpression(ts.getExportName(node), ts.getLocalName(node)),
+ /*location*/ node));
+ }
+ }
+ if (hasAssociatedEndOfDeclarationMarker(node)) {
+ // Defer exports until we encounter an EndOfDeclarationMarker node
+ var id = ts.getOriginalNodeId(node);
+ deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node);
+ }
+ else {
+ statements = appendExportsOfImportEqualsDeclaration(statements, node);
+ }
+ return ts.singleOrMany(statements);
+ }
+ /**
+ * Visits an ExportDeclaration node.
+ *
+ * @param The node to visit.
+ */
+ function visitExportDeclaration(node) {
+ if (!node.moduleSpecifier) {
+ // Elide export declarations with no module specifier as they are handled
+ // elsewhere.
+ return undefined;
+ }
+ var generatedName = ts.getGeneratedNameForNode(node);
+ if (node.exportClause) {
+ var statements = [];
+ // export { x, y } from "mod";
+ if (moduleKind !== ts.ModuleKind.AMD) {
+ statements.push(ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(generatedName,
+ /*type*/ undefined, createRequireCall(node))
+ ]),
+ /*location*/ node));
+ }
+ for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) {
+ var specifier = _a[_i];
+ var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name);
+ statements.push(ts.createStatement(createExportExpression(ts.getExportName(specifier), exportedValue),
+ /*location*/ specifier));
+ }
+ return ts.singleOrMany(statements);
+ }
+ else {
+ // export * from "mod";
+ return ts.createStatement(ts.createCall(ts.createIdentifier("__export"),
+ /*typeArguments*/ undefined, [
+ moduleKind !== ts.ModuleKind.AMD
+ ? createRequireCall(node)
+ : generatedName
+ ]),
+ /*location*/ node);
+ }
+ }
+ /**
+ * Visits an ExportAssignment node.
+ *
+ * @param node The node to visit.
+ */
+ function visitExportAssignment(node) {
+ if (node.isExportEquals) {
+ return undefined;
+ }
+ var statements;
+ var original = node.original;
+ if (original && hasAssociatedEndOfDeclarationMarker(original)) {
+ // Defer exports until we encounter an EndOfDeclarationMarker node
+ var id = ts.getOriginalNodeId(node);
+ deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true);
+ }
+ else {
+ statements = appendExportStatement(statements, ts.createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true);
+ }
+ return ts.singleOrMany(statements);
+ }
+ /**
+ * Visits a FunctionDeclaration node.
+ *
+ * @param node The node to visit.
+ */
+ function visitFunctionDeclaration(node) {
+ var statements;
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ statements = ts.append(statements, ts.setOriginalNode(ts.createFunctionDeclaration(
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true),
+ /*typeParameters*/ undefined, node.parameters,
+ /*type*/ undefined, node.body,
+ /*location*/ node),
+ /*original*/ node));
+ }
+ else {
+ statements = ts.append(statements, node);
+ }
+ if (hasAssociatedEndOfDeclarationMarker(node)) {
+ // Defer exports until we encounter an EndOfDeclarationMarker node
+ var id = ts.getOriginalNodeId(node);
+ deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);
+ }
+ else {
+ statements = appendExportsOfHoistedDeclaration(statements, node);
+ }
+ return ts.singleOrMany(statements);
+ }
+ /**
+ * Visits a ClassDeclaration node.
+ *
+ * @param node The node to visit.
+ */
+ function visitClassDeclaration(node) {
+ var statements;
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ statements = ts.append(statements, ts.setOriginalNode(ts.createClassDeclaration(
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true),
+ /*typeParameters*/ undefined, node.heritageClauses, node.members,
+ /*location*/ node),
+ /*original*/ node));
+ }
+ else {
+ statements = ts.append(statements, node);
+ }
+ if (hasAssociatedEndOfDeclarationMarker(node)) {
+ // Defer exports until we encounter an EndOfDeclarationMarker node
+ var id = ts.getOriginalNodeId(node);
+ deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);
+ }
+ else {
+ statements = appendExportsOfHoistedDeclaration(statements, node);
+ }
+ return ts.singleOrMany(statements);
+ }
+ /**
+ * Visits a VariableStatement node.
+ *
+ * @param node The node to visit.
+ */
+ function visitVariableStatement(node) {
+ var statements;
+ var variables;
+ var expressions;
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ var modifiers = void 0;
+ // If we're exporting these variables, then these just become assignments to 'exports.x'.
+ // We only want to emit assignments for variables with initializers.
+ for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
+ var variable = _a[_i];
+ if (ts.isIdentifier(variable.name) && ts.isLocalName(variable.name)) {
+ if (!modifiers) {
+ modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier);
+ }
+ variables = ts.append(variables, variable);
+ }
+ else if (variable.initializer) {
+ expressions = ts.append(expressions, transformInitializedVariable(variable));
+ }
+ }
+ if (variables) {
+ statements = ts.append(statements, ts.updateVariableStatement(node, modifiers, ts.updateVariableDeclarationList(node.declarationList, variables)));
+ }
+ if (expressions) {
+ statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), /*location*/ node));
+ }
+ }
+ else {
+ statements = ts.append(statements, node);
+ }
+ if (hasAssociatedEndOfDeclarationMarker(node)) {
+ // Defer exports until we encounter an EndOfDeclarationMarker node
+ var id = ts.getOriginalNodeId(node);
+ deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node);
+ }
+ else {
+ statements = appendExportsOfVariableStatement(statements, node);
+ }
+ return ts.singleOrMany(statements);
+ }
+ /**
+ * Transforms an exported variable with an initializer into an expression.
+ *
+ * @param node The node to transform.
+ */
+ function transformInitializedVariable(node) {
+ if (ts.isBindingPattern(node.name)) {
+ return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createExportExpression);
+ }
+ else {
+ return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name,
+ /*location*/ node.name), node.initializer);
+ }
+ }
+ /**
+ * Visits a MergeDeclarationMarker used as a placeholder for the beginning of a merged
+ * and transformed declaration.
+ *
+ * @param node The node to visit.
+ */
+ function visitMergeDeclarationMarker(node) {
+ // For an EnumDeclaration or ModuleDeclaration that merges with a preceeding
+ // declaration we do not emit a leading variable declaration. To preserve the
+ // begin/end semantics of the declararation and to properly handle exports
+ // we wrapped the leading variable declaration in a `MergeDeclarationMarker`.
+ //
+ // To balance the declaration, add the exports of the elided variable
+ // statement.
+ if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 204 /* VariableStatement */) {
+ var id = ts.getOriginalNodeId(node);
+ deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original);
+ }
+ return node;
+ }
+ /**
+ * Determines whether a node has an associated EndOfDeclarationMarker.
+ *
+ * @param node The node to test.
+ */
+ function hasAssociatedEndOfDeclarationMarker(node) {
+ return (ts.getEmitFlags(node) & 33554432 /* HasEndOfDeclarationMarker */) !== 0;
+ }
+ /**
+ * Visits a DeclarationMarker used as a placeholder for the end of a transformed
+ * declaration.
+ *
+ * @param node The node to visit.
+ */
+ function visitEndOfDeclarationMarker(node) {
+ // For some transformations we emit an `EndOfDeclarationMarker` to mark the actual
+ // end of the transformed declaration. We use this marker to emit any deferred exports
+ // of the declaration.
+ var id = ts.getOriginalNodeId(node);
+ var statements = deferredExports[id];
+ if (statements) {
+ delete deferredExports[id];
+ return ts.append(statements, node);
+ }
+ return node;
+ }
+ /**
+ * Appends the exports of an ImportDeclaration to a statement list, returning the
+ * statement list.
+ *
+ * @param statements A statement list to which the down-level export statements are to be
+ * appended. If `statements` is `undefined`, a new array is allocated if statements are
+ * appended.
+ * @param decl The declaration whose exports are to be recorded.
+ */
+ function appendExportsOfImportDeclaration(statements, decl) {
+ if (currentModuleInfo.exportEquals) {
+ return statements;
+ }
+ var importClause = decl.importClause;
+ if (!importClause) {
+ return statements;
+ }
+ if (importClause.name) {
+ statements = appendExportsOfDeclaration(statements, importClause);
+ }
+ var namedBindings = importClause.namedBindings;
+ if (namedBindings) {
+ switch (namedBindings.kind) {
+ case 236 /* NamespaceImport */:
+ statements = appendExportsOfDeclaration(statements, namedBindings);
+ break;
+ case 237 /* NamedImports */:
+ for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {
+ var importBinding = _a[_i];
+ statements = appendExportsOfDeclaration(statements, importBinding);
+ }
+ break;
+ }
+ }
+ return statements;
+ }
+ /**
+ * Appends the exports of an ImportEqualsDeclaration to a statement list, returning the
+ * statement list.
+ *
+ * @param statements A statement list to which the down-level export statements are to be
+ * appended. If `statements` is `undefined`, a new array is allocated if statements are
+ * appended.
+ * @param decl The declaration whose exports are to be recorded.
+ */
+ function appendExportsOfImportEqualsDeclaration(statements, decl) {
+ if (currentModuleInfo.exportEquals) {
+ return statements;
+ }
+ return appendExportsOfDeclaration(statements, decl);
+ }
+ /**
+ * Appends the exports of a VariableStatement to a statement list, returning the statement
+ * list.
+ *
+ * @param statements A statement list to which the down-level export statements are to be
+ * appended. If `statements` is `undefined`, a new array is allocated if statements are
+ * appended.
+ * @param node The VariableStatement whose exports are to be recorded.
+ */
+ function appendExportsOfVariableStatement(statements, node) {
+ if (currentModuleInfo.exportEquals) {
+ return statements;
+ }
+ for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
+ var decl = _a[_i];
+ statements = appendExportsOfBindingElement(statements, decl);
+ }
+ return statements;
+ }
+ /**
+ * Appends the exports of a VariableDeclaration or BindingElement to a statement list,
+ * returning the statement list.
+ *
+ * @param statements A statement list to which the down-level export statements are to be
+ * appended. If `statements` is `undefined`, a new array is allocated if statements are
+ * appended.
+ * @param decl The declaration whose exports are to be recorded.
+ */
+ function appendExportsOfBindingElement(statements, decl) {
+ if (currentModuleInfo.exportEquals) {
+ return statements;
+ }
+ if (ts.isBindingPattern(decl.name)) {
+ for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {
+ var element = _a[_i];
+ if (!ts.isOmittedExpression(element)) {
+ statements = appendExportsOfBindingElement(statements, element);
+ }
+ }
+ }
+ else if (!ts.isGeneratedIdentifier(decl.name)) {
+ statements = appendExportsOfDeclaration(statements, decl);
+ }
+ return statements;
+ }
+ /**
+ * Appends the exports of a ClassDeclaration or FunctionDeclaration to a statement list,
+ * returning the statement list.
+ *
+ * @param statements A statement list to which the down-level export statements are to be
+ * appended. If `statements` is `undefined`, a new array is allocated if statements are
+ * appended.
+ * @param decl The declaration whose exports are to be recorded.
+ */
+ function appendExportsOfHoistedDeclaration(statements, decl) {
+ if (currentModuleInfo.exportEquals) {
+ return statements;
+ }
+ if (ts.hasModifier(decl, 1 /* Export */)) {
+ var exportName = ts.hasModifier(decl, 512 /* Default */) ? ts.createIdentifier("default") : decl.name;
+ statements = appendExportStatement(statements, exportName, ts.getLocalName(decl), /*location*/ decl);
+ }
+ if (decl.name) {
+ statements = appendExportsOfDeclaration(statements, decl);
+ }
+ return statements;
+ }
+ /**
+ * Appends the exports of a declaration to a statement list, returning the statement list.
+ *
+ * @param statements A statement list to which the down-level export statements are to be
+ * appended. If `statements` is `undefined`, a new array is allocated if statements are
+ * appended.
+ * @param decl The declaration to export.
+ */
+ function appendExportsOfDeclaration(statements, decl) {
+ var name = ts.getDeclarationName(decl);
+ var exportSpecifiers = currentModuleInfo.exportSpecifiers[name.text];
+ if (exportSpecifiers) {
+ for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) {
+ var exportSpecifier = exportSpecifiers_2[_i];
+ statements = appendExportStatement(statements, exportSpecifier.name, name, /*location*/ exportSpecifier.name);
+ }
+ }
+ return statements;
+ }
+ /**
+ * Appends the down-level representation of an export to a statement list, returning the
+ * statement list.
+ *
+ * @param statements A statement list to which the down-level export statements are to be
+ * appended. If `statements` is `undefined`, a new array is allocated if statements are
+ * appended.
+ * @param exportName The name of the export.
+ * @param expression The expression to export.
+ * @param location The location to use for source maps and comments for the export.
+ * @param allowComments Whether to allow comments on the export.
+ */
+ function appendExportStatement(statements, exportName, expression, location, allowComments) {
+ if (exportName.text === "default") {
+ var sourceFile = ts.getOriginalNode(currentSourceFile, ts.isSourceFile);
+ if (sourceFile && !sourceFile.symbol.exports["___esModule"]) {
+ if (languageVersion === 0 /* ES3 */) {
+ statements = ts.append(statements, ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(true))));
+ }
+ else {
+ statements = ts.append(statements, ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"),
+ /*typeArguments*/ undefined, [
+ ts.createIdentifier("exports"),
+ ts.createLiteral("__esModule"),
+ ts.createObjectLiteral([
+ ts.createPropertyAssignment("value", ts.createLiteral(true))
+ ])
+ ])));
+ }
+ }
+ }
+ statements = ts.append(statements, createExportStatement(exportName, expression, location, allowComments));
+ return statements;
+ }
+ /**
+ * Creates a call to the current file's export function to export a value.
+ *
+ * @param name The bound name of the export.
+ * @param value The exported value.
+ * @param location The location to use for source maps and comments for the export.
+ * @param allowComments An optional value indicating whether to emit comments for the statement.
+ */
+ function createExportStatement(name, value, location, allowComments) {
+ var statement = ts.createStatement(createExportExpression(name, value), location);
+ ts.startOnNewLine(statement);
+ if (!allowComments) {
+ ts.setEmitFlags(statement, 49152 /* NoComments */);
+ }
+ return statement;
+ }
+ /**
+ * Creates a call to the current file's export function to export a value.
+ *
+ * @param name The bound name of the export.
+ * @param value The exported value.
+ * @param location The location to use for source maps and comments for the export.
+ */
+ function createExportExpression(name, value, location) {
+ return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value, location);
+ }
+ //
+ // Modifier Visitors
+ //
+ /**
+ * Visit nodes to elide module-specific modifiers.
+ *
+ * @param node The node to visit.
+ */
+ function modifierVisitor(node) {
+ // Elide module-specific modifiers.
+ switch (node.kind) {
+ case 83 /* ExportKeyword */:
+ case 78 /* DefaultKeyword */:
+ return undefined;
+ }
+ return node;
+ }
+ //
+ // Emit Notification
+ //
+ /**
+ * Hook for node emit notifications.
+ *
+ * @param emitContext A context hint for the emitter.
+ * @param node The node to emit.
+ * @param emit A callback used to emit the node in the printer.
+ */
+ function onEmitNode(emitContext, node, emitCallback) {
+ if (node.kind === 260 /* SourceFile */) {
+ currentSourceFile = node;
+ currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)];
+ noSubstitution = ts.createMap();
+ previousOnEmitNode(emitContext, node, emitCallback);
+ currentSourceFile = undefined;
+ currentModuleInfo = undefined;
+ noSubstitution = undefined;
+ }
+ else {
+ previousOnEmitNode(emitContext, node, emitCallback);
+ }
+ }
+ //
+ // Substitutions
+ //
+ /**
+ * Hooks node substitutions.
+ *
+ * @param emitContext A context hint for the emitter.
+ * @param node The node to substitute.
+ */
+ function onSubstituteNode(emitContext, node) {
+ node = previousOnSubstituteNode(emitContext, node);
+ if (node.id && noSubstitution[node.id]) {
+ return node;
+ }
+ if (emitContext === 1 /* Expression */) {
+ return substituteExpression(node);
+ }
+ else if (ts.isShorthandPropertyAssignment(node)) {
+ return substituteShorthandPropertyAssignment(node);
+ }
+ return node;
+ }
+ /**
+ * Substitution for a ShorthandPropertyAssignment whose declaration name is an imported
+ * or exported symbol.
+ *
+ * @param node The node to substitute.
+ */
+ function substituteShorthandPropertyAssignment(node) {
+ var name = node.name;
+ var exportedOrImportedName = substituteExpressionIdentifier(name);
+ if (exportedOrImportedName !== name) {
+ // A shorthand property with an assignment initializer is probably part of a
+ // destructuring assignment
+ if (node.objectAssignmentInitializer) {
+ var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer);
+ return ts.createPropertyAssignment(name, initializer, /*location*/ node);
+ }
+ return ts.createPropertyAssignment(name, exportedOrImportedName, /*location*/ node);
+ }
+ return node;
+ }
+ /**
+ * Substitution for an Expression that may contain an imported or exported symbol.
+ *
+ * @param node The node to substitute.
+ */
+ function substituteExpression(node) {
+ switch (node.kind) {
+ case 70 /* Identifier */:
+ return substituteExpressionIdentifier(node);
+ case 191 /* BinaryExpression */:
+ return substituteBinaryExpression(node);
+ case 190 /* PostfixUnaryExpression */:
+ case 189 /* PrefixUnaryExpression */:
+ return substituteUnaryExpression(node);
+ }
+ return node;
+ }
+ /**
+ * Substitution for an Identifier expression that may contain an imported or exported
+ * symbol.
+ *
+ * @param node The node to substitute.
+ */
+ function substituteExpressionIdentifier(node) {
+ if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
+ var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node));
+ if (exportContainer && exportContainer.kind === 260 /* SourceFile */) {
+ return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node),
+ /*location*/ node);
+ }
+ var importDeclaration = resolver.getReferencedImportDeclaration(node);
+ if (importDeclaration) {
+ if (ts.isImportClause(importDeclaration)) {
+ return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"),
+ /*location*/ node);
+ }
+ else if (ts.isImportSpecifier(importDeclaration)) {
+ var name_36 = importDeclaration.propertyName || importDeclaration.name;
+ return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_36),
+ /*location*/ node);
+ }
+ }
+ }
+ return node;
+ }
+ /**
+ * Substitution for a BinaryExpression that may contain an imported or exported symbol.
+ *
+ * @param node The node to substitute.
+ */
+ function substituteBinaryExpression(node) {
+ // When we see an assignment expression whose left-hand side is an exported symbol,
+ // we should ensure all exports of that symbol are updated with the correct value.
+ //
+ // - We do not substitute generated identifiers for any reason.
+ // - We do not substitute identifiers tagged with the LocalName flag.
+ // - We do not substitute identifiers that were originally the name of an enum or
+ // namespace due to how they are transformed in TypeScript.
+ // - We only substitute identifiers that are exported at the top level.
+ if (ts.isAssignmentOperator(node.operatorToken.kind)
+ && ts.isIdentifier(node.left)
+ && !ts.isGeneratedIdentifier(node.left)
+ && !ts.isLocalName(node.left)
+ && !ts.isDeclarationNameOfEnumOrNamespace(node.left)) {
+ var exportedNames = getExports(node.left);
+ if (exportedNames) {
+ // For each additional export of the declaration, apply an export assignment.
+ var expression = node;
+ for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) {
+ var exportName = exportedNames_3[_i];
+ // Mark the node to prevent triggering this rule again.
+ noSubstitution[ts.getNodeId(expression)] = true;
+ expression = createExportExpression(exportName, expression, /*location*/ node);
+ }
+ return expression;
+ }
+ }
+ return node;
+ }
+ /**
+ * Substitution for a UnaryExpression that may contain an imported or exported symbol.
+ *
+ * @param node The node to substitute.
+ */
+ function substituteUnaryExpression(node) {
+ // When we see a prefix or postfix increment expression whose operand is an exported
+ // symbol, we should ensure all exports of that symbol are updated with the correct
+ // value.
+ //
+ // - We do not substitute generated identifiers for any reason.
+ // - We do not substitute identifiers tagged with the LocalName flag.
+ // - We do not substitute identifiers that were originally the name of an enum or
+ // namespace due to how they are transformed in TypeScript.
+ // - We only substitute identifiers that are exported at the top level.
+ if ((node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */)
+ && ts.isIdentifier(node.operand)
+ && !ts.isGeneratedIdentifier(node.operand)
+ && !ts.isLocalName(node.operand)
+ && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {
+ var exportedNames = getExports(node.operand);
+ if (exportedNames) {
+ var expression = node.kind === 190 /* PostfixUnaryExpression */
+ ? ts.createBinary(node.operand, ts.createToken(node.operator === 42 /* PlusPlusToken */ ? 58 /* PlusEqualsToken */ : 59 /* MinusEqualsToken */), ts.createLiteral(1),
+ /*location*/ node)
+ : node;
+ for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) {
+ var exportName = exportedNames_4[_i];
+ // Mark the node to prevent triggering this rule again.
+ noSubstitution[ts.getNodeId(expression)] = true;
+ expression = createExportExpression(exportName, expression);
+ }
+ return expression;
+ }
+ }
+ return node;
+ }
+ /**
+ * Gets the additional exports of a name.
+ *
+ * @param name The name.
+ */
+ function getExports(name) {
+ if (!ts.isGeneratedIdentifier(name)) {
+ var valueDeclaration = resolver.getReferencedImportDeclaration(name)
+ || resolver.getReferencedValueDeclaration(name);
+ if (valueDeclaration) {
+ return currentModuleInfo
+ && currentModuleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)];
+ }
+ }
+ }
+ var _a;
+ }
+ ts.transformModule = transformModule;
+})(ts || (ts = {}));
///
///
///
+///
///
///
///
@@ -53978,10 +55767,12 @@ var ts;
var moduleKind = ts.getEmitModuleKind(compilerOptions);
var transformers = [];
transformers.push(ts.transformTypeScript);
- transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ts.ModuleKind.None]);
if (jsx === 2 /* React */) {
transformers.push(ts.transformJsx);
}
+ if (languageVersion < 5 /* ESNext */) {
+ transformers.push(ts.transformESNext);
+ }
if (languageVersion < 4 /* ES2017 */) {
transformers.push(ts.transformES2017);
}
@@ -53992,6 +55783,9 @@ var ts;
transformers.push(ts.transformES2015);
transformers.push(ts.transformGenerators);
}
+ transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ts.ModuleKind.None]);
+ // The ES5 transformer is last so that it can substitute expressions like `exports.default`
+ // for ES3.
if (languageVersion < 1 /* ES5 */) {
transformers.push(ts.transformES5);
}
@@ -54009,7 +55803,7 @@ var ts;
function transformFiles(resolver, host, sourceFiles, transformers) {
var lexicalEnvironmentVariableDeclarationsStack = [];
var lexicalEnvironmentFunctionDeclarationsStack = [];
- var enabledSyntaxKindFeatures = new Array(289 /* Count */);
+ var enabledSyntaxKindFeatures = new Array(295 /* Count */);
var lexicalEnvironmentStackOffset = 0;
var hoistedVariableDeclarations;
var hoistedFunctionDeclarations;
@@ -54409,7 +56203,7 @@ var ts;
var emitNode = node.emitNode;
var emitFlags = emitNode && emitNode.flags;
var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end;
- if (node.kind !== 287 /* NotEmittedStatement */
+ if (node.kind !== 291 /* NotEmittedStatement */
&& (emitFlags & 512 /* NoLeadingSourceMap */) === 0
&& pos >= 0) {
emitPos(ts.skipTrivia(currentSourceText, pos));
@@ -54422,7 +56216,7 @@ var ts;
else {
emitCallback(emitContext, node);
}
- if (node.kind !== 287 /* NotEmittedStatement */
+ if (node.kind !== 291 /* NotEmittedStatement */
&& (emitFlags & 1024 /* NoTrailingSourceMap */) === 0
&& end >= 0) {
emitPos(end);
@@ -54601,7 +56395,7 @@ var ts;
if (extendedDiagnostics) {
ts.performance.mark("preEmitNodeWithComment");
}
- var isEmittedNode = node.kind !== 287 /* NotEmittedStatement */;
+ var isEmittedNode = node.kind !== 291 /* NotEmittedStatement */;
var skipLeadingComments = pos < 0 || (emitFlags & 16384 /* NoLeadingComments */) !== 0;
var skipTrailingComments = end < 0 || (emitFlags & 32768 /* NoTrailingComments */) !== 0;
// Emit leading comments if the position is not synthesized and the node
@@ -54620,7 +56414,7 @@ var ts;
containerEnd = end;
// To avoid invalid comment emit in a down-level binding pattern, we
// keep track of the last declaration list container's end
- if (node.kind === 220 /* VariableDeclarationList */) {
+ if (node.kind === 223 /* VariableDeclarationList */) {
declarationListContainerEnd = end;
}
}
@@ -54930,7 +56724,7 @@ var ts;
var oldWriter = writer;
ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) {
if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) {
- ts.Debug.assert(aliasEmitInfo.node.kind === 231 /* ImportDeclaration */);
+ ts.Debug.assert(aliasEmitInfo.node.kind === 234 /* ImportDeclaration */);
createAndSetNewTextWriterWithSymbolWriter();
ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit));
for (var i = 0; i < aliasEmitInfo.indent; i++) {
@@ -55004,10 +56798,10 @@ var ts;
var oldWriter = writer;
ts.forEach(nodes, function (declaration) {
var nodeToCheck;
- if (declaration.kind === 219 /* VariableDeclaration */) {
+ if (declaration.kind === 222 /* VariableDeclaration */) {
nodeToCheck = declaration.parent.parent;
}
- else if (declaration.kind === 234 /* NamedImports */ || declaration.kind === 235 /* ImportSpecifier */ || declaration.kind === 232 /* ImportClause */) {
+ else if (declaration.kind === 237 /* NamedImports */ || declaration.kind === 238 /* ImportSpecifier */ || declaration.kind === 235 /* ImportClause */) {
ts.Debug.fail("We should be getting ImportDeclaration instead to write");
}
else {
@@ -55025,7 +56819,7 @@ var ts;
// Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing,
// we would write alias foo declaration when we visit it since it would now be marked as visible
if (moduleElementEmitInfo) {
- if (moduleElementEmitInfo.node.kind === 231 /* ImportDeclaration */) {
+ if (moduleElementEmitInfo.node.kind === 234 /* ImportDeclaration */) {
// we have to create asynchronous output only after we have collected complete information
// because it is possible to enable multiple bindings as asynchronously visible
moduleElementEmitInfo.isVisible = true;
@@ -55035,12 +56829,12 @@ var ts;
for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) {
increaseIndent();
}
- if (nodeToCheck.kind === 226 /* ModuleDeclaration */) {
+ if (nodeToCheck.kind === 229 /* ModuleDeclaration */) {
ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined);
asynchronousSubModuleDeclarationEmitInfo = [];
}
writeModuleElement(nodeToCheck);
- if (nodeToCheck.kind === 226 /* ModuleDeclaration */) {
+ if (nodeToCheck.kind === 229 /* ModuleDeclaration */) {
moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo;
asynchronousSubModuleDeclarationEmitInfo = undefined;
}
@@ -55158,43 +56952,47 @@ var ts;
function emitType(type) {
switch (type.kind) {
case 118 /* AnyKeyword */:
- case 133 /* StringKeyword */:
- case 131 /* NumberKeyword */:
+ case 134 /* StringKeyword */:
+ case 132 /* NumberKeyword */:
case 121 /* BooleanKeyword */:
- case 134 /* SymbolKeyword */:
+ case 135 /* SymbolKeyword */:
case 104 /* VoidKeyword */:
- case 136 /* UndefinedKeyword */:
+ case 137 /* UndefinedKeyword */:
case 94 /* NullKeyword */:
- case 128 /* NeverKeyword */:
- case 166 /* ThisType */:
- case 167 /* LiteralType */:
+ case 129 /* NeverKeyword */:
+ case 167 /* ThisType */:
+ case 170 /* LiteralType */:
return writeTextOfNode(currentText, type);
- case 195 /* ExpressionWithTypeArguments */:
+ case 198 /* ExpressionWithTypeArguments */:
return emitExpressionWithTypeArguments(type);
- case 156 /* TypeReference */:
+ case 157 /* TypeReference */:
return emitTypeReference(type);
- case 159 /* TypeQuery */:
+ case 160 /* TypeQuery */:
return emitTypeQuery(type);
- case 161 /* ArrayType */:
+ case 162 /* ArrayType */:
return emitArrayType(type);
- case 162 /* TupleType */:
+ case 163 /* TupleType */:
return emitTupleType(type);
- case 163 /* UnionType */:
+ case 164 /* UnionType */:
return emitUnionType(type);
- case 164 /* IntersectionType */:
+ case 165 /* IntersectionType */:
return emitIntersectionType(type);
- case 165 /* ParenthesizedType */:
+ case 166 /* ParenthesizedType */:
return emitParenType(type);
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
+ case 168 /* TypeOperator */:
+ return emitTypeOperator(type);
+ case 169 /* IndexedAccessType */:
+ return emitPropertyAccessType(type);
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
return emitSignatureDeclarationWithJsDocComments(type);
- case 160 /* TypeLiteral */:
+ case 161 /* TypeLiteral */:
return emitTypeLiteral(type);
case 70 /* Identifier */:
return emitEntityName(type);
- case 140 /* QualifiedName */:
+ case 141 /* QualifiedName */:
return emitEntityName(type);
- case 155 /* TypePredicate */:
+ case 156 /* TypePredicate */:
return emitTypePredicate(type);
}
function writeEntityName(entityName) {
@@ -55202,8 +57000,8 @@ var ts;
writeTextOfNode(currentText, entityName);
}
else {
- var left = entityName.kind === 140 /* QualifiedName */ ? entityName.left : entityName.expression;
- var right = entityName.kind === 140 /* QualifiedName */ ? entityName.right : entityName.name;
+ var left = entityName.kind === 141 /* QualifiedName */ ? entityName.left : entityName.expression;
+ var right = entityName.kind === 141 /* QualifiedName */ ? entityName.right : entityName.name;
writeEntityName(left);
write(".");
writeTextOfNode(currentText, right);
@@ -55212,14 +57010,14 @@ var ts;
function emitEntityName(entityName) {
var visibilityResult = resolver.isEntityNameVisible(entityName,
// Aliases can be written asynchronously so use correct enclosing declaration
- entityName.parent.kind === 230 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration);
+ entityName.parent.kind === 233 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration);
handleSymbolAccessibilityError(visibilityResult);
recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName));
writeEntityName(entityName);
}
function emitExpressionWithTypeArguments(node) {
if (ts.isEntityNameExpression(node.expression)) {
- ts.Debug.assert(node.expression.kind === 70 /* Identifier */ || node.expression.kind === 173 /* PropertyAccessExpression */);
+ ts.Debug.assert(node.expression.kind === 70 /* Identifier */ || node.expression.kind === 176 /* PropertyAccessExpression */);
emitEntityName(node.expression);
if (node.typeArguments) {
write("<");
@@ -55265,6 +57063,17 @@ var ts;
emitType(type.type);
write(")");
}
+ function emitTypeOperator(type) {
+ write(ts.tokenToString(type.operator));
+ write(" ");
+ emitType(type.type);
+ }
+ function emitPropertyAccessType(node) {
+ emitType(node.objectType);
+ write("[");
+ emitType(node.indexType);
+ write("]");
+ }
function emitTypeLiteral(type) {
write("{");
if (type.members.length) {
@@ -55298,9 +57107,9 @@ var ts;
var count = 0;
while (true) {
count++;
- var name_40 = baseName + "_" + count;
- if (!(name_40 in currentIdentifiers)) {
- return name_40;
+ var name_37 = baseName + "_" + count;
+ if (!(name_37 in currentIdentifiers)) {
+ return name_37;
}
}
}
@@ -55347,10 +57156,10 @@ var ts;
if (isModuleElementVisible) {
writeModuleElement(node);
}
- else if (node.kind === 230 /* ImportEqualsDeclaration */ ||
- (node.parent.kind === 256 /* SourceFile */ && isCurrentFileExternalModule)) {
+ else if (node.kind === 233 /* ImportEqualsDeclaration */ ||
+ (node.parent.kind === 260 /* SourceFile */ && isCurrentFileExternalModule)) {
var isVisible = void 0;
- if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 256 /* SourceFile */) {
+ if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 260 /* SourceFile */) {
// Import declaration of another module that is visited async so lets put it in right spot
asynchronousSubModuleDeclarationEmitInfo.push({
node: node,
@@ -55360,7 +57169,7 @@ var ts;
});
}
else {
- if (node.kind === 231 /* ImportDeclaration */) {
+ if (node.kind === 234 /* ImportDeclaration */) {
var importDeclaration = node;
if (importDeclaration.importClause) {
isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) ||
@@ -55378,23 +57187,23 @@ var ts;
}
function writeModuleElement(node) {
switch (node.kind) {
- case 221 /* FunctionDeclaration */:
+ case 224 /* FunctionDeclaration */:
return writeFunctionDeclaration(node);
- case 201 /* VariableStatement */:
+ case 204 /* VariableStatement */:
return writeVariableStatement(node);
- case 223 /* InterfaceDeclaration */:
+ case 226 /* InterfaceDeclaration */:
return writeInterfaceDeclaration(node);
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
return writeClassDeclaration(node);
- case 224 /* TypeAliasDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
return writeTypeAliasDeclaration(node);
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
return writeEnumDeclaration(node);
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
return writeModuleDeclaration(node);
- case 230 /* ImportEqualsDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
return writeImportEqualsDeclaration(node);
- case 231 /* ImportDeclaration */:
+ case 234 /* ImportDeclaration */:
return writeImportDeclaration(node);
default:
ts.Debug.fail("Unknown symbol kind");
@@ -55402,7 +57211,7 @@ var ts;
}
function emitModuleElementDeclarationFlags(node) {
// If the node is parented in the current source file we need to emit export declare or just export
- if (node.parent.kind === 256 /* SourceFile */) {
+ if (node.parent.kind === 260 /* SourceFile */) {
var modifiers = ts.getModifierFlags(node);
// If the node is exported
if (modifiers & 1 /* Export */) {
@@ -55411,7 +57220,7 @@ var ts;
if (modifiers & 512 /* Default */) {
write("default ");
}
- else if (node.kind !== 223 /* InterfaceDeclaration */ && !noDeclare) {
+ else if (node.kind !== 226 /* InterfaceDeclaration */ && !noDeclare) {
write("declare ");
}
}
@@ -55463,7 +57272,7 @@ var ts;
}
function isVisibleNamedBinding(namedBindings) {
if (namedBindings) {
- if (namedBindings.kind === 233 /* NamespaceImport */) {
+ if (namedBindings.kind === 236 /* NamespaceImport */) {
return resolver.isDeclarationVisible(namedBindings);
}
else {
@@ -55487,7 +57296,7 @@ var ts;
// If the default binding was emitted, write the separated
write(", ");
}
- if (node.importClause.namedBindings.kind === 233 /* NamespaceImport */) {
+ if (node.importClause.namedBindings.kind === 236 /* NamespaceImport */) {
write("* as ");
writeTextOfNode(currentText, node.importClause.namedBindings.name);
}
@@ -55508,13 +57317,13 @@ var ts;
// the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered
// external modules since they are indistinguishable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}'
// so compiler will treat them as external modules.
- resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 226 /* ModuleDeclaration */;
+ resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 229 /* ModuleDeclaration */;
var moduleSpecifier;
- if (parent.kind === 230 /* ImportEqualsDeclaration */) {
+ if (parent.kind === 233 /* ImportEqualsDeclaration */) {
var node = parent;
moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node);
}
- else if (parent.kind === 226 /* ModuleDeclaration */) {
+ else if (parent.kind === 229 /* ModuleDeclaration */) {
moduleSpecifier = parent.name;
}
else {
@@ -55584,7 +57393,7 @@ var ts;
writeTextOfNode(currentText, node.name);
}
}
- while (node.body && node.body.kind !== 227 /* ModuleBlock */) {
+ while (node.body && node.body.kind !== 230 /* ModuleBlock */) {
node = node.body;
write(".");
writeTextOfNode(currentText, node.name);
@@ -55654,7 +57463,7 @@ var ts;
writeLine();
}
function isPrivateMethodTypeParameter(node) {
- return node.parent.kind === 148 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */);
+ return node.parent.kind === 149 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */);
}
function emitTypeParameters(typeParameters) {
function emitTypeParameter(node) {
@@ -55665,15 +57474,15 @@ var ts;
// If there is constraint present and this is not a type parameter of the private method emit the constraint
if (node.constraint && !isPrivateMethodTypeParameter(node)) {
write(" extends ");
- if (node.parent.kind === 157 /* FunctionType */ ||
- node.parent.kind === 158 /* ConstructorType */ ||
- (node.parent.parent && node.parent.parent.kind === 160 /* TypeLiteral */)) {
- ts.Debug.assert(node.parent.kind === 148 /* MethodDeclaration */ ||
- node.parent.kind === 147 /* MethodSignature */ ||
- node.parent.kind === 157 /* FunctionType */ ||
- node.parent.kind === 158 /* ConstructorType */ ||
- node.parent.kind === 152 /* CallSignature */ ||
- node.parent.kind === 153 /* ConstructSignature */);
+ if (node.parent.kind === 158 /* FunctionType */ ||
+ node.parent.kind === 159 /* ConstructorType */ ||
+ (node.parent.parent && node.parent.parent.kind === 161 /* TypeLiteral */)) {
+ ts.Debug.assert(node.parent.kind === 149 /* MethodDeclaration */ ||
+ node.parent.kind === 148 /* MethodSignature */ ||
+ node.parent.kind === 158 /* FunctionType */ ||
+ node.parent.kind === 159 /* ConstructorType */ ||
+ node.parent.kind === 153 /* CallSignature */ ||
+ node.parent.kind === 154 /* ConstructSignature */);
emitType(node.constraint);
}
else {
@@ -55684,31 +57493,31 @@ var ts;
// Type parameter constraints are named by user so we should always be able to name it
var diagnosticMessage;
switch (node.parent.kind) {
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;
break;
- case 223 /* InterfaceDeclaration */:
+ case 226 /* InterfaceDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;
break;
- case 153 /* ConstructSignature */:
+ case 154 /* ConstructSignature */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
- case 152 /* CallSignature */:
+ case 153 /* CallSignature */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
if (ts.hasModifier(node.parent, 32 /* Static */)) {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 222 /* ClassDeclaration */) {
+ else if (node.parent.parent.kind === 225 /* ClassDeclaration */) {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;
}
else {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
break;
- case 221 /* FunctionDeclaration */:
+ case 224 /* FunctionDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
break;
default:
@@ -55746,7 +57555,7 @@ var ts;
function getHeritageClauseVisibilityError() {
var diagnosticMessage;
// Heritage clause is written by user so it can always be named
- if (node.parent.parent.kind === 222 /* ClassDeclaration */) {
+ if (node.parent.parent.kind === 225 /* ClassDeclaration */) {
// Class or Interface implemented/extended is inaccessible
diagnosticMessage = isImplementsList ?
ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
@@ -55830,7 +57639,7 @@ var ts;
function emitVariableDeclaration(node) {
// If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted
// so there is no check needed to see if declaration is visible
- if (node.kind !== 219 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) {
+ if (node.kind !== 222 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) {
if (ts.isBindingPattern(node.name)) {
emitBindingPattern(node.name);
}
@@ -55841,11 +57650,11 @@ var ts;
writeTextOfNode(currentText, node.name);
// If optional property emit ? but in the case of parameterProperty declaration with "?" indicating optional parameter for the constructor
// we don't want to emit property declaration with "?"
- if ((node.kind === 146 /* PropertyDeclaration */ || node.kind === 145 /* PropertySignature */ ||
- (node.kind === 143 /* Parameter */ && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) {
+ if ((node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */ ||
+ (node.kind === 144 /* Parameter */ && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) {
write("?");
}
- if ((node.kind === 146 /* PropertyDeclaration */ || node.kind === 145 /* PropertySignature */) && node.parent.kind === 160 /* TypeLiteral */) {
+ if ((node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */) && node.parent.kind === 161 /* TypeLiteral */) {
emitTypeOfVariableDeclarationFromTypeLiteral(node);
}
else if (resolver.isLiteralConstDeclaration(node)) {
@@ -55858,14 +57667,14 @@ var ts;
}
}
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
- if (node.kind === 219 /* VariableDeclaration */) {
+ if (node.kind === 222 /* VariableDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
}
- else if (node.kind === 146 /* PropertyDeclaration */ || node.kind === 145 /* PropertySignature */) {
+ else if (node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */) {
// TODO(jfreeman): Deal with computed properties in error reporting.
if (ts.hasModifier(node, 32 /* Static */)) {
return symbolAccessibilityResult.errorModuleName ?
@@ -55874,7 +57683,7 @@ var ts;
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 222 /* ClassDeclaration */) {
+ else if (node.parent.kind === 225 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -55906,7 +57715,7 @@ var ts;
var elements = [];
for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) {
var element = _a[_i];
- if (element.kind !== 194 /* OmittedExpression */) {
+ if (element.kind !== 197 /* OmittedExpression */) {
elements.push(element);
}
}
@@ -55976,7 +57785,7 @@ var ts;
var type = getTypeAnnotationFromAccessor(node);
if (!type) {
// couldn't get type for the first accessor, try the another one
- var anotherAccessor = node.kind === 150 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor;
+ var anotherAccessor = node.kind === 151 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor;
type = getTypeAnnotationFromAccessor(anotherAccessor);
if (type) {
accessorWithTypeAnnotation = anotherAccessor;
@@ -55989,7 +57798,7 @@ var ts;
}
function getTypeAnnotationFromAccessor(accessor) {
if (accessor) {
- return accessor.kind === 150 /* GetAccessor */
+ return accessor.kind === 151 /* GetAccessor */
? accessor.type // Getter - return type
: accessor.parameters.length > 0
? accessor.parameters[0].type // Setter parameter type
@@ -55998,7 +57807,7 @@ var ts;
}
function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
- if (accessorWithTypeAnnotation.kind === 151 /* SetAccessor */) {
+ if (accessorWithTypeAnnotation.kind === 152 /* SetAccessor */) {
// Setters have to have type named and cannot infer it so, the type should always be named
if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32 /* Static */)) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
@@ -56048,17 +57857,17 @@ var ts;
// so no need to verify if the declaration is visible
if (!resolver.isImplementationOfOverload(node)) {
emitJsDocComments(node);
- if (node.kind === 221 /* FunctionDeclaration */) {
+ if (node.kind === 224 /* FunctionDeclaration */) {
emitModuleElementDeclarationFlags(node);
}
- else if (node.kind === 148 /* MethodDeclaration */ || node.kind === 149 /* Constructor */) {
+ else if (node.kind === 149 /* MethodDeclaration */ || node.kind === 150 /* Constructor */) {
emitClassMemberDeclarationFlags(ts.getModifierFlags(node));
}
- if (node.kind === 221 /* FunctionDeclaration */) {
+ if (node.kind === 224 /* FunctionDeclaration */) {
write("function ");
writeTextOfNode(currentText, node.name);
}
- else if (node.kind === 149 /* Constructor */) {
+ else if (node.kind === 150 /* Constructor */) {
write("constructor");
}
else {
@@ -56078,17 +57887,17 @@ var ts;
var prevEnclosingDeclaration = enclosingDeclaration;
enclosingDeclaration = node;
var closeParenthesizedFunctionType = false;
- if (node.kind === 154 /* IndexSignature */) {
+ if (node.kind === 155 /* IndexSignature */) {
// Index signature can have readonly modifier
emitClassMemberDeclarationFlags(ts.getModifierFlags(node));
write("[");
}
else {
// Construct signature or constructor type write new Signature
- if (node.kind === 153 /* ConstructSignature */ || node.kind === 158 /* ConstructorType */) {
+ if (node.kind === 154 /* ConstructSignature */ || node.kind === 159 /* ConstructorType */) {
write("new ");
}
- else if (node.kind === 157 /* FunctionType */) {
+ else if (node.kind === 158 /* FunctionType */) {
var currentOutput = writer.getText();
// Do not generate incorrect type when function type with type parameters is type argument
// This could happen if user used space between two '<' making it error free
@@ -56103,22 +57912,22 @@ var ts;
}
// Parameters
emitCommaList(node.parameters, emitParameterDeclaration);
- if (node.kind === 154 /* IndexSignature */) {
+ if (node.kind === 155 /* IndexSignature */) {
write("]");
}
else {
write(")");
}
// If this is not a constructor and is not private, emit the return type
- var isFunctionTypeOrConstructorType = node.kind === 157 /* FunctionType */ || node.kind === 158 /* ConstructorType */;
- if (isFunctionTypeOrConstructorType || node.parent.kind === 160 /* TypeLiteral */) {
+ var isFunctionTypeOrConstructorType = node.kind === 158 /* FunctionType */ || node.kind === 159 /* ConstructorType */;
+ if (isFunctionTypeOrConstructorType || node.parent.kind === 161 /* TypeLiteral */) {
// Emit type literal signature return type only if specified
if (node.type) {
write(isFunctionTypeOrConstructorType ? " => " : ": ");
emitType(node.type);
}
}
- else if (node.kind !== 149 /* Constructor */ && !ts.hasModifier(node, 8 /* Private */)) {
+ else if (node.kind !== 150 /* Constructor */ && !ts.hasModifier(node, 8 /* Private */)) {
writeReturnTypeAtSignature(node, getReturnTypeVisibilityError);
}
enclosingDeclaration = prevEnclosingDeclaration;
@@ -56132,26 +57941,26 @@ var ts;
function getReturnTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
switch (node.kind) {
- case 153 /* ConstructSignature */:
+ case 154 /* ConstructSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 152 /* CallSignature */:
+ case 153 /* CallSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 154 /* IndexSignature */:
+ case 155 /* IndexSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
if (ts.hasModifier(node, 32 /* Static */)) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
@@ -56159,7 +57968,7 @@ var ts;
ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0;
}
- else if (node.parent.kind === 222 /* ClassDeclaration */) {
+ else if (node.parent.kind === 225 /* ClassDeclaration */) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -56173,7 +57982,7 @@ var ts;
ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;
}
break;
- case 221 /* FunctionDeclaration */:
+ case 224 /* FunctionDeclaration */:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -56208,9 +58017,9 @@ var ts;
write("?");
}
decreaseIndent();
- if (node.parent.kind === 157 /* FunctionType */ ||
- node.parent.kind === 158 /* ConstructorType */ ||
- node.parent.parent.kind === 160 /* TypeLiteral */) {
+ if (node.parent.kind === 158 /* FunctionType */ ||
+ node.parent.kind === 159 /* ConstructorType */ ||
+ node.parent.parent.kind === 161 /* TypeLiteral */) {
emitTypeOfVariableDeclarationFromTypeLiteral(node);
}
else if (!ts.hasModifier(node.parent, 8 /* Private */)) {
@@ -56226,24 +58035,24 @@ var ts;
}
function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
switch (node.parent.kind) {
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;
- case 153 /* ConstructSignature */:
+ case 154 /* ConstructSignature */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 152 /* CallSignature */:
+ case 153 /* CallSignature */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
if (ts.hasModifier(node.parent, 32 /* Static */)) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
@@ -56251,7 +58060,7 @@ var ts;
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 222 /* ClassDeclaration */) {
+ else if (node.parent.parent.kind === 225 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -56264,7 +58073,7 @@ var ts;
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
- case 221 /* FunctionDeclaration */:
+ case 224 /* FunctionDeclaration */:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -56276,12 +58085,12 @@ var ts;
}
function emitBindingPattern(bindingPattern) {
// We have to explicitly emit square bracket and bracket because these tokens are not store inside the node.
- if (bindingPattern.kind === 168 /* ObjectBindingPattern */) {
+ if (bindingPattern.kind === 171 /* ObjectBindingPattern */) {
write("{");
emitCommaList(bindingPattern.elements, emitBindingElement);
write("}");
}
- else if (bindingPattern.kind === 169 /* ArrayBindingPattern */) {
+ else if (bindingPattern.kind === 172 /* ArrayBindingPattern */) {
write("[");
var elements = bindingPattern.elements;
emitCommaList(elements, emitBindingElement);
@@ -56292,7 +58101,7 @@ var ts;
}
}
function emitBindingElement(bindingElement) {
- if (bindingElement.kind === 194 /* OmittedExpression */) {
+ if (bindingElement.kind === 197 /* OmittedExpression */) {
// If bindingElement is an omittedExpression (i.e. containing elision),
// we will emit blank space (although this may differ from users' original code,
// it allows emitSeparatedList to write separator appropriately)
@@ -56301,7 +58110,7 @@ var ts;
// emit : function foo([ , x, , ]) {}
write(" ");
}
- else if (bindingElement.kind === 170 /* BindingElement */) {
+ else if (bindingElement.kind === 173 /* BindingElement */) {
if (bindingElement.propertyName) {
// bindingElement has propertyName property in the following case:
// { y: [a,b,c] ...} -> bindingPattern will have a property called propertyName for "y"
@@ -56340,40 +58149,40 @@ var ts;
}
function emitNode(node) {
switch (node.kind) {
- case 221 /* FunctionDeclaration */:
- case 226 /* ModuleDeclaration */:
- case 230 /* ImportEqualsDeclaration */:
- case 223 /* InterfaceDeclaration */:
- case 222 /* ClassDeclaration */:
- case 224 /* TypeAliasDeclaration */:
- case 225 /* EnumDeclaration */:
+ case 224 /* FunctionDeclaration */:
+ case 229 /* ModuleDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
+ case 228 /* EnumDeclaration */:
return emitModuleElement(node, isModuleElementVisible(node));
- case 201 /* VariableStatement */:
+ case 204 /* VariableStatement */:
return emitModuleElement(node, isVariableStatementVisible(node));
- case 231 /* ImportDeclaration */:
+ case 234 /* ImportDeclaration */:
// Import declaration without import clause is visible, otherwise it is not visible
return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause);
- case 237 /* ExportDeclaration */:
+ case 240 /* ExportDeclaration */:
return emitExportDeclaration(node);
- case 149 /* Constructor */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 150 /* Constructor */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
return writeFunctionDeclaration(node);
- case 153 /* ConstructSignature */:
- case 152 /* CallSignature */:
- case 154 /* IndexSignature */:
+ case 154 /* ConstructSignature */:
+ case 153 /* CallSignature */:
+ case 155 /* IndexSignature */:
return emitSignatureDeclarationWithJsDocComments(node);
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
return emitAccessorDeclaration(node);
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
return emitPropertyDeclaration(node);
- case 255 /* EnumMember */:
+ case 259 /* EnumMember */:
return emitEnumMemberDeclaration(node);
- case 236 /* ExportAssignment */:
+ case 239 /* ExportAssignment */:
return emitExportAssignment(node);
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
return emitSourceFile(node);
}
}
@@ -56464,6 +58273,7 @@ var ts;
// This is typically used for JSX spread attributes,
// and can be used for object literal spread properties.
var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};";
+ var restHelper = "\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))\n t[p] = s[p];\n return t;\n};";
// emit output for the __decorate helper function
var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};";
// emit output for the __metadata helper function
@@ -56561,6 +58371,7 @@ var ts;
var currentFileIdentifiers;
var extendsEmitted;
var assignEmitted;
+ var restEmitted;
var decorateEmitted;
var paramEmitted;
var awaiterEmitted;
@@ -56754,7 +58565,7 @@ var ts;
var kind = node.kind;
switch (kind) {
// Top-level nodes
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
return emitSourceFile(node);
}
}
@@ -56810,210 +58621,216 @@ var ts;
case 123 /* DeclareKeyword */:
case 124 /* GetKeyword */:
case 125 /* IsKeyword */:
- case 126 /* ModuleKeyword */:
- case 127 /* NamespaceKeyword */:
- case 128 /* NeverKeyword */:
- case 129 /* ReadonlyKeyword */:
- case 130 /* RequireKeyword */:
- case 131 /* NumberKeyword */:
- case 132 /* SetKeyword */:
- case 133 /* StringKeyword */:
- case 134 /* SymbolKeyword */:
- case 135 /* TypeKeyword */:
- case 136 /* UndefinedKeyword */:
- case 137 /* FromKeyword */:
- case 138 /* GlobalKeyword */:
- case 139 /* OfKeyword */:
+ case 127 /* ModuleKeyword */:
+ case 128 /* NamespaceKeyword */:
+ case 129 /* NeverKeyword */:
+ case 130 /* ReadonlyKeyword */:
+ case 131 /* RequireKeyword */:
+ case 132 /* NumberKeyword */:
+ case 133 /* SetKeyword */:
+ case 134 /* StringKeyword */:
+ case 135 /* SymbolKeyword */:
+ case 136 /* TypeKeyword */:
+ case 137 /* UndefinedKeyword */:
+ case 138 /* FromKeyword */:
+ case 139 /* GlobalKeyword */:
+ case 140 /* OfKeyword */:
writeTokenText(kind);
return;
// Parse tree nodes
// Names
- case 140 /* QualifiedName */:
+ case 141 /* QualifiedName */:
return emitQualifiedName(node);
- case 141 /* ComputedPropertyName */:
+ case 142 /* ComputedPropertyName */:
return emitComputedPropertyName(node);
// Signature elements
- case 142 /* TypeParameter */:
+ case 143 /* TypeParameter */:
return emitTypeParameter(node);
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
return emitParameter(node);
- case 144 /* Decorator */:
+ case 145 /* Decorator */:
return emitDecorator(node);
// Type members
- case 145 /* PropertySignature */:
+ case 146 /* PropertySignature */:
return emitPropertySignature(node);
- case 146 /* PropertyDeclaration */:
+ case 147 /* PropertyDeclaration */:
return emitPropertyDeclaration(node);
- case 147 /* MethodSignature */:
+ case 148 /* MethodSignature */:
return emitMethodSignature(node);
- case 148 /* MethodDeclaration */:
+ case 149 /* MethodDeclaration */:
return emitMethodDeclaration(node);
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
return emitConstructor(node);
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
return emitAccessorDeclaration(node);
- case 152 /* CallSignature */:
+ case 153 /* CallSignature */:
return emitCallSignature(node);
- case 153 /* ConstructSignature */:
+ case 154 /* ConstructSignature */:
return emitConstructSignature(node);
- case 154 /* IndexSignature */:
+ case 155 /* IndexSignature */:
return emitIndexSignature(node);
// Types
- case 155 /* TypePredicate */:
+ case 156 /* TypePredicate */:
return emitTypePredicate(node);
- case 156 /* TypeReference */:
+ case 157 /* TypeReference */:
return emitTypeReference(node);
- case 157 /* FunctionType */:
+ case 158 /* FunctionType */:
return emitFunctionType(node);
- case 158 /* ConstructorType */:
+ case 159 /* ConstructorType */:
return emitConstructorType(node);
- case 159 /* TypeQuery */:
+ case 160 /* TypeQuery */:
return emitTypeQuery(node);
- case 160 /* TypeLiteral */:
+ case 161 /* TypeLiteral */:
return emitTypeLiteral(node);
- case 161 /* ArrayType */:
+ case 162 /* ArrayType */:
return emitArrayType(node);
- case 162 /* TupleType */:
+ case 163 /* TupleType */:
return emitTupleType(node);
- case 163 /* UnionType */:
+ case 164 /* UnionType */:
return emitUnionType(node);
- case 164 /* IntersectionType */:
+ case 165 /* IntersectionType */:
return emitIntersectionType(node);
- case 165 /* ParenthesizedType */:
+ case 166 /* ParenthesizedType */:
return emitParenthesizedType(node);
- case 195 /* ExpressionWithTypeArguments */:
+ case 198 /* ExpressionWithTypeArguments */:
return emitExpressionWithTypeArguments(node);
- case 166 /* ThisType */:
+ case 167 /* ThisType */:
return emitThisType();
- case 167 /* LiteralType */:
+ case 168 /* TypeOperator */:
+ return emitTypeOperator(node);
+ case 169 /* IndexedAccessType */:
+ return emitPropertyAccessType(node);
+ case 170 /* LiteralType */:
return emitLiteralType(node);
// Binding patterns
- case 168 /* ObjectBindingPattern */:
+ case 171 /* ObjectBindingPattern */:
return emitObjectBindingPattern(node);
- case 169 /* ArrayBindingPattern */:
+ case 172 /* ArrayBindingPattern */:
return emitArrayBindingPattern(node);
- case 170 /* BindingElement */:
+ case 173 /* BindingElement */:
return emitBindingElement(node);
// Misc
- case 198 /* TemplateSpan */:
+ case 201 /* TemplateSpan */:
return emitTemplateSpan(node);
- case 199 /* SemicolonClassElement */:
+ case 202 /* SemicolonClassElement */:
return emitSemicolonClassElement();
// Statements
- case 200 /* Block */:
+ case 203 /* Block */:
return emitBlock(node);
- case 201 /* VariableStatement */:
+ case 204 /* VariableStatement */:
return emitVariableStatement(node);
- case 202 /* EmptyStatement */:
+ case 205 /* EmptyStatement */:
return emitEmptyStatement();
- case 203 /* ExpressionStatement */:
+ case 206 /* ExpressionStatement */:
return emitExpressionStatement(node);
- case 204 /* IfStatement */:
+ case 207 /* IfStatement */:
return emitIfStatement(node);
- case 205 /* DoStatement */:
+ case 208 /* DoStatement */:
return emitDoStatement(node);
- case 206 /* WhileStatement */:
+ case 209 /* WhileStatement */:
return emitWhileStatement(node);
- case 207 /* ForStatement */:
+ case 210 /* ForStatement */:
return emitForStatement(node);
- case 208 /* ForInStatement */:
+ case 211 /* ForInStatement */:
return emitForInStatement(node);
- case 209 /* ForOfStatement */:
+ case 212 /* ForOfStatement */:
return emitForOfStatement(node);
- case 210 /* ContinueStatement */:
+ case 213 /* ContinueStatement */:
return emitContinueStatement(node);
- case 211 /* BreakStatement */:
+ case 214 /* BreakStatement */:
return emitBreakStatement(node);
- case 212 /* ReturnStatement */:
+ case 215 /* ReturnStatement */:
return emitReturnStatement(node);
- case 213 /* WithStatement */:
+ case 216 /* WithStatement */:
return emitWithStatement(node);
- case 214 /* SwitchStatement */:
+ case 217 /* SwitchStatement */:
return emitSwitchStatement(node);
- case 215 /* LabeledStatement */:
+ case 218 /* LabeledStatement */:
return emitLabeledStatement(node);
- case 216 /* ThrowStatement */:
+ case 219 /* ThrowStatement */:
return emitThrowStatement(node);
- case 217 /* TryStatement */:
+ case 220 /* TryStatement */:
return emitTryStatement(node);
- case 218 /* DebuggerStatement */:
+ case 221 /* DebuggerStatement */:
return emitDebuggerStatement(node);
// Declarations
- case 219 /* VariableDeclaration */:
+ case 222 /* VariableDeclaration */:
return emitVariableDeclaration(node);
- case 220 /* VariableDeclarationList */:
+ case 223 /* VariableDeclarationList */:
return emitVariableDeclarationList(node);
- case 221 /* FunctionDeclaration */:
+ case 224 /* FunctionDeclaration */:
return emitFunctionDeclaration(node);
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
return emitClassDeclaration(node);
- case 223 /* InterfaceDeclaration */:
+ case 226 /* InterfaceDeclaration */:
return emitInterfaceDeclaration(node);
- case 224 /* TypeAliasDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
return emitTypeAliasDeclaration(node);
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
return emitEnumDeclaration(node);
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
return emitModuleDeclaration(node);
- case 227 /* ModuleBlock */:
+ case 230 /* ModuleBlock */:
return emitModuleBlock(node);
- case 228 /* CaseBlock */:
+ case 231 /* CaseBlock */:
return emitCaseBlock(node);
- case 230 /* ImportEqualsDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
return emitImportEqualsDeclaration(node);
- case 231 /* ImportDeclaration */:
+ case 234 /* ImportDeclaration */:
return emitImportDeclaration(node);
- case 232 /* ImportClause */:
+ case 235 /* ImportClause */:
return emitImportClause(node);
- case 233 /* NamespaceImport */:
+ case 236 /* NamespaceImport */:
return emitNamespaceImport(node);
- case 234 /* NamedImports */:
+ case 237 /* NamedImports */:
return emitNamedImports(node);
- case 235 /* ImportSpecifier */:
+ case 238 /* ImportSpecifier */:
return emitImportSpecifier(node);
- case 236 /* ExportAssignment */:
+ case 239 /* ExportAssignment */:
return emitExportAssignment(node);
- case 237 /* ExportDeclaration */:
+ case 240 /* ExportDeclaration */:
return emitExportDeclaration(node);
- case 238 /* NamedExports */:
+ case 241 /* NamedExports */:
return emitNamedExports(node);
- case 239 /* ExportSpecifier */:
+ case 242 /* ExportSpecifier */:
return emitExportSpecifier(node);
- case 240 /* MissingDeclaration */:
+ case 243 /* MissingDeclaration */:
return;
// Module references
- case 241 /* ExternalModuleReference */:
+ case 244 /* ExternalModuleReference */:
return emitExternalModuleReference(node);
// JSX (non-expression)
case 10 /* JsxText */:
return emitJsxText(node);
- case 244 /* JsxOpeningElement */:
+ case 247 /* JsxOpeningElement */:
return emitJsxOpeningElement(node);
- case 245 /* JsxClosingElement */:
+ case 248 /* JsxClosingElement */:
return emitJsxClosingElement(node);
- case 246 /* JsxAttribute */:
+ case 249 /* JsxAttribute */:
return emitJsxAttribute(node);
- case 247 /* JsxSpreadAttribute */:
+ case 250 /* JsxSpreadAttribute */:
return emitJsxSpreadAttribute(node);
- case 248 /* JsxExpression */:
+ case 251 /* JsxExpression */:
return emitJsxExpression(node);
// Clauses
- case 249 /* CaseClause */:
+ case 252 /* CaseClause */:
return emitCaseClause(node);
- case 250 /* DefaultClause */:
+ case 253 /* DefaultClause */:
return emitDefaultClause(node);
- case 251 /* HeritageClause */:
+ case 254 /* HeritageClause */:
return emitHeritageClause(node);
- case 252 /* CatchClause */:
+ case 255 /* CatchClause */:
return emitCatchClause(node);
// Property assignments
- case 253 /* PropertyAssignment */:
+ case 256 /* PropertyAssignment */:
return emitPropertyAssignment(node);
- case 254 /* ShorthandPropertyAssignment */:
+ case 257 /* ShorthandPropertyAssignment */:
return emitShorthandPropertyAssignment(node);
+ case 258 /* SpreadAssignment */:
+ return emitSpreadAssignment(node);
// Enum
- case 255 /* EnumMember */:
+ case 259 /* EnumMember */:
return emitEnumMember(node);
}
// If the node is an expression, try to emit it as an expression with
@@ -57050,65 +58867,65 @@ var ts;
writeTokenText(kind);
return;
// Expressions
- case 171 /* ArrayLiteralExpression */:
+ case 174 /* ArrayLiteralExpression */:
return emitArrayLiteralExpression(node);
- case 172 /* ObjectLiteralExpression */:
+ case 175 /* ObjectLiteralExpression */:
return emitObjectLiteralExpression(node);
- case 173 /* PropertyAccessExpression */:
+ case 176 /* PropertyAccessExpression */:
return emitPropertyAccessExpression(node);
- case 174 /* ElementAccessExpression */:
+ case 177 /* ElementAccessExpression */:
return emitElementAccessExpression(node);
- case 175 /* CallExpression */:
+ case 178 /* CallExpression */:
return emitCallExpression(node);
- case 176 /* NewExpression */:
+ case 179 /* NewExpression */:
return emitNewExpression(node);
- case 177 /* TaggedTemplateExpression */:
+ case 180 /* TaggedTemplateExpression */:
return emitTaggedTemplateExpression(node);
- case 178 /* TypeAssertionExpression */:
+ case 181 /* TypeAssertionExpression */:
return emitTypeAssertionExpression(node);
- case 179 /* ParenthesizedExpression */:
+ case 182 /* ParenthesizedExpression */:
return emitParenthesizedExpression(node);
- case 180 /* FunctionExpression */:
+ case 183 /* FunctionExpression */:
return emitFunctionExpression(node);
- case 181 /* ArrowFunction */:
+ case 184 /* ArrowFunction */:
return emitArrowFunction(node);
- case 182 /* DeleteExpression */:
+ case 185 /* DeleteExpression */:
return emitDeleteExpression(node);
- case 183 /* TypeOfExpression */:
+ case 186 /* TypeOfExpression */:
return emitTypeOfExpression(node);
- case 184 /* VoidExpression */:
+ case 187 /* VoidExpression */:
return emitVoidExpression(node);
- case 185 /* AwaitExpression */:
+ case 188 /* AwaitExpression */:
return emitAwaitExpression(node);
- case 186 /* PrefixUnaryExpression */:
+ case 189 /* PrefixUnaryExpression */:
return emitPrefixUnaryExpression(node);
- case 187 /* PostfixUnaryExpression */:
+ case 190 /* PostfixUnaryExpression */:
return emitPostfixUnaryExpression(node);
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
return emitBinaryExpression(node);
- case 189 /* ConditionalExpression */:
+ case 192 /* ConditionalExpression */:
return emitConditionalExpression(node);
- case 190 /* TemplateExpression */:
+ case 193 /* TemplateExpression */:
return emitTemplateExpression(node);
- case 191 /* YieldExpression */:
+ case 194 /* YieldExpression */:
return emitYieldExpression(node);
- case 192 /* SpreadElementExpression */:
- return emitSpreadElementExpression(node);
- case 193 /* ClassExpression */:
+ case 195 /* SpreadElement */:
+ return emitSpreadExpression(node);
+ case 196 /* ClassExpression */:
return emitClassExpression(node);
- case 194 /* OmittedExpression */:
+ case 197 /* OmittedExpression */:
return;
- case 196 /* AsExpression */:
+ case 199 /* AsExpression */:
return emitAsExpression(node);
- case 197 /* NonNullExpression */:
+ case 200 /* NonNullExpression */:
return emitNonNullExpression(node);
// JSX
- case 242 /* JsxElement */:
+ case 245 /* JsxElement */:
return emitJsxElement(node);
- case 243 /* JsxSelfClosingElement */:
+ case 246 /* JsxSelfClosingElement */:
return emitJsxSelfClosingElement(node);
// Transformation nodes
- case 288 /* PartiallyEmittedExpression */:
+ case 292 /* PartiallyEmittedExpression */:
return emitPartiallyEmittedExpression(node);
}
}
@@ -57234,7 +59051,7 @@ var ts;
function emitAccessorDeclaration(node) {
emitDecorators(node, node.decorators);
emitModifiers(node, node.modifiers);
- write(node.kind === 150 /* GetAccessor */ ? "get " : "set ");
+ write(node.kind === 151 /* GetAccessor */ ? "get " : "set ");
emit(node.name);
emitSignatureAndBody(node, emitSignatureHead);
}
@@ -57322,6 +59139,17 @@ var ts;
function emitThisType() {
write("this");
}
+ function emitTypeOperator(node) {
+ writeTokenText(node.operator);
+ write(" ");
+ emit(node.type);
+ }
+ function emitPropertyAccessType(node) {
+ emit(node.objectType);
+ write("[");
+ emit(node.indexType);
+ write("]");
+ }
function emitLiteralType(node) {
emitExpression(node.literal);
}
@@ -57508,7 +59336,7 @@ var ts;
// expression a prefix increment whose operand is a plus expression - (++(+x))
// The same is true of minus of course.
var operand = node.operand;
- return operand.kind === 186 /* PrefixUnaryExpression */
+ return operand.kind === 189 /* PrefixUnaryExpression */
&& ((node.operator === 36 /* PlusToken */ && (operand.operator === 36 /* PlusToken */ || operand.operator === 42 /* PlusPlusToken */))
|| (node.operator === 37 /* MinusToken */ && (operand.operator === 37 /* MinusToken */ || operand.operator === 43 /* MinusMinusToken */)));
}
@@ -57552,7 +59380,7 @@ var ts;
write(node.asteriskToken ? "yield*" : "yield");
emitExpressionWithPrefix(" ", node.expression);
}
- function emitSpreadElementExpression(node) {
+ function emitSpreadExpression(node) {
write("...");
emitExpression(node.expression);
}
@@ -57626,7 +59454,7 @@ var ts;
if (node.elseStatement) {
writeLine();
writeToken(81 /* ElseKeyword */, node.thenStatement.end, node);
- if (node.elseStatement.kind === 204 /* IfStatement */) {
+ if (node.elseStatement.kind === 207 /* IfStatement */) {
write(" ");
emit(node.elseStatement);
}
@@ -57688,7 +59516,7 @@ var ts;
}
function emitForBinding(node) {
if (node !== undefined) {
- if (node.kind === 220 /* VariableDeclarationList */) {
+ if (node.kind === 223 /* VariableDeclarationList */) {
emit(node);
}
else {
@@ -57927,7 +59755,7 @@ var ts;
write(node.flags & 16 /* Namespace */ ? "namespace " : "module ");
emit(node.name);
var body = node.body;
- while (body.kind === 226 /* ModuleDeclaration */) {
+ while (body.kind === 229 /* ModuleDeclaration */) {
write(".");
emit(body.name);
body = body.body;
@@ -58167,6 +59995,12 @@ var ts;
emitExpression(node.objectAssignmentInitializer);
}
}
+ function emitSpreadAssignment(node) {
+ if (node.expression) {
+ write("...");
+ emitExpression(node.expression);
+ }
+ }
//
// Enum
//
@@ -58252,10 +60086,17 @@ var ts;
extendsEmitted = true;
helpersEmitted = true;
}
- if (compilerOptions.jsx !== 1 /* Preserve */ && !assignEmitted && (node.flags & 16384 /* HasJsxSpreadAttributes */)) {
+ if ((languageVersion < 5 /* ESNext */ || currentSourceFile.scriptKind === 2 /* JSX */ || currentSourceFile.scriptKind === 4 /* TSX */) &&
+ compilerOptions.jsx !== 1 /* Preserve */ &&
+ !assignEmitted &&
+ node.flags & 16384 /* HasSpreadAttribute */) {
writeLines(assignHelper);
assignEmitted = true;
}
+ if (languageVersion < 5 /* ESNext */ && !restEmitted && node.flags & 32768 /* HasRestAttribute */) {
+ writeLines(restHelper);
+ restEmitted = true;
+ }
if (!decorateEmitted && node.flags & 2048 /* HasDecorators */) {
writeLines(decorateHelper);
if (compilerOptions.emitDecoratorMetadata) {
@@ -58601,7 +60442,7 @@ var ts;
&& !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile);
}
function skipSynthesizedParentheses(node) {
- while (node.kind === 179 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
+ while (node.kind === 182 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
node = node.expression;
}
return node;
@@ -58664,10 +60505,10 @@ var ts;
*/
function makeTempVariableName(flags) {
if (flags && !(tempFlags & flags)) {
- var name_41 = flags === 268435456 /* _i */ ? "_i" : "_n";
- if (isUniqueName(name_41)) {
+ var name_38 = flags === 268435456 /* _i */ ? "_i" : "_n";
+ if (isUniqueName(name_38)) {
tempFlags |= flags;
- return name_41;
+ return name_38;
}
}
while (true) {
@@ -58675,11 +60516,11 @@ var ts;
tempFlags++;
// Skip over 'i' and 'n'
if (count !== 8 && count !== 13) {
- var name_42 = count < 26
+ var name_39 = count < 26
? "_" + String.fromCharCode(97 /* a */ + count)
: "_" + (count - 26);
- if (isUniqueName(name_42)) {
- return name_42;
+ if (isUniqueName(name_39)) {
+ return name_39;
}
}
}
@@ -58728,17 +60569,17 @@ var ts;
switch (node.kind) {
case 70 /* Identifier */:
return makeUniqueName(getTextOfNode(node));
- case 226 /* ModuleDeclaration */:
- case 225 /* EnumDeclaration */:
+ case 229 /* ModuleDeclaration */:
+ case 228 /* EnumDeclaration */:
return generateNameForModuleOrEnum(node);
- case 231 /* ImportDeclaration */:
- case 237 /* ExportDeclaration */:
+ case 234 /* ImportDeclaration */:
+ case 240 /* ExportDeclaration */:
return generateNameForImportOrExportDeclaration(node);
- case 221 /* FunctionDeclaration */:
- case 222 /* ClassDeclaration */:
- case 236 /* ExportAssignment */:
+ case 224 /* FunctionDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 239 /* ExportAssignment */:
return generateNameForExportDefault();
- case 193 /* ClassExpression */:
+ case 196 /* ClassExpression */:
return generateNameForClassExpression();
default:
return makeTempVariableName(0 /* Auto */);
@@ -58905,7 +60746,7 @@ var ts;
var ts;
(function (ts) {
/** The version of the TypeScript compiler release */
- ts.version = "2.1.2";
+ ts.version = "2.1.3";
var emptyArray = [];
function findConfigFile(searchPath, fileExists, configName) {
if (configName === void 0) { configName = "tsconfig.json"; }
@@ -59131,11 +60972,11 @@ var ts;
}
var resolutions = [];
var cache = ts.createMap();
- for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
- var name_43 = names_2[_i];
- var result = name_43 in cache
- ? cache[name_43]
- : cache[name_43] = loader(name_43, containingFile);
+ for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
+ var name_40 = names_1[_i];
+ var result = name_40 in cache
+ ? cache[name_40]
+ : cache[name_40] = loader(name_40, containingFile);
resolutions.push(result);
}
return resolutions;
@@ -59156,7 +60997,7 @@ var ts;
// - This calls resolveModuleNames, and then calls findSourceFile for each resolved module.
// As all these operations happen - and are nested - within the createProgram call, they close over the below variables.
// The current resolution depth is tracked by incrementing/decrementing as the depth first search progresses.
- var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
+ var maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
var currentNodeModulesDepth = 0;
// If a module has some of its imports skipped due to being at the depth limit under node_modules, then track
// this, as it may be imported at a shallower depth later, and then it will need its skipped imports processed.
@@ -59173,7 +61014,15 @@ var ts;
var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName);
var resolveModuleNamesWorker;
if (host.resolveModuleNames) {
- resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); };
+ resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) {
+ // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
+ if (!resolved || resolved.extension !== undefined) {
+ return resolved;
+ }
+ var withExtension = ts.clone(resolved);
+ withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName);
+ return withExtension;
+ }); };
}
else {
var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host).resolvedModule; };
@@ -59246,6 +61095,7 @@ var ts;
getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
+ isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker
};
verifyCompilerOptions();
@@ -59282,6 +61132,112 @@ var ts;
}
return classifiableNames;
}
+ function resolveModuleNamesReusingOldState(moduleNames, containingFile, file, oldProgramState) {
+ if (!oldProgramState && !file.ambientModuleNames.length) {
+ // if old program state is not supplied and file does not contain locally defined ambient modules
+ // then the best we can do is fallback to the default logic
+ return resolveModuleNamesWorker(moduleNames, containingFile);
+ }
+ // at this point we know that either
+ // - file has local declarations for ambient modules
+ // OR
+ // - old program state is available
+ // OR
+ // - both of items above
+ // With this it is possible that we can tell how some module names from the initial list will be resolved
+ // without doing actual resolution (in particular if some name was resolved to ambient module).
+ // Such names should be excluded from the list of module names that will be provided to `resolveModuleNamesWorker`
+ // since we don't want to resolve them again.
+ // this is a list of modules for which we cannot predict resolution so they should be actually resolved
+ var unknownModuleNames;
+ // this is a list of combined results assembles from predicted and resolved results.
+ // Order in this list matches the order in the original list of module names `moduleNames` which is important
+ // so later we can split results to resolutions of modules and resolutions of module augmentations.
+ var result;
+ // a transient placeholder that is used to mark predicted resolution in the result list
+ var predictedToResolveToAmbientModuleMarker = {};
+ for (var i = 0; i < moduleNames.length; i++) {
+ var moduleName = moduleNames[i];
+ // module name is known to be resolved to ambient module if
+ // - module name is contained in the list of ambient modules that are locally declared in the file
+ // - in the old program module name was resolved to ambient module whose declaration is in non-modified file
+ // (so the same module declaration will land in the new program)
+ var isKnownToResolveToAmbientModule = false;
+ if (ts.contains(file.ambientModuleNames, moduleName)) {
+ isKnownToResolveToAmbientModule = true;
+ if (ts.isTraceEnabled(options, host)) {
+ ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName, containingFile);
+ }
+ }
+ else {
+ isKnownToResolveToAmbientModule = checkModuleNameResolvedToAmbientModuleInNonModifiedFile(moduleName, oldProgramState);
+ }
+ if (isKnownToResolveToAmbientModule) {
+ if (!unknownModuleNames) {
+ // found a first module name for which result can be prediced
+ // this means that this module name should not be passed to `resolveModuleNamesWorker`.
+ // We'll use a separate list for module names that are definitely unknown.
+ result = new Array(moduleNames.length);
+ // copy all module names that appear before the current one in the list
+ // since they are known to be unknown
+ unknownModuleNames = moduleNames.slice(0, i);
+ }
+ // mark prediced resolution in the result list
+ result[i] = predictedToResolveToAmbientModuleMarker;
+ }
+ else if (unknownModuleNames) {
+ // found unknown module name and we are already using separate list for those - add it to the list
+ unknownModuleNames.push(moduleName);
+ }
+ }
+ if (!unknownModuleNames) {
+ // we've looked throught the list but have not seen any predicted resolution
+ // use default logic
+ return resolveModuleNamesWorker(moduleNames, containingFile);
+ }
+ var resolutions = unknownModuleNames.length
+ ? resolveModuleNamesWorker(unknownModuleNames, containingFile)
+ : emptyArray;
+ // combine results of resolutions and predicted results
+ var j = 0;
+ for (var i = 0; i < result.length; i++) {
+ if (result[i] == predictedToResolveToAmbientModuleMarker) {
+ result[i] = undefined;
+ }
+ else {
+ result[i] = resolutions[j];
+ j++;
+ }
+ }
+ ts.Debug.assert(j === resolutions.length);
+ return result;
+ function checkModuleNameResolvedToAmbientModuleInNonModifiedFile(moduleName, oldProgramState) {
+ if (!oldProgramState) {
+ return false;
+ }
+ var resolutionToFile = ts.getResolvedModule(oldProgramState.file, moduleName);
+ if (resolutionToFile) {
+ // module used to be resolved to file - ignore it
+ return false;
+ }
+ var ambientModule = oldProgram.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(moduleName);
+ if (!(ambientModule && ambientModule.declarations)) {
+ return false;
+ }
+ // at least one of declarations should come from non-modified source file
+ var firstUnmodifiedFile = ts.forEach(ambientModule.declarations, function (d) {
+ var f = ts.getSourceFileOfNode(d);
+ return !ts.contains(oldProgramState.modifiedFilePaths, f.path) && f;
+ });
+ if (!firstUnmodifiedFile) {
+ return false;
+ }
+ if (ts.isTraceEnabled(options, host)) {
+ ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName, firstUnmodifiedFile.fileName);
+ }
+ return true;
+ }
+ }
function tryReuseStructureFromOldProgram() {
if (!oldProgram) {
return false;
@@ -59340,29 +61296,8 @@ var ts;
// 'types' references has changed
return false;
}
- var newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory);
- if (resolveModuleNamesWorker) {
- var moduleNames = ts.map(ts.concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral);
- var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFilePath);
- // ensure that module resolution results are still correct
- var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo);
- if (resolutionsChanged) {
- return false;
- }
- }
- if (resolveTypeReferenceDirectiveNamesWorker) {
- var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (x) { return x.fileName; });
- var resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath);
- // ensure that types resolutions are still correct
- var resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo);
- if (resolutionsChanged) {
- return false;
- }
- }
- // pass the cache of module/types resolutions from the old source file
- newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
- newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
- modifiedSourceFiles.push(newSourceFile);
+ // tentatively approve the file
+ modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
}
else {
// file has no changes - use it as is
@@ -59371,15 +61306,42 @@ var ts;
// if file has passed all checks it should be safe to reuse it
newSourceFiles.push(newSourceFile);
}
+ var modifiedFilePaths = modifiedSourceFiles.map(function (f) { return f.newFile.path; });
+ // try to verify results of module resolution
+ for (var _b = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _b < modifiedSourceFiles_1.length; _b++) {
+ var _c = modifiedSourceFiles_1[_b], oldSourceFile = _c.oldFile, newSourceFile = _c.newFile;
+ var newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory);
+ if (resolveModuleNamesWorker) {
+ var moduleNames = ts.map(ts.concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral);
+ var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFilePath, newSourceFile, { file: oldSourceFile, program: oldProgram, modifiedFilePaths: modifiedFilePaths });
+ // ensure that module resolution results are still correct
+ var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo);
+ if (resolutionsChanged) {
+ return false;
+ }
+ }
+ if (resolveTypeReferenceDirectiveNamesWorker) {
+ var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (x) { return x.fileName; });
+ var resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath);
+ // ensure that types resolutions are still correct
+ var resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo);
+ if (resolutionsChanged) {
+ return false;
+ }
+ }
+ // pass the cache of module/types resolutions from the old source file
+ newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
+ newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
+ }
// update fileName -> file mapping
for (var i = 0, len = newSourceFiles.length; i < len; i++) {
filesByName.set(filePaths[i], newSourceFiles[i]);
}
files = newSourceFiles;
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
- for (var _b = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _b < modifiedSourceFiles_1.length; _b++) {
- var modifiedFile = modifiedSourceFiles_1[_b];
- fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile);
+ for (var _d = 0, modifiedSourceFiles_2 = modifiedSourceFiles; _d < modifiedSourceFiles_2.length; _d++) {
+ var modifiedFile = modifiedSourceFiles_2[_d];
+ fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile.newFile);
}
resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
oldProgram.structureIsReused = true;
@@ -59395,11 +61357,14 @@ var ts;
getSourceFile: program.getSourceFile,
getSourceFileByPath: program.getSourceFileByPath,
getSourceFiles: program.getSourceFiles,
- isSourceFileFromExternalLibrary: function (file) { return !!sourceFilesFoundSearchingNodeModules[file.path]; },
+ isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }),
isEmitBlocked: isEmitBlocked,
};
}
+ function isSourceFileFromExternalLibrary(file) {
+ return sourceFilesFoundSearchingNodeModules[file.path];
+ }
function getDiagnosticsProducingTypeChecker() {
return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ true));
}
@@ -59488,6 +61453,14 @@ var ts;
}
}
function getSyntacticDiagnosticsForFile(sourceFile) {
+ // For JavaScript files, we report semantic errors for using TypeScript-only
+ // constructs from within a JavaScript file as syntactic errors.
+ if (ts.isSourceFileJavaScript(sourceFile)) {
+ if (!sourceFile.additionalSyntacticDiagnostics) {
+ sourceFile.additionalSyntacticDiagnostics = getJavaScriptSyntacticDiagnosticsForFile(sourceFile);
+ }
+ return ts.concatenate(sourceFile.additionalSyntacticDiagnostics, sourceFile.parseDiagnostics);
+ }
return sourceFile.parseDiagnostics;
}
function runWithCancellationToken(func) {
@@ -59516,179 +61489,180 @@ var ts;
var typeChecker = getDiagnosticsProducingTypeChecker();
ts.Debug.assert(!!sourceFile.bindDiagnostics);
var bindDiagnostics = sourceFile.bindDiagnostics;
- // For JavaScript files, we don't want to report the normal typescript semantic errors.
- // Instead, we just report errors for using TypeScript-only constructs from within a
- // JavaScript file.
- var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ?
- getJavaScriptSemanticDiagnosticsForFile(sourceFile) :
- typeChecker.getDiagnostics(sourceFile, cancellationToken);
+ // For JavaScript files, we don't want to report semantic errors.
+ // Instead, we'll report errors for using TypeScript-only constructs from within a
+ // JavaScript file when we get syntactic diagnostics for the file.
+ var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ? [] : typeChecker.getDiagnostics(sourceFile, cancellationToken);
var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName);
var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);
return bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile);
});
}
- function getJavaScriptSemanticDiagnosticsForFile(sourceFile) {
+ function getJavaScriptSyntacticDiagnosticsForFile(sourceFile) {
return runWithCancellationToken(function () {
var diagnostics = [];
+ var parent = sourceFile;
walk(sourceFile);
return diagnostics;
function walk(node) {
- if (!node) {
- return false;
+ // Return directly from the case if the given node doesnt want to visit each child
+ // Otherwise break to visit each child
+ switch (parent.kind) {
+ case 144 /* Parameter */:
+ case 147 /* PropertyDeclaration */:
+ if (parent.questionToken === node) {
+ diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?"));
+ return;
+ }
+ // Pass through
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 150 /* Constructor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 183 /* FunctionExpression */:
+ case 224 /* FunctionDeclaration */:
+ case 184 /* ArrowFunction */:
+ case 224 /* FunctionDeclaration */:
+ case 222 /* VariableDeclaration */:
+ // type annotation
+ if (parent.type === node) {
+ diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file));
+ return;
+ }
}
switch (node.kind) {
- case 230 /* ImportEqualsDeclaration */:
- diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file));
- return true;
- case 236 /* ExportAssignment */:
+ case 233 /* ImportEqualsDeclaration */:
+ diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file));
+ return;
+ case 239 /* ExportAssignment */:
if (node.isExportEquals) {
- diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file));
- return true;
+ diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file));
+ return;
}
break;
- case 222 /* ClassDeclaration */:
- var classDeclaration = node;
- if (checkModifiers(classDeclaration.modifiers) ||
- checkTypeParameters(classDeclaration.typeParameters)) {
- return true;
- }
- break;
- case 251 /* HeritageClause */:
+ case 254 /* HeritageClause */:
var heritageClause = node;
if (heritageClause.token === 107 /* ImplementsKeyword */) {
- diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file));
- return true;
+ diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file));
+ return;
}
break;
- case 223 /* InterfaceDeclaration */:
- diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file));
- return true;
- case 226 /* ModuleDeclaration */:
- diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file));
- return true;
- case 224 /* TypeAliasDeclaration */:
- diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file));
- return true;
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 149 /* Constructor */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 180 /* FunctionExpression */:
- case 221 /* FunctionDeclaration */:
- case 181 /* ArrowFunction */:
- case 221 /* FunctionDeclaration */:
- var functionDeclaration = node;
- if (checkModifiers(functionDeclaration.modifiers) ||
- checkTypeParameters(functionDeclaration.typeParameters) ||
- checkTypeAnnotation(functionDeclaration.type)) {
- return true;
+ case 226 /* InterfaceDeclaration */:
+ diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file));
+ return;
+ case 229 /* ModuleDeclaration */:
+ diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file));
+ return;
+ case 227 /* TypeAliasDeclaration */:
+ diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file));
+ return;
+ case 228 /* EnumDeclaration */:
+ diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file));
+ return;
+ case 181 /* TypeAssertionExpression */:
+ var typeAssertionExpression = node;
+ diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));
+ return;
+ }
+ var prevParent = parent;
+ parent = node;
+ ts.forEachChild(node, walk, walkArray);
+ parent = prevParent;
+ }
+ function walkArray(nodes) {
+ if (parent.decorators === nodes && !options.experimentalDecorators) {
+ diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning));
+ }
+ switch (parent.kind) {
+ case 225 /* ClassDeclaration */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 150 /* Constructor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 183 /* FunctionExpression */:
+ case 224 /* FunctionDeclaration */:
+ case 184 /* ArrowFunction */:
+ case 224 /* FunctionDeclaration */:
+ // Check type parameters
+ if (nodes === parent.typeParameters) {
+ diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file));
+ return;
+ }
+ // pass through
+ case 204 /* VariableStatement */:
+ // Check modifiers
+ if (nodes === parent.modifiers) {
+ return checkModifiers(nodes, parent.kind === 204 /* VariableStatement */);
}
break;
- case 201 /* VariableStatement */:
- var variableStatement = node;
- if (checkModifiers(variableStatement.modifiers)) {
- return true;
- }
- break;
- case 219 /* VariableDeclaration */:
- var variableDeclaration = node;
- if (checkTypeAnnotation(variableDeclaration.type)) {
- return true;
- }
- break;
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
- var expression = node;
- if (expression.typeArguments && expression.typeArguments.length > 0) {
- var start = expression.typeArguments.pos;
- diagnostics.push(ts.createFileDiagnostic(sourceFile, start, expression.typeArguments.end - start, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file));
- return true;
- }
- break;
- case 143 /* Parameter */:
- var parameter = node;
- if (parameter.modifiers) {
- var start = parameter.modifiers.pos;
- diagnostics.push(ts.createFileDiagnostic(sourceFile, start, parameter.modifiers.end - start, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file));
- return true;
- }
- if (parameter.questionToken) {
- diagnostics.push(ts.createDiagnosticForNode(parameter.questionToken, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?"));
- return true;
- }
- if (parameter.type) {
- diagnostics.push(ts.createDiagnosticForNode(parameter.type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file));
- return true;
- }
- break;
- case 146 /* PropertyDeclaration */:
- var propertyDeclaration = node;
- if (propertyDeclaration.modifiers) {
- for (var _i = 0, _a = propertyDeclaration.modifiers; _i < _a.length; _i++) {
+ case 147 /* PropertyDeclaration */:
+ // Check modifiers of property declaration
+ if (nodes === parent.modifiers) {
+ for (var _i = 0, _a = nodes; _i < _a.length; _i++) {
var modifier = _a[_i];
if (modifier.kind !== 114 /* StaticKeyword */) {
- diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
- return true;
+ diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
}
}
- }
- if (checkTypeAnnotation(node.type)) {
- return true;
+ return;
}
break;
- case 225 /* EnumDeclaration */:
- diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file));
- return true;
- case 178 /* TypeAssertionExpression */:
- var typeAssertionExpression = node;
- diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));
- return true;
- case 144 /* Decorator */:
- if (!options.experimentalDecorators) {
- diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning));
+ case 144 /* Parameter */:
+ // Check modifiers of parameter declaration
+ if (nodes === parent.modifiers) {
+ diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file));
+ return;
}
- return true;
- }
- return ts.forEachChild(node, walk);
- }
- function checkTypeParameters(typeParameters) {
- if (typeParameters) {
- var start = typeParameters.pos;
- diagnostics.push(ts.createFileDiagnostic(sourceFile, start, typeParameters.end - start, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file));
- return true;
- }
- return false;
- }
- function checkTypeAnnotation(type) {
- if (type) {
- diagnostics.push(ts.createDiagnosticForNode(type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file));
- return true;
- }
- return false;
- }
- function checkModifiers(modifiers) {
- if (modifiers) {
- for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) {
- var modifier = modifiers_1[_i];
- switch (modifier.kind) {
- case 113 /* PublicKeyword */:
- case 111 /* PrivateKeyword */:
- case 112 /* ProtectedKeyword */:
- case 129 /* ReadonlyKeyword */:
- case 123 /* DeclareKeyword */:
- diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
- return true;
- // These are all legal modifiers.
- case 114 /* StaticKeyword */:
- case 83 /* ExportKeyword */:
- case 75 /* ConstKeyword */:
- case 78 /* DefaultKeyword */:
- case 116 /* AbstractKeyword */:
+ break;
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
+ case 198 /* ExpressionWithTypeArguments */:
+ // Check type arguments
+ if (nodes === parent.typeArguments) {
+ diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file));
+ return;
}
+ break;
+ }
+ for (var _b = 0, nodes_4 = nodes; _b < nodes_4.length; _b++) {
+ var node = nodes_4[_b];
+ walk(node);
+ }
+ }
+ function checkModifiers(modifiers, isConstValid) {
+ for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) {
+ var modifier = modifiers_1[_i];
+ switch (modifier.kind) {
+ case 75 /* ConstKeyword */:
+ if (isConstValid) {
+ continue;
+ }
+ // Fallthrough to report error
+ case 113 /* PublicKeyword */:
+ case 111 /* PrivateKeyword */:
+ case 112 /* ProtectedKeyword */:
+ case 130 /* ReadonlyKeyword */:
+ case 123 /* DeclareKeyword */:
+ case 116 /* AbstractKeyword */:
+ diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
+ break;
+ // These are all legal modifiers.
+ case 114 /* StaticKeyword */:
+ case 83 /* ExportKeyword */:
+ case 78 /* DefaultKeyword */:
}
}
- return false;
+ }
+ function createDiagnosticForNodeArray(nodes, message, arg0, arg1, arg2) {
+ var start = nodes.pos;
+ return ts.createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2);
+ }
+ // Since these are syntactic diagnostics, parent might not have been set
+ // this means the sourceFile cannot be infered from the node
+ function createDiagnosticForNode(node, message, arg0, arg1, arg2) {
+ return ts.createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2);
}
});
}
@@ -59713,9 +61687,6 @@ var ts;
ts.addRange(allDiagnostics, getDiagnosticsProducingTypeChecker().getGlobalDiagnostics());
return ts.sortAndDeduplicateDiagnostics(allDiagnostics);
}
- function hasExtension(fileName) {
- return ts.getBaseFileName(fileName).indexOf(".") >= 0;
- }
function processRootFile(fileName, isDefaultLib) {
processSourceFile(ts.normalizePath(fileName), isDefaultLib);
}
@@ -59734,16 +61705,21 @@ var ts;
}
var isJavaScriptFile = ts.isSourceFileJavaScript(file);
var isExternalModuleFile = ts.isExternalModule(file);
+ var isDtsFile = ts.isDeclarationFile(file);
var imports;
var moduleAugmentations;
+ var ambientModules;
// If we are importing helpers, we need to add a synthetic reference to resolve the
// helpers library.
if (options.importHelpers
&& (options.isolatedModules || isExternalModuleFile)
&& !file.isDeclarationFile) {
- var externalHelpersModuleReference = ts.createNode(9 /* StringLiteral */);
+ // synthesize 'import "tslib"' declaration
+ var externalHelpersModuleReference = ts.createSynthesizedNode(9 /* StringLiteral */);
externalHelpersModuleReference.text = ts.externalHelpersModuleNameText;
- externalHelpersModuleReference.parent = file;
+ var importDecl = ts.createSynthesizedNode(234 /* ImportDeclaration */);
+ importDecl.parent = file;
+ externalHelpersModuleReference.parent = importDecl;
imports = [externalHelpersModuleReference];
}
for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {
@@ -59755,12 +61731,13 @@ var ts;
}
file.imports = imports || emptyArray;
file.moduleAugmentations = moduleAugmentations || emptyArray;
+ file.ambientModuleNames = ambientModules || emptyArray;
return;
function collectModuleReferences(node, inAmbientModule) {
switch (node.kind) {
- case 231 /* ImportDeclaration */:
- case 230 /* ImportEqualsDeclaration */:
- case 237 /* ExportDeclaration */:
+ case 234 /* ImportDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
+ case 240 /* ExportDeclaration */:
var moduleNameExpr = ts.getExternalModuleName(node);
if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) {
break;
@@ -59775,7 +61752,7 @@ var ts;
(imports || (imports = [])).push(moduleNameExpr);
}
break;
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2 /* Ambient */) || ts.isDeclarationFile(file))) {
var moduleName = node.name;
// Ambient module declarations can be interpreted as augmentations for some existing external modules.
@@ -59787,6 +61764,10 @@ var ts;
(moduleAugmentations || (moduleAugmentations = [])).push(moduleName);
}
else if (!inAmbientModule) {
+ if (isDtsFile) {
+ // for global .d.ts files record name of ambient module
+ (ambientModules || (ambientModules = [])).push(moduleName.text);
+ }
// An AmbientExternalModuleDeclaration declares an external module.
// This type of declaration is permitted only in the global module.
// The StringLiteral must specify a top - level external module name.
@@ -59812,13 +61793,10 @@ var ts;
}
}
}
- /**
- * 'isReference' indicates whether the file was brought in via a reference directive (rather than an import declaration)
- */
function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) {
var diagnosticArgument;
var diagnostic;
- if (hasExtension(fileName)) {
+ if (ts.hasExtension(fileName)) {
if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) {
diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1;
diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"];
@@ -59884,7 +61862,7 @@ var ts;
processImportedModules(file_1);
}
else if (file_1 && modulesWithElidedImports[file_1.path]) {
- if (currentNodeModulesDepth < maxNodeModulesJsDepth) {
+ if (currentNodeModulesDepth < maxNodeModuleJsDepth) {
modulesWithElidedImports[file_1.path] = false;
processImportedModules(file_1);
}
@@ -60004,29 +61982,39 @@ var ts;
collectExternalModuleReferences(file);
if (file.imports.length || file.moduleAugmentations.length) {
file.resolvedModules = ts.createMap();
- var moduleNames = ts.map(ts.concatenate(file.imports, file.moduleAugmentations), getTextOfLiteral);
- var resolutions = resolveModuleNamesWorker(moduleNames, ts.getNormalizedAbsolutePath(file.fileName, currentDirectory));
+ // Because global augmentation doesn't have string literal name, we can check for global augmentation as such.
+ var nonGlobalAugmentation = ts.filter(file.moduleAugmentations, function (moduleAugmentation) { return moduleAugmentation.kind === 9 /* StringLiteral */; });
+ var moduleNames = ts.map(ts.concatenate(file.imports, nonGlobalAugmentation), getTextOfLiteral);
+ var resolutions = resolveModuleNamesReusingOldState(moduleNames, ts.getNormalizedAbsolutePath(file.fileName, currentDirectory), file);
+ ts.Debug.assert(resolutions.length === moduleNames.length);
for (var i = 0; i < moduleNames.length; i++) {
var resolution = resolutions[i];
ts.setResolvedModule(file, moduleNames[i], resolution);
+ if (!resolution) {
+ continue;
+ }
+ var isFromNodeModulesSearch = resolution.isExternalLibraryImport;
+ var isJsFileFromNodeModules = isFromNodeModulesSearch && !ts.extensionIsTypeScript(resolution.extension);
+ var resolvedFileName = resolution.resolvedFileName;
+ if (isFromNodeModulesSearch) {
+ currentNodeModulesDepth++;
+ }
// add file to program only if:
// - resolution was successful
// - noResolve is falsy
// - module name comes from the list of imports
// - it's not a top level JavaScript module that exceeded the search max
- var isFromNodeModulesSearch = resolution && resolution.isExternalLibraryImport;
- var isJsFileFromNodeModules = isFromNodeModulesSearch && ts.hasJavaScriptFileExtension(resolution.resolvedFileName);
- if (isFromNodeModulesSearch) {
- currentNodeModulesDepth++;
- }
- var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModulesJsDepth;
- var shouldAddFile = resolution && !options.noResolve && i < file.imports.length && !elideImport;
+ var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth;
+ // Don't add the file if it has a bad extension (e.g. 'tsx' if we don't have '--allowJs')
+ // This may still end up being an untyped module -- the file won't be included but imports will be allowed.
+ var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport;
if (elideImport) {
modulesWithElidedImports[file.path] = true;
}
else if (shouldAddFile) {
- findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName),
- /*isDefaultLib*/ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
+ var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName);
+ var pos = ts.skipTrivia(file.text, file.imports[i].pos);
+ findSourceFile(resolvedFileName, path, /*isDefaultLib*/ false, file, pos, file.imports[i].end);
}
if (isFromNodeModulesSearch) {
currentNodeModulesDepth--;
@@ -60037,7 +62025,6 @@ var ts;
// no imports - drop cached module resolutions
file.resolvedModules = undefined;
}
- return;
}
function computeCommonSourceDirectory(sourceFiles) {
var fileNames = [];
@@ -60198,7 +62185,15 @@ var ts;
!options.experimentalDecorators) {
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
}
- if (options.reactNamespace && !ts.isIdentifierText(options.reactNamespace, languageVersion)) {
+ if (options.jsxFactory) {
+ if (options.reactNamespace) {
+ programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "reactNamespace", "jsxFactory"));
+ }
+ if (!ts.parseIsolatedEntityName(options.jsxFactory, languageVersion)) {
+ programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory));
+ }
+ }
+ else if (options.reactNamespace && !ts.isIdentifierText(options.reactNamespace, languageVersion)) {
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace));
}
// If the emit is enabled make sure that every output file is unique and not overwriting any of the input files
@@ -60216,18 +62211,13 @@ var ts;
var emitFilePath = ts.toPath(emitFileName, currentDirectory, getCanonicalFileName);
// Report error if the output overwrites input file
if (filesByName.contains(emitFilePath)) {
- if (options.noEmitOverwritenFiles && !options.out && !options.outDir && !options.outFile) {
- blockEmittingOfFile(emitFileName);
- }
- else {
- var chain_1;
- if (!options.configFilePath) {
- // The program is from either an inferred project or an external project
- chain_1 = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);
- }
- chain_1 = ts.chainDiagnosticMessages(chain_1, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
- blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_1));
+ var chain_1;
+ if (!options.configFilePath) {
+ // The program is from either an inferred project or an external project
+ chain_1 = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);
}
+ chain_1 = ts.chainDiagnosticMessages(chain_1, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
+ blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_1));
}
// Report error if multiple files write into same file
if (emitFilesSeen.contains(emitFilePath)) {
@@ -60242,12 +62232,38 @@ var ts;
}
function blockEmittingOfFile(emitFileName, diag) {
hasEmitBlockingDiagnostics.set(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName), true);
- if (diag) {
- programDiagnostics.add(diag);
- }
+ programDiagnostics.add(diag);
}
}
ts.createProgram = createProgram;
+ /* @internal */
+ /**
+ * Returns a DiagnosticMessage if we won't include a resolved module due to its extension.
+ * The DiagnosticMessage's parameters are the imported module name, and the filename it resolved to.
+ * This returns a diagnostic even if the module will be an untyped module.
+ */
+ function getResolutionDiagnostic(options, _a) {
+ var extension = _a.extension;
+ switch (extension) {
+ case ts.Extension.Ts:
+ case ts.Extension.Dts:
+ // These are always allowed.
+ return undefined;
+ case ts.Extension.Tsx:
+ return needJsx();
+ case ts.Extension.Jsx:
+ return needJsx() || needAllowJs();
+ case ts.Extension.Js:
+ return needAllowJs();
+ }
+ function needJsx() {
+ return options.jsx ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set;
+ }
+ function needAllowJs() {
+ return options.allowJs ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_allowJs_is_not_set;
+ }
+ }
+ ts.getResolutionDiagnostic = getResolutionDiagnostic;
})(ts || (ts = {}));
///
///
@@ -60328,6 +62344,11 @@ var ts;
type: "string",
description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit
},
+ {
+ name: "jsxFactory",
+ type: "string",
+ description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h
+ },
{
name: "listFiles",
type: "boolean",
@@ -60516,6 +62537,7 @@ var ts;
"es2015": 2 /* ES2015 */,
"es2016": 3 /* ES2016 */,
"es2017": 4 /* ES2017 */,
+ "esnext": 5 /* ESNext */,
}),
description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015,
paramType: ts.Diagnostics.VERSION,
@@ -60679,7 +62701,8 @@ var ts;
"es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts",
"es2016.array.include": "lib.es2016.array.include.d.ts",
"es2017.object": "lib.es2017.object.d.ts",
- "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts"
+ "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts",
+ "es2017.string": "lib.es2017.string.d.ts",
}),
},
description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon
@@ -60976,11 +62999,11 @@ var ts;
function serializeCompilerOptions(options) {
var result = ts.createMap();
var optionsNameMap = getOptionNameMap().optionNameMap;
- for (var name_44 in options) {
- if (ts.hasProperty(options, name_44)) {
+ for (var name_41 in options) {
+ if (ts.hasProperty(options, name_41)) {
// tsconfig only options cannot be specified via command line,
// so we can assume that only types that can appear here string | number | boolean
- switch (name_44) {
+ switch (name_41) {
case "init":
case "watch":
case "version":
@@ -60988,14 +63011,14 @@ var ts;
case "project":
break;
default:
- var value = options[name_44];
- var optionDefinition = optionsNameMap[name_44.toLowerCase()];
+ var value = options[name_41];
+ var optionDefinition = optionsNameMap[name_41.toLowerCase()];
if (optionDefinition) {
var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition);
if (!customTypeMap) {
// There is no map associated with this compiler option then use the value as-is
// This is the case if the value is expect to be string, number, boolean or list of string
- result[name_44] = value;
+ result[name_41] = value;
}
else {
if (optionDefinition.type === "list") {
@@ -61004,11 +63027,11 @@ var ts;
var element = _a[_i];
convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap));
}
- result[name_44] = convertedValue;
+ result[name_41] = convertedValue;
}
else {
// There is a typeMap associated with this command-line option so use it to map value back to its name
- result[name_44] = getNameOfCompilerOptionValue(value, customTypeMap);
+ result[name_41] = getNameOfCompilerOptionValue(value, customTypeMap);
}
}
}
@@ -61218,9 +63241,7 @@ var ts;
return options;
}
function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
- var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
- ? { enableAutoDiscovery: true, include: [], exclude: [] }
- : { enableAutoDiscovery: false, include: [], exclude: [] };
+ var options = { enableAutoDiscovery: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors);
return options;
}
@@ -61452,6 +63473,7 @@ var ts;
//
// /a/b/**/d - Watch /a/b recursively to catch changes to any d in any subfolder recursively
// /a/b/*/d - Watch /a/b recursively to catch any d in any immediate subfolder, even if a new subfolder is added
+ // /a/b - Watch /a/b recursively to catch changes to anything in any recursive subfoler
//
// We watch a directory without recursion if it contains a wildcard in the file segment of
// the pattern:
@@ -61465,14 +63487,13 @@ var ts;
var recursiveKeys = [];
for (var _i = 0, include_1 = include; _i < include_1.length; _i++) {
var file = include_1[_i];
- var name_45 = ts.normalizePath(ts.combinePaths(path, file));
- if (excludeRegex && excludeRegex.test(name_45)) {
+ var spec = ts.normalizePath(ts.combinePaths(path, file));
+ if (excludeRegex && excludeRegex.test(spec)) {
continue;
}
- var match = wildcardDirectoryPattern.exec(name_45);
+ var match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames);
if (match) {
- var key = useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase();
- var flags = watchRecursivePattern.test(name_45) ? 1 /* Recursive */ : 0 /* None */;
+ var key = match.key, flags = match.flags;
var existingFlags = wildcardDirectories[key];
if (existingFlags === undefined || existingFlags < flags) {
wildcardDirectories[key] = flags;
@@ -61494,6 +63515,19 @@ var ts;
}
return wildcardDirectories;
}
+ function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames) {
+ var match = wildcardDirectoryPattern.exec(spec);
+ if (match) {
+ return {
+ key: useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase(),
+ flags: watchRecursivePattern.test(spec) ? 1 /* Recursive */ : 0 /* None */
+ };
+ }
+ if (ts.isImplicitGlob(spec)) {
+ return { key: spec, flags: 1 /* Recursive */ };
+ }
+ return undefined;
+ }
/**
* Determines whether a literal or wildcard file has already been included that has a higher
* extension priority.
@@ -61597,12 +63631,13 @@ var ts;
HighlightSpanKind.reference = "reference";
HighlightSpanKind.writtenReference = "writtenReference";
})(HighlightSpanKind = ts.HighlightSpanKind || (ts.HighlightSpanKind = {}));
+ var IndentStyle;
(function (IndentStyle) {
IndentStyle[IndentStyle["None"] = 0] = "None";
IndentStyle[IndentStyle["Block"] = 1] = "Block";
IndentStyle[IndentStyle["Smart"] = 2] = "Smart";
- })(ts.IndentStyle || (ts.IndentStyle = {}));
- var IndentStyle = ts.IndentStyle;
+ })(IndentStyle = ts.IndentStyle || (ts.IndentStyle = {}));
+ var SymbolDisplayPartKind;
(function (SymbolDisplayPartKind) {
SymbolDisplayPartKind[SymbolDisplayPartKind["aliasName"] = 0] = "aliasName";
SymbolDisplayPartKind[SymbolDisplayPartKind["className"] = 1] = "className";
@@ -61626,14 +63661,14 @@ var ts;
SymbolDisplayPartKind[SymbolDisplayPartKind["enumMemberName"] = 19] = "enumMemberName";
SymbolDisplayPartKind[SymbolDisplayPartKind["functionName"] = 20] = "functionName";
SymbolDisplayPartKind[SymbolDisplayPartKind["regularExpressionLiteral"] = 21] = "regularExpressionLiteral";
- })(ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {}));
- var SymbolDisplayPartKind = ts.SymbolDisplayPartKind;
+ })(SymbolDisplayPartKind = ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {}));
+ var OutputFileType;
(function (OutputFileType) {
OutputFileType[OutputFileType["JavaScript"] = 0] = "JavaScript";
OutputFileType[OutputFileType["SourceMap"] = 1] = "SourceMap";
OutputFileType[OutputFileType["Declaration"] = 2] = "Declaration";
- })(ts.OutputFileType || (ts.OutputFileType = {}));
- var OutputFileType = ts.OutputFileType;
+ })(OutputFileType = ts.OutputFileType || (ts.OutputFileType = {}));
+ var EndOfLineState;
(function (EndOfLineState) {
EndOfLineState[EndOfLineState["None"] = 0] = "None";
EndOfLineState[EndOfLineState["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia";
@@ -61642,8 +63677,8 @@ var ts;
EndOfLineState[EndOfLineState["InTemplateHeadOrNoSubstitutionTemplate"] = 4] = "InTemplateHeadOrNoSubstitutionTemplate";
EndOfLineState[EndOfLineState["InTemplateMiddleOrTail"] = 5] = "InTemplateMiddleOrTail";
EndOfLineState[EndOfLineState["InTemplateSubstitutionPosition"] = 6] = "InTemplateSubstitutionPosition";
- })(ts.EndOfLineState || (ts.EndOfLineState = {}));
- var EndOfLineState = ts.EndOfLineState;
+ })(EndOfLineState = ts.EndOfLineState || (ts.EndOfLineState = {}));
+ var TokenClass;
(function (TokenClass) {
TokenClass[TokenClass["Punctuation"] = 0] = "Punctuation";
TokenClass[TokenClass["Keyword"] = 1] = "Keyword";
@@ -61654,8 +63689,7 @@ var ts;
TokenClass[TokenClass["NumberLiteral"] = 6] = "NumberLiteral";
TokenClass[TokenClass["StringLiteral"] = 7] = "StringLiteral";
TokenClass[TokenClass["RegExpLiteral"] = 8] = "RegExpLiteral";
- })(ts.TokenClass || (ts.TokenClass = {}));
- var TokenClass = ts.TokenClass;
+ })(TokenClass = ts.TokenClass || (ts.TokenClass = {}));
// TODO: move these to enums
var ScriptElementKind;
(function (ScriptElementKind) {
@@ -61762,6 +63796,7 @@ var ts;
ClassificationTypeNames.jsxText = "jsx text";
ClassificationTypeNames.jsxAttributeStringLiteralValue = "jsx attribute string literal value";
ts.ClassificationTypeNames = ClassificationTypeNames;
+ var ClassificationType;
(function (ClassificationType) {
ClassificationType[ClassificationType["comment"] = 1] = "comment";
ClassificationType[ClassificationType["identifier"] = 2] = "identifier";
@@ -61787,52 +63822,51 @@ var ts;
ClassificationType[ClassificationType["jsxAttribute"] = 22] = "jsxAttribute";
ClassificationType[ClassificationType["jsxText"] = 23] = "jsxText";
ClassificationType[ClassificationType["jsxAttributeStringLiteralValue"] = 24] = "jsxAttributeStringLiteralValue";
- })(ts.ClassificationType || (ts.ClassificationType = {}));
- var ClassificationType = ts.ClassificationType;
+ })(ClassificationType = ts.ClassificationType || (ts.ClassificationType = {}));
})(ts || (ts = {}));
// These utilities are common to multiple language service features.
/* @internal */
var ts;
(function (ts) {
- ts.scanner = ts.createScanner(4 /* Latest */, /*skipTrivia*/ true);
+ ts.scanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ true);
ts.emptyArray = [];
+ var SemanticMeaning;
(function (SemanticMeaning) {
SemanticMeaning[SemanticMeaning["None"] = 0] = "None";
SemanticMeaning[SemanticMeaning["Value"] = 1] = "Value";
SemanticMeaning[SemanticMeaning["Type"] = 2] = "Type";
SemanticMeaning[SemanticMeaning["Namespace"] = 4] = "Namespace";
SemanticMeaning[SemanticMeaning["All"] = 7] = "All";
- })(ts.SemanticMeaning || (ts.SemanticMeaning = {}));
- var SemanticMeaning = ts.SemanticMeaning;
+ })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {}));
function getMeaningFromDeclaration(node) {
switch (node.kind) {
- case 143 /* Parameter */:
- case 219 /* VariableDeclaration */:
- case 170 /* BindingElement */:
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 253 /* PropertyAssignment */:
- case 254 /* ShorthandPropertyAssignment */:
- case 255 /* EnumMember */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 149 /* Constructor */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
- case 252 /* CatchClause */:
+ case 144 /* Parameter */:
+ case 222 /* VariableDeclaration */:
+ case 173 /* BindingElement */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 256 /* PropertyAssignment */:
+ case 257 /* ShorthandPropertyAssignment */:
+ case 259 /* EnumMember */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 150 /* Constructor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 255 /* CatchClause */:
return 1 /* Value */;
- case 142 /* TypeParameter */:
- case 223 /* InterfaceDeclaration */:
- case 224 /* TypeAliasDeclaration */:
- case 160 /* TypeLiteral */:
+ case 143 /* TypeParameter */:
+ case 226 /* InterfaceDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
+ case 161 /* TypeLiteral */:
return 2 /* Type */;
- case 222 /* ClassDeclaration */:
- case 225 /* EnumDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 228 /* EnumDeclaration */:
return 1 /* Value */ | 2 /* Type */;
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
if (ts.isAmbientModule(node)) {
return 4 /* Namespace */ | 1 /* Value */;
}
@@ -61842,22 +63876,22 @@ var ts;
else {
return 4 /* Namespace */;
}
- case 234 /* NamedImports */:
- case 235 /* ImportSpecifier */:
- case 230 /* ImportEqualsDeclaration */:
- case 231 /* ImportDeclaration */:
- case 236 /* ExportAssignment */:
- case 237 /* ExportDeclaration */:
+ case 237 /* NamedImports */:
+ case 238 /* ImportSpecifier */:
+ case 233 /* ImportEqualsDeclaration */:
+ case 234 /* ImportDeclaration */:
+ case 239 /* ExportAssignment */:
+ case 240 /* ExportDeclaration */:
return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */;
// An external module can be a Value
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
return 4 /* Namespace */ | 1 /* Value */;
}
return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */;
}
ts.getMeaningFromDeclaration = getMeaningFromDeclaration;
function getMeaningFromLocation(node) {
- if (node.parent.kind === 236 /* ExportAssignment */) {
+ if (node.parent.kind === 239 /* ExportAssignment */) {
return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */;
}
else if (isInRightSideOfImport(node)) {
@@ -61882,15 +63916,15 @@ var ts;
// import a = |b|; // Namespace
// import a = |b.c|; // Value, type, namespace
// import a = |b.c|.d; // Namespace
- if (node.parent.kind === 140 /* QualifiedName */ &&
+ if (node.parent.kind === 141 /* QualifiedName */ &&
node.parent.right === node &&
- node.parent.parent.kind === 230 /* ImportEqualsDeclaration */) {
+ node.parent.parent.kind === 233 /* ImportEqualsDeclaration */) {
return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */;
}
return 4 /* Namespace */;
}
function isInRightSideOfImport(node) {
- while (node.parent.kind === 140 /* QualifiedName */) {
+ while (node.parent.kind === 141 /* QualifiedName */) {
node = node.parent;
}
return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node;
@@ -61901,27 +63935,27 @@ var ts;
function isQualifiedNameNamespaceReference(node) {
var root = node;
var isLastClause = true;
- if (root.parent.kind === 140 /* QualifiedName */) {
- while (root.parent && root.parent.kind === 140 /* QualifiedName */) {
+ if (root.parent.kind === 141 /* QualifiedName */) {
+ while (root.parent && root.parent.kind === 141 /* QualifiedName */) {
root = root.parent;
}
isLastClause = root.right === node;
}
- return root.parent.kind === 156 /* TypeReference */ && !isLastClause;
+ return root.parent.kind === 157 /* TypeReference */ && !isLastClause;
}
function isPropertyAccessNamespaceReference(node) {
var root = node;
var isLastClause = true;
- if (root.parent.kind === 173 /* PropertyAccessExpression */) {
- while (root.parent && root.parent.kind === 173 /* PropertyAccessExpression */) {
+ if (root.parent.kind === 176 /* PropertyAccessExpression */) {
+ while (root.parent && root.parent.kind === 176 /* PropertyAccessExpression */) {
root = root.parent;
}
isLastClause = root.name === node;
}
- if (!isLastClause && root.parent.kind === 195 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 251 /* HeritageClause */) {
+ if (!isLastClause && root.parent.kind === 198 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 254 /* HeritageClause */) {
var decl = root.parent.parent.parent;
- return (decl.kind === 222 /* ClassDeclaration */ && root.parent.parent.token === 107 /* ImplementsKeyword */) ||
- (decl.kind === 223 /* InterfaceDeclaration */ && root.parent.parent.token === 84 /* ExtendsKeyword */);
+ return (decl.kind === 225 /* ClassDeclaration */ && root.parent.parent.token === 107 /* ImplementsKeyword */) ||
+ (decl.kind === 226 /* InterfaceDeclaration */ && root.parent.parent.token === 84 /* ExtendsKeyword */);
}
return false;
}
@@ -61929,17 +63963,17 @@ var ts;
if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) {
node = node.parent;
}
- return node.parent.kind === 156 /* TypeReference */ ||
- (node.parent.kind === 195 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) ||
+ return node.parent.kind === 157 /* TypeReference */ ||
+ (node.parent.kind === 198 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) ||
(node.kind === 98 /* ThisKeyword */ && !ts.isPartOfExpression(node)) ||
- node.kind === 166 /* ThisType */;
+ node.kind === 167 /* ThisType */;
}
function isCallExpressionTarget(node) {
- return isCallOrNewExpressionTarget(node, 175 /* CallExpression */);
+ return isCallOrNewExpressionTarget(node, 178 /* CallExpression */);
}
ts.isCallExpressionTarget = isCallExpressionTarget;
function isNewExpressionTarget(node) {
- return isCallOrNewExpressionTarget(node, 176 /* NewExpression */);
+ return isCallOrNewExpressionTarget(node, 179 /* NewExpression */);
}
ts.isNewExpressionTarget = isNewExpressionTarget;
function isCallOrNewExpressionTarget(node, kind) {
@@ -61952,7 +63986,7 @@ var ts;
ts.climbPastPropertyAccess = climbPastPropertyAccess;
function getTargetLabel(referenceNode, labelName) {
while (referenceNode) {
- if (referenceNode.kind === 215 /* LabeledStatement */ && referenceNode.label.text === labelName) {
+ if (referenceNode.kind === 218 /* LabeledStatement */ && referenceNode.label.text === labelName) {
return referenceNode.label;
}
referenceNode = referenceNode.parent;
@@ -61962,13 +63996,13 @@ var ts;
ts.getTargetLabel = getTargetLabel;
function isJumpStatementTarget(node) {
return node.kind === 70 /* Identifier */ &&
- (node.parent.kind === 211 /* BreakStatement */ || node.parent.kind === 210 /* ContinueStatement */) &&
+ (node.parent.kind === 214 /* BreakStatement */ || node.parent.kind === 213 /* ContinueStatement */) &&
node.parent.label === node;
}
ts.isJumpStatementTarget = isJumpStatementTarget;
function isLabelOfLabeledStatement(node) {
return node.kind === 70 /* Identifier */ &&
- node.parent.kind === 215 /* LabeledStatement */ &&
+ node.parent.kind === 218 /* LabeledStatement */ &&
node.parent.label === node;
}
function isLabelName(node) {
@@ -61976,15 +64010,15 @@ var ts;
}
ts.isLabelName = isLabelName;
function isRightSideOfQualifiedName(node) {
- return node.parent.kind === 140 /* QualifiedName */ && node.parent.right === node;
+ return node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node;
}
ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName;
function isRightSideOfPropertyAccess(node) {
- return node && node.parent && node.parent.kind === 173 /* PropertyAccessExpression */ && node.parent.name === node;
+ return node && node.parent && node.parent.kind === 176 /* PropertyAccessExpression */ && node.parent.name === node;
}
ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess;
function isNameOfModuleDeclaration(node) {
- return node.parent.kind === 226 /* ModuleDeclaration */ && node.parent.name === node;
+ return node.parent.kind === 229 /* ModuleDeclaration */ && node.parent.name === node;
}
ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration;
function isNameOfFunctionDeclaration(node) {
@@ -61995,19 +64029,19 @@ var ts;
function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) {
if (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) {
switch (node.parent.kind) {
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 253 /* PropertyAssignment */:
- case 255 /* EnumMember */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 226 /* ModuleDeclaration */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 256 /* PropertyAssignment */:
+ case 259 /* EnumMember */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 229 /* ModuleDeclaration */:
return node.parent.name === node;
- case 174 /* ElementAccessExpression */:
+ case 177 /* ElementAccessExpression */:
return node.parent.argumentExpression === node;
- case 141 /* ComputedPropertyName */:
+ case 142 /* ComputedPropertyName */:
return true;
}
}
@@ -62056,17 +64090,17 @@ var ts;
return undefined;
}
switch (node.kind) {
- case 256 /* SourceFile */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 222 /* ClassDeclaration */:
- case 223 /* InterfaceDeclaration */:
- case 225 /* EnumDeclaration */:
- case 226 /* ModuleDeclaration */:
+ case 260 /* SourceFile */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 225 /* ClassDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 229 /* ModuleDeclaration */:
return node;
}
}
@@ -62074,46 +64108,46 @@ var ts;
ts.getContainerNode = getContainerNode;
function getNodeKind(node) {
switch (node.kind) {
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement;
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
return ts.ScriptElementKind.moduleElement;
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
return ts.ScriptElementKind.classElement;
- case 223 /* InterfaceDeclaration */: return ts.ScriptElementKind.interfaceElement;
- case 224 /* TypeAliasDeclaration */: return ts.ScriptElementKind.typeElement;
- case 225 /* EnumDeclaration */: return ts.ScriptElementKind.enumElement;
- case 219 /* VariableDeclaration */:
+ case 226 /* InterfaceDeclaration */: return ts.ScriptElementKind.interfaceElement;
+ case 227 /* TypeAliasDeclaration */: return ts.ScriptElementKind.typeElement;
+ case 228 /* EnumDeclaration */: return ts.ScriptElementKind.enumElement;
+ case 222 /* VariableDeclaration */:
return getKindOfVariableDeclaration(node);
- case 170 /* BindingElement */:
+ case 173 /* BindingElement */:
return getKindOfVariableDeclaration(ts.getRootDeclaration(node));
- case 181 /* ArrowFunction */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
return ts.ScriptElementKind.functionElement;
- case 150 /* GetAccessor */: return ts.ScriptElementKind.memberGetAccessorElement;
- case 151 /* SetAccessor */: return ts.ScriptElementKind.memberSetAccessorElement;
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 151 /* GetAccessor */: return ts.ScriptElementKind.memberGetAccessorElement;
+ case 152 /* SetAccessor */: return ts.ScriptElementKind.memberSetAccessorElement;
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
return ts.ScriptElementKind.memberFunctionElement;
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
return ts.ScriptElementKind.memberVariableElement;
- case 154 /* IndexSignature */: return ts.ScriptElementKind.indexSignatureElement;
- case 153 /* ConstructSignature */: return ts.ScriptElementKind.constructSignatureElement;
- case 152 /* CallSignature */: return ts.ScriptElementKind.callSignatureElement;
- case 149 /* Constructor */: return ts.ScriptElementKind.constructorImplementationElement;
- case 142 /* TypeParameter */: return ts.ScriptElementKind.typeParameterElement;
- case 255 /* EnumMember */: return ts.ScriptElementKind.enumMemberElement;
- case 143 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement;
- case 230 /* ImportEqualsDeclaration */:
- case 235 /* ImportSpecifier */:
- case 232 /* ImportClause */:
- case 239 /* ExportSpecifier */:
- case 233 /* NamespaceImport */:
+ case 155 /* IndexSignature */: return ts.ScriptElementKind.indexSignatureElement;
+ case 154 /* ConstructSignature */: return ts.ScriptElementKind.constructSignatureElement;
+ case 153 /* CallSignature */: return ts.ScriptElementKind.callSignatureElement;
+ case 150 /* Constructor */: return ts.ScriptElementKind.constructorImplementationElement;
+ case 143 /* TypeParameter */: return ts.ScriptElementKind.typeParameterElement;
+ case 259 /* EnumMember */: return ts.ScriptElementKind.enumMemberElement;
+ case 144 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement;
+ case 233 /* ImportEqualsDeclaration */:
+ case 238 /* ImportSpecifier */:
+ case 235 /* ImportClause */:
+ case 242 /* ExportSpecifier */:
+ case 236 /* NamespaceImport */:
return ts.ScriptElementKind.alias;
- case 279 /* JSDocTypedefTag */:
+ case 283 /* JSDocTypedefTag */:
return ts.ScriptElementKind.typeElement;
default:
return ts.ScriptElementKind.unknown;
@@ -62128,7 +64162,7 @@ var ts;
}
ts.getNodeKind = getNodeKind;
function getStringLiteralTypeForNode(node, typeChecker) {
- var searchNode = node.parent.kind === 167 /* LiteralType */ ? node.parent : node;
+ var searchNode = node.parent.kind === 170 /* LiteralType */ ? node.parent : node;
var type = typeChecker.getTypeAtLocation(searchNode);
if (type && type.flags & 32 /* StringLiteral */) {
return type;
@@ -62143,7 +64177,7 @@ var ts;
return true;
case 70 /* Identifier */:
// 'this' as a parameter
- return ts.identifierIsThisKeyword(node) && node.parent.kind === 143 /* Parameter */;
+ return ts.identifierIsThisKeyword(node) && node.parent.kind === 144 /* Parameter */;
default:
return false;
}
@@ -62188,42 +64222,42 @@ var ts;
return false;
}
switch (n.kind) {
- case 222 /* ClassDeclaration */:
- case 223 /* InterfaceDeclaration */:
- case 225 /* EnumDeclaration */:
- case 172 /* ObjectLiteralExpression */:
- case 168 /* ObjectBindingPattern */:
- case 160 /* TypeLiteral */:
- case 200 /* Block */:
- case 227 /* ModuleBlock */:
- case 228 /* CaseBlock */:
- case 234 /* NamedImports */:
- case 238 /* NamedExports */:
+ case 225 /* ClassDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 175 /* ObjectLiteralExpression */:
+ case 171 /* ObjectBindingPattern */:
+ case 161 /* TypeLiteral */:
+ case 203 /* Block */:
+ case 230 /* ModuleBlock */:
+ case 231 /* CaseBlock */:
+ case 237 /* NamedImports */:
+ case 241 /* NamedExports */:
return nodeEndsWith(n, 17 /* CloseBraceToken */, sourceFile);
- case 252 /* CatchClause */:
+ case 255 /* CatchClause */:
return isCompletedNode(n.block, sourceFile);
- case 176 /* NewExpression */:
+ case 179 /* NewExpression */:
if (!n.arguments) {
return true;
}
// fall through
- case 175 /* CallExpression */:
- case 179 /* ParenthesizedExpression */:
- case 165 /* ParenthesizedType */:
+ case 178 /* CallExpression */:
+ case 182 /* ParenthesizedExpression */:
+ case 166 /* ParenthesizedType */:
return nodeEndsWith(n, 19 /* CloseParenToken */, sourceFile);
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
return isCompletedNode(n.type, sourceFile);
- case 149 /* Constructor */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 153 /* ConstructSignature */:
- case 152 /* CallSignature */:
- case 181 /* ArrowFunction */:
+ case 150 /* Constructor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 154 /* ConstructSignature */:
+ case 153 /* CallSignature */:
+ case 184 /* ArrowFunction */:
if (n.body) {
return isCompletedNode(n.body, sourceFile);
}
@@ -62233,67 +64267,67 @@ var ts;
// Even though type parameters can be unclosed, we can get away with
// having at least a closing paren.
return hasChildOfKind(n, 19 /* CloseParenToken */, sourceFile);
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
return n.body && isCompletedNode(n.body, sourceFile);
- case 204 /* IfStatement */:
+ case 207 /* IfStatement */:
if (n.elseStatement) {
return isCompletedNode(n.elseStatement, sourceFile);
}
return isCompletedNode(n.thenStatement, sourceFile);
- case 203 /* ExpressionStatement */:
+ case 206 /* ExpressionStatement */:
return isCompletedNode(n.expression, sourceFile) ||
hasChildOfKind(n, 24 /* SemicolonToken */);
- case 171 /* ArrayLiteralExpression */:
- case 169 /* ArrayBindingPattern */:
- case 174 /* ElementAccessExpression */:
- case 141 /* ComputedPropertyName */:
- case 162 /* TupleType */:
+ case 174 /* ArrayLiteralExpression */:
+ case 172 /* ArrayBindingPattern */:
+ case 177 /* ElementAccessExpression */:
+ case 142 /* ComputedPropertyName */:
+ case 163 /* TupleType */:
return nodeEndsWith(n, 21 /* CloseBracketToken */, sourceFile);
- case 154 /* IndexSignature */:
+ case 155 /* IndexSignature */:
if (n.type) {
return isCompletedNode(n.type, sourceFile);
}
return hasChildOfKind(n, 21 /* CloseBracketToken */, sourceFile);
- case 249 /* CaseClause */:
- case 250 /* DefaultClause */:
+ case 252 /* CaseClause */:
+ case 253 /* DefaultClause */:
// there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed
return false;
- case 207 /* ForStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
- case 206 /* WhileStatement */:
+ case 210 /* ForStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
+ case 209 /* WhileStatement */:
return isCompletedNode(n.statement, sourceFile);
- case 205 /* DoStatement */:
+ case 208 /* DoStatement */:
// rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')';
var hasWhileKeyword = findChildOfKind(n, 105 /* WhileKeyword */, sourceFile);
if (hasWhileKeyword) {
return nodeEndsWith(n, 19 /* CloseParenToken */, sourceFile);
}
return isCompletedNode(n.statement, sourceFile);
- case 159 /* TypeQuery */:
+ case 160 /* TypeQuery */:
return isCompletedNode(n.exprName, sourceFile);
- case 183 /* TypeOfExpression */:
- case 182 /* DeleteExpression */:
- case 184 /* VoidExpression */:
- case 191 /* YieldExpression */:
- case 192 /* SpreadElementExpression */:
+ case 186 /* TypeOfExpression */:
+ case 185 /* DeleteExpression */:
+ case 187 /* VoidExpression */:
+ case 194 /* YieldExpression */:
+ case 195 /* SpreadElement */:
var unaryWordExpression = n;
return isCompletedNode(unaryWordExpression.expression, sourceFile);
- case 177 /* TaggedTemplateExpression */:
+ case 180 /* TaggedTemplateExpression */:
return isCompletedNode(n.template, sourceFile);
- case 190 /* TemplateExpression */:
+ case 193 /* TemplateExpression */:
var lastSpan = ts.lastOrUndefined(n.templateSpans);
return isCompletedNode(lastSpan, sourceFile);
- case 198 /* TemplateSpan */:
+ case 201 /* TemplateSpan */:
return ts.nodeIsPresent(n.literal);
- case 237 /* ExportDeclaration */:
- case 231 /* ImportDeclaration */:
+ case 240 /* ExportDeclaration */:
+ case 234 /* ImportDeclaration */:
return ts.nodeIsPresent(n.moduleSpecifier);
- case 186 /* PrefixUnaryExpression */:
+ case 189 /* PrefixUnaryExpression */:
return isCompletedNode(n.operand, sourceFile);
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
return isCompletedNode(n.right, sourceFile);
- case 189 /* ConditionalExpression */:
+ case 192 /* ConditionalExpression */:
return isCompletedNode(n.whenFalse, sourceFile);
default:
return true;
@@ -62349,7 +64383,7 @@ var ts;
// for the position of the relevant node (or comma).
var syntaxList = ts.forEach(node.parent.getChildren(), function (c) {
// find syntax list that covers the span of the node
- if (c.kind === 286 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) {
+ if (c.kind === 290 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) {
return c;
}
});
@@ -62521,7 +64555,7 @@ var ts;
}
}
}
- ts.Debug.assert(startNode !== undefined || n.kind === 256 /* SourceFile */);
+ ts.Debug.assert(startNode !== undefined || n.kind === 260 /* SourceFile */);
// Here we know that none of child token nodes embrace the position,
// the only known case is when position is at the end of the file.
// Try to find the rightmost token in the file without filtering.
@@ -62580,17 +64614,17 @@ var ts;
return true;
}
// { |
or
- if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 248 /* JsxExpression */) {
+ if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 251 /* JsxExpression */) {
return true;
}
//
{
// |
// } < /div>
- if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 248 /* JsxExpression */) {
+ if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 251 /* JsxExpression */) {
return true;
}
//
|
- if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 245 /* JsxClosingElement */) {
+ if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 248 /* JsxClosingElement */) {
return true;
}
return false;
@@ -62702,17 +64736,17 @@ var ts;
}
ts.getNodeModifiers = getNodeModifiers;
function getTypeArgumentOrTypeParameterList(node) {
- if (node.kind === 156 /* TypeReference */ || node.kind === 175 /* CallExpression */) {
+ if (node.kind === 157 /* TypeReference */ || node.kind === 178 /* CallExpression */) {
return node.typeArguments;
}
- if (ts.isFunctionLike(node) || node.kind === 222 /* ClassDeclaration */ || node.kind === 223 /* InterfaceDeclaration */) {
+ if (ts.isFunctionLike(node) || node.kind === 225 /* ClassDeclaration */ || node.kind === 226 /* InterfaceDeclaration */) {
return node.typeParameters;
}
return undefined;
}
ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList;
function isToken(n) {
- return n.kind >= 0 /* FirstToken */ && n.kind <= 139 /* LastToken */;
+ return n.kind >= 0 /* FirstToken */ && n.kind <= 140 /* LastToken */;
}
ts.isToken = isToken;
function isWord(kind) {
@@ -62771,18 +64805,18 @@ var ts;
}
ts.compareDataObjects = compareDataObjects;
function isArrayLiteralOrObjectLiteralDestructuringPattern(node) {
- if (node.kind === 171 /* ArrayLiteralExpression */ ||
- node.kind === 172 /* ObjectLiteralExpression */) {
+ if (node.kind === 174 /* ArrayLiteralExpression */ ||
+ node.kind === 175 /* ObjectLiteralExpression */) {
// [a,b,c] from:
// [a, b, c] = someExpression;
- if (node.parent.kind === 188 /* BinaryExpression */ &&
+ if (node.parent.kind === 191 /* BinaryExpression */ &&
node.parent.left === node &&
node.parent.operatorToken.kind === 57 /* EqualsToken */) {
return true;
}
// [a, b, c] from:
// for([a, b, c] of expression)
- if (node.parent.kind === 209 /* ForOfStatement */ &&
+ if (node.parent.kind === 212 /* ForOfStatement */ &&
node.parent.initializer === node) {
return true;
}
@@ -62790,7 +64824,7 @@ var ts;
// [x, [a, b, c] ] = someExpression
// or
// {x, a: {a, b, c} } = someExpression
- if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 253 /* PropertyAssignment */ ? node.parent.parent : node.parent)) {
+ if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 256 /* PropertyAssignment */ ? node.parent.parent : node.parent)) {
return true;
}
}
@@ -62823,7 +64857,7 @@ var ts;
/* @internal */
(function (ts) {
function isFirstDeclarationOfSymbolParameter(symbol) {
- return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 143 /* Parameter */;
+ return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 144 /* Parameter */;
}
ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter;
var displayPartWriter = getDisplayPartWriter();
@@ -63003,7 +65037,7 @@ var ts;
return location.getText();
}
else if (ts.isStringOrNumericLiteral(location.kind) &&
- location.parent.kind === 141 /* ComputedPropertyName */) {
+ location.parent.kind === 142 /* ComputedPropertyName */) {
return location.text;
}
// Try to get the local symbol if we're dealing with an 'export default'
@@ -63015,7 +65049,7 @@ var ts;
ts.getDeclaredName = getDeclaredName;
function isImportOrExportSpecifierName(location) {
return location.parent &&
- (location.parent.kind === 235 /* ImportSpecifier */ || location.parent.kind === 239 /* ExportSpecifier */) &&
+ (location.parent.kind === 238 /* ImportSpecifier */ || location.parent.kind === 242 /* ExportSpecifier */) &&
location.parent.propertyName === location;
}
ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName;
@@ -63087,7 +65121,7 @@ var ts;
(function (ts) {
/// Classifier
function createClassifier() {
- var scanner = ts.createScanner(4 /* Latest */, /*skipTrivia*/ false);
+ var scanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false);
/// We do not have a full parser support to know when we should parse a regex or not
/// If we consider every slash token to be a regex, we could be missing cases like "1/2/3", where
/// we have a series of divide operator. this list allows us to be more accurate by ruling out
@@ -63130,7 +65164,7 @@ var ts;
function canFollow(keyword1, keyword2) {
if (ts.isAccessibilityModifier(keyword1)) {
if (keyword2 === 124 /* GetKeyword */ ||
- keyword2 === 132 /* SetKeyword */ ||
+ keyword2 === 133 /* SetKeyword */ ||
keyword2 === 122 /* ConstructorKeyword */ ||
keyword2 === 114 /* StaticKeyword */) {
// Allow things like "public get", "public constructor" and "public static".
@@ -63289,10 +65323,10 @@ var ts;
angleBracketStack--;
}
else if (token === 118 /* AnyKeyword */ ||
- token === 133 /* StringKeyword */ ||
- token === 131 /* NumberKeyword */ ||
+ token === 134 /* StringKeyword */ ||
+ token === 132 /* NumberKeyword */ ||
token === 121 /* BooleanKeyword */ ||
- token === 134 /* SymbolKeyword */) {
+ token === 135 /* SymbolKeyword */) {
if (angleBracketStack > 0 && !syntacticClassifierAbsent) {
// If it looks like we're could be in something generic, don't classify this
// as a keyword. We may just get overwritten by the syntactic classifier,
@@ -63464,7 +65498,7 @@ var ts;
}
}
function isKeyword(token) {
- return token >= 71 /* FirstKeyword */ && token <= 139 /* LastKeyword */;
+ return token >= 71 /* FirstKeyword */ && token <= 140 /* LastKeyword */;
}
function classFromKind(token) {
if (isKeyword(token)) {
@@ -63521,10 +65555,10 @@ var ts;
// That means we're calling back into the host around every 1.2k of the file we process.
// Lib.d.ts has similar numbers.
switch (kind) {
- case 226 /* ModuleDeclaration */:
- case 222 /* ClassDeclaration */:
- case 223 /* InterfaceDeclaration */:
- case 221 /* FunctionDeclaration */:
+ case 229 /* ModuleDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 224 /* FunctionDeclaration */:
cancellationToken.throwIfCancellationRequested();
}
}
@@ -63575,7 +65609,7 @@ var ts;
*/
function hasValueSideModule(symbol) {
return ts.forEach(symbol.declarations, function (declaration) {
- return declaration.kind === 226 /* ModuleDeclaration */ &&
+ return declaration.kind === 229 /* ModuleDeclaration */ &&
ts.getModuleInstanceState(declaration) === 1 /* Instantiated */;
});
}
@@ -63654,8 +65688,8 @@ var ts;
var spanStart = span.start;
var spanLength = span.length;
// Make a scanner we can get trivia from.
- var triviaScanner = ts.createScanner(4 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
- var mergeConflictScanner = ts.createScanner(4 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var triviaScanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var mergeConflictScanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
var result = [];
processElement(sourceFile);
return { spans: result, endOfLineState: 0 /* None */ };
@@ -63739,16 +65773,16 @@ var ts;
pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */);
pos = tag.tagName.end;
switch (tag.kind) {
- case 275 /* JSDocParameterTag */:
+ case 279 /* JSDocParameterTag */:
processJSDocParameterTag(tag);
break;
- case 278 /* JSDocTemplateTag */:
+ case 282 /* JSDocTemplateTag */:
processJSDocTemplateTag(tag);
break;
- case 277 /* JSDocTypeTag */:
+ case 281 /* JSDocTypeTag */:
processElement(tag.typeExpression);
break;
- case 276 /* JSDocReturnTag */:
+ case 280 /* JSDocReturnTag */:
processElement(tag.typeExpression);
break;
}
@@ -63835,22 +65869,22 @@ var ts;
}
function tryClassifyJsxElementName(token) {
switch (token.parent && token.parent.kind) {
- case 244 /* JsxOpeningElement */:
+ case 247 /* JsxOpeningElement */:
if (token.parent.tagName === token) {
return 19 /* jsxOpenTagName */;
}
break;
- case 245 /* JsxClosingElement */:
+ case 248 /* JsxClosingElement */:
if (token.parent.tagName === token) {
return 20 /* jsxCloseTagName */;
}
break;
- case 243 /* JsxSelfClosingElement */:
+ case 246 /* JsxSelfClosingElement */:
if (token.parent.tagName === token) {
return 21 /* jsxSelfClosingTagName */;
}
break;
- case 246 /* JsxAttribute */:
+ case 249 /* JsxAttribute */:
if (token.parent.name === token) {
return 22 /* jsxAttribute */;
}
@@ -63878,17 +65912,17 @@ var ts;
if (token) {
if (tokenKind === 57 /* EqualsToken */) {
// the '=' in a variable declaration is special cased here.
- if (token.parent.kind === 219 /* VariableDeclaration */ ||
- token.parent.kind === 146 /* PropertyDeclaration */ ||
- token.parent.kind === 143 /* Parameter */ ||
- token.parent.kind === 246 /* JsxAttribute */) {
+ if (token.parent.kind === 222 /* VariableDeclaration */ ||
+ token.parent.kind === 147 /* PropertyDeclaration */ ||
+ token.parent.kind === 144 /* Parameter */ ||
+ token.parent.kind === 249 /* JsxAttribute */) {
return 5 /* operator */;
}
}
- if (token.parent.kind === 188 /* BinaryExpression */ ||
- token.parent.kind === 186 /* PrefixUnaryExpression */ ||
- token.parent.kind === 187 /* PostfixUnaryExpression */ ||
- token.parent.kind === 189 /* ConditionalExpression */) {
+ if (token.parent.kind === 191 /* BinaryExpression */ ||
+ token.parent.kind === 189 /* PrefixUnaryExpression */ ||
+ token.parent.kind === 190 /* PostfixUnaryExpression */ ||
+ token.parent.kind === 192 /* ConditionalExpression */) {
return 5 /* operator */;
}
}
@@ -63898,7 +65932,7 @@ var ts;
return 4 /* numericLiteral */;
}
else if (tokenKind === 9 /* StringLiteral */) {
- return token.parent.kind === 246 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */;
+ return token.parent.kind === 249 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */;
}
else if (tokenKind === 11 /* RegularExpressionLiteral */) {
// TODO: we should get another classification type for these literals.
@@ -63914,32 +65948,32 @@ var ts;
else if (tokenKind === 70 /* Identifier */) {
if (token) {
switch (token.parent.kind) {
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
if (token.parent.name === token) {
return 11 /* className */;
}
return;
- case 142 /* TypeParameter */:
+ case 143 /* TypeParameter */:
if (token.parent.name === token) {
return 15 /* typeParameterName */;
}
return;
- case 223 /* InterfaceDeclaration */:
+ case 226 /* InterfaceDeclaration */:
if (token.parent.name === token) {
return 13 /* interfaceName */;
}
return;
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
if (token.parent.name === token) {
return 12 /* enumName */;
}
return;
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
if (token.parent.name === token) {
return 14 /* moduleName */;
}
return;
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
if (token.parent.name === token) {
return ts.isThisIdentifier(token) ? 3 /* keyword */ : 17 /* parameterName */;
}
@@ -63999,7 +66033,7 @@ var ts;
else {
if (!symbols || symbols.length === 0) {
if (sourceFile.languageVariant === 1 /* JSX */ &&
- location.parent && location.parent.kind === 245 /* JsxClosingElement */) {
+ location.parent && location.parent.kind === 248 /* JsxClosingElement */) {
// In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag,
// instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element.
// For example:
@@ -64026,14 +66060,14 @@ var ts;
function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) {
var entries = [];
var nameTable = ts.getNameTable(sourceFile);
- for (var name_46 in nameTable) {
+ for (var name_42 in nameTable) {
// Skip identifiers produced only from the current location
- if (nameTable[name_46] === position) {
+ if (nameTable[name_42] === position) {
continue;
}
- if (!uniqueNames[name_46]) {
- uniqueNames[name_46] = name_46;
- var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_46), compilerOptions.target, /*performCharacterChecks*/ true);
+ if (!uniqueNames[name_42]) {
+ uniqueNames[name_42] = name_42;
+ var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_42), compilerOptions.target, /*performCharacterChecks*/ true);
if (displayName) {
var entry = {
name: displayName,
@@ -64093,8 +66127,8 @@ var ts;
if (!node || node.kind !== 9 /* StringLiteral */) {
return undefined;
}
- if (node.parent.kind === 253 /* PropertyAssignment */ &&
- node.parent.parent.kind === 172 /* ObjectLiteralExpression */ &&
+ if (node.parent.kind === 256 /* PropertyAssignment */ &&
+ node.parent.parent.kind === 175 /* ObjectLiteralExpression */ &&
node.parent.name === node) {
// Get quoted name of properties of the object literal expression
// i.e. interface ConfigFiles {
@@ -64119,7 +66153,7 @@ var ts;
// a['/*completion position*/']
return getStringLiteralCompletionEntriesFromElementAccess(node.parent);
}
- else if (node.parent.kind === 231 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) {
+ else if (node.parent.kind === 234 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) {
// Get all known external module names or complete a path to a module
// i.e. import * as ns from "/*completion position*/";
// import x = require("/*completion position*/");
@@ -64510,8 +66544,8 @@ var ts;
}
catch (e) { }
if (typeRoots) {
- for (var _b = 0, typeRoots_2 = typeRoots; _b < typeRoots_2.length; _b++) {
- var root = typeRoots_2[_b];
+ for (var _b = 0, typeRoots_3 = typeRoots; _b < typeRoots_3.length; _b++) {
+ var root = typeRoots_3[_b];
getCompletionEntriesFromDirectories(host, root, span, result);
}
}
@@ -64546,11 +66580,11 @@ var ts;
if (currentConfigPath) {
paths.push(currentConfigPath);
currentDir = ts.getDirectoryPath(currentConfigPath);
- var parent_16 = ts.getDirectoryPath(currentDir);
- if (currentDir === parent_16) {
+ var parent_15 = ts.getDirectoryPath(currentDir);
+ if (currentDir === parent_15) {
break;
}
- currentDir = parent_16;
+ currentDir = parent_15;
}
else {
break;
@@ -64702,9 +66736,9 @@ var ts;
isJsDocTagName = true;
}
switch (tag.kind) {
- case 277 /* JSDocTypeTag */:
- case 275 /* JSDocParameterTag */:
- case 276 /* JSDocReturnTag */:
+ case 281 /* JSDocTypeTag */:
+ case 279 /* JSDocParameterTag */:
+ case 280 /* JSDocReturnTag */:
var tagWithExpression = tag;
if (tagWithExpression.typeExpression) {
insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end;
@@ -64749,13 +66783,13 @@ var ts;
log("Returning an empty list because completion was requested in an invalid position.");
return undefined;
}
- var parent_17 = contextToken.parent, kind = contextToken.kind;
+ var parent_16 = contextToken.parent, kind = contextToken.kind;
if (kind === 22 /* DotToken */) {
- if (parent_17.kind === 173 /* PropertyAccessExpression */) {
+ if (parent_16.kind === 176 /* PropertyAccessExpression */) {
node = contextToken.parent.expression;
isRightOfDot = true;
}
- else if (parent_17.kind === 140 /* QualifiedName */) {
+ else if (parent_16.kind === 141 /* QualifiedName */) {
node = contextToken.parent.left;
isRightOfDot = true;
}
@@ -64770,7 +66804,7 @@ var ts;
isRightOfOpenTag = true;
location = contextToken;
}
- else if (kind === 40 /* SlashToken */ && contextToken.parent.kind === 245 /* JsxClosingElement */) {
+ else if (kind === 40 /* SlashToken */ && contextToken.parent.kind === 248 /* JsxClosingElement */) {
isStartingCloseTag = true;
location = contextToken;
}
@@ -64819,7 +66853,7 @@ var ts;
isGlobalCompletion = false;
isMemberCompletion = true;
isNewIdentifierLocation = false;
- if (node.kind === 70 /* Identifier */ || node.kind === 140 /* QualifiedName */ || node.kind === 173 /* PropertyAccessExpression */) {
+ if (node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */ || node.kind === 176 /* PropertyAccessExpression */) {
var symbol = typeChecker.getSymbolAtLocation(node);
// This is an alias, follow what it aliases
if (symbol && symbol.flags & 8388608 /* Alias */) {
@@ -64875,7 +66909,7 @@ var ts;
}
if (jsxContainer = tryGetContainingJsxElement(contextToken)) {
var attrsType = void 0;
- if ((jsxContainer.kind === 243 /* JsxSelfClosingElement */) || (jsxContainer.kind === 244 /* JsxOpeningElement */)) {
+ if ((jsxContainer.kind === 246 /* JsxSelfClosingElement */) || (jsxContainer.kind === 247 /* JsxOpeningElement */)) {
// Cursor is inside a JSX self-closing element or opening element
attrsType = typeChecker.getJsxElementAttributesType(jsxContainer);
if (attrsType) {
@@ -64923,9 +66957,9 @@ var ts;
var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;
if (scopeNode) {
isGlobalCompletion =
- scopeNode.kind === 256 /* SourceFile */ ||
- scopeNode.kind === 190 /* TemplateExpression */ ||
- scopeNode.kind === 248 /* JsxExpression */ ||
+ scopeNode.kind === 260 /* SourceFile */ ||
+ scopeNode.kind === 193 /* TemplateExpression */ ||
+ scopeNode.kind === 251 /* JsxExpression */ ||
ts.isStatement(scopeNode);
}
/// TODO filter meaning based on the current context
@@ -64958,11 +66992,11 @@ var ts;
return true;
}
if (contextToken.kind === 28 /* GreaterThanToken */ && contextToken.parent) {
- if (contextToken.parent.kind === 244 /* JsxOpeningElement */) {
+ if (contextToken.parent.kind === 247 /* JsxOpeningElement */) {
return true;
}
- if (contextToken.parent.kind === 245 /* JsxClosingElement */ || contextToken.parent.kind === 243 /* JsxSelfClosingElement */) {
- return contextToken.parent.parent && contextToken.parent.parent.kind === 242 /* JsxElement */;
+ if (contextToken.parent.kind === 248 /* JsxClosingElement */ || contextToken.parent.kind === 246 /* JsxSelfClosingElement */) {
+ return contextToken.parent.parent && contextToken.parent.parent.kind === 245 /* JsxElement */;
}
}
return false;
@@ -64972,40 +67006,40 @@ var ts;
var containingNodeKind = previousToken.parent.kind;
switch (previousToken.kind) {
case 25 /* CommaToken */:
- return containingNodeKind === 175 /* CallExpression */ // func( a, |
- || containingNodeKind === 149 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
- || containingNodeKind === 176 /* NewExpression */ // new C(a, |
- || containingNodeKind === 171 /* ArrayLiteralExpression */ // [a, |
- || containingNodeKind === 188 /* BinaryExpression */ // const x = (a, |
- || containingNodeKind === 157 /* FunctionType */; // var x: (s: string, list|
+ return containingNodeKind === 178 /* CallExpression */ // func( a, |
+ || containingNodeKind === 150 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
+ || containingNodeKind === 179 /* NewExpression */ // new C(a, |
+ || containingNodeKind === 174 /* ArrayLiteralExpression */ // [a, |
+ || containingNodeKind === 191 /* BinaryExpression */ // const x = (a, |
+ || containingNodeKind === 158 /* FunctionType */; // var x: (s: string, list|
case 18 /* OpenParenToken */:
- return containingNodeKind === 175 /* CallExpression */ // func( |
- || containingNodeKind === 149 /* Constructor */ // constructor( |
- || containingNodeKind === 176 /* NewExpression */ // new C(a|
- || containingNodeKind === 179 /* ParenthesizedExpression */ // const x = (a|
- || containingNodeKind === 165 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */
+ return containingNodeKind === 178 /* CallExpression */ // func( |
+ || containingNodeKind === 150 /* Constructor */ // constructor( |
+ || containingNodeKind === 179 /* NewExpression */ // new C(a|
+ || containingNodeKind === 182 /* ParenthesizedExpression */ // const x = (a|
+ || containingNodeKind === 166 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */
case 20 /* OpenBracketToken */:
- return containingNodeKind === 171 /* ArrayLiteralExpression */ // [ |
- || containingNodeKind === 154 /* IndexSignature */ // [ | : string ]
- || containingNodeKind === 141 /* ComputedPropertyName */; // [ | /* this can become an index signature */
- case 126 /* ModuleKeyword */: // module |
- case 127 /* NamespaceKeyword */:
+ return containingNodeKind === 174 /* ArrayLiteralExpression */ // [ |
+ || containingNodeKind === 155 /* IndexSignature */ // [ | : string ]
+ || containingNodeKind === 142 /* ComputedPropertyName */; // [ | /* this can become an index signature */
+ case 127 /* ModuleKeyword */: // module |
+ case 128 /* NamespaceKeyword */:
return true;
case 22 /* DotToken */:
- return containingNodeKind === 226 /* ModuleDeclaration */; // module A.|
+ return containingNodeKind === 229 /* ModuleDeclaration */; // module A.|
case 16 /* OpenBraceToken */:
- return containingNodeKind === 222 /* ClassDeclaration */; // class A{ |
+ return containingNodeKind === 225 /* ClassDeclaration */; // class A{ |
case 57 /* EqualsToken */:
- return containingNodeKind === 219 /* VariableDeclaration */ // const x = a|
- || containingNodeKind === 188 /* BinaryExpression */; // x = a|
+ return containingNodeKind === 222 /* VariableDeclaration */ // const x = a|
+ || containingNodeKind === 191 /* BinaryExpression */; // x = a|
case 13 /* TemplateHead */:
- return containingNodeKind === 190 /* TemplateExpression */; // `aa ${|
+ return containingNodeKind === 193 /* TemplateExpression */; // `aa ${|
case 14 /* TemplateMiddle */:
- return containingNodeKind === 198 /* TemplateSpan */; // `aa ${10} dd ${|
+ return containingNodeKind === 201 /* TemplateSpan */; // `aa ${10} dd ${|
case 113 /* PublicKeyword */:
case 111 /* PrivateKeyword */:
case 112 /* ProtectedKeyword */:
- return containingNodeKind === 146 /* PropertyDeclaration */; // class A{ public |
+ return containingNodeKind === 147 /* PropertyDeclaration */; // class A{ public |
}
// Previous token may have been a keyword that was converted to an identifier.
switch (previousToken.getText()) {
@@ -65048,7 +67082,7 @@ var ts;
isMemberCompletion = true;
var typeForObject;
var existingMembers;
- if (objectLikeContainer.kind === 172 /* ObjectLiteralExpression */) {
+ if (objectLikeContainer.kind === 175 /* ObjectLiteralExpression */) {
// We are completing on contextual types, but may also include properties
// other than those within the declared type.
isNewIdentifierLocation = true;
@@ -65058,7 +67092,7 @@ var ts;
typeForObject = typeForObject && typeForObject.getNonNullableType();
existingMembers = objectLikeContainer.properties;
}
- else if (objectLikeContainer.kind === 168 /* ObjectBindingPattern */) {
+ else if (objectLikeContainer.kind === 171 /* ObjectBindingPattern */) {
// We are *only* completing on properties from the type being destructured.
isNewIdentifierLocation = false;
var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent);
@@ -65069,11 +67103,11 @@ var ts;
// Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -
// type of parameter will flow in from the contextual type of the function
var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type);
- if (!canGetType && rootDeclaration.kind === 143 /* Parameter */) {
+ if (!canGetType && rootDeclaration.kind === 144 /* Parameter */) {
if (ts.isExpression(rootDeclaration.parent)) {
canGetType = !!typeChecker.getContextualType(rootDeclaration.parent);
}
- else if (rootDeclaration.parent.kind === 148 /* MethodDeclaration */ || rootDeclaration.parent.kind === 151 /* SetAccessor */) {
+ else if (rootDeclaration.parent.kind === 149 /* MethodDeclaration */ || rootDeclaration.parent.kind === 152 /* SetAccessor */) {
canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent);
}
}
@@ -65115,9 +67149,9 @@ var ts;
* @returns true if 'symbols' was successfully populated; false otherwise.
*/
function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) {
- var declarationKind = namedImportsOrExports.kind === 234 /* NamedImports */ ?
- 231 /* ImportDeclaration */ :
- 237 /* ExportDeclaration */;
+ var declarationKind = namedImportsOrExports.kind === 237 /* NamedImports */ ?
+ 234 /* ImportDeclaration */ :
+ 240 /* ExportDeclaration */;
var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind);
var moduleSpecifier = importOrExportDeclaration.moduleSpecifier;
if (!moduleSpecifier) {
@@ -65142,9 +67176,9 @@ var ts;
switch (contextToken.kind) {
case 16 /* OpenBraceToken */: // const x = { |
case 25 /* CommaToken */:
- var parent_18 = contextToken.parent;
- if (parent_18 && (parent_18.kind === 172 /* ObjectLiteralExpression */ || parent_18.kind === 168 /* ObjectBindingPattern */)) {
- return parent_18;
+ var parent_17 = contextToken.parent;
+ if (parent_17 && (parent_17.kind === 175 /* ObjectLiteralExpression */ || parent_17.kind === 171 /* ObjectBindingPattern */)) {
+ return parent_17;
}
break;
}
@@ -65161,8 +67195,8 @@ var ts;
case 16 /* OpenBraceToken */: // import { |
case 25 /* CommaToken */:
switch (contextToken.parent.kind) {
- case 234 /* NamedImports */:
- case 238 /* NamedExports */:
+ case 237 /* NamedImports */:
+ case 241 /* NamedExports */:
return contextToken.parent;
}
}
@@ -65171,37 +67205,37 @@ var ts;
}
function tryGetContainingJsxElement(contextToken) {
if (contextToken) {
- var parent_19 = contextToken.parent;
+ var parent_18 = contextToken.parent;
switch (contextToken.kind) {
case 27 /* LessThanSlashToken */:
case 40 /* SlashToken */:
case 70 /* Identifier */:
- case 246 /* JsxAttribute */:
- case 247 /* JsxSpreadAttribute */:
- if (parent_19 && (parent_19.kind === 243 /* JsxSelfClosingElement */ || parent_19.kind === 244 /* JsxOpeningElement */)) {
- return parent_19;
+ case 249 /* JsxAttribute */:
+ case 250 /* JsxSpreadAttribute */:
+ if (parent_18 && (parent_18.kind === 246 /* JsxSelfClosingElement */ || parent_18.kind === 247 /* JsxOpeningElement */)) {
+ return parent_18;
}
- else if (parent_19.kind === 246 /* JsxAttribute */) {
- return parent_19.parent;
+ else if (parent_18.kind === 249 /* JsxAttribute */) {
+ return parent_18.parent;
}
break;
// The context token is the closing } or " of an attribute, which means
// its parent is a JsxExpression, whose parent is a JsxAttribute,
// whose parent is a JsxOpeningLikeElement
case 9 /* StringLiteral */:
- if (parent_19 && ((parent_19.kind === 246 /* JsxAttribute */) || (parent_19.kind === 247 /* JsxSpreadAttribute */))) {
- return parent_19.parent;
+ if (parent_18 && ((parent_18.kind === 249 /* JsxAttribute */) || (parent_18.kind === 250 /* JsxSpreadAttribute */))) {
+ return parent_18.parent;
}
break;
case 17 /* CloseBraceToken */:
- if (parent_19 &&
- parent_19.kind === 248 /* JsxExpression */ &&
- parent_19.parent &&
- (parent_19.parent.kind === 246 /* JsxAttribute */)) {
- return parent_19.parent.parent;
+ if (parent_18 &&
+ parent_18.kind === 251 /* JsxExpression */ &&
+ parent_18.parent &&
+ (parent_18.parent.kind === 249 /* JsxAttribute */)) {
+ return parent_18.parent.parent;
}
- if (parent_19 && parent_19.kind === 247 /* JsxSpreadAttribute */) {
- return parent_19.parent;
+ if (parent_18 && parent_18.kind === 250 /* JsxSpreadAttribute */) {
+ return parent_18.parent;
}
break;
}
@@ -65210,16 +67244,16 @@ var ts;
}
function isFunction(kind) {
switch (kind) {
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
- case 221 /* FunctionDeclaration */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 154 /* IndexSignature */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 224 /* FunctionDeclaration */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 155 /* IndexSignature */:
return true;
}
return false;
@@ -65231,66 +67265,66 @@ var ts;
var containingNodeKind = contextToken.parent.kind;
switch (contextToken.kind) {
case 25 /* CommaToken */:
- return containingNodeKind === 219 /* VariableDeclaration */ ||
- containingNodeKind === 220 /* VariableDeclarationList */ ||
- containingNodeKind === 201 /* VariableStatement */ ||
- containingNodeKind === 225 /* EnumDeclaration */ ||
+ return containingNodeKind === 222 /* VariableDeclaration */ ||
+ containingNodeKind === 223 /* VariableDeclarationList */ ||
+ containingNodeKind === 204 /* VariableStatement */ ||
+ containingNodeKind === 228 /* EnumDeclaration */ ||
isFunction(containingNodeKind) ||
- containingNodeKind === 222 /* ClassDeclaration */ ||
- containingNodeKind === 193 /* ClassExpression */ ||
- containingNodeKind === 223 /* InterfaceDeclaration */ ||
- containingNodeKind === 169 /* ArrayBindingPattern */ ||
- containingNodeKind === 224 /* TypeAliasDeclaration */; // type Map, K, |
+ containingNodeKind === 225 /* ClassDeclaration */ ||
+ containingNodeKind === 196 /* ClassExpression */ ||
+ containingNodeKind === 226 /* InterfaceDeclaration */ ||
+ containingNodeKind === 172 /* ArrayBindingPattern */ ||
+ containingNodeKind === 227 /* TypeAliasDeclaration */; // type Map, K, |
case 22 /* DotToken */:
- return containingNodeKind === 169 /* ArrayBindingPattern */; // var [.|
+ return containingNodeKind === 172 /* ArrayBindingPattern */; // var [.|
case 55 /* ColonToken */:
- return containingNodeKind === 170 /* BindingElement */; // var {x :html|
+ return containingNodeKind === 173 /* BindingElement */; // var {x :html|
case 20 /* OpenBracketToken */:
- return containingNodeKind === 169 /* ArrayBindingPattern */; // var [x|
+ return containingNodeKind === 172 /* ArrayBindingPattern */; // var [x|
case 18 /* OpenParenToken */:
- return containingNodeKind === 252 /* CatchClause */ ||
+ return containingNodeKind === 255 /* CatchClause */ ||
isFunction(containingNodeKind);
case 16 /* OpenBraceToken */:
- return containingNodeKind === 225 /* EnumDeclaration */ ||
- containingNodeKind === 223 /* InterfaceDeclaration */ ||
- containingNodeKind === 160 /* TypeLiteral */; // const x : { |
+ return containingNodeKind === 228 /* EnumDeclaration */ ||
+ containingNodeKind === 226 /* InterfaceDeclaration */ ||
+ containingNodeKind === 161 /* TypeLiteral */; // const x : { |
case 24 /* SemicolonToken */:
- return containingNodeKind === 145 /* PropertySignature */ &&
+ return containingNodeKind === 146 /* PropertySignature */ &&
contextToken.parent && contextToken.parent.parent &&
- (contextToken.parent.parent.kind === 223 /* InterfaceDeclaration */ ||
- contextToken.parent.parent.kind === 160 /* TypeLiteral */); // const x : { a; |
+ (contextToken.parent.parent.kind === 226 /* InterfaceDeclaration */ ||
+ contextToken.parent.parent.kind === 161 /* TypeLiteral */); // const x : { a; |
case 26 /* LessThanToken */:
- return containingNodeKind === 222 /* ClassDeclaration */ ||
- containingNodeKind === 193 /* ClassExpression */ ||
- containingNodeKind === 223 /* InterfaceDeclaration */ ||
- containingNodeKind === 224 /* TypeAliasDeclaration */ ||
+ return containingNodeKind === 225 /* ClassDeclaration */ ||
+ containingNodeKind === 196 /* ClassExpression */ ||
+ containingNodeKind === 226 /* InterfaceDeclaration */ ||
+ containingNodeKind === 227 /* TypeAliasDeclaration */ ||
isFunction(containingNodeKind);
case 114 /* StaticKeyword */:
- return containingNodeKind === 146 /* PropertyDeclaration */;
+ return containingNodeKind === 147 /* PropertyDeclaration */;
case 23 /* DotDotDotToken */:
- return containingNodeKind === 143 /* Parameter */ ||
+ return containingNodeKind === 144 /* Parameter */ ||
(contextToken.parent && contextToken.parent.parent &&
- contextToken.parent.parent.kind === 169 /* ArrayBindingPattern */); // var [...z|
+ contextToken.parent.parent.kind === 172 /* ArrayBindingPattern */); // var [...z|
case 113 /* PublicKeyword */:
case 111 /* PrivateKeyword */:
case 112 /* ProtectedKeyword */:
- return containingNodeKind === 143 /* Parameter */;
+ return containingNodeKind === 144 /* Parameter */;
case 117 /* AsKeyword */:
- return containingNodeKind === 235 /* ImportSpecifier */ ||
- containingNodeKind === 239 /* ExportSpecifier */ ||
- containingNodeKind === 233 /* NamespaceImport */;
+ return containingNodeKind === 238 /* ImportSpecifier */ ||
+ containingNodeKind === 242 /* ExportSpecifier */ ||
+ containingNodeKind === 236 /* NamespaceImport */;
case 74 /* ClassKeyword */:
case 82 /* EnumKeyword */:
case 108 /* InterfaceKeyword */:
case 88 /* FunctionKeyword */:
case 103 /* VarKeyword */:
case 124 /* GetKeyword */:
- case 132 /* SetKeyword */:
+ case 133 /* SetKeyword */:
case 90 /* ImportKeyword */:
case 109 /* LetKeyword */:
case 75 /* ConstKeyword */:
case 115 /* YieldKeyword */:
- case 135 /* TypeKeyword */:
+ case 136 /* TypeKeyword */:
return true;
}
// Previous token may have been a keyword that was converted to an identifier.
@@ -65338,8 +67372,8 @@ var ts;
if (element.getStart() <= position && position <= element.getEnd()) {
continue;
}
- var name_47 = element.propertyName || element.name;
- existingImportsOrExports[name_47.text] = true;
+ var name_43 = element.propertyName || element.name;
+ existingImportsOrExports[name_43.text] = true;
}
if (!ts.someProperties(existingImportsOrExports)) {
return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; });
@@ -65360,10 +67394,12 @@ var ts;
for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) {
var m = existingMembers_1[_i];
// Ignore omitted expressions for missing members
- if (m.kind !== 253 /* PropertyAssignment */ &&
- m.kind !== 254 /* ShorthandPropertyAssignment */ &&
- m.kind !== 170 /* BindingElement */ &&
- m.kind !== 148 /* MethodDeclaration */) {
+ if (m.kind !== 256 /* PropertyAssignment */ &&
+ m.kind !== 257 /* ShorthandPropertyAssignment */ &&
+ m.kind !== 173 /* BindingElement */ &&
+ m.kind !== 149 /* MethodDeclaration */ &&
+ m.kind !== 151 /* GetAccessor */ &&
+ m.kind !== 152 /* SetAccessor */) {
continue;
}
// If this is the current item we are editing right now, do not filter it out
@@ -65371,7 +67407,7 @@ var ts;
continue;
}
var existingName = void 0;
- if (m.kind === 170 /* BindingElement */ && m.propertyName) {
+ if (m.kind === 173 /* BindingElement */ && m.propertyName) {
// include only identifiers in completion list
if (m.propertyName.kind === 70 /* Identifier */) {
existingName = m.propertyName.text;
@@ -65401,7 +67437,7 @@ var ts;
if (attr.getStart() <= position && position <= attr.getEnd()) {
continue;
}
- if (attr.kind === 246 /* JsxAttribute */) {
+ if (attr.kind === 249 /* JsxAttribute */) {
seenNames[attr.name.text] = true;
}
}
@@ -65451,7 +67487,7 @@ var ts;
}
// A cache of completion entries for keywords, these do not change between sessions
var keywordCompletions = [];
- for (var i = 71 /* FirstKeyword */; i <= 139 /* LastKeyword */; i++) {
+ for (var i = 71 /* FirstKeyword */; i <= 140 /* LastKeyword */; i++) {
keywordCompletions.push({
name: ts.tokenToString(i),
kind: ts.ScriptElementKind.keyword,
@@ -65528,7 +67564,7 @@ var ts;
function getSemanticDocumentHighlights(node) {
if (node.kind === 70 /* Identifier */ ||
node.kind === 98 /* ThisKeyword */ ||
- node.kind === 166 /* ThisType */ ||
+ node.kind === 167 /* ThisType */ ||
node.kind === 96 /* SuperKeyword */ ||
node.kind === 9 /* StringLiteral */ ||
ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) {
@@ -65582,75 +67618,75 @@ var ts;
switch (node.kind) {
case 89 /* IfKeyword */:
case 81 /* ElseKeyword */:
- if (hasKind(node.parent, 204 /* IfStatement */)) {
+ if (hasKind(node.parent, 207 /* IfStatement */)) {
return getIfElseOccurrences(node.parent);
}
break;
case 95 /* ReturnKeyword */:
- if (hasKind(node.parent, 212 /* ReturnStatement */)) {
+ if (hasKind(node.parent, 215 /* ReturnStatement */)) {
return getReturnOccurrences(node.parent);
}
break;
case 99 /* ThrowKeyword */:
- if (hasKind(node.parent, 216 /* ThrowStatement */)) {
+ if (hasKind(node.parent, 219 /* ThrowStatement */)) {
return getThrowOccurrences(node.parent);
}
break;
case 73 /* CatchKeyword */:
- if (hasKind(parent(parent(node)), 217 /* TryStatement */)) {
+ if (hasKind(parent(parent(node)), 220 /* TryStatement */)) {
return getTryCatchFinallyOccurrences(node.parent.parent);
}
break;
case 101 /* TryKeyword */:
case 86 /* FinallyKeyword */:
- if (hasKind(parent(node), 217 /* TryStatement */)) {
+ if (hasKind(parent(node), 220 /* TryStatement */)) {
return getTryCatchFinallyOccurrences(node.parent);
}
break;
case 97 /* SwitchKeyword */:
- if (hasKind(node.parent, 214 /* SwitchStatement */)) {
+ if (hasKind(node.parent, 217 /* SwitchStatement */)) {
return getSwitchCaseDefaultOccurrences(node.parent);
}
break;
case 72 /* CaseKeyword */:
case 78 /* DefaultKeyword */:
- if (hasKind(parent(parent(parent(node))), 214 /* SwitchStatement */)) {
+ if (hasKind(parent(parent(parent(node))), 217 /* SwitchStatement */)) {
return getSwitchCaseDefaultOccurrences(node.parent.parent.parent);
}
break;
case 71 /* BreakKeyword */:
case 76 /* ContinueKeyword */:
- if (hasKind(node.parent, 211 /* BreakStatement */) || hasKind(node.parent, 210 /* ContinueStatement */)) {
+ if (hasKind(node.parent, 214 /* BreakStatement */) || hasKind(node.parent, 213 /* ContinueStatement */)) {
return getBreakOrContinueStatementOccurrences(node.parent);
}
break;
case 87 /* ForKeyword */:
- if (hasKind(node.parent, 207 /* ForStatement */) ||
- hasKind(node.parent, 208 /* ForInStatement */) ||
- hasKind(node.parent, 209 /* ForOfStatement */)) {
+ if (hasKind(node.parent, 210 /* ForStatement */) ||
+ hasKind(node.parent, 211 /* ForInStatement */) ||
+ hasKind(node.parent, 212 /* ForOfStatement */)) {
return getLoopBreakContinueOccurrences(node.parent);
}
break;
case 105 /* WhileKeyword */:
case 80 /* DoKeyword */:
- if (hasKind(node.parent, 206 /* WhileStatement */) || hasKind(node.parent, 205 /* DoStatement */)) {
+ if (hasKind(node.parent, 209 /* WhileStatement */) || hasKind(node.parent, 208 /* DoStatement */)) {
return getLoopBreakContinueOccurrences(node.parent);
}
break;
case 122 /* ConstructorKeyword */:
- if (hasKind(node.parent, 149 /* Constructor */)) {
+ if (hasKind(node.parent, 150 /* Constructor */)) {
return getConstructorOccurrences(node.parent);
}
break;
case 124 /* GetKeyword */:
- case 132 /* SetKeyword */:
- if (hasKind(node.parent, 150 /* GetAccessor */) || hasKind(node.parent, 151 /* SetAccessor */)) {
+ case 133 /* SetKeyword */:
+ if (hasKind(node.parent, 151 /* GetAccessor */) || hasKind(node.parent, 152 /* SetAccessor */)) {
return getGetAndSetOccurrences(node.parent);
}
break;
default:
if (ts.isModifierKind(node.kind) && node.parent &&
- (ts.isDeclaration(node.parent) || node.parent.kind === 201 /* VariableStatement */)) {
+ (ts.isDeclaration(node.parent) || node.parent.kind === 204 /* VariableStatement */)) {
return getModifierOccurrences(node.kind, node.parent);
}
}
@@ -65666,10 +67702,10 @@ var ts;
aggregate(node);
return statementAccumulator;
function aggregate(node) {
- if (node.kind === 216 /* ThrowStatement */) {
+ if (node.kind === 219 /* ThrowStatement */) {
statementAccumulator.push(node);
}
- else if (node.kind === 217 /* TryStatement */) {
+ else if (node.kind === 220 /* TryStatement */) {
var tryStatement = node;
if (tryStatement.catchClause) {
aggregate(tryStatement.catchClause);
@@ -65696,19 +67732,19 @@ var ts;
function getThrowStatementOwner(throwStatement) {
var child = throwStatement;
while (child.parent) {
- var parent_20 = child.parent;
- if (ts.isFunctionBlock(parent_20) || parent_20.kind === 256 /* SourceFile */) {
- return parent_20;
+ var parent_19 = child.parent;
+ if (ts.isFunctionBlock(parent_19) || parent_19.kind === 260 /* SourceFile */) {
+ return parent_19;
}
// A throw-statement is only owned by a try-statement if the try-statement has
// a catch clause, and if the throw-statement occurs within the try block.
- if (parent_20.kind === 217 /* TryStatement */) {
- var tryStatement = parent_20;
+ if (parent_19.kind === 220 /* TryStatement */) {
+ var tryStatement = parent_19;
if (tryStatement.tryBlock === child && tryStatement.catchClause) {
return child;
}
}
- child = parent_20;
+ child = parent_19;
}
return undefined;
}
@@ -65717,7 +67753,7 @@ var ts;
aggregate(node);
return statementAccumulator;
function aggregate(node) {
- if (node.kind === 211 /* BreakStatement */ || node.kind === 210 /* ContinueStatement */) {
+ if (node.kind === 214 /* BreakStatement */ || node.kind === 213 /* ContinueStatement */) {
statementAccumulator.push(node);
}
else if (!ts.isFunctionLike(node)) {
@@ -65732,16 +67768,16 @@ var ts;
function getBreakOrContinueOwner(statement) {
for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) {
switch (node_1.kind) {
- case 214 /* SwitchStatement */:
- if (statement.kind === 210 /* ContinueStatement */) {
+ case 217 /* SwitchStatement */:
+ if (statement.kind === 213 /* ContinueStatement */) {
continue;
}
// Fall through.
- case 207 /* ForStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
- case 206 /* WhileStatement */:
- case 205 /* DoStatement */:
+ case 210 /* ForStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
+ case 209 /* WhileStatement */:
+ case 208 /* DoStatement */:
if (!statement.label || isLabeledBy(node_1, statement.label.text)) {
return node_1;
}
@@ -65760,24 +67796,24 @@ var ts;
var container = declaration.parent;
// Make sure we only highlight the keyword when it makes sense to do so.
if (ts.isAccessibilityModifier(modifier)) {
- if (!(container.kind === 222 /* ClassDeclaration */ ||
- container.kind === 193 /* ClassExpression */ ||
- (declaration.kind === 143 /* Parameter */ && hasKind(container, 149 /* Constructor */)))) {
+ if (!(container.kind === 225 /* ClassDeclaration */ ||
+ container.kind === 196 /* ClassExpression */ ||
+ (declaration.kind === 144 /* Parameter */ && hasKind(container, 150 /* Constructor */)))) {
return undefined;
}
}
else if (modifier === 114 /* StaticKeyword */) {
- if (!(container.kind === 222 /* ClassDeclaration */ || container.kind === 193 /* ClassExpression */)) {
+ if (!(container.kind === 225 /* ClassDeclaration */ || container.kind === 196 /* ClassExpression */)) {
return undefined;
}
}
else if (modifier === 83 /* ExportKeyword */ || modifier === 123 /* DeclareKeyword */) {
- if (!(container.kind === 227 /* ModuleBlock */ || container.kind === 256 /* SourceFile */)) {
+ if (!(container.kind === 230 /* ModuleBlock */ || container.kind === 260 /* SourceFile */)) {
return undefined;
}
}
else if (modifier === 116 /* AbstractKeyword */) {
- if (!(container.kind === 222 /* ClassDeclaration */ || declaration.kind === 222 /* ClassDeclaration */)) {
+ if (!(container.kind === 225 /* ClassDeclaration */ || declaration.kind === 225 /* ClassDeclaration */)) {
return undefined;
}
}
@@ -65789,8 +67825,8 @@ var ts;
var modifierFlag = getFlagFromModifier(modifier);
var nodes;
switch (container.kind) {
- case 227 /* ModuleBlock */:
- case 256 /* SourceFile */:
+ case 230 /* ModuleBlock */:
+ case 260 /* SourceFile */:
// Container is either a class declaration or the declaration is a classDeclaration
if (modifierFlag & 128 /* Abstract */) {
nodes = declaration.members.concat(declaration);
@@ -65799,17 +67835,17 @@ var ts;
nodes = container.statements;
}
break;
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
nodes = container.parameters.concat(container.parent.members);
break;
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
nodes = container.members;
// If we're an accessibility modifier, we're in an instance member and should search
// the constructor's parameter list for instance members as well.
if (modifierFlag & 28 /* AccessibilityModifier */) {
var constructor = ts.forEach(container.members, function (member) {
- return member.kind === 149 /* Constructor */ && member;
+ return member.kind === 150 /* Constructor */ && member;
});
if (constructor) {
nodes = nodes.concat(constructor.parameters);
@@ -65862,13 +67898,13 @@ var ts;
}
function getGetAndSetOccurrences(accessorDeclaration) {
var keywords = [];
- tryPushAccessorKeyword(accessorDeclaration.symbol, 150 /* GetAccessor */);
- tryPushAccessorKeyword(accessorDeclaration.symbol, 151 /* SetAccessor */);
+ tryPushAccessorKeyword(accessorDeclaration.symbol, 151 /* GetAccessor */);
+ tryPushAccessorKeyword(accessorDeclaration.symbol, 152 /* SetAccessor */);
return ts.map(keywords, getHighlightSpanForNode);
function tryPushAccessorKeyword(accessorSymbol, accessorKind) {
var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind);
if (accessor) {
- ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 124 /* GetKeyword */, 132 /* SetKeyword */); });
+ ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 124 /* GetKeyword */, 133 /* SetKeyword */); });
}
}
}
@@ -65886,7 +67922,7 @@ var ts;
var keywords = [];
if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87 /* ForKeyword */, 105 /* WhileKeyword */, 80 /* DoKeyword */)) {
// If we succeeded and got a do-while loop, then start looking for a 'while' keyword.
- if (loopNode.kind === 205 /* DoStatement */) {
+ if (loopNode.kind === 208 /* DoStatement */) {
var loopTokens = loopNode.getChildren();
for (var i = loopTokens.length - 1; i >= 0; i--) {
if (pushKeywordIf(keywords, loopTokens[i], 105 /* WhileKeyword */)) {
@@ -65907,13 +67943,13 @@ var ts;
var owner = getBreakOrContinueOwner(breakOrContinueStatement);
if (owner) {
switch (owner.kind) {
- case 207 /* ForStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
- case 205 /* DoStatement */:
- case 206 /* WhileStatement */:
+ case 210 /* ForStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
+ case 208 /* DoStatement */:
+ case 209 /* WhileStatement */:
return getLoopBreakContinueOccurrences(owner);
- case 214 /* SwitchStatement */:
+ case 217 /* SwitchStatement */:
return getSwitchCaseDefaultOccurrences(owner);
}
}
@@ -65967,7 +68003,7 @@ var ts;
function getReturnOccurrences(returnStatement) {
var func = ts.getContainingFunction(returnStatement);
// If we didn't find a containing function with a block body, bail out.
- if (!(func && hasKind(func.body, 200 /* Block */))) {
+ if (!(func && hasKind(func.body, 203 /* Block */))) {
return undefined;
}
var keywords = [];
@@ -65983,7 +68019,7 @@ var ts;
function getIfElseOccurrences(ifStatement) {
var keywords = [];
// Traverse upwards through all parent if-statements linked by their else-branches.
- while (hasKind(ifStatement.parent, 204 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) {
+ while (hasKind(ifStatement.parent, 207 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) {
ifStatement = ifStatement.parent;
}
// Now traverse back down through the else branches, aggregating if/else keywords of if-statements.
@@ -65996,7 +68032,7 @@ var ts;
break;
}
}
- if (!hasKind(ifStatement.elseStatement, 204 /* IfStatement */)) {
+ if (!hasKind(ifStatement.elseStatement, 207 /* IfStatement */)) {
break;
}
ifStatement = ifStatement.elseStatement;
@@ -66039,7 +68075,7 @@ var ts;
* Note: 'node' cannot be a SourceFile.
*/
function isLabeledBy(node, labelName) {
- for (var owner = node.parent; owner.kind === 215 /* LabeledStatement */; owner = owner.parent) {
+ for (var owner = node.parent; owner.kind === 218 /* LabeledStatement */; owner = owner.parent) {
if (owner.label.text === labelName) {
return true;
}
@@ -66273,12 +68309,12 @@ var ts;
function getAliasSymbolForPropertyNameSymbol(symbol, location) {
if (symbol.flags & 8388608 /* Alias */) {
// Default import get alias
- var defaultImport = ts.getDeclarationOfKind(symbol, 232 /* ImportClause */);
+ var defaultImport = ts.getDeclarationOfKind(symbol, 235 /* ImportClause */);
if (defaultImport) {
return typeChecker.getAliasedSymbol(symbol);
}
- var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 235 /* ImportSpecifier */ ||
- declaration.kind === 239 /* ExportSpecifier */) ? declaration : undefined; });
+ var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 238 /* ImportSpecifier */ ||
+ declaration.kind === 242 /* ExportSpecifier */) ? declaration : undefined; });
if (importOrExportSpecifier &&
// export { a }
(!importOrExportSpecifier.propertyName ||
@@ -66286,7 +68322,7 @@ var ts;
importOrExportSpecifier.propertyName === location)) {
// If Import specifier -> get alias
// else Export specifier -> get local target
- return importOrExportSpecifier.kind === 235 /* ImportSpecifier */ ?
+ return importOrExportSpecifier.kind === 238 /* ImportSpecifier */ ?
typeChecker.getAliasedSymbol(symbol) :
typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier);
}
@@ -66301,14 +68337,14 @@ var ts;
typeChecker.getPropertySymbolOfDestructuringAssignment(location);
}
function isObjectBindingPatternElementWithoutPropertyName(symbol) {
- var bindingElement = ts.getDeclarationOfKind(symbol, 170 /* BindingElement */);
+ var bindingElement = ts.getDeclarationOfKind(symbol, 173 /* BindingElement */);
return bindingElement &&
- bindingElement.parent.kind === 168 /* ObjectBindingPattern */ &&
+ bindingElement.parent.kind === 171 /* ObjectBindingPattern */ &&
!bindingElement.propertyName;
}
function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) {
if (isObjectBindingPatternElementWithoutPropertyName(symbol)) {
- var bindingElement = ts.getDeclarationOfKind(symbol, 170 /* BindingElement */);
+ var bindingElement = ts.getDeclarationOfKind(symbol, 173 /* BindingElement */);
var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent);
return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text);
}
@@ -66338,14 +68374,14 @@ var ts;
// If this is the symbol of a named function expression or named class expression,
// then named references are limited to its own scope.
var valueDeclaration = symbol.valueDeclaration;
- if (valueDeclaration && (valueDeclaration.kind === 180 /* FunctionExpression */ || valueDeclaration.kind === 193 /* ClassExpression */)) {
+ if (valueDeclaration && (valueDeclaration.kind === 183 /* FunctionExpression */ || valueDeclaration.kind === 196 /* ClassExpression */)) {
return valueDeclaration;
}
// If this is private property or method, the scope is the containing class
if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) {
var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8 /* Private */) ? d : undefined; });
if (privateDeclaration) {
- return ts.getAncestor(privateDeclaration, 222 /* ClassDeclaration */);
+ return ts.getAncestor(privateDeclaration, 225 /* ClassDeclaration */);
}
}
// If the symbol is an import we would like to find it if we are looking for what it imports.
@@ -66376,7 +68412,7 @@ var ts;
// Different declarations have different containers, bail out
return undefined;
}
- if (container.kind === 256 /* SourceFile */ && !ts.isExternalModule(container)) {
+ if (container.kind === 260 /* SourceFile */ && !ts.isExternalModule(container)) {
// This is a global variable and not an external module, any declaration defined
// within this scope is visible outside the file
return undefined;
@@ -66407,8 +68443,8 @@ var ts;
// We found a match. Make sure it's not part of a larger word (i.e. the char
// before and after it have to be a non-identifier char).
var endPosition = position + symbolNameLength;
- if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 4 /* Latest */)) &&
- (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 4 /* Latest */))) {
+ if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 5 /* Latest */)) &&
+ (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 5 /* Latest */))) {
// Found a real match. Keep searching.
positions.push(position);
}
@@ -66580,14 +68616,14 @@ var ts;
var result = [];
for (var _i = 0, _a = classSymbol.members["__constructor"].declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- ts.Debug.assert(decl.kind === 149 /* Constructor */);
+ ts.Debug.assert(decl.kind === 150 /* Constructor */);
var ctrKeyword = decl.getChildAt(0);
ts.Debug.assert(ctrKeyword.kind === 122 /* ConstructorKeyword */);
result.push(ctrKeyword);
}
ts.forEachProperty(classSymbol.exports, function (member) {
var decl = member.valueDeclaration;
- if (decl && decl.kind === 148 /* MethodDeclaration */) {
+ if (decl && decl.kind === 149 /* MethodDeclaration */) {
var body = decl.body;
if (body) {
forEachDescendantOfKind(body, 98 /* ThisKeyword */, function (thisKeyword) {
@@ -66610,7 +68646,7 @@ var ts;
var result = [];
for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- ts.Debug.assert(decl.kind === 149 /* Constructor */);
+ ts.Debug.assert(decl.kind === 150 /* Constructor */);
var body = decl.body;
if (body) {
forEachDescendantOfKind(body, 96 /* SuperKeyword */, function (node) {
@@ -66652,7 +68688,7 @@ var ts;
result.push(getReferenceEntryFromNode(refNode.parent));
}
else if (refNode.kind === 70 /* Identifier */) {
- if (refNode.parent.kind === 254 /* ShorthandPropertyAssignment */) {
+ if (refNode.parent.kind === 257 /* ShorthandPropertyAssignment */) {
// Go ahead and dereference the shorthand assignment by going to its definition
getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result);
}
@@ -66665,24 +68701,24 @@ var ts;
// If we got a type reference, try and see if the reference applies to any expressions that can implement an interface
var containingTypeReference = getContainingTypeReference(refNode);
if (containingTypeReference) {
- var parent_21 = containingTypeReference.parent;
- if (ts.isVariableLike(parent_21) && parent_21.type === containingTypeReference && parent_21.initializer && isImplementationExpression(parent_21.initializer)) {
- maybeAdd(getReferenceEntryFromNode(parent_21.initializer));
+ var parent_20 = containingTypeReference.parent;
+ if (ts.isVariableLike(parent_20) && parent_20.type === containingTypeReference && parent_20.initializer && isImplementationExpression(parent_20.initializer)) {
+ maybeAdd(getReferenceEntryFromNode(parent_20.initializer));
}
- else if (ts.isFunctionLike(parent_21) && parent_21.type === containingTypeReference && parent_21.body) {
- if (parent_21.body.kind === 200 /* Block */) {
- ts.forEachReturnStatement(parent_21.body, function (returnStatement) {
+ else if (ts.isFunctionLike(parent_20) && parent_20.type === containingTypeReference && parent_20.body) {
+ if (parent_20.body.kind === 203 /* Block */) {
+ ts.forEachReturnStatement(parent_20.body, function (returnStatement) {
if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) {
maybeAdd(getReferenceEntryFromNode(returnStatement.expression));
}
});
}
- else if (isImplementationExpression(parent_21.body)) {
- maybeAdd(getReferenceEntryFromNode(parent_21.body));
+ else if (isImplementationExpression(parent_20.body)) {
+ maybeAdd(getReferenceEntryFromNode(parent_20.body));
}
}
- else if (ts.isAssertionExpression(parent_21) && isImplementationExpression(parent_21.expression)) {
- maybeAdd(getReferenceEntryFromNode(parent_21.expression));
+ else if (ts.isAssertionExpression(parent_20) && isImplementationExpression(parent_20.expression)) {
+ maybeAdd(getReferenceEntryFromNode(parent_20.expression));
}
}
}
@@ -66722,12 +68758,12 @@ var ts;
}
function getContainingClassIfInHeritageClause(node) {
if (node && node.parent) {
- if (node.kind === 195 /* ExpressionWithTypeArguments */
- && node.parent.kind === 251 /* HeritageClause */
+ if (node.kind === 198 /* ExpressionWithTypeArguments */
+ && node.parent.kind === 254 /* HeritageClause */
&& ts.isClassLike(node.parent.parent)) {
return node.parent.parent;
}
- else if (node.kind === 70 /* Identifier */ || node.kind === 173 /* PropertyAccessExpression */) {
+ else if (node.kind === 70 /* Identifier */ || node.kind === 176 /* PropertyAccessExpression */) {
return getContainingClassIfInHeritageClause(node.parent);
}
}
@@ -66738,14 +68774,14 @@ var ts;
*/
function isImplementationExpression(node) {
// Unwrap parentheses
- if (node.kind === 179 /* ParenthesizedExpression */) {
+ if (node.kind === 182 /* ParenthesizedExpression */) {
return isImplementationExpression(node.expression);
}
- return node.kind === 181 /* ArrowFunction */ ||
- node.kind === 180 /* FunctionExpression */ ||
- node.kind === 172 /* ObjectLiteralExpression */ ||
- node.kind === 193 /* ClassExpression */ ||
- node.kind === 171 /* ArrayLiteralExpression */;
+ return node.kind === 184 /* ArrowFunction */ ||
+ node.kind === 183 /* FunctionExpression */ ||
+ node.kind === 175 /* ObjectLiteralExpression */ ||
+ node.kind === 196 /* ClassExpression */ ||
+ node.kind === 174 /* ArrayLiteralExpression */;
}
/**
* Determines if the parent symbol occurs somewhere in the child's ancestry. If the parent symbol
@@ -66794,7 +68830,7 @@ var ts;
}
return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration));
}
- else if (declaration.kind === 223 /* InterfaceDeclaration */) {
+ else if (declaration.kind === 226 /* InterfaceDeclaration */) {
if (parentIsInterface) {
return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference);
}
@@ -66822,13 +68858,13 @@ var ts;
// Whether 'super' occurs in a static context within a class.
var staticFlag = 32 /* Static */;
switch (searchSpaceNode.kind) {
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 149 /* Constructor */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 150 /* Constructor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
staticFlag &= ts.getModifierFlags(searchSpaceNode);
searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class
break;
@@ -66860,27 +68896,27 @@ var ts;
// Whether 'this' occurs in a static context within a class.
var staticFlag = 32 /* Static */;
switch (searchSpaceNode.kind) {
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
if (ts.isObjectLiteralMethod(searchSpaceNode)) {
break;
}
// fall through
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
- case 149 /* Constructor */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
+ case 150 /* Constructor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
staticFlag &= ts.getModifierFlags(searchSpaceNode);
searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class
break;
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
if (ts.isExternalModule(searchSpaceNode)) {
return undefined;
}
// Fall through
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
break;
// Computed properties in classes are not handled here because references to this are illegal,
// so there is no point finding references to them.
@@ -66889,7 +68925,7 @@ var ts;
}
var references = [];
var possiblePositions;
- if (searchSpaceNode.kind === 256 /* SourceFile */) {
+ if (searchSpaceNode.kind === 260 /* SourceFile */) {
ts.forEach(sourceFiles, function (sourceFile) {
possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd());
getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references);
@@ -66923,28 +68959,28 @@ var ts;
}
var container = ts.getThisContainer(node, /* includeArrowFunctions */ false);
switch (searchSpaceNode.kind) {
- case 180 /* FunctionExpression */:
- case 221 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 224 /* FunctionDeclaration */:
if (searchSpaceNode.symbol === container.symbol) {
result.push(getReferenceEntryFromNode(node));
}
break;
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) {
result.push(getReferenceEntryFromNode(node));
}
break;
- case 193 /* ClassExpression */:
- case 222 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 225 /* ClassDeclaration */:
// Make sure the container belongs to the same class
// and has the appropriate static modifier from the original container.
if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag) {
result.push(getReferenceEntryFromNode(node));
}
break;
- case 256 /* SourceFile */:
- if (container.kind === 256 /* SourceFile */ && !ts.isExternalModule(container)) {
+ case 260 /* SourceFile */:
+ if (container.kind === 260 /* SourceFile */ && !ts.isExternalModule(container)) {
result.push(getReferenceEntryFromNode(node));
}
break;
@@ -66998,7 +69034,7 @@ var ts;
// Search the property symbol
// for ( { property: p2 } of elems) { }
var containingObjectLiteralElement = getContainingObjectLiteralElement(location);
- if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 254 /* ShorthandPropertyAssignment */) {
+ if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 257 /* ShorthandPropertyAssignment */) {
var propertySymbol = getPropertySymbolOfDestructuringAssignment(location);
if (propertySymbol) {
result.push(propertySymbol);
@@ -67046,7 +69082,7 @@ var ts;
// we should include both parameter declaration symbol and property declaration symbol
// Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals.
// Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members
- if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 143 /* Parameter */ &&
+ if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 144 /* Parameter */ &&
ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) {
result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name));
}
@@ -67101,7 +69137,7 @@ var ts;
getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration));
ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference);
}
- else if (declaration.kind === 223 /* InterfaceDeclaration */) {
+ else if (declaration.kind === 226 /* InterfaceDeclaration */) {
ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference);
}
});
@@ -67185,7 +69221,7 @@ var ts;
});
}
function getNameFromObjectLiteralElement(node) {
- if (node.name.kind === 141 /* ComputedPropertyName */) {
+ if (node.name.kind === 142 /* ComputedPropertyName */) {
var nameExpression = node.name.expression;
// treat computed property names where expression is string/numeric literal as just string/numeric literal
if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
@@ -67267,7 +69303,7 @@ var ts;
if (node.initializer) {
return true;
}
- else if (node.kind === 219 /* VariableDeclaration */) {
+ else if (node.kind === 222 /* VariableDeclaration */) {
var parentStatement = getParentStatementOfVariableDeclaration(node);
return parentStatement && ts.hasModifier(parentStatement, 2 /* Ambient */);
}
@@ -67277,18 +69313,18 @@ var ts;
}
else {
switch (node.kind) {
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 225 /* EnumDeclaration */:
- case 226 /* ModuleDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 228 /* EnumDeclaration */:
+ case 229 /* ModuleDeclaration */:
return true;
}
}
return false;
}
function getParentStatementOfVariableDeclaration(node) {
- if (node.parent && node.parent.parent && node.parent.parent.kind === 201 /* VariableStatement */) {
- ts.Debug.assert(node.parent.kind === 220 /* VariableDeclarationList */);
+ if (node.parent && node.parent.parent && node.parent.parent.kind === 204 /* VariableStatement */) {
+ ts.Debug.assert(node.parent.kind === 223 /* VariableDeclarationList */);
return node.parent.parent;
}
}
@@ -67327,10 +69363,10 @@ var ts;
}
var parent = node.parent;
if (parent) {
- if (parent.kind === 187 /* PostfixUnaryExpression */ || parent.kind === 186 /* PrefixUnaryExpression */) {
+ if (parent.kind === 190 /* PostfixUnaryExpression */ || parent.kind === 189 /* PrefixUnaryExpression */) {
return true;
}
- else if (parent.kind === 188 /* BinaryExpression */ && parent.left === node) {
+ else if (parent.kind === 191 /* BinaryExpression */ && parent.left === node) {
var operator = parent.operatorToken.kind;
return 57 /* FirstAssignment */ <= operator && operator <= 69 /* LastAssignment */;
}
@@ -67352,7 +69388,7 @@ var ts;
switch (node.kind) {
case 9 /* StringLiteral */:
case 8 /* NumericLiteral */:
- if (node.parent.kind === 141 /* ComputedPropertyName */) {
+ if (node.parent.kind === 142 /* ComputedPropertyName */) {
return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined;
}
// intential fall through
@@ -67363,11 +69399,11 @@ var ts;
}
function isObjectLiteralPropertyDeclaration(node) {
switch (node.kind) {
- case 253 /* PropertyAssignment */:
- case 254 /* ShorthandPropertyAssignment */:
- case 148 /* MethodDeclaration */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 256 /* PropertyAssignment */:
+ case 257 /* ShorthandPropertyAssignment */:
+ case 149 /* MethodDeclaration */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
return true;
}
return false;
@@ -67442,7 +69478,7 @@ var ts;
//
if (node.kind === 70 /* Identifier */ &&
(node.parent === declaration ||
- (declaration.kind === 235 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 234 /* NamedImports */))) {
+ (declaration.kind === 238 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 237 /* NamedImports */))) {
symbol = typeChecker.getAliasedSymbol(symbol);
}
}
@@ -67451,7 +69487,7 @@ var ts;
// go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition
// is performed at the location of property access, we would like to go to definition of the property in the short-hand
// assignment. This case and others are handled by the following code.
- if (node.parent.kind === 254 /* ShorthandPropertyAssignment */) {
+ if (node.parent.kind === 257 /* ShorthandPropertyAssignment */) {
var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
if (!shorthandSymbol) {
return [];
@@ -67534,8 +69570,8 @@ var ts;
var declarations = [];
var definition;
ts.forEach(signatureDeclarations, function (d) {
- if ((selectConstructors && d.kind === 149 /* Constructor */) ||
- (!selectConstructors && (d.kind === 221 /* FunctionDeclaration */ || d.kind === 148 /* MethodDeclaration */ || d.kind === 147 /* MethodSignature */))) {
+ if ((selectConstructors && d.kind === 150 /* Constructor */) ||
+ (!selectConstructors && (d.kind === 224 /* FunctionDeclaration */ || d.kind === 149 /* MethodDeclaration */ || d.kind === 148 /* MethodSignature */))) {
declarations.push(d);
if (d.body)
definition = d;
@@ -67615,7 +69651,7 @@ var ts;
function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) {
// If invoked directly on a shorthand property assignment, then return
// the declaration of the symbol being assigned (not the symbol being assigned to).
- if (node.parent.kind === 254 /* ShorthandPropertyAssignment */) {
+ if (node.parent.kind === 257 /* ShorthandPropertyAssignment */) {
var result = [];
ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result);
return result.length > 0 ? result : undefined;
@@ -67781,19 +69817,19 @@ var ts;
var commentOwner;
findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) {
switch (commentOwner.kind) {
- case 221 /* FunctionDeclaration */:
- case 148 /* MethodDeclaration */:
- case 149 /* Constructor */:
- case 222 /* ClassDeclaration */:
- case 201 /* VariableStatement */:
+ case 224 /* FunctionDeclaration */:
+ case 149 /* MethodDeclaration */:
+ case 150 /* Constructor */:
+ case 225 /* ClassDeclaration */:
+ case 204 /* VariableStatement */:
break findOwner;
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
return undefined;
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
// If in walking up the tree, we hit a a nested namespace declaration,
// then we must be somewhere within a dotted namespace name; however we don't
// want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'.
- if (commentOwner.parent.kind === 226 /* ModuleDeclaration */) {
+ if (commentOwner.parent.kind === 229 /* ModuleDeclaration */) {
return undefined;
}
break findOwner;
@@ -67834,7 +69870,7 @@ var ts;
if (ts.isFunctionLike(commentOwner)) {
return commentOwner.parameters;
}
- if (commentOwner.kind === 201 /* VariableStatement */) {
+ if (commentOwner.kind === 204 /* VariableStatement */) {
var varStatement = commentOwner;
var varDeclarations = varStatement.declarationList.declarations;
if (varDeclarations.length === 1 && varDeclarations[0].initializer) {
@@ -67852,17 +69888,17 @@ var ts;
* @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'.
*/
function getParametersFromRightHandSideOfAssignment(rightHandSide) {
- while (rightHandSide.kind === 179 /* ParenthesizedExpression */) {
+ while (rightHandSide.kind === 182 /* ParenthesizedExpression */) {
rightHandSide = rightHandSide.expression;
}
switch (rightHandSide.kind) {
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
return rightHandSide.parameters;
- case 193 /* ClassExpression */:
+ case 196 /* ClassExpression */:
for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 149 /* Constructor */) {
+ if (member.kind === 150 /* Constructor */) {
return member.parameters;
}
}
@@ -67929,7 +69965,7 @@ var ts;
mergeTypings(typingOptions.include);
exclude = typingOptions.exclude || [];
var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
- if (projectRootPath !== undefined) {
+ if (projectRootPath) {
possibleSearchDirs.push(projectRootPath);
}
searchDirs = ts.deduplicate(possibleSearchDirs);
@@ -67954,9 +69990,9 @@ var ts;
}
}
// Add the cached typing locations for inferred typings that are already installed
- for (var name_48 in packageNameToTypingLocation) {
- if (name_48 in inferredTypings && !inferredTypings[name_48]) {
- inferredTypings[name_48] = packageNameToTypingLocation[name_48];
+ for (var name_44 in packageNameToTypingLocation) {
+ if (name_44 in inferredTypings && !inferredTypings[name_44]) {
+ inferredTypings[name_44] = packageNameToTypingLocation[name_44];
}
}
// Remove typings that the user has added to the exclude list
@@ -68094,12 +70130,12 @@ var ts;
return;
}
var nameToDeclarations = sourceFile.getNamedDeclarations();
- for (var name_49 in nameToDeclarations) {
- var declarations = nameToDeclarations[name_49];
+ for (var name_45 in nameToDeclarations) {
+ var declarations = nameToDeclarations[name_45];
if (declarations) {
// First do a quick check to see if the name of the declaration matches the
// last portion of the (possibly) dotted name they're searching for.
- var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_49);
+ var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_45);
if (!matches) {
continue;
}
@@ -68112,14 +70148,14 @@ var ts;
if (!containers) {
return undefined;
}
- matches = patternMatcher.getMatches(containers, name_49);
+ matches = patternMatcher.getMatches(containers, name_45);
if (!matches) {
continue;
}
}
var fileName = sourceFile.fileName;
var matchKind = bestMatchKind(matches);
- rawItems.push({ name: name_49, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
+ rawItems.push({ name: name_45, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
}
}
}
@@ -68127,7 +70163,7 @@ var ts;
// Remove imports when the imported declaration is already in the list and has the same name.
rawItems = ts.filter(rawItems, function (item) {
var decl = item.declaration;
- if (decl.kind === 232 /* ImportClause */ || decl.kind === 235 /* ImportSpecifier */ || decl.kind === 230 /* ImportEqualsDeclaration */) {
+ if (decl.kind === 235 /* ImportClause */ || decl.kind === 238 /* ImportSpecifier */ || decl.kind === 233 /* ImportEqualsDeclaration */) {
var importer = checker.getSymbolAtLocation(decl.name);
var imported = checker.getAliasedSymbol(importer);
return importer.name !== imported.name;
@@ -68169,7 +70205,7 @@ var ts;
if (text !== undefined) {
containers.unshift(text);
}
- else if (declaration.name.kind === 141 /* ComputedPropertyName */) {
+ else if (declaration.name.kind === 142 /* ComputedPropertyName */) {
return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ true);
}
else {
@@ -68190,7 +70226,7 @@ var ts;
}
return true;
}
- if (expression.kind === 173 /* PropertyAccessExpression */) {
+ if (expression.kind === 176 /* PropertyAccessExpression */) {
var propertyAccess = expression;
if (includeLastPortion) {
containers.unshift(propertyAccess.name.text);
@@ -68203,7 +70239,7 @@ var ts;
var containers = [];
// First, if we started with a computed property name, then add all but the last
// portion into the container array.
- if (declaration.name.kind === 141 /* ComputedPropertyName */) {
+ if (declaration.name.kind === 142 /* ComputedPropertyName */) {
if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ false)) {
return undefined;
}
@@ -68356,7 +70392,7 @@ var ts;
return;
}
switch (node.kind) {
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
// Get parameter properties, and treat them as being on the *same* level as the constructor, not under it.
var ctr = node;
addNodeWithRecursiveChild(ctr, ctr.body);
@@ -68368,21 +70404,21 @@ var ts;
}
}
break;
- case 148 /* MethodDeclaration */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 147 /* MethodSignature */:
+ case 149 /* MethodDeclaration */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 148 /* MethodSignature */:
if (!ts.hasDynamicName(node)) {
addNodeWithRecursiveChild(node, node.body);
}
break;
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
if (!ts.hasDynamicName(node)) {
addLeafNode(node);
}
break;
- case 232 /* ImportClause */:
+ case 235 /* ImportClause */:
var importClause = node;
// Handle default import case e.g.:
// import d from "mod";
@@ -68394,7 +70430,7 @@ var ts;
// import {a, b as B} from "mod";
var namedBindings = importClause.namedBindings;
if (namedBindings) {
- if (namedBindings.kind === 233 /* NamespaceImport */) {
+ if (namedBindings.kind === 236 /* NamespaceImport */) {
addLeafNode(namedBindings);
}
else {
@@ -68405,12 +70441,12 @@ var ts;
}
}
break;
- case 170 /* BindingElement */:
- case 219 /* VariableDeclaration */:
+ case 173 /* BindingElement */:
+ case 222 /* VariableDeclaration */:
var decl = node;
- var name_50 = decl.name;
- if (ts.isBindingPattern(name_50)) {
- addChildrenRecursively(name_50);
+ var name_46 = decl.name;
+ if (ts.isBindingPattern(name_46)) {
+ addChildrenRecursively(name_46);
}
else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) {
// For `const x = function() {}`, just use the function node, not the const.
@@ -68420,12 +70456,12 @@ var ts;
addNodeWithRecursiveChild(decl, decl.initializer);
}
break;
- case 181 /* ArrowFunction */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
addNodeWithRecursiveChild(node, node.body);
break;
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
startNode(node);
for (var _d = 0, _e = node.members; _d < _e.length; _d++) {
var member = _e[_d];
@@ -68435,9 +70471,9 @@ var ts;
}
endNode();
break;
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 223 /* InterfaceDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 226 /* InterfaceDeclaration */:
startNode(node);
for (var _f = 0, _g = node.members; _f < _g.length; _f++) {
var member = _g[_f];
@@ -68445,21 +70481,21 @@ var ts;
}
endNode();
break;
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
addNodeWithRecursiveChild(node, getInteriorModule(node).body);
break;
- case 239 /* ExportSpecifier */:
- case 230 /* ImportEqualsDeclaration */:
- case 154 /* IndexSignature */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 224 /* TypeAliasDeclaration */:
+ case 242 /* ExportSpecifier */:
+ case 233 /* ImportEqualsDeclaration */:
+ case 155 /* IndexSignature */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 227 /* TypeAliasDeclaration */:
addLeafNode(node);
break;
default:
ts.forEach(node.jsDocComments, function (jsDocComment) {
ts.forEach(jsDocComment.tags, function (tag) {
- if (tag.kind === 279 /* JSDocTypedefTag */) {
+ if (tag.kind === 283 /* JSDocTypedefTag */) {
addLeafNode(tag);
}
});
@@ -68510,14 +70546,14 @@ var ts;
});
/** a and b have the same name, but they may not be mergeable. */
function shouldReallyMerge(a, b) {
- return a.kind === b.kind && (a.kind !== 226 /* ModuleDeclaration */ || areSameModule(a, b));
+ return a.kind === b.kind && (a.kind !== 229 /* ModuleDeclaration */ || areSameModule(a, b));
// We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes.
// Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'!
function areSameModule(a, b) {
if (a.body.kind !== b.body.kind) {
return false;
}
- if (a.body.kind !== 226 /* ModuleDeclaration */) {
+ if (a.body.kind !== 229 /* ModuleDeclaration */) {
return true;
}
return areSameModule(a.body, b.body);
@@ -68577,7 +70613,7 @@ var ts;
* So `new()` can still come before an `aardvark` method.
*/
function tryGetName(node) {
- if (node.kind === 226 /* ModuleDeclaration */) {
+ if (node.kind === 229 /* ModuleDeclaration */) {
return getModuleName(node);
}
var decl = node;
@@ -68585,18 +70621,18 @@ var ts;
return ts.getPropertyNameForPropertyNameNode(decl.name);
}
switch (node.kind) {
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
- case 193 /* ClassExpression */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 196 /* ClassExpression */:
return getFunctionOrClassName(node);
- case 279 /* JSDocTypedefTag */:
+ case 283 /* JSDocTypedefTag */:
return getJSDocTypedefTagName(node);
default:
return undefined;
}
}
function getItemName(node) {
- if (node.kind === 226 /* ModuleDeclaration */) {
+ if (node.kind === 229 /* ModuleDeclaration */) {
return getModuleName(node);
}
var name = node.name;
@@ -68607,16 +70643,16 @@ var ts;
}
}
switch (node.kind) {
- case 256 /* SourceFile */:
+ case 260 /* SourceFile */:
var sourceFile = node;
return ts.isExternalModule(sourceFile)
? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\""
: "
";
- case 181 /* ArrowFunction */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
+ case 184 /* ArrowFunction */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
if (ts.getModifierFlags(node) & 512 /* Default */) {
return "default";
}
@@ -68624,15 +70660,15 @@ var ts;
// (eg: "app\n.onactivated"), so we should remove the whitespace for readabiltiy in the
// navigation bar.
return getFunctionOrClassName(node);
- case 149 /* Constructor */:
+ case 150 /* Constructor */:
return "constructor";
- case 153 /* ConstructSignature */:
+ case 154 /* ConstructSignature */:
return "new()";
- case 152 /* CallSignature */:
+ case 153 /* CallSignature */:
return "()";
- case 154 /* IndexSignature */:
+ case 155 /* IndexSignature */:
return "[]";
- case 279 /* JSDocTypedefTag */:
+ case 283 /* JSDocTypedefTag */:
return getJSDocTypedefTagName(node);
default:
return "";
@@ -68644,7 +70680,7 @@ var ts;
}
else {
var parentNode = node.parent && node.parent.parent;
- if (parentNode && parentNode.kind === 201 /* VariableStatement */) {
+ if (parentNode && parentNode.kind === 204 /* VariableStatement */) {
if (parentNode.declarationList.declarations.length > 0) {
var nameIdentifier = parentNode.declarationList.declarations[0].name;
if (nameIdentifier.kind === 70 /* Identifier */) {
@@ -68673,24 +70709,24 @@ var ts;
return topLevel;
function isTopLevel(item) {
switch (navigationBarNodeKind(item)) {
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 225 /* EnumDeclaration */:
- case 223 /* InterfaceDeclaration */:
- case 226 /* ModuleDeclaration */:
- case 256 /* SourceFile */:
- case 224 /* TypeAliasDeclaration */:
- case 279 /* JSDocTypedefTag */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 228 /* EnumDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 229 /* ModuleDeclaration */:
+ case 260 /* SourceFile */:
+ case 227 /* TypeAliasDeclaration */:
+ case 283 /* JSDocTypedefTag */:
return true;
- case 149 /* Constructor */:
- case 148 /* MethodDeclaration */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 219 /* VariableDeclaration */:
+ case 150 /* Constructor */:
+ case 149 /* MethodDeclaration */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 222 /* VariableDeclaration */:
return hasSomeImportantChild(item);
- case 181 /* ArrowFunction */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
return isTopLevelFunctionDeclaration(item);
default:
return false;
@@ -68700,10 +70736,10 @@ var ts;
return false;
}
switch (navigationBarNodeKind(item.parent)) {
- case 227 /* ModuleBlock */:
- case 256 /* SourceFile */:
- case 148 /* MethodDeclaration */:
- case 149 /* Constructor */:
+ case 230 /* ModuleBlock */:
+ case 260 /* SourceFile */:
+ case 149 /* MethodDeclaration */:
+ case 150 /* Constructor */:
return true;
default:
return hasSomeImportantChild(item);
@@ -68712,7 +70748,7 @@ var ts;
function hasSomeImportantChild(item) {
return ts.forEach(item.children, function (child) {
var childKind = navigationBarNodeKind(child);
- return childKind !== 219 /* VariableDeclaration */ && childKind !== 170 /* BindingElement */;
+ return childKind !== 222 /* VariableDeclaration */ && childKind !== 173 /* BindingElement */;
});
}
}
@@ -68770,7 +70806,7 @@ var ts;
// Otherwise, we need to aggregate each identifier to build up the qualified name.
var result = [];
result.push(moduleDeclaration.name.text);
- while (moduleDeclaration.body && moduleDeclaration.body.kind === 226 /* ModuleDeclaration */) {
+ while (moduleDeclaration.body && moduleDeclaration.body.kind === 229 /* ModuleDeclaration */) {
moduleDeclaration = moduleDeclaration.body;
result.push(moduleDeclaration.name.text);
}
@@ -68781,13 +70817,13 @@ var ts;
* We store 'A' as associated with a NavNode, and use getModuleName to traverse down again.
*/
function getInteriorModule(decl) {
- return decl.body.kind === 226 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl;
+ return decl.body.kind === 229 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl;
}
function isComputedProperty(member) {
- return !member.name || member.name.kind === 141 /* ComputedPropertyName */;
+ return !member.name || member.name.kind === 142 /* ComputedPropertyName */;
}
function getNodeSpan(node) {
- return node.kind === 256 /* SourceFile */
+ return node.kind === 260 /* SourceFile */
? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd())
: ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd());
}
@@ -68795,14 +70831,14 @@ var ts;
if (node.name && ts.getFullWidth(node.name) > 0) {
return ts.declarationNameToString(node.name);
}
- else if (node.parent.kind === 219 /* VariableDeclaration */) {
+ else if (node.parent.kind === 222 /* VariableDeclaration */) {
return ts.declarationNameToString(node.parent.name);
}
- else if (node.parent.kind === 188 /* BinaryExpression */ &&
+ else if (node.parent.kind === 191 /* BinaryExpression */ &&
node.parent.operatorToken.kind === 57 /* EqualsToken */) {
return nodeText(node.parent.left).replace(whiteSpaceRegex, "");
}
- else if (node.parent.kind === 253 /* PropertyAssignment */ && node.parent.name) {
+ else if (node.parent.kind === 256 /* PropertyAssignment */ && node.parent.name) {
return nodeText(node.parent.name);
}
else if (ts.getModifierFlags(node) & 512 /* Default */) {
@@ -68813,7 +70849,7 @@ var ts;
}
}
function isFunctionOrClassExpression(node) {
- return node.kind === 180 /* FunctionExpression */ || node.kind === 181 /* ArrowFunction */ || node.kind === 193 /* ClassExpression */;
+ return node.kind === 183 /* FunctionExpression */ || node.kind === 184 /* ArrowFunction */ || node.kind === 196 /* ClassExpression */;
}
/**
* Matches all whitespace characters in a string. Eg:
@@ -68903,7 +70939,7 @@ var ts;
}
}
function autoCollapse(node) {
- return ts.isFunctionBlock(node) && node.parent.kind !== 181 /* ArrowFunction */;
+ return ts.isFunctionBlock(node) && node.parent.kind !== 184 /* ArrowFunction */;
}
var depth = 0;
var maxDepth = 20;
@@ -68915,30 +70951,30 @@ var ts;
addOutliningForLeadingCommentsForNode(n);
}
switch (n.kind) {
- case 200 /* Block */:
+ case 203 /* Block */:
if (!ts.isFunctionBlock(n)) {
- var parent_22 = n.parent;
+ var parent_21 = n.parent;
var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile);
var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile);
// Check if the block is standalone, or 'attached' to some parent statement.
// If the latter, we want to collapse the block, but consider its hint span
// to be the entire span of the parent.
- if (parent_22.kind === 205 /* DoStatement */ ||
- parent_22.kind === 208 /* ForInStatement */ ||
- parent_22.kind === 209 /* ForOfStatement */ ||
- parent_22.kind === 207 /* ForStatement */ ||
- parent_22.kind === 204 /* IfStatement */ ||
- parent_22.kind === 206 /* WhileStatement */ ||
- parent_22.kind === 213 /* WithStatement */ ||
- parent_22.kind === 252 /* CatchClause */) {
- addOutliningSpan(parent_22, openBrace, closeBrace, autoCollapse(n));
+ if (parent_21.kind === 208 /* DoStatement */ ||
+ parent_21.kind === 211 /* ForInStatement */ ||
+ parent_21.kind === 212 /* ForOfStatement */ ||
+ parent_21.kind === 210 /* ForStatement */ ||
+ parent_21.kind === 207 /* IfStatement */ ||
+ parent_21.kind === 209 /* WhileStatement */ ||
+ parent_21.kind === 216 /* WithStatement */ ||
+ parent_21.kind === 255 /* CatchClause */) {
+ addOutliningSpan(parent_21, openBrace, closeBrace, autoCollapse(n));
break;
}
- if (parent_22.kind === 217 /* TryStatement */) {
+ if (parent_21.kind === 220 /* TryStatement */) {
// Could be the try-block, or the finally-block.
- var tryStatement = parent_22;
+ var tryStatement = parent_21;
if (tryStatement.tryBlock === n) {
- addOutliningSpan(parent_22, openBrace, closeBrace, autoCollapse(n));
+ addOutliningSpan(parent_21, openBrace, closeBrace, autoCollapse(n));
break;
}
else if (tryStatement.finallyBlock === n) {
@@ -68961,23 +70997,23 @@ var ts;
break;
}
// Fallthrough.
- case 227 /* ModuleBlock */: {
+ case 230 /* ModuleBlock */: {
var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile);
var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile);
addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n));
break;
}
- case 222 /* ClassDeclaration */:
- case 223 /* InterfaceDeclaration */:
- case 225 /* EnumDeclaration */:
- case 172 /* ObjectLiteralExpression */:
- case 228 /* CaseBlock */: {
+ case 225 /* ClassDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 175 /* ObjectLiteralExpression */:
+ case 231 /* CaseBlock */: {
var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile);
var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile);
addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n));
break;
}
- case 171 /* ArrayLiteralExpression */:
+ case 174 /* ArrayLiteralExpression */:
var openBracket = ts.findChildOfKind(n, 20 /* OpenBracketToken */, sourceFile);
var closeBracket = ts.findChildOfKind(n, 21 /* CloseBracketToken */, sourceFile);
addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n));
@@ -68997,13 +71033,13 @@ var ts;
var ts;
(function (ts) {
// Note(cyrusn): this enum is ordered from strongest match type to weakest match type.
+ var PatternMatchKind;
(function (PatternMatchKind) {
PatternMatchKind[PatternMatchKind["exact"] = 0] = "exact";
PatternMatchKind[PatternMatchKind["prefix"] = 1] = "prefix";
PatternMatchKind[PatternMatchKind["substring"] = 2] = "substring";
PatternMatchKind[PatternMatchKind["camelCase"] = 3] = "camelCase";
- })(ts.PatternMatchKind || (ts.PatternMatchKind = {}));
- var PatternMatchKind = ts.PatternMatchKind;
+ })(PatternMatchKind = ts.PatternMatchKind || (ts.PatternMatchKind = {}));
function createPatternMatch(kind, punctuationStripped, isCaseSensitive, camelCaseWeight) {
return {
kind: kind,
@@ -69334,7 +71370,7 @@ var ts;
if (ch >= 65 /* A */ && ch <= 90 /* Z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 4 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 5 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -69347,7 +71383,7 @@ var ts;
if (ch >= 97 /* a */ && ch <= 122 /* z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 4 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 5 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -69625,7 +71661,7 @@ var ts;
if (token === 123 /* DeclareKeyword */) {
// declare module "mod"
token = nextToken();
- if (token === 126 /* ModuleKeyword */) {
+ if (token === 127 /* ModuleKeyword */) {
token = nextToken();
if (token === 9 /* StringLiteral */) {
recordAmbientExternalModule();
@@ -69650,7 +71686,7 @@ var ts;
else {
if (token === 70 /* Identifier */ || ts.isKeyword(token)) {
token = nextToken();
- if (token === 137 /* FromKeyword */) {
+ if (token === 138 /* FromKeyword */) {
token = nextToken();
if (token === 9 /* StringLiteral */) {
// import d from "mod";
@@ -69681,7 +71717,7 @@ var ts;
}
if (token === 17 /* CloseBraceToken */) {
token = nextToken();
- if (token === 137 /* FromKeyword */) {
+ if (token === 138 /* FromKeyword */) {
token = nextToken();
if (token === 9 /* StringLiteral */) {
// import {a as A} from "mod";
@@ -69697,7 +71733,7 @@ var ts;
token = nextToken();
if (token === 70 /* Identifier */ || ts.isKeyword(token)) {
token = nextToken();
- if (token === 137 /* FromKeyword */) {
+ if (token === 138 /* FromKeyword */) {
token = nextToken();
if (token === 9 /* StringLiteral */) {
// import * as NS from "mod"
@@ -69727,7 +71763,7 @@ var ts;
}
if (token === 17 /* CloseBraceToken */) {
token = nextToken();
- if (token === 137 /* FromKeyword */) {
+ if (token === 138 /* FromKeyword */) {
token = nextToken();
if (token === 9 /* StringLiteral */) {
// export {a as A} from "mod";
@@ -69739,7 +71775,7 @@ var ts;
}
else if (token === 38 /* AsteriskToken */) {
token = nextToken();
- if (token === 137 /* FromKeyword */) {
+ if (token === 138 /* FromKeyword */) {
token = nextToken();
if (token === 9 /* StringLiteral */) {
// export * from "mod"
@@ -69764,7 +71800,7 @@ var ts;
}
function tryConsumeRequireCall(skipCurrentToken) {
var token = skipCurrentToken ? nextToken() : ts.scanner.getToken();
- if (token === 130 /* RequireKeyword */) {
+ if (token === 131 /* RequireKeyword */) {
token = nextToken();
if (token === 18 /* OpenParenToken */) {
token = nextToken();
@@ -70119,12 +72155,12 @@ var ts;
// return null;
// }
var emptyArray = [];
+ var ArgumentListKind;
(function (ArgumentListKind) {
ArgumentListKind[ArgumentListKind["TypeArguments"] = 0] = "TypeArguments";
ArgumentListKind[ArgumentListKind["CallArguments"] = 1] = "CallArguments";
ArgumentListKind[ArgumentListKind["TaggedTemplateArguments"] = 2] = "TaggedTemplateArguments";
- })(SignatureHelp.ArgumentListKind || (SignatureHelp.ArgumentListKind = {}));
- var ArgumentListKind = SignatureHelp.ArgumentListKind;
+ })(ArgumentListKind = SignatureHelp.ArgumentListKind || (SignatureHelp.ArgumentListKind = {}));
function getSignatureHelpItems(program, sourceFile, position, cancellationToken) {
var typeChecker = program.getTypeChecker();
// Decide whether to show signature help
@@ -70155,7 +72191,7 @@ var ts;
}
SignatureHelp.getSignatureHelpItems = getSignatureHelpItems;
function createJavaScriptSignatureHelpItems(argumentInfo, program) {
- if (argumentInfo.invocation.kind !== 175 /* CallExpression */) {
+ if (argumentInfo.invocation.kind !== 178 /* CallExpression */) {
return undefined;
}
// See if we can find some symbol with the call expression name that has call signatures.
@@ -70163,7 +72199,7 @@ var ts;
var expression = callExpression.expression;
var name = expression.kind === 70 /* Identifier */
? expression
- : expression.kind === 173 /* PropertyAccessExpression */
+ : expression.kind === 176 /* PropertyAccessExpression */
? expression.name
: undefined;
if (!name || !name.text) {
@@ -70196,7 +72232,7 @@ var ts;
* in the argument of an invocation; returns undefined otherwise.
*/
function getImmediatelyContainingArgumentInfo(node, position, sourceFile) {
- if (node.parent.kind === 175 /* CallExpression */ || node.parent.kind === 176 /* NewExpression */) {
+ if (node.parent.kind === 178 /* CallExpression */ || node.parent.kind === 179 /* NewExpression */) {
var callExpression = node.parent;
// There are 3 cases to handle:
// 1. The token introduces a list, and should begin a sig help session
@@ -70250,25 +72286,25 @@ var ts;
}
return undefined;
}
- else if (node.kind === 12 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 177 /* TaggedTemplateExpression */) {
+ else if (node.kind === 12 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 180 /* TaggedTemplateExpression */) {
// Check if we're actually inside the template;
// otherwise we'll fall out and return undefined.
if (ts.isInsideTemplateLiteral(node, position)) {
return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0, sourceFile);
}
}
- else if (node.kind === 13 /* TemplateHead */ && node.parent.parent.kind === 177 /* TaggedTemplateExpression */) {
+ else if (node.kind === 13 /* TemplateHead */ && node.parent.parent.kind === 180 /* TaggedTemplateExpression */) {
var templateExpression = node.parent;
var tagExpression = templateExpression.parent;
- ts.Debug.assert(templateExpression.kind === 190 /* TemplateExpression */);
+ ts.Debug.assert(templateExpression.kind === 193 /* TemplateExpression */);
var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1;
return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile);
}
- else if (node.parent.kind === 198 /* TemplateSpan */ && node.parent.parent.parent.kind === 177 /* TaggedTemplateExpression */) {
+ else if (node.parent.kind === 201 /* TemplateSpan */ && node.parent.parent.parent.kind === 180 /* TaggedTemplateExpression */) {
var templateSpan = node.parent;
var templateExpression = templateSpan.parent;
var tagExpression = templateExpression.parent;
- ts.Debug.assert(templateExpression.kind === 190 /* TemplateExpression */);
+ ts.Debug.assert(templateExpression.kind === 193 /* TemplateExpression */);
// If we're just after a template tail, don't show signature help.
if (node.kind === 15 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) {
return undefined;
@@ -70386,7 +72422,7 @@ var ts;
//
// This is because a Missing node has no width. However, what we actually want is to include trivia
// leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail.
- if (template.kind === 190 /* TemplateExpression */) {
+ if (template.kind === 193 /* TemplateExpression */) {
var lastSpan = ts.lastOrUndefined(template.templateSpans);
if (lastSpan.literal.getFullWidth() === 0) {
applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false);
@@ -70395,7 +72431,7 @@ var ts;
return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
}
function getContainingArgumentInfo(node, position, sourceFile) {
- for (var n = node; n.kind !== 256 /* SourceFile */; n = n.parent) {
+ for (var n = node; n.kind !== 260 /* SourceFile */; n = n.parent) {
if (ts.isFunctionBlock(n)) {
return undefined;
}
@@ -70455,7 +72491,9 @@ var ts;
if (callTargetDisplayParts) {
ts.addRange(prefixDisplayParts, callTargetDisplayParts);
}
+ var isVariadic;
if (isTypeParameterList) {
+ isVariadic = false; // type parameter lists are not variadic
prefixDisplayParts.push(ts.punctuationPart(26 /* LessThanToken */));
var typeParameters = candidateSignature.typeParameters;
signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray;
@@ -70466,6 +72504,7 @@ var ts;
ts.addRange(suffixDisplayParts, parameterParts);
}
else {
+ isVariadic = candidateSignature.hasRestParameter;
var typeParameterParts = ts.mapToDisplayParts(function (writer) {
return typeChecker.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation);
});
@@ -70480,7 +72519,7 @@ var ts;
});
ts.addRange(suffixDisplayParts, returnTypeParts);
return {
- isVariadic: candidateSignature.hasRestParameter,
+ isVariadic: isVariadic,
prefixDisplayParts: prefixDisplayParts,
suffixDisplayParts: suffixDisplayParts,
separatorDisplayParts: [ts.punctuationPart(25 /* CommaToken */), ts.spacePart()],
@@ -70537,7 +72576,7 @@ var ts;
function getSymbolKind(typeChecker, symbol, location) {
var flags = symbol.getFlags();
if (flags & 32 /* Class */)
- return ts.getDeclarationOfKind(symbol, 193 /* ClassExpression */) ?
+ return ts.getDeclarationOfKind(symbol, 196 /* ClassExpression */) ?
ts.ScriptElementKind.localClassElement : ts.ScriptElementKind.classElement;
if (flags & 384 /* Enum */)
return ts.ScriptElementKind.enumElement;
@@ -70643,7 +72682,7 @@ var ts;
var signature = void 0;
type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
if (type) {
- if (location.parent && location.parent.kind === 173 /* PropertyAccessExpression */) {
+ if (location.parent && location.parent.kind === 176 /* PropertyAccessExpression */) {
var right = location.parent.name;
// Either the location is on the right of a property access, or on the left and the right is missing
if (right === location || (right && right.getFullWidth() === 0)) {
@@ -70652,7 +72691,7 @@ var ts;
}
// try get the call/construct signature from the type if it matches
var callExpression = void 0;
- if (location.kind === 175 /* CallExpression */ || location.kind === 176 /* NewExpression */) {
+ if (location.kind === 178 /* CallExpression */ || location.kind === 179 /* NewExpression */) {
callExpression = location;
}
else if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location)) {
@@ -70665,7 +72704,7 @@ var ts;
// Use the first candidate:
signature = candidateSignatures[0];
}
- var useConstructSignatures = callExpression.kind === 176 /* NewExpression */ || callExpression.expression.kind === 96 /* SuperKeyword */;
+ var useConstructSignatures = callExpression.kind === 179 /* NewExpression */ || callExpression.expression.kind === 96 /* SuperKeyword */;
var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();
if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) {
// Get the first signature if there is one -- allSignatures may contain
@@ -70718,24 +72757,24 @@ var ts;
}
}
else if ((ts.isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) ||
- (location.kind === 122 /* ConstructorKeyword */ && location.parent.kind === 149 /* Constructor */)) {
+ (location.kind === 122 /* ConstructorKeyword */ && location.parent.kind === 150 /* Constructor */)) {
// get the signature from the declaration and write it
var functionDeclaration = location.parent;
- var allSignatures = functionDeclaration.kind === 149 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();
+ var allSignatures = functionDeclaration.kind === 150 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();
if (!typeChecker.isImplementationOfOverload(functionDeclaration)) {
signature = typeChecker.getSignatureFromDeclaration(functionDeclaration);
}
else {
signature = allSignatures[0];
}
- if (functionDeclaration.kind === 149 /* Constructor */) {
+ if (functionDeclaration.kind === 150 /* Constructor */) {
// show (constructor) Type(...) signature
symbolKind = ts.ScriptElementKind.constructorImplementationElement;
addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);
}
else {
// (function/method) symbol(..signature)
- addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 152 /* CallSignature */ &&
+ addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 153 /* CallSignature */ &&
!(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind);
}
addSignatureDisplayParts(signature, allSignatures);
@@ -70744,7 +72783,7 @@ var ts;
}
}
if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) {
- if (ts.getDeclarationOfKind(symbol, 193 /* ClassExpression */)) {
+ if (ts.getDeclarationOfKind(symbol, 196 /* ClassExpression */)) {
// Special case for class expressions because we would like to indicate that
// the class name is local to the class body (similar to function expression)
// (local class) class
@@ -70767,7 +72806,7 @@ var ts;
}
if (symbolFlags & 524288 /* TypeAlias */) {
addNewLineIfDisplayPartsExist();
- displayParts.push(ts.keywordPart(135 /* TypeKeyword */));
+ displayParts.push(ts.keywordPart(136 /* TypeKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
writeTypeParametersOfSymbol(symbol, sourceFile);
@@ -70788,9 +72827,9 @@ var ts;
}
if (symbolFlags & 1536 /* Module */) {
addNewLineIfDisplayPartsExist();
- var declaration = ts.getDeclarationOfKind(symbol, 226 /* ModuleDeclaration */);
+ var declaration = ts.getDeclarationOfKind(symbol, 229 /* ModuleDeclaration */);
var isNamespace = declaration && declaration.name && declaration.name.kind === 70 /* Identifier */;
- displayParts.push(ts.keywordPart(isNamespace ? 127 /* NamespaceKeyword */ : 126 /* ModuleKeyword */));
+ displayParts.push(ts.keywordPart(isNamespace ? 128 /* NamespaceKeyword */ : 127 /* ModuleKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
}
@@ -70811,17 +72850,17 @@ var ts;
}
else {
// Method/function type parameter
- var declaration = ts.getDeclarationOfKind(symbol, 142 /* TypeParameter */);
+ var declaration = ts.getDeclarationOfKind(symbol, 143 /* TypeParameter */);
ts.Debug.assert(declaration !== undefined);
declaration = declaration.parent;
if (declaration) {
if (ts.isFunctionLikeKind(declaration.kind)) {
var signature = typeChecker.getSignatureFromDeclaration(declaration);
- if (declaration.kind === 153 /* ConstructSignature */) {
+ if (declaration.kind === 154 /* ConstructSignature */) {
displayParts.push(ts.keywordPart(93 /* NewKeyword */));
displayParts.push(ts.spacePart());
}
- else if (declaration.kind !== 152 /* CallSignature */ && declaration.name) {
+ else if (declaration.kind !== 153 /* CallSignature */ && declaration.name) {
addFullSymbolName(declaration.symbol);
}
ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */));
@@ -70830,7 +72869,7 @@ var ts;
// Type alias type parameter
// For example
// type list = T[]; // Both T will go through same code path
- displayParts.push(ts.keywordPart(135 /* TypeKeyword */));
+ displayParts.push(ts.keywordPart(136 /* TypeKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(declaration.symbol);
writeTypeParametersOfSymbol(declaration.symbol, sourceFile);
@@ -70841,7 +72880,7 @@ var ts;
if (symbolFlags & 8 /* EnumMember */) {
addPrefixForAnyFunctionOrVar(symbol, "enum member");
var declaration = symbol.declarations[0];
- if (declaration.kind === 255 /* EnumMember */) {
+ if (declaration.kind === 259 /* EnumMember */) {
var constantValue = typeChecker.getConstantValue(declaration);
if (constantValue !== undefined) {
displayParts.push(ts.spacePart());
@@ -70853,10 +72892,10 @@ var ts;
}
if (symbolFlags & 8388608 /* Alias */) {
addNewLineIfDisplayPartsExist();
- if (symbol.declarations[0].kind === 229 /* NamespaceExportDeclaration */) {
+ if (symbol.declarations[0].kind === 232 /* NamespaceExportDeclaration */) {
displayParts.push(ts.keywordPart(83 /* ExportKeyword */));
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(127 /* NamespaceKeyword */));
+ displayParts.push(ts.keywordPart(128 /* NamespaceKeyword */));
}
else {
displayParts.push(ts.keywordPart(90 /* ImportKeyword */));
@@ -70864,13 +72903,13 @@ var ts;
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
ts.forEach(symbol.declarations, function (declaration) {
- if (declaration.kind === 230 /* ImportEqualsDeclaration */) {
+ if (declaration.kind === 233 /* ImportEqualsDeclaration */) {
var importEqualsDeclaration = declaration;
if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) {
displayParts.push(ts.spacePart());
displayParts.push(ts.operatorPart(57 /* EqualsToken */));
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(130 /* RequireKeyword */));
+ displayParts.push(ts.keywordPart(131 /* RequireKeyword */));
displayParts.push(ts.punctuationPart(18 /* OpenParenToken */));
displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral));
displayParts.push(ts.punctuationPart(19 /* CloseParenToken */));
@@ -70937,10 +72976,10 @@ var ts;
// For some special property access expressions like `experts.foo = foo` or `module.exports.foo = foo`
// there documentation comments might be attached to the right hand side symbol of their declarations.
// The pattern of such special property access is that the parent symbol is the symbol of the file.
- if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 256 /* SourceFile */; })) {
+ if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 260 /* SourceFile */; })) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (!declaration.parent || declaration.parent.kind !== 188 /* BinaryExpression */) {
+ if (!declaration.parent || declaration.parent.kind !== 191 /* BinaryExpression */) {
continue;
}
var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right);
@@ -71016,16 +73055,16 @@ var ts;
}
return ts.forEach(symbol.declarations, function (declaration) {
// Function expressions are local
- if (declaration.kind === 180 /* FunctionExpression */) {
+ if (declaration.kind === 183 /* FunctionExpression */) {
return true;
}
- if (declaration.kind !== 219 /* VariableDeclaration */ && declaration.kind !== 221 /* FunctionDeclaration */) {
+ if (declaration.kind !== 222 /* VariableDeclaration */ && declaration.kind !== 224 /* FunctionDeclaration */) {
return false;
}
// If the parent is not sourceFile or module block it is local variable
- for (var parent_23 = declaration.parent; !ts.isFunctionBlock(parent_23); parent_23 = parent_23.parent) {
+ for (var parent_22 = declaration.parent; !ts.isFunctionBlock(parent_22); parent_22 = parent_22.parent) {
// Reached source file or module block
- if (parent_23.kind === 256 /* SourceFile */ || parent_23.kind === 227 /* ModuleBlock */) {
+ if (parent_22.kind === 260 /* SourceFile */ || parent_22.kind === 230 /* ModuleBlock */) {
return false;
}
}
@@ -71136,7 +73175,7 @@ var ts;
return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; });
});
options = ts.clone(options);
- var _loop_3 = function (opt) {
+ var _loop_4 = function (opt) {
if (!ts.hasProperty(options, opt.name)) {
return "continue";
}
@@ -71155,7 +73194,7 @@ var ts;
};
for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {
var opt = commandLineOptionsStringToEnum_1[_i];
- _loop_3(opt);
+ _loop_4(opt);
}
return options;
}
@@ -71167,8 +73206,8 @@ var ts;
(function (ts) {
var formatting;
(function (formatting) {
- var standardScanner = ts.createScanner(4 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
- var jsxScanner = ts.createScanner(4 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
+ var standardScanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
+ var jsxScanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
/**
* Scanner that is currently used for formatting
*/
@@ -71263,10 +73302,10 @@ var ts;
function shouldRescanJsxIdentifier(node) {
if (node.parent) {
switch (node.parent.kind) {
- case 246 /* JsxAttribute */:
- case 244 /* JsxOpeningElement */:
- case 245 /* JsxClosingElement */:
- case 243 /* JsxSelfClosingElement */:
+ case 249 /* JsxAttribute */:
+ case 247 /* JsxOpeningElement */:
+ case 248 /* JsxClosingElement */:
+ case 246 /* JsxSelfClosingElement */:
return node.kind === 70 /* Identifier */;
}
}
@@ -71501,14 +73540,14 @@ var ts;
(function (ts) {
var formatting;
(function (formatting) {
+ var FormattingRequestKind;
(function (FormattingRequestKind) {
FormattingRequestKind[FormattingRequestKind["FormatDocument"] = 0] = "FormatDocument";
FormattingRequestKind[FormattingRequestKind["FormatSelection"] = 1] = "FormatSelection";
FormattingRequestKind[FormattingRequestKind["FormatOnEnter"] = 2] = "FormatOnEnter";
FormattingRequestKind[FormattingRequestKind["FormatOnSemicolon"] = 3] = "FormatOnSemicolon";
FormattingRequestKind[FormattingRequestKind["FormatOnClosingCurlyBrace"] = 4] = "FormatOnClosingCurlyBrace";
- })(formatting.FormattingRequestKind || (formatting.FormattingRequestKind = {}));
- var FormattingRequestKind = formatting.FormattingRequestKind;
+ })(FormattingRequestKind = formatting.FormattingRequestKind || (formatting.FormattingRequestKind = {}));
})(formatting = ts.formatting || (ts.formatting = {}));
})(ts || (ts = {}));
///
@@ -71540,13 +73579,13 @@ var ts;
(function (ts) {
var formatting;
(function (formatting) {
+ var RuleAction;
(function (RuleAction) {
RuleAction[RuleAction["Ignore"] = 1] = "Ignore";
RuleAction[RuleAction["Space"] = 2] = "Space";
RuleAction[RuleAction["NewLine"] = 4] = "NewLine";
RuleAction[RuleAction["Delete"] = 8] = "Delete";
- })(formatting.RuleAction || (formatting.RuleAction = {}));
- var RuleAction = formatting.RuleAction;
+ })(RuleAction = formatting.RuleAction || (formatting.RuleAction = {}));
})(formatting = ts.formatting || (ts.formatting = {}));
})(ts || (ts = {}));
///
@@ -71587,11 +73626,11 @@ var ts;
(function (ts) {
var formatting;
(function (formatting) {
+ var RuleFlags;
(function (RuleFlags) {
RuleFlags[RuleFlags["None"] = 0] = "None";
RuleFlags[RuleFlags["CanDeleteNewLines"] = 1] = "CanDeleteNewLines";
- })(formatting.RuleFlags || (formatting.RuleFlags = {}));
- var RuleFlags = formatting.RuleFlags;
+ })(RuleFlags = formatting.RuleFlags || (formatting.RuleFlags = {}));
})(formatting = ts.formatting || (ts.formatting = {}));
})(ts || (ts = {}));
///
@@ -71742,7 +73781,7 @@ var ts;
this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([101 /* TryKeyword */, 86 /* FinallyKeyword */]), 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));
// get x() {}
// set x(val) {}
- this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124 /* GetKeyword */, 132 /* SetKeyword */]), 70 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */));
+ this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124 /* GetKeyword */, 133 /* SetKeyword */]), 70 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */));
// Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options.
this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */));
this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */));
@@ -71750,10 +73789,10 @@ var ts;
// Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses
this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122 /* ConstructorKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));
// Use of module as a function call. e.g.: import m2 = module("m2");
- this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([126 /* ModuleKeyword */, 130 /* RequireKeyword */]), 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));
+ this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([127 /* ModuleKeyword */, 131 /* RequireKeyword */]), 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));
// Add a space around certain TypeScript keywords
- this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 126 /* ModuleKeyword */, 127 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 132 /* SetKeyword */, 114 /* StaticKeyword */, 135 /* TypeKeyword */, 137 /* FromKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));
- this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84 /* ExtendsKeyword */, 107 /* ImplementsKeyword */, 137 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));
+ this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 127 /* ModuleKeyword */, 128 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 133 /* SetKeyword */, 114 /* StaticKeyword */, 136 /* TypeKeyword */, 138 /* FromKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));
+ this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84 /* ExtendsKeyword */, 107 /* ImplementsKeyword */, 138 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));
// Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {
this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */));
// Lambda expressions
@@ -71773,7 +73812,7 @@ var ts;
// decorators
this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 56 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */));
this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(56 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */));
- this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 70 /* Identifier */, 83 /* ExportKeyword */, 78 /* DefaultKeyword */, 74 /* ClassKeyword */, 114 /* StaticKeyword */, 113 /* PublicKeyword */, 111 /* PrivateKeyword */, 112 /* ProtectedKeyword */, 124 /* GetKeyword */, 132 /* SetKeyword */, 20 /* OpenBracketToken */, 38 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */));
+ this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 70 /* Identifier */, 83 /* ExportKeyword */, 78 /* DefaultKeyword */, 74 /* ClassKeyword */, 114 /* StaticKeyword */, 113 /* PublicKeyword */, 111 /* PrivateKeyword */, 112 /* ProtectedKeyword */, 124 /* GetKeyword */, 133 /* SetKeyword */, 20 /* OpenBracketToken */, 38 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */));
this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(88 /* FunctionKeyword */, 38 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */));
this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(38 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */));
this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(115 /* YieldKeyword */, 38 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */));
@@ -71901,9 +73940,9 @@ var ts;
}
Rules.prototype.getRuleName = function (rule) {
var o = this;
- for (var name_51 in o) {
- if (o[name_51] === rule) {
- return name_51;
+ for (var name_47 in o) {
+ if (o[name_47] === rule) {
+ return name_47;
}
}
throw new Error("Unknown rule");
@@ -71912,42 +73951,42 @@ var ts;
/// Contexts
///
Rules.IsForContext = function (context) {
- return context.contextNode.kind === 207 /* ForStatement */;
+ return context.contextNode.kind === 210 /* ForStatement */;
};
Rules.IsNotForContext = function (context) {
return !Rules.IsForContext(context);
};
Rules.IsBinaryOpContext = function (context) {
switch (context.contextNode.kind) {
- case 188 /* BinaryExpression */:
- case 189 /* ConditionalExpression */:
- case 196 /* AsExpression */:
- case 239 /* ExportSpecifier */:
- case 235 /* ImportSpecifier */:
- case 155 /* TypePredicate */:
- case 163 /* UnionType */:
- case 164 /* IntersectionType */:
+ case 191 /* BinaryExpression */:
+ case 192 /* ConditionalExpression */:
+ case 199 /* AsExpression */:
+ case 242 /* ExportSpecifier */:
+ case 238 /* ImportSpecifier */:
+ case 156 /* TypePredicate */:
+ case 164 /* UnionType */:
+ case 165 /* IntersectionType */:
return true;
// equals in binding elements: function foo([[x, y] = [1, 2]])
- case 170 /* BindingElement */:
+ case 173 /* BindingElement */:
// equals in type X = ...
- case 224 /* TypeAliasDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
// equal in import a = module('a');
- case 230 /* ImportEqualsDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
// equal in let a = 0;
- case 219 /* VariableDeclaration */:
+ case 222 /* VariableDeclaration */:
// equal in p = 0;
- case 143 /* Parameter */:
- case 255 /* EnumMember */:
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
+ case 144 /* Parameter */:
+ case 259 /* EnumMember */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
return context.currentTokenSpan.kind === 57 /* EqualsToken */ || context.nextTokenSpan.kind === 57 /* EqualsToken */;
// "in" keyword in for (let x in []) { }
- case 208 /* ForInStatement */:
+ case 211 /* ForInStatement */:
return context.currentTokenSpan.kind === 91 /* InKeyword */ || context.nextTokenSpan.kind === 91 /* InKeyword */;
// Technically, "of" is not a binary operator, but format it the same way as "in"
- case 209 /* ForOfStatement */:
- return context.currentTokenSpan.kind === 139 /* OfKeyword */ || context.nextTokenSpan.kind === 139 /* OfKeyword */;
+ case 212 /* ForOfStatement */:
+ return context.currentTokenSpan.kind === 140 /* OfKeyword */ || context.nextTokenSpan.kind === 140 /* OfKeyword */;
}
return false;
};
@@ -71955,7 +73994,7 @@ var ts;
return !Rules.IsBinaryOpContext(context);
};
Rules.IsConditionalOperatorContext = function (context) {
- return context.contextNode.kind === 189 /* ConditionalExpression */;
+ return context.contextNode.kind === 192 /* ConditionalExpression */;
};
Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) {
//// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction.
@@ -71999,97 +74038,97 @@ var ts;
return true;
}
switch (node.kind) {
- case 200 /* Block */:
- case 228 /* CaseBlock */:
- case 172 /* ObjectLiteralExpression */:
- case 227 /* ModuleBlock */:
+ case 203 /* Block */:
+ case 231 /* CaseBlock */:
+ case 175 /* ObjectLiteralExpression */:
+ case 230 /* ModuleBlock */:
return true;
}
return false;
};
Rules.IsFunctionDeclContext = function (context) {
switch (context.contextNode.kind) {
- case 221 /* FunctionDeclaration */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 224 /* FunctionDeclaration */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
// case SyntaxKind.MemberFunctionDeclaration:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
// case SyntaxKind.MethodSignature:
- case 152 /* CallSignature */:
- case 180 /* FunctionExpression */:
- case 149 /* Constructor */:
- case 181 /* ArrowFunction */:
+ case 153 /* CallSignature */:
+ case 183 /* FunctionExpression */:
+ case 150 /* Constructor */:
+ case 184 /* ArrowFunction */:
// case SyntaxKind.ConstructorDeclaration:
// case SyntaxKind.SimpleArrowFunctionExpression:
// case SyntaxKind.ParenthesizedArrowFunctionExpression:
- case 223 /* InterfaceDeclaration */:
+ case 226 /* InterfaceDeclaration */:
return true;
}
return false;
};
Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) {
- return context.contextNode.kind === 221 /* FunctionDeclaration */ || context.contextNode.kind === 180 /* FunctionExpression */;
+ return context.contextNode.kind === 224 /* FunctionDeclaration */ || context.contextNode.kind === 183 /* FunctionExpression */;
};
Rules.IsTypeScriptDeclWithBlockContext = function (context) {
return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode);
};
Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) {
switch (node.kind) {
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 223 /* InterfaceDeclaration */:
- case 225 /* EnumDeclaration */:
- case 160 /* TypeLiteral */:
- case 226 /* ModuleDeclaration */:
- case 237 /* ExportDeclaration */:
- case 238 /* NamedExports */:
- case 231 /* ImportDeclaration */:
- case 234 /* NamedImports */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 226 /* InterfaceDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 161 /* TypeLiteral */:
+ case 229 /* ModuleDeclaration */:
+ case 240 /* ExportDeclaration */:
+ case 241 /* NamedExports */:
+ case 234 /* ImportDeclaration */:
+ case 237 /* NamedImports */:
return true;
}
return false;
};
Rules.IsAfterCodeBlockContext = function (context) {
switch (context.currentTokenParent.kind) {
- case 222 /* ClassDeclaration */:
- case 226 /* ModuleDeclaration */:
- case 225 /* EnumDeclaration */:
- case 200 /* Block */:
- case 252 /* CatchClause */:
- case 227 /* ModuleBlock */:
- case 214 /* SwitchStatement */:
+ case 225 /* ClassDeclaration */:
+ case 229 /* ModuleDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 203 /* Block */:
+ case 255 /* CatchClause */:
+ case 230 /* ModuleBlock */:
+ case 217 /* SwitchStatement */:
return true;
}
return false;
};
Rules.IsControlDeclContext = function (context) {
switch (context.contextNode.kind) {
- case 204 /* IfStatement */:
- case 214 /* SwitchStatement */:
- case 207 /* ForStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
- case 206 /* WhileStatement */:
- case 217 /* TryStatement */:
- case 205 /* DoStatement */:
- case 213 /* WithStatement */:
+ case 207 /* IfStatement */:
+ case 217 /* SwitchStatement */:
+ case 210 /* ForStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
+ case 209 /* WhileStatement */:
+ case 220 /* TryStatement */:
+ case 208 /* DoStatement */:
+ case 216 /* WithStatement */:
// TODO
// case SyntaxKind.ElseClause:
- case 252 /* CatchClause */:
+ case 255 /* CatchClause */:
return true;
default:
return false;
}
};
Rules.IsObjectContext = function (context) {
- return context.contextNode.kind === 172 /* ObjectLiteralExpression */;
+ return context.contextNode.kind === 175 /* ObjectLiteralExpression */;
};
Rules.IsFunctionCallContext = function (context) {
- return context.contextNode.kind === 175 /* CallExpression */;
+ return context.contextNode.kind === 178 /* CallExpression */;
};
Rules.IsNewContext = function (context) {
- return context.contextNode.kind === 176 /* NewExpression */;
+ return context.contextNode.kind === 179 /* NewExpression */;
};
Rules.IsFunctionCallOrNewContext = function (context) {
return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context);
@@ -72101,25 +74140,25 @@ var ts;
return context.nextTokenSpan.kind !== 21 /* CloseBracketToken */;
};
Rules.IsArrowFunctionContext = function (context) {
- return context.contextNode.kind === 181 /* ArrowFunction */;
+ return context.contextNode.kind === 184 /* ArrowFunction */;
};
Rules.IsNonJsxSameLineTokenContext = function (context) {
return context.TokensAreOnSameLine() && context.contextNode.kind !== 10 /* JsxText */;
};
Rules.IsNonJsxElementContext = function (context) {
- return context.contextNode.kind !== 242 /* JsxElement */;
+ return context.contextNode.kind !== 245 /* JsxElement */;
};
Rules.IsJsxExpressionContext = function (context) {
- return context.contextNode.kind === 248 /* JsxExpression */;
+ return context.contextNode.kind === 251 /* JsxExpression */;
};
Rules.IsNextTokenParentJsxAttribute = function (context) {
- return context.nextTokenParent.kind === 246 /* JsxAttribute */;
+ return context.nextTokenParent.kind === 249 /* JsxAttribute */;
};
Rules.IsJsxAttributeContext = function (context) {
- return context.contextNode.kind === 246 /* JsxAttribute */;
+ return context.contextNode.kind === 249 /* JsxAttribute */;
};
Rules.IsJsxSelfClosingElementContext = function (context) {
- return context.contextNode.kind === 243 /* JsxSelfClosingElement */;
+ return context.contextNode.kind === 246 /* JsxSelfClosingElement */;
};
Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) {
return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context);
@@ -72134,41 +74173,41 @@ var ts;
while (ts.isPartOfExpression(node)) {
node = node.parent;
}
- return node.kind === 144 /* Decorator */;
+ return node.kind === 145 /* Decorator */;
};
Rules.IsStartOfVariableDeclarationList = function (context) {
- return context.currentTokenParent.kind === 220 /* VariableDeclarationList */ &&
+ return context.currentTokenParent.kind === 223 /* VariableDeclarationList */ &&
context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos;
};
Rules.IsNotFormatOnEnter = function (context) {
return context.formattingRequestKind !== 2 /* FormatOnEnter */;
};
Rules.IsModuleDeclContext = function (context) {
- return context.contextNode.kind === 226 /* ModuleDeclaration */;
+ return context.contextNode.kind === 229 /* ModuleDeclaration */;
};
Rules.IsObjectTypeContext = function (context) {
- return context.contextNode.kind === 160 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration;
+ return context.contextNode.kind === 161 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration;
};
Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) {
if (token.kind !== 26 /* LessThanToken */ && token.kind !== 28 /* GreaterThanToken */) {
return false;
}
switch (parent.kind) {
- case 156 /* TypeReference */:
- case 178 /* TypeAssertionExpression */:
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 223 /* InterfaceDeclaration */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
- case 195 /* ExpressionWithTypeArguments */:
+ case 157 /* TypeReference */:
+ case 181 /* TypeAssertionExpression */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 226 /* InterfaceDeclaration */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
+ case 198 /* ExpressionWithTypeArguments */:
return true;
default:
return false;
@@ -72179,13 +74218,13 @@ var ts;
Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent);
};
Rules.IsTypeAssertionContext = function (context) {
- return context.contextNode.kind === 178 /* TypeAssertionExpression */;
+ return context.contextNode.kind === 181 /* TypeAssertionExpression */;
};
Rules.IsVoidOpContext = function (context) {
- return context.currentTokenSpan.kind === 104 /* VoidKeyword */ && context.currentTokenParent.kind === 184 /* VoidExpression */;
+ return context.currentTokenSpan.kind === 104 /* VoidKeyword */ && context.currentTokenParent.kind === 187 /* VoidExpression */;
};
Rules.IsYieldOrYieldStarWithOperand = function (context) {
- return context.contextNode.kind === 191 /* YieldExpression */ && context.contextNode.expression !== undefined;
+ return context.contextNode.kind === 194 /* YieldExpression */ && context.contextNode.expression !== undefined;
};
return Rules;
}());
@@ -72209,7 +74248,7 @@ var ts;
return result;
};
RulesMap.prototype.Initialize = function (rules) {
- this.mapRowLength = 139 /* LastToken */ + 1;
+ this.mapRowLength = 140 /* LastToken */ + 1;
this.map = new Array(this.mapRowLength * this.mapRowLength); // new Array(this.mapRowLength * this.mapRowLength);
// This array is used only during construction of the rulesbucket in the map
var rulesBucketConstructionStateList = new Array(this.map.length); // new Array(this.map.length);
@@ -72223,7 +74262,7 @@ var ts;
});
};
RulesMap.prototype.GetRuleBucketIndex = function (row, column) {
- ts.Debug.assert(row <= 139 /* LastKeyword */ && column <= 139 /* LastKeyword */, "Must compute formatting context from tokens");
+ ts.Debug.assert(row <= 140 /* LastKeyword */ && column <= 140 /* LastKeyword */, "Must compute formatting context from tokens");
var rulesBucketIndex = (row * this.mapRowLength) + column;
return rulesBucketIndex;
};
@@ -72260,6 +74299,7 @@ var ts;
formatting.RulesMap = RulesMap;
var MaskBitSize = 5;
var Mask = 0x1f;
+ var RulesPosition;
(function (RulesPosition) {
RulesPosition[RulesPosition["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific";
RulesPosition[RulesPosition["IgnoreRulesAny"] = MaskBitSize * 1] = "IgnoreRulesAny";
@@ -72267,8 +74307,7 @@ var ts;
RulesPosition[RulesPosition["ContextRulesAny"] = MaskBitSize * 3] = "ContextRulesAny";
RulesPosition[RulesPosition["NoContextRulesSpecific"] = MaskBitSize * 4] = "NoContextRulesSpecific";
RulesPosition[RulesPosition["NoContextRulesAny"] = MaskBitSize * 5] = "NoContextRulesAny";
- })(formatting.RulesPosition || (formatting.RulesPosition = {}));
- var RulesPosition = formatting.RulesPosition;
+ })(RulesPosition = formatting.RulesPosition || (formatting.RulesPosition = {}));
var RulesBucketConstructionState = (function () {
function RulesBucketConstructionState() {
//// The Rules list contains all the inserted rules into a rulebucket in the following order:
@@ -72404,7 +74443,7 @@ var ts;
}
TokenAllAccess.prototype.GetTokens = function () {
var result = [];
- for (var token = 0 /* FirstToken */; token <= 139 /* LastToken */; token++) {
+ for (var token = 0 /* FirstToken */; token <= 140 /* LastToken */; token++) {
result.push(token);
}
return result;
@@ -72448,9 +74487,9 @@ var ts;
}());
TokenRange.Any = TokenRange.AllTokens();
TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */]));
- TokenRange.Keywords = TokenRange.FromRange(71 /* FirstKeyword */, 139 /* LastKeyword */);
+ TokenRange.Keywords = TokenRange.FromRange(71 /* FirstKeyword */, 140 /* LastKeyword */);
TokenRange.BinaryOperators = TokenRange.FromRange(26 /* FirstBinaryOperator */, 69 /* LastBinaryOperator */);
- TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91 /* InKeyword */, 92 /* InstanceOfKeyword */, 139 /* OfKeyword */, 117 /* AsKeyword */, 125 /* IsKeyword */]);
+ TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91 /* InKeyword */, 92 /* InstanceOfKeyword */, 140 /* OfKeyword */, 117 /* AsKeyword */, 125 /* IsKeyword */]);
TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([42 /* PlusPlusToken */, 43 /* MinusMinusToken */, 51 /* TildeToken */, 50 /* ExclamationToken */]);
TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 70 /* Identifier */, 18 /* OpenParenToken */, 20 /* OpenBracketToken */, 16 /* OpenBraceToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]);
TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]);
@@ -72458,7 +74497,7 @@ var ts;
TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]);
TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 19 /* CloseParenToken */, 21 /* CloseBracketToken */, 93 /* NewKeyword */]);
TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]);
- TokenRange.TypeNames = TokenRange.FromTokens([70 /* Identifier */, 131 /* NumberKeyword */, 133 /* StringKeyword */, 121 /* BooleanKeyword */, 134 /* SymbolKeyword */, 104 /* VoidKeyword */, 118 /* AnyKeyword */]);
+ TokenRange.TypeNames = TokenRange.FromTokens([70 /* Identifier */, 132 /* NumberKeyword */, 134 /* StringKeyword */, 121 /* BooleanKeyword */, 135 /* SymbolKeyword */, 104 /* VoidKeyword */, 118 /* AnyKeyword */]);
Shared.TokenRange = TokenRange;
})(Shared = formatting.Shared || (formatting.Shared = {}));
})(formatting = ts.formatting || (ts.formatting = {}));
@@ -72717,17 +74756,17 @@ var ts;
// i.e. parent is class declaration with the list of members and node is one of members.
function isListElement(parent, node) {
switch (parent.kind) {
- case 222 /* ClassDeclaration */:
- case 223 /* InterfaceDeclaration */:
+ case 225 /* ClassDeclaration */:
+ case 226 /* InterfaceDeclaration */:
return ts.rangeContainsRange(parent.members, node);
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
var body = parent.body;
- return body && body.kind === 227 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node);
- case 256 /* SourceFile */:
- case 200 /* Block */:
- case 227 /* ModuleBlock */:
+ return body && body.kind === 230 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node);
+ case 260 /* SourceFile */:
+ case 203 /* Block */:
+ case 230 /* ModuleBlock */:
return ts.rangeContainsRange(parent.statements, node);
- case 252 /* CatchClause */:
+ case 255 /* CatchClause */:
return ts.rangeContainsRange(parent.block.statements, node);
}
return false;
@@ -72932,20 +74971,20 @@ var ts;
return node.modifiers[0].kind;
}
switch (node.kind) {
- case 222 /* ClassDeclaration */: return 74 /* ClassKeyword */;
- case 223 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */;
- case 221 /* FunctionDeclaration */: return 88 /* FunctionKeyword */;
- case 225 /* EnumDeclaration */: return 225 /* EnumDeclaration */;
- case 150 /* GetAccessor */: return 124 /* GetKeyword */;
- case 151 /* SetAccessor */: return 132 /* SetKeyword */;
- case 148 /* MethodDeclaration */:
+ case 225 /* ClassDeclaration */: return 74 /* ClassKeyword */;
+ case 226 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */;
+ case 224 /* FunctionDeclaration */: return 88 /* FunctionKeyword */;
+ case 228 /* EnumDeclaration */: return 228 /* EnumDeclaration */;
+ case 151 /* GetAccessor */: return 124 /* GetKeyword */;
+ case 152 /* SetAccessor */: return 133 /* SetKeyword */;
+ case 149 /* MethodDeclaration */:
if (node.asteriskToken) {
return 38 /* AsteriskToken */;
} /*
fall-through
*/
- case 146 /* PropertyDeclaration */:
- case 143 /* Parameter */:
+ case 147 /* PropertyDeclaration */:
+ case 144 /* Parameter */:
return node.name.kind;
}
}
@@ -73089,11 +75128,11 @@ var ts;
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child);
return inheritedIndentation;
}
- var effectiveParentStartLine = child.kind === 144 /* Decorator */ ? childStartLine : undecoratedParentStartLine;
+ var effectiveParentStartLine = child.kind === 145 /* Decorator */ ? childStartLine : undecoratedParentStartLine;
var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine);
processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta);
childContextNode = node;
- if (isFirstListItem && parent.kind === 171 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) {
+ if (isFirstListItem && parent.kind === 174 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) {
inheritedIndentation = childIndentation.indentation;
}
return inheritedIndentation;
@@ -73438,12 +75477,12 @@ var ts;
}
function getOpenTokenForList(node, list) {
switch (node.kind) {
- case 149 /* Constructor */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 181 /* ArrowFunction */:
+ case 150 /* Constructor */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 184 /* ArrowFunction */:
if (node.typeParameters === list) {
return 26 /* LessThanToken */;
}
@@ -73451,8 +75490,8 @@ var ts;
return 18 /* OpenParenToken */;
}
break;
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
if (node.typeArguments === list) {
return 26 /* LessThanToken */;
}
@@ -73460,7 +75499,7 @@ var ts;
return 18 /* OpenParenToken */;
}
break;
- case 156 /* TypeReference */:
+ case 157 /* TypeReference */:
if (node.typeArguments === list) {
return 26 /* LessThanToken */;
}
@@ -73576,7 +75615,7 @@ var ts;
var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile);
return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options);
}
- if (precedingToken.kind === 25 /* CommaToken */ && precedingToken.parent.kind !== 188 /* BinaryExpression */) {
+ if (precedingToken.kind === 25 /* CommaToken */ && precedingToken.parent.kind !== 191 /* BinaryExpression */) {
// previous token is comma that separates items in list - find the previous item and try to derive indentation from it
var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options);
if (actualIndentation !== -1 /* Unknown */) {
@@ -73699,7 +75738,7 @@ var ts;
// - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually
// - parent and child are not on the same line
var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) &&
- (parent.kind === 256 /* SourceFile */ || !parentAndChildShareLine);
+ (parent.kind === 260 /* SourceFile */ || !parentAndChildShareLine);
if (!useActualIndentation) {
return -1 /* Unknown */;
}
@@ -73732,7 +75771,7 @@ var ts;
return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));
}
function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) {
- if (parent.kind === 204 /* IfStatement */ && parent.elseStatement === child) {
+ if (parent.kind === 207 /* IfStatement */ && parent.elseStatement === child) {
var elseKeyword = ts.findChildOfKind(parent, 81 /* ElseKeyword */, sourceFile);
ts.Debug.assert(elseKeyword !== undefined);
var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line;
@@ -73744,23 +75783,23 @@ var ts;
function getContainingList(node, sourceFile) {
if (node.parent) {
switch (node.parent.kind) {
- case 156 /* TypeReference */:
+ case 157 /* TypeReference */:
if (node.parent.typeArguments &&
ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) {
return node.parent.typeArguments;
}
break;
- case 172 /* ObjectLiteralExpression */:
+ case 175 /* ObjectLiteralExpression */:
return node.parent.properties;
- case 171 /* ArrayLiteralExpression */:
+ case 174 /* ArrayLiteralExpression */:
return node.parent.elements;
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */: {
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */: {
var start = node.getStart(sourceFile);
if (node.parent.typeParameters &&
ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) {
@@ -73771,8 +75810,8 @@ var ts;
}
break;
}
- case 176 /* NewExpression */:
- case 175 /* CallExpression */: {
+ case 179 /* NewExpression */:
+ case 178 /* CallExpression */: {
var start = node.getStart(sourceFile);
if (node.parent.typeArguments &&
ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) {
@@ -73802,8 +75841,8 @@ var ts;
if (node.kind === 19 /* CloseParenToken */) {
return -1 /* Unknown */;
}
- if (node.parent && (node.parent.kind === 175 /* CallExpression */ ||
- node.parent.kind === 176 /* NewExpression */) &&
+ if (node.parent && (node.parent.kind === 178 /* CallExpression */ ||
+ node.parent.kind === 179 /* NewExpression */) &&
node.parent.expression !== node) {
var fullCallOrNewExpression = node.parent.expression;
var startingExpression = getStartingExpression(fullCallOrNewExpression);
@@ -73821,10 +75860,10 @@ var ts;
function getStartingExpression(node) {
while (true) {
switch (node.kind) {
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
- case 173 /* PropertyAccessExpression */:
- case 174 /* ElementAccessExpression */:
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
+ case 176 /* PropertyAccessExpression */:
+ case 177 /* ElementAccessExpression */:
node = node.expression;
break;
default:
@@ -73888,48 +75927,48 @@ var ts;
SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn;
function nodeContentIsAlwaysIndented(kind) {
switch (kind) {
- case 203 /* ExpressionStatement */:
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 223 /* InterfaceDeclaration */:
- case 225 /* EnumDeclaration */:
- case 224 /* TypeAliasDeclaration */:
- case 171 /* ArrayLiteralExpression */:
- case 200 /* Block */:
- case 227 /* ModuleBlock */:
- case 172 /* ObjectLiteralExpression */:
- case 160 /* TypeLiteral */:
- case 162 /* TupleType */:
- case 228 /* CaseBlock */:
- case 250 /* DefaultClause */:
- case 249 /* CaseClause */:
- case 179 /* ParenthesizedExpression */:
- case 173 /* PropertyAccessExpression */:
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
- case 201 /* VariableStatement */:
- case 219 /* VariableDeclaration */:
- case 236 /* ExportAssignment */:
- case 212 /* ReturnStatement */:
- case 189 /* ConditionalExpression */:
- case 169 /* ArrayBindingPattern */:
- case 168 /* ObjectBindingPattern */:
- case 244 /* JsxOpeningElement */:
- case 243 /* JsxSelfClosingElement */:
- case 248 /* JsxExpression */:
- case 147 /* MethodSignature */:
- case 152 /* CallSignature */:
- case 153 /* ConstructSignature */:
- case 143 /* Parameter */:
- case 157 /* FunctionType */:
- case 158 /* ConstructorType */:
- case 165 /* ParenthesizedType */:
- case 177 /* TaggedTemplateExpression */:
- case 185 /* AwaitExpression */:
- case 238 /* NamedExports */:
- case 234 /* NamedImports */:
- case 239 /* ExportSpecifier */:
- case 235 /* ImportSpecifier */:
+ case 206 /* ExpressionStatement */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 226 /* InterfaceDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
+ case 174 /* ArrayLiteralExpression */:
+ case 203 /* Block */:
+ case 230 /* ModuleBlock */:
+ case 175 /* ObjectLiteralExpression */:
+ case 161 /* TypeLiteral */:
+ case 163 /* TupleType */:
+ case 231 /* CaseBlock */:
+ case 253 /* DefaultClause */:
+ case 252 /* CaseClause */:
+ case 182 /* ParenthesizedExpression */:
+ case 176 /* PropertyAccessExpression */:
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
+ case 204 /* VariableStatement */:
+ case 222 /* VariableDeclaration */:
+ case 239 /* ExportAssignment */:
+ case 215 /* ReturnStatement */:
+ case 192 /* ConditionalExpression */:
+ case 172 /* ArrayBindingPattern */:
+ case 171 /* ObjectBindingPattern */:
+ case 247 /* JsxOpeningElement */:
+ case 246 /* JsxSelfClosingElement */:
+ case 251 /* JsxExpression */:
+ case 148 /* MethodSignature */:
+ case 153 /* CallSignature */:
+ case 154 /* ConstructSignature */:
+ case 144 /* Parameter */:
+ case 158 /* FunctionType */:
+ case 159 /* ConstructorType */:
+ case 166 /* ParenthesizedType */:
+ case 180 /* TaggedTemplateExpression */:
+ case 188 /* AwaitExpression */:
+ case 241 /* NamedExports */:
+ case 237 /* NamedImports */:
+ case 242 /* ExportSpecifier */:
+ case 238 /* ImportSpecifier */:
return true;
}
return false;
@@ -73938,27 +75977,27 @@ var ts;
function nodeWillIndentChild(parent, child, indentByDefault) {
var childKind = child ? child.kind : 0 /* Unknown */;
switch (parent.kind) {
- case 205 /* DoStatement */:
- case 206 /* WhileStatement */:
- case 208 /* ForInStatement */:
- case 209 /* ForOfStatement */:
- case 207 /* ForStatement */:
- case 204 /* IfStatement */:
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 148 /* MethodDeclaration */:
- case 181 /* ArrowFunction */:
- case 149 /* Constructor */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- return childKind !== 200 /* Block */;
- case 237 /* ExportDeclaration */:
- return childKind !== 238 /* NamedExports */;
- case 231 /* ImportDeclaration */:
- return childKind !== 232 /* ImportClause */ ||
- (child.namedBindings && child.namedBindings.kind !== 234 /* NamedImports */);
- case 242 /* JsxElement */:
- return childKind !== 245 /* JsxClosingElement */;
+ case 208 /* DoStatement */:
+ case 209 /* WhileStatement */:
+ case 211 /* ForInStatement */:
+ case 212 /* ForOfStatement */:
+ case 210 /* ForStatement */:
+ case 207 /* IfStatement */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 149 /* MethodDeclaration */:
+ case 184 /* ArrowFunction */:
+ case 150 /* Constructor */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ return childKind !== 203 /* Block */;
+ case 240 /* ExportDeclaration */:
+ return childKind !== 241 /* NamedExports */;
+ case 234 /* ImportDeclaration */:
+ return childKind !== 235 /* ImportClause */ ||
+ (child.namedBindings && child.namedBindings.kind !== 237 /* NamedImports */);
+ case 245 /* JsxElement */:
+ return childKind !== 248 /* JsxClosingElement */;
}
// No explicit rule for given nodes so the result will follow the default value argument
return indentByDefault;
@@ -74048,7 +76087,7 @@ var ts;
}
// figure out if the this access is actuall inside the supercall
// i.e. super(this.a), since in that case we won't suggest a fix
- if (superCall.expression && superCall.expression.kind == 175 /* CallExpression */) {
+ if (superCall.expression && superCall.expression.kind == 178 /* CallExpression */) {
var arguments_1 = superCall.expression.arguments;
for (var i = 0; i < arguments_1.length; i++) {
if (arguments_1[i].expression === token) {
@@ -74072,7 +76111,7 @@ var ts;
changes: changes
}];
function findSuperCall(n) {
- if (n.kind === 203 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) {
+ if (n.kind === 206 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) {
return n;
}
if (ts.isFunctionLike(n)) {
@@ -74117,7 +76156,7 @@ var ts;
/** The version of the language service API */
ts.servicesVersion = "0.5";
function createNode(kind, pos, end, parent) {
- var node = kind >= 140 /* FirstNode */ ? new NodeObject(kind, pos, end) :
+ var node = kind >= 141 /* FirstNode */ ? new NodeObject(kind, pos, end) :
kind === 70 /* Identifier */ ? new IdentifierObject(70 /* Identifier */, pos, end) :
new TokenObject(kind, pos, end);
node.parent = parent;
@@ -74175,11 +76214,11 @@ var ts;
return pos;
};
NodeObject.prototype.createSyntaxList = function (nodes) {
- var list = createNode(286 /* SyntaxList */, nodes.pos, nodes.end, this);
+ var list = createNode(290 /* SyntaxList */, nodes.pos, nodes.end, this);
list._children = [];
var pos = nodes.pos;
- for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
- var node = nodes_4[_i];
+ for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) {
+ var node = nodes_5[_i];
if (pos < node.pos) {
pos = this.addSyntheticNodes(list._children, pos, node.pos);
}
@@ -74194,11 +76233,11 @@ var ts;
NodeObject.prototype.createChildren = function (sourceFile) {
var _this = this;
var children;
- if (this.kind >= 140 /* FirstNode */) {
+ if (this.kind >= 141 /* FirstNode */) {
ts.scanner.setText((sourceFile || this.getSourceFile()).text);
children = [];
var pos_3 = this.pos;
- var useJSDocScanner_1 = this.kind >= 273 /* FirstJSDocTagNode */ && this.kind <= 285 /* LastJSDocTagNode */;
+ var useJSDocScanner_1 = this.kind >= 277 /* FirstJSDocTagNode */ && this.kind <= 289 /* LastJSDocTagNode */;
var processNode = function (node) {
var isJSDocTagNode = ts.isJSDocTag(node);
if (!isJSDocTagNode && pos_3 < node.pos) {
@@ -74256,7 +76295,7 @@ var ts;
return undefined;
}
var child = children[0];
- return child.kind < 140 /* FirstNode */ ? child : child.getFirstToken(sourceFile);
+ return child.kind < 141 /* FirstNode */ ? child : child.getFirstToken(sourceFile);
};
NodeObject.prototype.getLastToken = function (sourceFile) {
var children = this.getChildren(sourceFile);
@@ -74264,7 +76303,7 @@ var ts;
if (!child) {
return undefined;
}
- return child.kind < 140 /* FirstNode */ ? child : child.getLastToken(sourceFile);
+ return child.kind < 141 /* FirstNode */ ? child : child.getLastToken(sourceFile);
};
return NodeObject;
}());
@@ -74467,9 +76506,9 @@ var ts;
if (result_6 !== undefined) {
return result_6;
}
- if (declaration.name.kind === 141 /* ComputedPropertyName */) {
+ if (declaration.name.kind === 142 /* ComputedPropertyName */) {
var expr = declaration.name.expression;
- if (expr.kind === 173 /* PropertyAccessExpression */) {
+ if (expr.kind === 176 /* PropertyAccessExpression */) {
return expr.name.text;
}
return getTextOfIdentifierOrLiteral(expr);
@@ -74489,10 +76528,10 @@ var ts;
}
function visit(node) {
switch (node.kind) {
- case 221 /* FunctionDeclaration */:
- case 180 /* FunctionExpression */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
+ case 224 /* FunctionDeclaration */:
+ case 183 /* FunctionExpression */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
var functionDeclaration = node;
var declarationName = getDeclarationName(functionDeclaration);
if (declarationName) {
@@ -74512,32 +76551,32 @@ var ts;
ts.forEachChild(node, visit);
}
break;
- case 222 /* ClassDeclaration */:
- case 193 /* ClassExpression */:
- case 223 /* InterfaceDeclaration */:
- case 224 /* TypeAliasDeclaration */:
- case 225 /* EnumDeclaration */:
- case 226 /* ModuleDeclaration */:
- case 230 /* ImportEqualsDeclaration */:
- case 239 /* ExportSpecifier */:
- case 235 /* ImportSpecifier */:
- case 230 /* ImportEqualsDeclaration */:
- case 232 /* ImportClause */:
- case 233 /* NamespaceImport */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 160 /* TypeLiteral */:
+ case 225 /* ClassDeclaration */:
+ case 196 /* ClassExpression */:
+ case 226 /* InterfaceDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 229 /* ModuleDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
+ case 242 /* ExportSpecifier */:
+ case 238 /* ImportSpecifier */:
+ case 233 /* ImportEqualsDeclaration */:
+ case 235 /* ImportClause */:
+ case 236 /* NamespaceImport */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 161 /* TypeLiteral */:
addDeclaration(node);
ts.forEachChild(node, visit);
break;
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
// Only consider parameter properties
if (!ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) {
break;
}
// fall through
- case 219 /* VariableDeclaration */:
- case 170 /* BindingElement */: {
+ case 222 /* VariableDeclaration */:
+ case 173 /* BindingElement */: {
var decl = node;
if (ts.isBindingPattern(decl.name)) {
ts.forEachChild(decl.name, visit);
@@ -74546,19 +76585,19 @@ var ts;
if (decl.initializer)
visit(decl.initializer);
}
- case 255 /* EnumMember */:
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
+ case 259 /* EnumMember */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
addDeclaration(node);
break;
- case 237 /* ExportDeclaration */:
+ case 240 /* ExportDeclaration */:
// Handle named exports case e.g.:
// export {a, b as B} from "mod";
if (node.exportClause) {
ts.forEach(node.exportClause.elements, visit);
}
break;
- case 231 /* ImportDeclaration */:
+ case 234 /* ImportDeclaration */:
var importClause = node.importClause;
if (importClause) {
// Handle default import case e.g.:
@@ -74570,7 +76609,7 @@ var ts;
// import * as NS from "mod";
// import {a, b as B} from "mod";
if (importClause.namedBindings) {
- if (importClause.namedBindings.kind === 233 /* NamespaceImport */) {
+ if (importClause.namedBindings.kind === 236 /* NamespaceImport */) {
addDeclaration(importClause.namedBindings);
}
else {
@@ -74725,7 +76764,7 @@ var ts;
var sourceFile;
if (this.currentFileName !== fileName) {
// This is a new file, just parse it
- sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 4 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
+ sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 5 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
}
else if (this.currentFileVersion !== version) {
// This is the same file, just a newer version. Incrementally parse the file.
@@ -75100,10 +77139,10 @@ var ts;
// Try getting just type at this position and show
switch (node.kind) {
case 70 /* Identifier */:
- case 173 /* PropertyAccessExpression */:
- case 140 /* QualifiedName */:
+ case 176 /* PropertyAccessExpression */:
+ case 141 /* QualifiedName */:
case 98 /* ThisKeyword */:
- case 166 /* ThisType */:
+ case 167 /* ThisType */:
case 96 /* SuperKeyword */:
// For the identifiers/this/super etc get the type at position
var type = typeChecker.getTypeAtLocation(node);
@@ -75246,15 +77285,15 @@ var ts;
return;
}
switch (node.kind) {
- case 173 /* PropertyAccessExpression */:
- case 140 /* QualifiedName */:
+ case 176 /* PropertyAccessExpression */:
+ case 141 /* QualifiedName */:
case 9 /* StringLiteral */:
case 85 /* FalseKeyword */:
case 100 /* TrueKeyword */:
case 94 /* NullKeyword */:
case 96 /* SuperKeyword */:
case 98 /* ThisKeyword */:
- case 166 /* ThisType */:
+ case 167 /* ThisType */:
case 70 /* Identifier */:
break;
// Cant create the text span
@@ -75271,7 +77310,7 @@ var ts;
// If this is name of a module declarations, check if this is right side of dotted module name
// If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of
// Then this name is name from dotted module
- if (nodeForStartPos.parent.parent.kind === 226 /* ModuleDeclaration */ &&
+ if (nodeForStartPos.parent.parent.kind === 229 /* ModuleDeclaration */ &&
nodeForStartPos.parent.parent.body === nodeForStartPos.parent) {
// Use parent module declarations name for start pos
nodeForStartPos = nodeForStartPos.parent.parent.name;
@@ -75655,7 +77694,7 @@ var ts;
// then we want 'something' to be in the name table. Similarly, if we have
// "a['propname']" then we want to store "propname" in the name table.
if (ts.isDeclarationName(node) ||
- node.parent.kind === 241 /* ExternalModuleReference */ ||
+ node.parent.kind === 244 /* ExternalModuleReference */ ||
isArgumentOfElementAccessExpression(node) ||
ts.isLiteralComputedPropertyDeclarationName(node)) {
nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1;
@@ -75675,7 +77714,7 @@ var ts;
function isArgumentOfElementAccessExpression(node) {
return node &&
node.parent &&
- node.parent.kind === 174 /* ElementAccessExpression */ &&
+ node.parent.kind === 177 /* ElementAccessExpression */ &&
node.parent.argumentExpression === node;
}
/**
@@ -75759,113 +77798,113 @@ var ts;
function spanInNode(node) {
if (node) {
switch (node.kind) {
- case 201 /* VariableStatement */:
+ case 204 /* VariableStatement */:
// Span on first variable declaration
return spanInVariableDeclaration(node.declarationList.declarations[0]);
- case 219 /* VariableDeclaration */:
- case 146 /* PropertyDeclaration */:
- case 145 /* PropertySignature */:
+ case 222 /* VariableDeclaration */:
+ case 147 /* PropertyDeclaration */:
+ case 146 /* PropertySignature */:
return spanInVariableDeclaration(node);
- case 143 /* Parameter */:
+ case 144 /* Parameter */:
return spanInParameterDeclaration(node);
- case 221 /* FunctionDeclaration */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 149 /* Constructor */:
- case 180 /* FunctionExpression */:
- case 181 /* ArrowFunction */:
+ case 224 /* FunctionDeclaration */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 150 /* Constructor */:
+ case 183 /* FunctionExpression */:
+ case 184 /* ArrowFunction */:
return spanInFunctionDeclaration(node);
- case 200 /* Block */:
+ case 203 /* Block */:
if (ts.isFunctionBlock(node)) {
return spanInFunctionBlock(node);
}
// Fall through
- case 227 /* ModuleBlock */:
+ case 230 /* ModuleBlock */:
return spanInBlock(node);
- case 252 /* CatchClause */:
+ case 255 /* CatchClause */:
return spanInBlock(node.block);
- case 203 /* ExpressionStatement */:
+ case 206 /* ExpressionStatement */:
// span on the expression
return textSpan(node.expression);
- case 212 /* ReturnStatement */:
+ case 215 /* ReturnStatement */:
// span on return keyword and expression if present
return textSpan(node.getChildAt(0), node.expression);
- case 206 /* WhileStatement */:
+ case 209 /* WhileStatement */:
// Span on while(...)
return textSpanEndingAtNextToken(node, node.expression);
- case 205 /* DoStatement */:
+ case 208 /* DoStatement */:
// span in statement of the do statement
return spanInNode(node.statement);
- case 218 /* DebuggerStatement */:
+ case 221 /* DebuggerStatement */:
// span on debugger keyword
return textSpan(node.getChildAt(0));
- case 204 /* IfStatement */:
+ case 207 /* IfStatement */:
// set on if(..) span
return textSpanEndingAtNextToken(node, node.expression);
- case 215 /* LabeledStatement */:
+ case 218 /* LabeledStatement */:
// span in statement
return spanInNode(node.statement);
- case 211 /* BreakStatement */:
- case 210 /* ContinueStatement */:
+ case 214 /* BreakStatement */:
+ case 213 /* ContinueStatement */:
// On break or continue keyword and label if present
return textSpan(node.getChildAt(0), node.label);
- case 207 /* ForStatement */:
+ case 210 /* ForStatement */:
return spanInForStatement(node);
- case 208 /* ForInStatement */:
+ case 211 /* ForInStatement */:
// span of for (a in ...)
return textSpanEndingAtNextToken(node, node.expression);
- case 209 /* ForOfStatement */:
+ case 212 /* ForOfStatement */:
// span in initializer
return spanInInitializerOfForLike(node);
- case 214 /* SwitchStatement */:
+ case 217 /* SwitchStatement */:
// span on switch(...)
return textSpanEndingAtNextToken(node, node.expression);
- case 249 /* CaseClause */:
- case 250 /* DefaultClause */:
+ case 252 /* CaseClause */:
+ case 253 /* DefaultClause */:
// span in first statement of the clause
return spanInNode(node.statements[0]);
- case 217 /* TryStatement */:
+ case 220 /* TryStatement */:
// span in try block
return spanInBlock(node.tryBlock);
- case 216 /* ThrowStatement */:
+ case 219 /* ThrowStatement */:
// span in throw ...
return textSpan(node, node.expression);
- case 236 /* ExportAssignment */:
+ case 239 /* ExportAssignment */:
// span on export = id
return textSpan(node, node.expression);
- case 230 /* ImportEqualsDeclaration */:
+ case 233 /* ImportEqualsDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleReference);
- case 231 /* ImportDeclaration */:
+ case 234 /* ImportDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleSpecifier);
- case 237 /* ExportDeclaration */:
+ case 240 /* ExportDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleSpecifier);
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
// span on complete module if it is instantiated
if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) {
return undefined;
}
- case 222 /* ClassDeclaration */:
- case 225 /* EnumDeclaration */:
- case 255 /* EnumMember */:
- case 170 /* BindingElement */:
+ case 225 /* ClassDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 259 /* EnumMember */:
+ case 173 /* BindingElement */:
// span on complete node
return textSpan(node);
- case 213 /* WithStatement */:
+ case 216 /* WithStatement */:
// span in statement
return spanInNode(node.statement);
- case 144 /* Decorator */:
+ case 145 /* Decorator */:
return spanInNodeArray(node.parent.decorators);
- case 168 /* ObjectBindingPattern */:
- case 169 /* ArrayBindingPattern */:
+ case 171 /* ObjectBindingPattern */:
+ case 172 /* ArrayBindingPattern */:
return spanInBindingPattern(node);
// No breakpoint in interface, type alias
- case 223 /* InterfaceDeclaration */:
- case 224 /* TypeAliasDeclaration */:
+ case 226 /* InterfaceDeclaration */:
+ case 227 /* TypeAliasDeclaration */:
return undefined;
// Tokens:
case 24 /* SemicolonToken */:
@@ -75895,7 +77934,7 @@ var ts;
case 73 /* CatchKeyword */:
case 86 /* FinallyKeyword */:
return spanInNextNode(node);
- case 139 /* OfKeyword */:
+ case 140 /* OfKeyword */:
return spanInOfKeyword(node);
default:
// Destructuring pattern in destructuring assignment
@@ -75908,13 +77947,13 @@ var ts;
// a or ...c or d: x from
// [a, b, ...c] or { a, b } or { d: x } from destructuring pattern
if ((node.kind === 70 /* Identifier */ ||
- node.kind == 192 /* SpreadElementExpression */ ||
- node.kind === 253 /* PropertyAssignment */ ||
- node.kind === 254 /* ShorthandPropertyAssignment */) &&
+ node.kind == 195 /* SpreadElement */ ||
+ node.kind === 256 /* PropertyAssignment */ ||
+ node.kind === 257 /* ShorthandPropertyAssignment */) &&
ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
return textSpan(node);
}
- if (node.kind === 188 /* BinaryExpression */) {
+ if (node.kind === 191 /* BinaryExpression */) {
var binaryExpression = node;
// Set breakpoint in destructuring pattern if its destructuring assignment
// [a, b, c] or {a, b, c} of
@@ -75937,22 +77976,22 @@ var ts;
}
if (ts.isPartOfExpression(node)) {
switch (node.parent.kind) {
- case 205 /* DoStatement */:
+ case 208 /* DoStatement */:
// Set span as if on while keyword
return spanInPreviousNode(node);
- case 144 /* Decorator */:
+ case 145 /* Decorator */:
// Set breakpoint on the decorator emit
return spanInNode(node.parent);
- case 207 /* ForStatement */:
- case 209 /* ForOfStatement */:
+ case 210 /* ForStatement */:
+ case 212 /* ForOfStatement */:
return textSpan(node);
- case 188 /* BinaryExpression */:
+ case 191 /* BinaryExpression */:
if (node.parent.operatorToken.kind === 25 /* CommaToken */) {
// If this is a comma expression, the breakpoint is possible in this expression
return textSpan(node);
}
break;
- case 181 /* ArrowFunction */:
+ case 184 /* ArrowFunction */:
if (node.parent.body === node) {
// If this is body of arrow function, it is allowed to have the breakpoint
return textSpan(node);
@@ -75961,13 +78000,13 @@ var ts;
}
}
// If this is name of property assignment, set breakpoint in the initializer
- if (node.parent.kind === 253 /* PropertyAssignment */ &&
+ if (node.parent.kind === 256 /* PropertyAssignment */ &&
node.parent.name === node &&
!ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) {
return spanInNode(node.parent.initializer);
}
// Breakpoint in type assertion goes to its operand
- if (node.parent.kind === 178 /* TypeAssertionExpression */ && node.parent.type === node) {
+ if (node.parent.kind === 181 /* TypeAssertionExpression */ && node.parent.type === node) {
return spanInNextNode(node.parent.type);
}
// return type of function go to previous token
@@ -75975,8 +78014,8 @@ var ts;
return spanInPreviousNode(node);
}
// initializer of variable/parameter declaration go to previous node
- if ((node.parent.kind === 219 /* VariableDeclaration */ ||
- node.parent.kind === 143 /* Parameter */)) {
+ if ((node.parent.kind === 222 /* VariableDeclaration */ ||
+ node.parent.kind === 144 /* Parameter */)) {
var paramOrVarDecl = node.parent;
if (paramOrVarDecl.initializer === node ||
paramOrVarDecl.type === node ||
@@ -75984,7 +78023,7 @@ var ts;
return spanInPreviousNode(node);
}
}
- if (node.parent.kind === 188 /* BinaryExpression */) {
+ if (node.parent.kind === 191 /* BinaryExpression */) {
var binaryExpression = node.parent;
if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) &&
(binaryExpression.right === node ||
@@ -76010,7 +78049,7 @@ var ts;
}
function spanInVariableDeclaration(variableDeclaration) {
// If declaration of for in statement, just set the span in parent
- if (variableDeclaration.parent.parent.kind === 208 /* ForInStatement */) {
+ if (variableDeclaration.parent.parent.kind === 211 /* ForInStatement */) {
return spanInNode(variableDeclaration.parent.parent);
}
// If this is a destructuring pattern, set breakpoint in binding pattern
@@ -76021,7 +78060,7 @@ var ts;
// or its declaration from 'for of'
if (variableDeclaration.initializer ||
ts.hasModifier(variableDeclaration, 1 /* Export */) ||
- variableDeclaration.parent.parent.kind === 209 /* ForOfStatement */) {
+ variableDeclaration.parent.parent.kind === 212 /* ForOfStatement */) {
return textSpanFromVariableDeclaration(variableDeclaration);
}
var declarations = variableDeclaration.parent.declarations;
@@ -76061,7 +78100,7 @@ var ts;
}
function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) {
return ts.hasModifier(functionDeclaration, 1 /* Export */) ||
- (functionDeclaration.parent.kind === 222 /* ClassDeclaration */ && functionDeclaration.kind !== 149 /* Constructor */);
+ (functionDeclaration.parent.kind === 225 /* ClassDeclaration */ && functionDeclaration.kind !== 150 /* Constructor */);
}
function spanInFunctionDeclaration(functionDeclaration) {
// No breakpoints in the function signature
@@ -76084,25 +78123,25 @@ var ts;
}
function spanInBlock(block) {
switch (block.parent.kind) {
- case 226 /* ModuleDeclaration */:
+ case 229 /* ModuleDeclaration */:
if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) {
return undefined;
}
// Set on parent if on same line otherwise on first statement
- case 206 /* WhileStatement */:
- case 204 /* IfStatement */:
- case 208 /* ForInStatement */:
+ case 209 /* WhileStatement */:
+ case 207 /* IfStatement */:
+ case 211 /* ForInStatement */:
return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]);
// Set span on previous token if it starts on same line otherwise on the first statement of the block
- case 207 /* ForStatement */:
- case 209 /* ForOfStatement */:
+ case 210 /* ForStatement */:
+ case 212 /* ForOfStatement */:
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]);
}
// Default action is to set on first statement
return spanInNode(block.statements[0]);
}
function spanInInitializerOfForLike(forLikeStatement) {
- if (forLikeStatement.initializer.kind === 220 /* VariableDeclarationList */) {
+ if (forLikeStatement.initializer.kind === 223 /* VariableDeclarationList */) {
// Declaration list - set breakpoint in first declaration
var variableDeclarationList = forLikeStatement.initializer;
if (variableDeclarationList.declarations.length > 0) {
@@ -76127,23 +78166,23 @@ var ts;
}
function spanInBindingPattern(bindingPattern) {
// Set breakpoint in first binding element
- var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 194 /* OmittedExpression */ ? element : undefined; });
+ var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 197 /* OmittedExpression */ ? element : undefined; });
if (firstBindingElement) {
return spanInNode(firstBindingElement);
}
// Empty binding pattern of binding element, set breakpoint on binding element
- if (bindingPattern.parent.kind === 170 /* BindingElement */) {
+ if (bindingPattern.parent.kind === 173 /* BindingElement */) {
return textSpan(bindingPattern.parent);
}
// Variable declaration is used as the span
return textSpanFromVariableDeclaration(bindingPattern.parent);
}
function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) {
- ts.Debug.assert(node.kind !== 169 /* ArrayBindingPattern */ && node.kind !== 168 /* ObjectBindingPattern */);
- var elements = node.kind === 171 /* ArrayLiteralExpression */ ?
+ ts.Debug.assert(node.kind !== 172 /* ArrayBindingPattern */ && node.kind !== 171 /* ObjectBindingPattern */);
+ var elements = node.kind === 174 /* ArrayLiteralExpression */ ?
node.elements :
node.properties;
- var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 194 /* OmittedExpression */ ? element : undefined; });
+ var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 197 /* OmittedExpression */ ? element : undefined; });
if (firstBindingElement) {
return spanInNode(firstBindingElement);
}
@@ -76151,18 +78190,18 @@ var ts;
// just nested element in another destructuring assignment
// set breakpoint on assignment when parent is destructuring assignment
// Otherwise set breakpoint for this element
- return textSpan(node.parent.kind === 188 /* BinaryExpression */ ? node.parent : node);
+ return textSpan(node.parent.kind === 191 /* BinaryExpression */ ? node.parent : node);
}
// Tokens:
function spanInOpenBraceToken(node) {
switch (node.parent.kind) {
- case 225 /* EnumDeclaration */:
+ case 228 /* EnumDeclaration */:
var enumDeclaration = node.parent;
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile));
- case 222 /* ClassDeclaration */:
+ case 225 /* ClassDeclaration */:
var classDeclaration = node.parent;
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile));
- case 228 /* CaseBlock */:
+ case 231 /* CaseBlock */:
return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]);
}
// Default to parent node
@@ -76170,24 +78209,24 @@ var ts;
}
function spanInCloseBraceToken(node) {
switch (node.parent.kind) {
- case 227 /* ModuleBlock */:
+ case 230 /* ModuleBlock */:
// If this is not an instantiated module block, no bp span
if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) {
return undefined;
}
- case 225 /* EnumDeclaration */:
- case 222 /* ClassDeclaration */:
+ case 228 /* EnumDeclaration */:
+ case 225 /* ClassDeclaration */:
// Span on close brace token
return textSpan(node);
- case 200 /* Block */:
+ case 203 /* Block */:
if (ts.isFunctionBlock(node.parent)) {
// Span on close brace token
return textSpan(node);
}
// fall through
- case 252 /* CatchClause */:
+ case 255 /* CatchClause */:
return spanInNode(ts.lastOrUndefined(node.parent.statements));
- case 228 /* CaseBlock */:
+ case 231 /* CaseBlock */:
// breakpoint in last statement of the last clause
var caseBlock = node.parent;
var lastClause = ts.lastOrUndefined(caseBlock.clauses);
@@ -76195,7 +78234,7 @@ var ts;
return spanInNode(ts.lastOrUndefined(lastClause.statements));
}
return undefined;
- case 168 /* ObjectBindingPattern */:
+ case 171 /* ObjectBindingPattern */:
// Breakpoint in last binding element or binding pattern if it contains no elements
var bindingPattern = node.parent;
return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);
@@ -76211,7 +78250,7 @@ var ts;
}
function spanInCloseBracketToken(node) {
switch (node.parent.kind) {
- case 169 /* ArrayBindingPattern */:
+ case 172 /* ArrayBindingPattern */:
// Breakpoint in last binding element or binding pattern if it contains no elements
var bindingPattern = node.parent;
return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);
@@ -76226,12 +78265,12 @@ var ts;
}
}
function spanInOpenParenToken(node) {
- if (node.parent.kind === 205 /* DoStatement */ ||
- node.parent.kind === 175 /* CallExpression */ ||
- node.parent.kind === 176 /* NewExpression */) {
+ if (node.parent.kind === 208 /* DoStatement */ ||
+ node.parent.kind === 178 /* CallExpression */ ||
+ node.parent.kind === 179 /* NewExpression */) {
return spanInPreviousNode(node);
}
- if (node.parent.kind === 179 /* ParenthesizedExpression */) {
+ if (node.parent.kind === 182 /* ParenthesizedExpression */) {
return spanInNextNode(node);
}
// Default to parent node
@@ -76240,21 +78279,21 @@ var ts;
function spanInCloseParenToken(node) {
// Is this close paren token of parameter list, set span in previous token
switch (node.parent.kind) {
- case 180 /* FunctionExpression */:
- case 221 /* FunctionDeclaration */:
- case 181 /* ArrowFunction */:
- case 148 /* MethodDeclaration */:
- case 147 /* MethodSignature */:
- case 150 /* GetAccessor */:
- case 151 /* SetAccessor */:
- case 149 /* Constructor */:
- case 206 /* WhileStatement */:
- case 205 /* DoStatement */:
- case 207 /* ForStatement */:
- case 209 /* ForOfStatement */:
- case 175 /* CallExpression */:
- case 176 /* NewExpression */:
- case 179 /* ParenthesizedExpression */:
+ case 183 /* FunctionExpression */:
+ case 224 /* FunctionDeclaration */:
+ case 184 /* ArrowFunction */:
+ case 149 /* MethodDeclaration */:
+ case 148 /* MethodSignature */:
+ case 151 /* GetAccessor */:
+ case 152 /* SetAccessor */:
+ case 150 /* Constructor */:
+ case 209 /* WhileStatement */:
+ case 208 /* DoStatement */:
+ case 210 /* ForStatement */:
+ case 212 /* ForOfStatement */:
+ case 178 /* CallExpression */:
+ case 179 /* NewExpression */:
+ case 182 /* ParenthesizedExpression */:
return spanInPreviousNode(node);
// Default to parent node
default:
@@ -76264,20 +78303,20 @@ var ts;
function spanInColonToken(node) {
// Is this : specifying return annotation of the function declaration
if (ts.isFunctionLike(node.parent) ||
- node.parent.kind === 253 /* PropertyAssignment */ ||
- node.parent.kind === 143 /* Parameter */) {
+ node.parent.kind === 256 /* PropertyAssignment */ ||
+ node.parent.kind === 144 /* Parameter */) {
return spanInPreviousNode(node);
}
return spanInNode(node.parent);
}
function spanInGreaterThanOrLessThanToken(node) {
- if (node.parent.kind === 178 /* TypeAssertionExpression */) {
+ if (node.parent.kind === 181 /* TypeAssertionExpression */) {
return spanInNextNode(node);
}
return spanInNode(node.parent);
}
function spanInWhileKeyword(node) {
- if (node.parent.kind === 205 /* DoStatement */) {
+ if (node.parent.kind === 208 /* DoStatement */) {
// Set span on while expression
return textSpanEndingAtNextToken(node, node.parent.expression);
}
@@ -76285,7 +78324,7 @@ var ts;
return spanInNode(node.parent);
}
function spanInOfKeyword(node) {
- if (node.parent.kind === 209 /* ForOfStatement */) {
+ if (node.parent.kind === 212 /* ForOfStatement */) {
// Set using next token
return spanInNextNode(node);
}
@@ -76367,7 +78406,7 @@ var ts;
var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile));
return ts.map(moduleNames, function (name) {
var result = ts.getProperty(resolutionsInFile, name);
- return result ? { resolvedFileName: result } : undefined;
+ return result ? { resolvedFileName: result, extension: ts.extensionFromPath(result), isExternalLibraryImport: false } : undefined;
});
};
}
diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js
index 2cd89cdc029..47c2ab085df 100644
--- a/lib/typingsInstaller.js
+++ b/lib/typingsInstaller.js
@@ -26,12 +26,13 @@ var ts;
return OperationCanceledException;
}());
ts.OperationCanceledException = OperationCanceledException;
+ var ExitStatus;
(function (ExitStatus) {
ExitStatus[ExitStatus["Success"] = 0] = "Success";
ExitStatus[ExitStatus["DiagnosticsPresent_OutputsSkipped"] = 1] = "DiagnosticsPresent_OutputsSkipped";
ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated";
- })(ts.ExitStatus || (ts.ExitStatus = {}));
- var ExitStatus = ts.ExitStatus;
+ })(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {}));
+ var TypeReferenceSerializationKind;
(function (TypeReferenceSerializationKind) {
TypeReferenceSerializationKind[TypeReferenceSerializationKind["Unknown"] = 0] = "Unknown";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithConstructSignatureAndValue"] = 1] = "TypeWithConstructSignatureAndValue";
@@ -44,19 +45,19 @@ var ts;
TypeReferenceSerializationKind[TypeReferenceSerializationKind["Promise"] = 8] = "Promise";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithCallSignature"] = 9] = "TypeWithCallSignature";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["ObjectType"] = 10] = "ObjectType";
- })(ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {}));
- var TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind;
+ })(TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {}));
+ var DiagnosticCategory;
(function (DiagnosticCategory) {
DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning";
DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
DiagnosticCategory[DiagnosticCategory["Message"] = 2] = "Message";
- })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {}));
- var DiagnosticCategory = ts.DiagnosticCategory;
+ })(DiagnosticCategory = ts.DiagnosticCategory || (ts.DiagnosticCategory = {}));
+ var ModuleResolutionKind;
(function (ModuleResolutionKind) {
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
- })(ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
- var ModuleResolutionKind = ts.ModuleResolutionKind;
+ })(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
+ var ModuleKind;
(function (ModuleKind) {
ModuleKind[ModuleKind["None"] = 0] = "None";
ModuleKind[ModuleKind["CommonJS"] = 1] = "CommonJS";
@@ -64,8 +65,16 @@ var ts;
ModuleKind[ModuleKind["UMD"] = 3] = "UMD";
ModuleKind[ModuleKind["System"] = 4] = "System";
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
- })(ts.ModuleKind || (ts.ModuleKind = {}));
- var ModuleKind = ts.ModuleKind;
+ })(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
+ var Extension;
+ (function (Extension) {
+ Extension[Extension["Ts"] = 0] = "Ts";
+ Extension[Extension["Tsx"] = 1] = "Tsx";
+ Extension[Extension["Dts"] = 2] = "Dts";
+ Extension[Extension["Js"] = 3] = "Js";
+ Extension[Extension["Jsx"] = 4] = "Jsx";
+ Extension[Extension["LastTypeScriptExtension"] = 2] = "LastTypeScriptExtension";
+ })(Extension = ts.Extension || (ts.Extension = {}));
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -204,6 +213,13 @@ var ts;
return undefined;
}
ts.forEach = forEach;
+ function zipWith(arrayA, arrayB, callback) {
+ Debug.assert(arrayA.length === arrayB.length);
+ for (var i = 0; i < arrayA.length; i++) {
+ callback(arrayA[i], arrayB[i], i);
+ }
+ }
+ ts.zipWith = zipWith;
function every(array, callback) {
if (array) {
for (var i = 0, len = array.length; i < len; i++) {
@@ -463,20 +479,25 @@ var ts;
ts.mapObject = mapObject;
function some(array, predicate) {
if (array) {
- for (var _i = 0, array_5 = array; _i < array_5.length; _i++) {
- var v = array_5[_i];
- if (!predicate || predicate(v)) {
- return true;
+ if (predicate) {
+ for (var _i = 0, array_5 = array; _i < array_5.length; _i++) {
+ var v = array_5[_i];
+ if (predicate(v)) {
+ return true;
+ }
}
}
+ else {
+ return array.length > 0;
+ }
}
return false;
}
ts.some = some;
function concatenate(array1, array2) {
- if (!array2 || !array2.length)
+ if (!some(array2))
return array1;
- if (!array1 || !array1.length)
+ if (!some(array1))
return array2;
return array1.concat(array2);
}
@@ -552,6 +573,26 @@ var ts;
return result || array;
}
ts.compact = compact;
+ function relativeComplement(arrayA, arrayB, comparer, offsetA, offsetB) {
+ if (comparer === void 0) { comparer = compareValues; }
+ if (offsetA === void 0) { offsetA = 0; }
+ if (offsetB === void 0) { offsetB = 0; }
+ if (!arrayB || !arrayA || arrayB.length === 0 || arrayA.length === 0)
+ return arrayB;
+ var result = [];
+ outer: for (; offsetB < arrayB.length; offsetB++) {
+ inner: for (; offsetA < arrayA.length; offsetA++) {
+ switch (comparer(arrayB[offsetB], arrayA[offsetA])) {
+ case -1: break inner;
+ case 0: continue outer;
+ case 1: continue inner;
+ }
+ }
+ result.push(arrayB[offsetB]);
+ }
+ return result;
+ }
+ ts.relativeComplement = relativeComplement;
function sum(array, prop) {
var result = 0;
for (var _i = 0, array_7 = array; _i < array_7.length; _i++) {
@@ -561,15 +602,23 @@ var ts;
return result;
}
ts.sum = sum;
+ function append(to, value) {
+ if (value === undefined)
+ return to;
+ if (to === undefined)
+ to = [];
+ to.push(value);
+ return to;
+ }
+ ts.append = append;
function addRange(to, from) {
- if (to && from) {
- for (var _i = 0, from_1 = from; _i < from_1.length; _i++) {
- var v = from_1[_i];
- if (v !== undefined) {
- to.push(v);
- }
- }
+ if (from === undefined)
+ return to;
+ for (var _i = 0, from_1 = from; _i < from_1.length; _i++) {
+ var v = from_1[_i];
+ to = append(to, v);
}
+ return to;
}
ts.addRange = addRange;
function rangeEquals(array1, array2, pos, end) {
@@ -588,6 +637,12 @@ var ts;
: undefined;
}
ts.firstOrUndefined = firstOrUndefined;
+ function lastOrUndefined(array) {
+ return array && array.length > 0
+ ? array[array.length - 1]
+ : undefined;
+ }
+ ts.lastOrUndefined = lastOrUndefined;
function singleOrUndefined(array) {
return array && array.length === 1
? array[0]
@@ -600,23 +655,17 @@ var ts;
: array;
}
ts.singleOrMany = singleOrMany;
- function lastOrUndefined(array) {
- return array && array.length > 0
- ? array[array.length - 1]
- : undefined;
- }
- ts.lastOrUndefined = lastOrUndefined;
function replaceElement(array, index, value) {
var result = array.slice(0);
result[index] = value;
return result;
}
ts.replaceElement = replaceElement;
- function binarySearch(array, value, comparer) {
+ function binarySearch(array, value, comparer, offset) {
if (!array || array.length === 0) {
return -1;
}
- var low = 0;
+ var low = offset || 0;
var high = array.length - 1;
comparer = comparer !== undefined
? comparer
@@ -1374,6 +1423,10 @@ var ts;
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
}
ts.endsWith = endsWith;
+ function hasExtension(fileName) {
+ return getBaseFileName(fileName).indexOf(".") >= 0;
+ }
+ ts.hasExtension = hasExtension;
function fileExtensionIs(path, extension) {
return path.length > extension.length && endsWith(path, extension);
}
@@ -1401,68 +1454,83 @@ var ts;
var doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?";
var pattern = "";
var hasWrittenSubpattern = false;
- spec: for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
+ for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
var spec = specs_1[_i];
if (!spec) {
continue;
}
- var subpattern = "";
- var hasRecursiveDirectoryWildcard = false;
- var hasWrittenComponent = false;
- var components = getNormalizedPathComponents(spec, basePath);
- if (usage !== "exclude" && components[components.length - 1] === "**") {
- continue spec;
- }
- components[0] = removeTrailingDirectorySeparator(components[0]);
- var optionalCount = 0;
- for (var _a = 0, components_1 = components; _a < components_1.length; _a++) {
- var component = components_1[_a];
- if (component === "**") {
- if (hasRecursiveDirectoryWildcard) {
- continue spec;
- }
- subpattern += doubleAsteriskRegexFragment;
- hasRecursiveDirectoryWildcard = true;
- hasWrittenComponent = true;
- }
- else {
- if (usage === "directories") {
- subpattern += "(";
- optionalCount++;
- }
- if (hasWrittenComponent) {
- subpattern += ts.directorySeparator;
- }
- if (usage !== "exclude") {
- if (component.charCodeAt(0) === 42) {
- subpattern += "([^./]" + singleAsteriskRegexFragment + ")?";
- component = component.substr(1);
- }
- else if (component.charCodeAt(0) === 63) {
- subpattern += "[^./]";
- component = component.substr(1);
- }
- }
- subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter);
- hasWrittenComponent = true;
- }
- }
- while (optionalCount > 0) {
- subpattern += ")?";
- optionalCount--;
+ var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter);
+ if (subPattern === undefined) {
+ continue;
}
if (hasWrittenSubpattern) {
pattern += "|";
}
- pattern += "(" + subpattern + ")";
+ pattern += "(" + subPattern + ")";
hasWrittenSubpattern = true;
}
if (!pattern) {
return undefined;
}
- return "^(" + pattern + (usage === "exclude" ? ")($|/)" : ")$");
+ var terminator = usage === "exclude" ? "($|/)" : "$";
+ return "^(" + pattern + ")" + terminator;
}
ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard;
+ function isImplicitGlob(lastPathComponent) {
+ return !/[.*?]/.test(lastPathComponent);
+ }
+ ts.isImplicitGlob = isImplicitGlob;
+ function getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter) {
+ var subpattern = "";
+ var hasRecursiveDirectoryWildcard = false;
+ var hasWrittenComponent = false;
+ var components = getNormalizedPathComponents(spec, basePath);
+ var lastComponent = lastOrUndefined(components);
+ if (usage !== "exclude" && lastComponent === "**") {
+ return undefined;
+ }
+ components[0] = removeTrailingDirectorySeparator(components[0]);
+ if (isImplicitGlob(lastComponent)) {
+ components.push("**", "*");
+ }
+ var optionalCount = 0;
+ for (var _i = 0, components_1 = components; _i < components_1.length; _i++) {
+ var component = components_1[_i];
+ if (component === "**") {
+ if (hasRecursiveDirectoryWildcard) {
+ return undefined;
+ }
+ subpattern += doubleAsteriskRegexFragment;
+ hasRecursiveDirectoryWildcard = true;
+ }
+ else {
+ if (usage === "directories") {
+ subpattern += "(";
+ optionalCount++;
+ }
+ if (hasWrittenComponent) {
+ subpattern += ts.directorySeparator;
+ }
+ if (usage !== "exclude") {
+ if (component.charCodeAt(0) === 42) {
+ subpattern += "([^./]" + singleAsteriskRegexFragment + ")?";
+ component = component.substr(1);
+ }
+ else if (component.charCodeAt(0) === 63) {
+ subpattern += "[^./]";
+ component = component.substr(1);
+ }
+ }
+ subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter);
+ }
+ hasWrittenComponent = true;
+ }
+ while (optionalCount > 0) {
+ subpattern += ")?";
+ optionalCount--;
+ }
+ return subpattern;
+ }
function replaceWildCardCharacterFiles(match) {
return replaceWildcardCharacter(match, singleAsteriskRegexFragmentFiles);
}
@@ -1529,25 +1597,30 @@ var ts;
for (var _i = 0, includes_1 = includes; _i < includes_1.length; _i++) {
var include = includes_1[_i];
var absolute = isRootedDiskPath(include) ? include : normalizePath(combinePaths(path, include));
- var wildcardOffset = indexOfAnyCharCode(absolute, wildcardCharCodes);
- var includeBasePath = wildcardOffset < 0
- ? removeTrailingDirectorySeparator(getDirectoryPath(absolute))
- : absolute.substring(0, absolute.lastIndexOf(ts.directorySeparator, wildcardOffset));
- includeBasePaths.push(includeBasePath);
+ includeBasePaths.push(getIncludeBasePath(absolute));
}
includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive);
- include: for (var i = 0; i < includeBasePaths.length; i++) {
- var includeBasePath = includeBasePaths[i];
- for (var j = 0; j < basePaths.length; j++) {
- if (containsPath(basePaths[j], includeBasePath, path, !useCaseSensitiveFileNames)) {
- continue include;
- }
+ var _loop_1 = function (includeBasePath) {
+ if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) {
+ basePaths.push(includeBasePath);
}
- basePaths.push(includeBasePath);
+ };
+ for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) {
+ var includeBasePath = includeBasePaths_1[_a];
+ _loop_1(includeBasePath);
}
}
return basePaths;
}
+ function getIncludeBasePath(absolute) {
+ var wildcardOffset = indexOfAnyCharCode(absolute, wildcardCharCodes);
+ if (wildcardOffset < 0) {
+ return !hasExtension(absolute)
+ ? absolute
+ : removeTrailingDirectorySeparator(getDirectoryPath(absolute));
+ }
+ return absolute.substring(0, absolute.lastIndexOf(ts.directorySeparator, wildcardOffset));
+ }
function ensureScriptKind(fileName, scriptKind) {
return (scriptKind || getScriptKindFromFileName(fileName)) || 3;
}
@@ -1647,10 +1720,6 @@ var ts;
return path.substring(0, path.length - extension.length);
}
ts.removeExtension = removeExtension;
- function isJsxOrTsxExtension(ext) {
- return ext === ".jsx" || ext === ".tsx";
- }
- ts.isJsxOrTsxExtension = isJsxOrTsxExtension;
function changeExtension(path, newExtension) {
return (removeFileExtension(path) + newExtension);
}
@@ -1796,6 +1865,30 @@ var ts;
return !(pos >= 0);
}
ts.positionIsSynthesized = positionIsSynthesized;
+ function extensionIsTypeScript(ext) {
+ return ext <= ts.Extension.LastTypeScriptExtension;
+ }
+ ts.extensionIsTypeScript = extensionIsTypeScript;
+ function extensionFromPath(path) {
+ if (fileExtensionIs(path, ".d.ts")) {
+ return ts.Extension.Dts;
+ }
+ if (fileExtensionIs(path, ".ts")) {
+ return ts.Extension.Ts;
+ }
+ if (fileExtensionIs(path, ".tsx")) {
+ return ts.Extension.Tsx;
+ }
+ if (fileExtensionIs(path, ".js")) {
+ return ts.Extension.Js;
+ }
+ if (fileExtensionIs(path, ".jsx")) {
+ return ts.Extension.Jsx;
+ }
+ Debug.fail("File " + path + " has unknown extension.");
+ return ts.Extension.Js;
+ }
+ ts.extensionFromPath = extensionFromPath;
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -2090,6 +2183,7 @@ var ts;
function getDirectories(path) {
return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1); });
}
+ var noOpFileWatcher = { close: ts.noop };
var nodeSystem = {
args: process.argv.slice(2),
newLine: _os.EOL,
@@ -2099,7 +2193,7 @@ var ts;
},
readFile: readFile,
writeFile: writeFile,
- watchFile: function (fileName, callback) {
+ watchFile: function (fileName, callback, pollingInterval) {
if (useNonPollingWatchers) {
var watchedFile_1 = watchedFileSet.addFile(fileName, callback);
return {
@@ -2107,7 +2201,7 @@ var ts;
};
}
else {
- _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged);
+ _fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);
return {
close: function () { return _fs.unwatchFile(fileName, fileChanged); }
};
@@ -2122,7 +2216,7 @@ var ts;
watchDirectory: function (directoryName, callback, recursive) {
var options;
if (!directoryExists(directoryName)) {
- return;
+ return noOpFileWatcher;
}
if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) {
options = { persistent: true, recursive: !!recursive };
@@ -2319,7 +2413,7 @@ var ts;
A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: ts.DiagnosticCategory.Error, key: "A_set_accessor_parameter_cannot_have_an_initializer_1052", message: "A 'set' accessor parameter cannot have an initializer." },
A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: ts.DiagnosticCategory.Error, key: "A_set_accessor_cannot_have_rest_parameter_1053", message: "A 'set' accessor cannot have rest parameter." },
A_get_accessor_cannot_have_parameters: { code: 1054, category: ts.DiagnosticCategory.Error, key: "A_get_accessor_cannot_have_parameters_1054", message: "A 'get' accessor cannot have parameters." },
- Type_0_is_not_a_valid_async_function_return_type: { code: 1055, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_valid_async_function_return_type_1055", message: "Type '{0}' is not a valid async function return type." },
+ Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: { code: 1055, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055", message: "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value." },
Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056", message: "Accessors are only available when targeting ECMAScript 5 and higher." },
An_async_function_or_method_must_have_a_valid_awaitable_return_type: { code: 1057, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057", message: "An async function or method must have a valid awaitable return type." },
Operand_for_await_does_not_have_a_valid_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "Operand_for_await_does_not_have_a_valid_callable_then_member_1058", message: "Operand for 'await' does not have a valid callable 'then' member." },
@@ -2546,14 +2640,14 @@ var ts;
Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." },
A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." },
An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." },
- The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer_2357", message: "The operand of an increment or decrement operator must be a variable, property or indexer." },
+ The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." },
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", message: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." },
The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", message: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." },
The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360", message: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." },
The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" },
The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362", message: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." },
The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", message: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." },
- Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_of_assignment_expression_2364", message: "Invalid left-hand side of assignment expression." },
+ The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: { code: 2364, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", message: "The left-hand side of an assignment expression must be a variable or a property access." },
Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: "Operator_0_cannot_be_applied_to_types_1_and_2_2365", message: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." },
Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", message: "Function lacks ending return statement and return type does not include 'undefined'." },
Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'" },
@@ -2593,7 +2687,7 @@ var ts;
Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: ts.DiagnosticCategory.Error, key: "Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403", message: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." },
The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", message: "The left-hand side of a 'for...in' statement cannot use a type annotation." },
The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405", message: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." },
- Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_in_for_in_statement_2406", message: "Invalid left-hand side in 'for...in' statement." },
+ The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: { code: 2406, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", message: "The left-hand side of a 'for...in' statement must be a variable or a property access." },
The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", message: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." },
Setters_cannot_return_a_value: { code: 2408, category: ts.DiagnosticCategory.Error, key: "Setters_cannot_return_a_value_2408", message: "Setters cannot return a value." },
Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class" },
@@ -2631,8 +2725,6 @@ var ts;
Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", message: "Property '{0}' is protected and only accessible through an instance of class '{1}'." },
The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", message: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." },
Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: "Block_scoped_variable_0_used_before_its_declaration_2448", message: "Block-scoped variable '{0}' used before its declaration." },
- The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property: { code: 2449, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property_2449", message: "The operand of an increment or decrement operator cannot be a constant or a read-only property." },
- Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property_2450", message: "Left-hand side of assignment expression cannot be a constant or a read-only property." },
Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_block_scoped_variable_0_2451", message: "Cannot redeclare block-scoped variable '{0}'." },
An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: "An_enum_member_cannot_have_a_numeric_name_2452", message: "An enum member cannot have a numeric name." },
The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", message: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." },
@@ -2644,7 +2736,7 @@ var ts;
Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_and_no_string_index_signature_2459", message: "Type '{0}' has no property '{1}' and no string index signature." },
Type_0_has_no_property_1: { code: 2460, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_2460", message: "Type '{0}' has no property '{1}'." },
Type_0_is_not_an_array_type: { code: 2461, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_2461", message: "Type '{0}' is not an array type." },
- A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_an_array_destructuring_pattern_2462", message: "A rest element must be last in an array destructuring pattern" },
+ A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", message: "A rest element must be last in a destructuring pattern" },
A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: ts.DiagnosticCategory.Error, key: "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463", message: "A binding pattern parameter cannot be optional in an implementation signature." },
A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464", message: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." },
this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_a_computed_property_name_2465", message: "'this' cannot be referenced in a computed property name." },
@@ -2666,9 +2758,7 @@ var ts;
Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", message: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." },
The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", message: "The left-hand side of a 'for...of' statement cannot use a type annotation." },
Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'" },
- The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property: { code: 2485, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property_2485", message: "The left-hand side of a 'for...of' statement cannot be a constant or a read-only property." },
- The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property: { code: 2486, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property_2486", message: "The left-hand side of a 'for...in' statement cannot be a constant or a read-only property." },
- Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_in_for_of_statement_2487", message: "Invalid left-hand side in 'for...of' statement." },
+ The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: { code: 2487, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", message: "The left-hand side of a 'for...of' statement must be a variable or a property access." },
Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", message: "Type must have a '[Symbol.iterator]()' method that returns an iterator." },
An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: "An_iterator_must_have_a_next_method_2489", message: "An iterator must have a 'next()' method." },
The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", message: "The type returned by the 'next()' method of an iterator must have a 'value' property." },
@@ -2715,6 +2805,13 @@ var ts;
Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." },
A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." },
Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." },
+ Type_0_is_not_constrained_to_keyof_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_constrained_to_keyof_1_2536", message: "Type '{0}' is not constrained to 'keyof {1}'." },
+ Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." },
+ Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." },
+ Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." },
+ Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." },
+ The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." },
+ Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." },
JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." },
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." },
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." },
@@ -2738,6 +2835,7 @@ var ts;
Cannot_find_name_0_Did_you_mean_the_static_member_1_0: { code: 2662, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662", message: "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?" },
Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: { code: 2663, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663", message: "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?" },
Invalid_module_name_in_augmentation_module_0_cannot_be_found: { code: 2664, category: ts.DiagnosticCategory.Error, key: "Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664", message: "Invalid module name in augmentation, module '{0}' cannot be found." },
+ Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented: { code: 2665, category: ts.DiagnosticCategory.Error, key: "Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augm_2665", message: "Invalid module name in augmentation. Module '{0}' resolves to an untyped module at '{1}', which cannot be augmented." },
Exports_and_export_assignments_are_not_permitted_in_module_augmentations: { code: 2666, category: ts.DiagnosticCategory.Error, key: "Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666", message: "Exports and export assignments are not permitted in module augmentations." },
Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: { code: 2667, category: ts.DiagnosticCategory.Error, key: "Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667", message: "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module." },
export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: { code: 2668, category: ts.DiagnosticCategory.Error, key: "export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668", message: "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible." },
@@ -2769,6 +2867,9 @@ var ts;
Namespace_0_has_no_exported_member_1: { code: 2694, category: ts.DiagnosticCategory.Error, key: "Namespace_0_has_no_exported_member_1_2694", message: "Namespace '{0}' has no exported member '{1}'." },
Left_side_of_comma_operator_is_unused_and_has_no_side_effects: { code: 2695, category: ts.DiagnosticCategory.Error, key: "Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695", message: "Left side of comma operator is unused and has no side effects." },
The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", message: "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" },
+ An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." },
+ Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." },
+ Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -2868,6 +2969,7 @@ var ts;
Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", message: "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'." },
File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5065, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065", message: "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'." },
Substitutions_for_pattern_0_shouldn_t_be_an_empty_array: { code: 5066, category: ts.DiagnosticCategory.Error, key: "Substitutions_for_pattern_0_shouldn_t_be_an_empty_array_5066", message: "Substitutions for pattern '{0}' shouldn't be an empty array." },
+ Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name: { code: 5067, category: ts.DiagnosticCategory.Error, key: "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067", message: "Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name." },
Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate_and_emit_output_to_single_file_6001", message: "Concatenate and emit output to single file." },
Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_d_ts_file_6002", message: "Generates corresponding '.d.ts' file." },
Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specify the location where debugger should locate map files instead of generated locations." },
@@ -2951,7 +3053,7 @@ var ts;
File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." },
Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." },
Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." },
- package_json_does_not_have_types_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_types_field_6100", message: "'package.json' does not have 'types' field." },
+ package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." },
package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." },
Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: "Allow_javascript_files_to_be_compiled_6102", message: "Allow javascript files to be compiled." },
Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: "Option_0_should_have_array_of_strings_as_a_value_6103", message: "Option '{0}' should have array of strings as a value." },
@@ -2988,11 +3090,16 @@ var ts;
Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_locals_6134", message: "Report errors on unused locals." },
Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_parameters_6135", message: "Report errors on unused parameters." },
The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files" },
- No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json' but 'allowJs' is set, so returning 'main' value of '{0}'" },
+ No_types_specified_in_package_json_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json', so returning 'main' value of '{0}'" },
Property_0_is_declared_but_never_used: { code: 6138, category: ts.DiagnosticCategory.Error, key: "Property_0_is_declared_but_never_used_6138", message: "Property '{0}' is declared but never used." },
Import_emit_helpers_from_tslib: { code: 6139, category: ts.DiagnosticCategory.Message, key: "Import_emit_helpers_from_tslib_6139", message: "Import emit helpers from 'tslib'." },
Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { code: 6140, category: ts.DiagnosticCategory.Error, key: "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", message: "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'." },
Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", message: "Parse in strict mode and emit \"use strict\" for each source file" },
+ Module_0_was_resolved_to_1_but_jsx_is_not_set: { code: 6142, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", message: "Module '{0}' was resolved to '{1}', but '--jsx' is not set." },
+ Module_0_was_resolved_to_1_but_allowJs_is_not_set: { code: 6143, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143", message: "Module '{0}' was resolved to '{1}', but '--allowJs' is not set." },
+ Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." },
+ Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." },
+ Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." },
@@ -3001,7 +3108,8 @@ var ts;
Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: ts.DiagnosticCategory.Error, key: "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", message: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." },
Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: ts.DiagnosticCategory.Error, key: "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", message: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." },
Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: { code: 7015, category: ts.DiagnosticCategory.Error, key: "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", message: "Element implicitly has an 'any' type because index expression is not of type 'number'." },
- Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: ts.DiagnosticCategory.Error, key: "Index_signature_of_object_type_implicitly_has_an_any_type_7017", message: "Index signature of object type implicitly has an 'any' type." },
+ Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type: { code: 7016, category: ts.DiagnosticCategory.Error, key: "Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type_7016", message: "Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type." },
+ Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature: { code: 7017, category: ts.DiagnosticCategory.Error, key: "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017", message: "Element implicitly has an 'any' type because type '{0}' has no index signature." },
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object_literal_s_property_0_implicitly_has_an_1_type_7018", message: "Object literal's property '{0}' implicitly has an '{1}' type." },
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest_parameter_0_implicitly_has_an_any_type_7019", message: "Rest parameter '{0}' implicitly has an 'any[]' type." },
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020", message: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
@@ -3058,6 +3166,7 @@ var ts;
Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" },
Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" },
Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" },
+ Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
};
})(ts || (ts = {}));
var ts;
@@ -3090,7 +3199,7 @@ var ts;
"false": 85,
"finally": 86,
"for": 87,
- "from": 137,
+ "from": 138,
"function": 88,
"get": 124,
"if": 89,
@@ -3100,34 +3209,35 @@ var ts;
"instanceof": 92,
"interface": 108,
"is": 125,
+ "keyof": 126,
"let": 109,
- "module": 126,
- "namespace": 127,
- "never": 128,
+ "module": 127,
+ "namespace": 128,
+ "never": 129,
"new": 93,
"null": 94,
- "number": 131,
+ "number": 132,
"package": 110,
"private": 111,
"protected": 112,
"public": 113,
- "readonly": 129,
- "require": 130,
- "global": 138,
+ "readonly": 130,
+ "require": 131,
+ "global": 139,
"return": 95,
- "set": 132,
+ "set": 133,
"static": 114,
- "string": 133,
+ "string": 134,
"super": 96,
"switch": 97,
- "symbol": 134,
+ "symbol": 135,
"this": 98,
"throw": 99,
"true": 100,
"try": 101,
- "type": 135,
+ "type": 136,
"typeof": 102,
- "undefined": 136,
+ "undefined": 137,
"var": 103,
"void": 104,
"while": 105,
@@ -3135,7 +3245,7 @@ var ts;
"yield": 115,
"async": 119,
"await": 120,
- "of": 139,
+ "of": 140,
"{": 16,
"}": 17,
"(": 18,
@@ -4522,9 +4632,9 @@ var ts;
pos++;
return token = 22;
}
- if (isIdentifierStart(ch, 4)) {
+ if (isIdentifierStart(ch, 5)) {
pos++;
- while (isIdentifierPart(text.charCodeAt(pos), 4) && pos < end) {
+ while (isIdentifierPart(text.charCodeAt(pos), 5) && pos < end) {
pos++;
}
return token = 70;
@@ -4683,6 +4793,11 @@ var ts;
type: "string",
description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit
},
+ {
+ name: "jsxFactory",
+ type: "string",
+ description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h
+ },
{
name: "listFiles",
type: "boolean",
@@ -4870,6 +4985,7 @@ var ts;
"es2015": 2,
"es2016": 3,
"es2017": 4,
+ "esnext": 5,
}),
description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015,
paramType: ts.Diagnostics.VERSION,
@@ -5026,7 +5142,8 @@ var ts;
"es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts",
"es2016.array.include": "lib.es2016.array.include.d.ts",
"es2017.object": "lib.es2017.object.d.ts",
- "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts"
+ "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts",
+ "es2017.string": "lib.es2017.string.d.ts",
}),
},
description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon
@@ -5513,9 +5630,7 @@ var ts;
return options;
}
function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
- var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
- ? { enableAutoDiscovery: true, include: [], exclude: [] }
- : { enableAutoDiscovery: false, include: [], exclude: [] };
+ var options = { enableAutoDiscovery: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors);
return options;
}
@@ -5646,14 +5761,13 @@ var ts;
var recursiveKeys = [];
for (var _i = 0, include_1 = include; _i < include_1.length; _i++) {
var file = include_1[_i];
- var name_6 = ts.normalizePath(ts.combinePaths(path, file));
- if (excludeRegex && excludeRegex.test(name_6)) {
+ var spec = ts.normalizePath(ts.combinePaths(path, file));
+ if (excludeRegex && excludeRegex.test(spec)) {
continue;
}
- var match = wildcardDirectoryPattern.exec(name_6);
+ var match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames);
if (match) {
- var key = useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase();
- var flags = watchRecursivePattern.test(name_6) ? 1 : 0;
+ var key = match.key, flags = match.flags;
var existingFlags = wildcardDirectories[key];
if (existingFlags === undefined || existingFlags < flags) {
wildcardDirectories[key] = flags;
@@ -5674,6 +5788,19 @@ var ts;
}
return wildcardDirectories;
}
+ function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames) {
+ var match = wildcardDirectoryPattern.exec(spec);
+ if (match) {
+ return {
+ key: useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase(),
+ flags: watchRecursivePattern.test(spec) ? 1 : 0
+ };
+ }
+ if (ts.isImplicitGlob(spec)) {
+ return { key: spec, flags: 1 };
+ }
+ return undefined;
+ }
function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) {
var extensionPriority = ts.getExtensionPriority(file, extensions);
var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority);
@@ -5742,7 +5869,7 @@ var ts;
mergeTypings(typingOptions.include);
exclude = typingOptions.exclude || [];
var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
- if (projectRootPath !== undefined) {
+ if (projectRootPath) {
possibleSearchDirs.push(projectRootPath);
}
searchDirs = ts.deduplicate(possibleSearchDirs);
@@ -5765,9 +5892,9 @@ var ts;
}
}
}
- for (var name_7 in packageNameToTypingLocation) {
- if (name_7 in inferredTypings && !inferredTypings[name_7]) {
- inferredTypings[name_7] = packageNameToTypingLocation[name_7];
+ for (var name_6 in packageNameToTypingLocation) {
+ if (name_6 in inferredTypings && !inferredTypings[name_6]) {
+ inferredTypings[name_6] = packageNameToTypingLocation[name_6];
}
}
for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) {
@@ -5903,24 +6030,50 @@ var ts;
return compilerOptions.traceResolution && host.trace !== undefined;
}
ts.isTraceEnabled = isTraceEnabled;
- function createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations) {
- return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations };
+ function resolvedTypeScriptOnly(resolved) {
+ if (!resolved) {
+ return undefined;
+ }
+ ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension));
+ return resolved.path;
+ }
+ function resolvedFromAnyFile(path) {
+ return { path: path, extension: ts.extensionFromPath(path) };
+ }
+ function resolvedModuleFromResolved(_a, isExternalLibraryImport) {
+ var path = _a.path, extension = _a.extension;
+ return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport };
+ }
+ function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations) {
+ return { resolvedModule: resolved && resolvedModuleFromResolved(resolved, isExternalLibraryImport), failedLookupLocations: failedLookupLocations };
}
- ts.createResolvedModule = createResolvedModule;
function moduleHasNonRelativeName(moduleName) {
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
}
- function tryReadTypesSection(packageJsonPath, baseDirectory, state) {
+ function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) {
var jsonContent = readJson(packageJsonPath, state.host);
+ switch (extensions) {
+ case 2:
+ case 0:
+ return tryReadFromField("typings") || tryReadFromField("types");
+ case 1:
+ if (typeof jsonContent.main === "string") {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main);
+ }
+ return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main));
+ }
+ return undefined;
+ }
function tryReadFromField(fieldName) {
if (ts.hasProperty(jsonContent, fieldName)) {
var typesFile = jsonContent[fieldName];
if (typeof typesFile === "string") {
- var typesFilePath_1 = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile));
+ var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile));
if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath_1);
+ trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath);
}
- return typesFilePath_1;
+ return typesFilePath;
}
else {
if (state.traceEnabled) {
@@ -5929,18 +6082,6 @@ var ts;
}
}
}
- var typesFilePath = tryReadFromField("typings") || tryReadFromField("types");
- if (typesFilePath) {
- return typesFilePath;
- }
- if (state.compilerOptions.allowJs && jsonContent.main && typeof jsonContent.main === "string") {
- if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0, jsonContent.main);
- }
- var mainFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main));
- return mainFilePath;
- }
- return undefined;
}
function readJson(path, host) {
try {
@@ -5951,7 +6092,6 @@ var ts;
return {};
}
}
- var typeReferenceExtensions = [".d.ts"];
function getEffectiveTypeRoots(options, host) {
if (options.typeRoots) {
return options.typeRoots;
@@ -5990,7 +6130,6 @@ var ts;
var moduleResolutionState = {
compilerOptions: options,
host: host,
- skipTsx: true,
traceEnabled: traceEnabled
};
var typeRoots = getEffectiveTypeRoots(options, host);
@@ -6017,18 +6156,17 @@ var ts;
if (traceEnabled) {
trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", "));
}
- var primarySearchPaths = typeRoots;
- for (var _i = 0, primarySearchPaths_1 = primarySearchPaths; _i < primarySearchPaths_1.length; _i++) {
- var typeRoot = primarySearchPaths_1[_i];
+ for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) {
+ var typeRoot = typeRoots_1[_i];
var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName);
var candidateDirectory = ts.getDirectoryPath(candidate);
- var resolvedFile_1 = loadNodeModuleFromDirectory(typeReferenceExtensions, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState);
- if (resolvedFile_1) {
+ var resolved = resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState));
+ if (resolved) {
if (traceEnabled) {
- trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile_1, true);
+ trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolved, true);
}
return {
- resolvedTypeReferenceDirective: { primary: true, resolvedFileName: resolvedFile_1 },
+ resolvedTypeReferenceDirective: { primary: true, resolvedFileName: resolved },
failedLookupLocations: failedLookupLocations
};
}
@@ -6040,15 +6178,12 @@ var ts;
}
}
var resolvedFile;
- var initialLocationForSecondaryLookup;
- if (containingFile) {
- initialLocationForSecondaryLookup = ts.getDirectoryPath(containingFile);
- }
+ var initialLocationForSecondaryLookup = containingFile && ts.getDirectoryPath(containingFile);
if (initialLocationForSecondaryLookup !== undefined) {
if (traceEnabled) {
trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
}
- resolvedFile = loadModuleFromNodeModules(typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, false);
+ resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, false));
if (traceEnabled) {
if (resolvedFile) {
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile, false);
@@ -6064,9 +6199,7 @@ var ts;
}
}
return {
- resolvedTypeReferenceDirective: resolvedFile
- ? { primary: false, resolvedFileName: resolvedFile }
- : undefined,
+ resolvedTypeReferenceDirective: resolvedFile ? { primary: false, resolvedFileName: resolvedFile } : undefined,
failedLookupLocations: failedLookupLocations
};
}
@@ -6079,8 +6212,8 @@ var ts;
if (host.directoryExists && host.getDirectories) {
var typeRoots = getEffectiveTypeRoots(options, host);
if (typeRoots) {
- for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) {
- var root = typeRoots_1[_i];
+ for (var _i = 0, typeRoots_2 = typeRoots; _i < typeRoots_2.length; _i++) {
+ var root = typeRoots_2[_i];
if (host.directoryExists(root)) {
for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) {
var typeDirectivePath = _b[_a];
@@ -6135,15 +6268,15 @@ var ts;
return result;
}
ts.resolveModuleName = resolveModuleName;
- function tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) {
+ function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) {
if (moduleHasNonRelativeName(moduleName)) {
- return tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state);
+ return tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state);
}
else {
- return tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state);
+ return tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state);
}
}
- function tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) {
+ function tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) {
if (!state.compilerOptions.rootDirs) {
return undefined;
}
@@ -6177,7 +6310,7 @@ var ts;
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate);
}
- var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state);
+ var resolvedFileName = loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state);
if (resolvedFileName) {
return resolvedFileName;
}
@@ -6194,7 +6327,7 @@ var ts;
trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1);
}
var baseDirectory = ts.getDirectoryPath(candidate_1);
- var resolvedFileName_1 = loader(candidate_1, supportedExtensions, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state);
+ var resolvedFileName_1 = loader(extensions, candidate_1, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state);
if (resolvedFileName_1) {
return resolvedFileName_1;
}
@@ -6205,7 +6338,7 @@ var ts;
}
return undefined;
}
- function tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state) {
+ function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state) {
if (!state.compilerOptions.baseUrl) {
return undefined;
}
@@ -6232,9 +6365,9 @@ var ts;
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path);
}
- var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
- if (resolvedFileName) {
- return resolvedFileName;
+ var resolved = loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
+ if (resolved) {
+ return resolved;
}
}
return undefined;
@@ -6244,53 +6377,63 @@ var ts;
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate);
}
- return loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
+ return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
}
}
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) {
var containingDirectory = ts.getDirectoryPath(containingFile);
- var supportedExtensions = ts.getSupportedExtensions(compilerOptions);
var traceEnabled = isTraceEnabled(compilerOptions, host);
var failedLookupLocations = [];
- var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: false };
- var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, supportedExtensions, state);
- var isExternalLibraryImport = false;
- if (!resolvedFileName) {
+ var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };
+ var result = tryResolve(0) || tryResolve(1);
+ if (result) {
+ var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport;
+ return createResolvedModuleWithFailedLookupLocations(resolved && resolvedWithRealpath(resolved, host, traceEnabled), isExternalLibraryImport, failedLookupLocations);
+ }
+ return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
+ function tryResolve(extensions) {
+ var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state);
+ if (resolved) {
+ return { resolved: resolved, isExternalLibraryImport: false };
+ }
if (moduleHasNonRelativeName(moduleName)) {
if (traceEnabled) {
trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName);
}
- resolvedFileName = loadModuleFromNodeModules(moduleName, containingDirectory, failedLookupLocations, state, false);
- isExternalLibraryImport = resolvedFileName !== undefined;
+ var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, false);
+ return resolved_1 && { resolved: resolved_1, isExternalLibraryImport: true };
}
else {
var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
- resolvedFileName = nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, false, state);
+ var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state);
+ return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false };
}
}
- if (resolvedFileName && host.realpath) {
- var originalFileName = resolvedFileName;
- resolvedFileName = ts.normalizePath(host.realpath(resolvedFileName));
- if (traceEnabled) {
- trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, originalFileName, resolvedFileName);
- }
- }
- return createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations);
}
ts.nodeModuleNameResolver = nodeModuleNameResolver;
- function nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state) {
+ function resolvedWithRealpath(resolved, host, traceEnabled) {
+ if (!host.realpath) {
+ return resolved;
+ }
+ var real = ts.normalizePath(host.realpath(resolved.path));
+ if (traceEnabled) {
+ trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, resolved.path, real);
+ }
+ return { path: real, extension: resolved.extension };
+ }
+ function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate);
}
- var resolvedFileName = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state);
- return resolvedFileName || loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, onlyRecordFailures, state);
+ var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state);
+ return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state);
}
function directoryProbablyExists(directoryName, host) {
return !host.directoryExists || host.directoryExists(directoryName);
}
ts.directoryProbablyExists = directoryProbablyExists;
- function loadModuleFromFile(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) {
- var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocation, onlyRecordFailures, state);
+ function loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {
+ var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state);
if (resolvedByAddingExtension) {
return resolvedByAddingExtension;
}
@@ -6300,19 +6443,28 @@ var ts;
var extension = candidate.substring(extensionless.length);
trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
}
- return tryAddingExtensions(extensionless, extensions, failedLookupLocation, onlyRecordFailures, state);
+ return tryAddingExtensions(extensionless, extensions, failedLookupLocations, onlyRecordFailures, state);
}
}
- function tryAddingExtensions(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) {
+ function tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state) {
if (!onlyRecordFailures) {
var directory = ts.getDirectoryPath(candidate);
if (directory) {
onlyRecordFailures = !directoryProbablyExists(directory, state.host);
}
}
- return ts.forEach(extensions, function (ext) {
- return !(state.skipTsx && ts.isJsxOrTsxExtension(ext)) && tryFile(candidate + ext, failedLookupLocation, onlyRecordFailures, state);
- });
+ switch (extensions) {
+ case 2:
+ return tryExtension(".d.ts", ts.Extension.Dts);
+ case 0:
+ return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts);
+ case 1:
+ return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx);
+ }
+ function tryExtension(ext, extension) {
+ var path = tryFile(candidate + ext, failedLookupLocations, onlyRecordFailures, state);
+ return path && { path: path, extension: extension };
+ }
}
function tryFile(fileName, failedLookupLocation, onlyRecordFailures, state) {
if (!onlyRecordFailures && state.host.fileExists(fileName)) {
@@ -6336,18 +6488,21 @@ var ts;
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
}
- var typesFile = tryReadTypesSection(packageJsonPath, candidate, state);
+ var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state);
if (typesFile) {
var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host);
- var result = tryFile(typesFile, failedLookupLocation, onlyRecordFailures_1, state) ||
- tryAddingExtensions(typesFile, extensions, failedLookupLocation, onlyRecordFailures_1, state);
- if (result) {
- return result;
+ var fromFile = tryFile(typesFile, failedLookupLocation, onlyRecordFailures_1, state);
+ if (fromFile) {
+ return resolvedFromAnyFile(fromFile);
+ }
+ var x = tryAddingExtensions(typesFile, 0, failedLookupLocation, onlyRecordFailures_1, state);
+ if (x) {
+ return x;
}
}
else {
if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.package_json_does_not_have_types_field);
+ trace(state.host, ts.Diagnostics.package_json_does_not_have_a_types_or_main_field);
}
}
}
@@ -6357,85 +6512,76 @@ var ts;
}
failedLookupLocation.push(packageJsonPath);
}
- return loadModuleFromFile(ts.combinePaths(candidate, "index"), extensions, failedLookupLocation, !directoryExists, state);
+ return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocation, !directoryExists, state);
}
function pathToPackageJson(directory) {
return ts.combinePaths(directory, "package.json");
}
- function loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) {
+ function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) {
var nodeModulesFolder = ts.combinePaths(directory, "node_modules");
var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host);
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName));
- var supportedExtensions = ts.getSupportedExtensions(state.compilerOptions);
- var result = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, !nodeModulesFolderExists, state);
- if (result) {
- return result;
- }
- result = loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state);
- if (result) {
- return result;
- }
+ return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) ||
+ loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state);
}
- function loadModuleFromNodeModules(moduleName, directory, failedLookupLocations, state, checkOneLevel) {
- return loadModuleFromNodeModulesWorker(moduleName, directory, failedLookupLocations, state, checkOneLevel, false);
+ function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, checkOneLevel) {
+ return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, checkOneLevel, false);
}
- ts.loadModuleFromNodeModules = loadModuleFromNodeModules;
function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) {
- return loadModuleFromNodeModulesWorker(moduleName, directory, failedLookupLocations, state, false, true);
+ return loadModuleFromNodeModulesWorker(0, moduleName, directory, failedLookupLocations, state, false, true);
}
- function loadModuleFromNodeModulesWorker(moduleName, directory, failedLookupLocations, state, checkOneLevel, typesOnly) {
+ function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, checkOneLevel, typesOnly) {
directory = ts.normalizeSlashes(directory);
while (true) {
- var baseName = ts.getBaseFileName(directory);
- if (baseName !== "node_modules") {
- var packageResult = void 0;
- if (!typesOnly) {
- packageResult = loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state);
- if (packageResult && ts.hasTypeScriptFileExtension(packageResult)) {
- return packageResult;
- }
- }
- var typesResult = loadModuleFromNodeModulesFolder(ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state);
- if (typesResult || packageResult) {
- return typesResult || packageResult;
+ if (ts.getBaseFileName(directory) !== "node_modules") {
+ var resolved = tryInDirectory();
+ if (resolved) {
+ return resolved;
}
}
var parentPath = ts.getDirectoryPath(directory);
if (parentPath === directory || checkOneLevel) {
- break;
+ return undefined;
}
directory = parentPath;
}
- return undefined;
+ function tryInDirectory() {
+ var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state);
+ return packageResult || loadModuleFromNodeModulesFolder(extensions, ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state);
+ }
}
function classicNameResolver(moduleName, containingFile, compilerOptions, host) {
var traceEnabled = isTraceEnabled(compilerOptions, host);
- var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: !compilerOptions.jsx };
+ var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };
var failedLookupLocations = [];
- var supportedExtensions = ts.getSupportedExtensions(compilerOptions);
var containingDirectory = ts.getDirectoryPath(containingFile);
- var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, supportedExtensions, state);
- if (resolvedFileName) {
- return createResolvedModule(resolvedFileName, false, failedLookupLocations);
+ var resolved = tryResolve(0) || tryResolve(1);
+ return createResolvedModuleWithFailedLookupLocations(resolved, false, failedLookupLocations);
+ function tryResolve(extensions) {
+ var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state);
+ if (resolvedUsingSettings) {
+ return resolvedUsingSettings;
+ }
+ if (moduleHasNonRelativeName(moduleName)) {
+ var resolved_3 = loadModuleFromAncestorDirectories(extensions, moduleName, containingDirectory, failedLookupLocations, state);
+ if (resolved_3) {
+ return resolved_3;
+ }
+ if (extensions === 0) {
+ return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state);
+ }
+ }
+ else {
+ var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
+ return loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state);
+ }
}
- var referencedSourceFile;
- if (moduleHasNonRelativeName(moduleName)) {
- referencedSourceFile = referencedSourceFile = loadModuleFromAncestorDirectories(moduleName, containingDirectory, supportedExtensions, failedLookupLocations, state) ||
- loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state);
- }
- else {
- var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
- referencedSourceFile = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, false, state);
- }
- return referencedSourceFile
- ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations }
- : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
}
ts.classicNameResolver = classicNameResolver;
- function loadModuleFromAncestorDirectories(moduleName, containingDirectory, supportedExtensions, failedLookupLocations, state) {
+ function loadModuleFromAncestorDirectories(extensions, moduleName, containingDirectory, failedLookupLocations, state) {
while (true) {
var searchName = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
- var referencedSourceFile = loadModuleFromFile(searchName, supportedExtensions, failedLookupLocations, false, state);
+ var referencedSourceFile = loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state);
if (referencedSourceFile) {
return referencedSourceFile;
}
@@ -6446,6 +6592,18 @@ var ts;
containingDirectory = parentPath;
}
}
+ function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache) {
+ var traceEnabled = isTraceEnabled(compilerOptions, host);
+ if (traceEnabled) {
+ trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache);
+ }
+ var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled };
+ var failedLookupLocations = [];
+ var resolved = loadModuleFromNodeModules(0, moduleName, globalCache, failedLookupLocations, state, true) ||
+ loadModuleFromNodeModules(1, moduleName, globalCache, failedLookupLocations, state, true);
+ return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations);
+ }
+ ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -6461,6 +6619,7 @@ var ts;
var result = ts.resolveModuleName(packageName, ts.combinePaths(cachePath, "index.d.ts"), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, installTypingHost);
return result.resolvedModule && result.resolvedModule.resolvedFileName;
}
+ var PackageNameValidationResult;
(function (PackageNameValidationResult) {
PackageNameValidationResult[PackageNameValidationResult["Ok"] = 0] = "Ok";
PackageNameValidationResult[PackageNameValidationResult["ScopedPackagesNotSupported"] = 1] = "ScopedPackagesNotSupported";
@@ -6469,8 +6628,7 @@ var ts;
PackageNameValidationResult[PackageNameValidationResult["NameStartsWithDot"] = 4] = "NameStartsWithDot";
PackageNameValidationResult[PackageNameValidationResult["NameStartsWithUnderscore"] = 5] = "NameStartsWithUnderscore";
PackageNameValidationResult[PackageNameValidationResult["NameContainsNonURISafeCharacters"] = 6] = "NameContainsNonURISafeCharacters";
- })(typingsInstaller.PackageNameValidationResult || (typingsInstaller.PackageNameValidationResult = {}));
- var PackageNameValidationResult = typingsInstaller.PackageNameValidationResult;
+ })(PackageNameValidationResult = typingsInstaller.PackageNameValidationResult || (typingsInstaller.PackageNameValidationResult = {}));
typingsInstaller.MaxPackageNameLength = 214;
function validatePackageName(packageName) {
if (!packageName) {
@@ -6752,7 +6910,7 @@ var ts;
_this.sendResponse({ projectName: projectName, kind: server.ActionInvalidate });
isInvoked = true;
}
- });
+ }, 2000);
watchers.push(w);
}
this.projectWatchers[projectName] = watchers;
@@ -6773,7 +6931,7 @@ var ts;
};
TypingsInstaller.prototype.executeWithThrottling = function () {
var _this = this;
- var _loop_1 = function () {
+ var _loop_2 = function () {
this_1.inFlightRequestCount++;
var request = this_1.pendingRunRequests.pop();
this_1.installWorker(request.requestId, request.args, request.cwd, function (ok) {
@@ -6784,7 +6942,7 @@ var ts;
};
var this_1 = this;
while (this.inFlightRequestCount < this.throttleLimit && this.pendingRunRequests.length) {
- _loop_1();
+ _loop_2();
}
};
return TypingsInstaller;