Merge branch 'master' into transitiveExports

Conflicts:
	src/compiler/checker.ts
This commit is contained in:
Daniel Rosenwasser
2015-03-25 17:02:58 -07:00
326 changed files with 10061 additions and 2785 deletions
+37 -12
View File
@@ -123,7 +123,7 @@ module ts {
case SyntaxKind.ExportDeclaration:
return "__export";
case SyntaxKind.ExportAssignment:
return "default";
return (<ExportAssignment>node).isExportEquals ? "export=" : "default";
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.ClassDeclaration:
return node.flags & NodeFlags.Default ? "default" : undefined;
@@ -188,14 +188,6 @@ module ts {
return symbol;
}
function isAmbientContext(node: Node): boolean {
while (node) {
if (node.flags & NodeFlags.Ambient) return true;
node = node.parent;
}
return false;
}
function declareModuleMember(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags) {
let hasExportModifier = getCombinedNodeFlags(node) & NodeFlags.Export;
if (symbolKind & SymbolFlags.Alias) {
@@ -218,7 +210,7 @@ module ts {
// 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol,
// but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way
// when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope.
if (hasExportModifier || isAmbientContext(container)) {
if (hasExportModifier || container.flags & NodeFlags.ExportContext) {
let exportKind = (symbolKind & SymbolFlags.Value ? SymbolFlags.ExportValue : 0) |
(symbolKind & SymbolFlags.Type ? SymbolFlags.ExportType : 0) |
(symbolKind & SymbolFlags.Namespace ? SymbolFlags.ExportNamespace : 0);
@@ -311,7 +303,39 @@ module ts {
bindChildren(node, symbolKind, isBlockScopeContainer);
}
function isAmbientContext(node: Node): boolean {
while (node) {
if (node.flags & NodeFlags.Ambient) return true;
node = node.parent;
}
return false;
}
function hasExportDeclarations(node: ModuleDeclaration | SourceFile): boolean {
var body = node.kind === SyntaxKind.SourceFile ? node : (<ModuleDeclaration>node).body;
if (body.kind === SyntaxKind.SourceFile || body.kind === SyntaxKind.ModuleBlock) {
for (let stat of (<Block>body).statements) {
if (stat.kind === SyntaxKind.ExportDeclaration || stat.kind === SyntaxKind.ExportAssignment) {
return true;
}
}
}
return false;
}
function setExportContextFlag(node: ModuleDeclaration | SourceFile) {
// A declaration source file or ambient module declaration that contains no export declarations (but possibly regular
// declarations with export modifiers) is an export context in which declarations are implicitly exported.
if (isAmbientContext(node) && !hasExportDeclarations(node)) {
node.flags |= NodeFlags.ExportContext;
}
else {
node.flags &= ~NodeFlags.ExportContext;
}
}
function bindModuleDeclaration(node: ModuleDeclaration) {
setExportContextFlag(node);
if (node.name.kind === SyntaxKind.StringLiteral) {
bindDeclaration(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes, /*isBlockScopeContainer*/ true);
}
@@ -508,15 +532,16 @@ module ts {
case SyntaxKind.ExportAssignment:
if ((<ExportAssignment>node).expression && (<ExportAssignment>node).expression.kind === SyntaxKind.Identifier) {
// An export default clause with an identifier exports all meanings of that identifier
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.Alias, SymbolFlags.AliasExcludes);
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.Alias, SymbolFlags.PropertyExcludes | SymbolFlags.AliasExcludes);
}
else {
// An export default clause with an expression exports a value
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.Property, SymbolFlags.PropertyExcludes | SymbolFlags.AliasExcludes);
}
bindChildren(node, 0, /*isBlockScopeContainer*/ false);
break;
case SyntaxKind.SourceFile:
setExportContextFlag(<SourceFile>node);
if (isExternalModule(<SourceFile>node)) {
bindAnonymousDeclaration(<SourceFile>node, SymbolFlags.ValueModule, '"' + removeFileExtension((<SourceFile>node).fileName) + '"', /*isBlockScopeContainer*/ true);
break;
+370 -131
View File
@@ -118,11 +118,17 @@ module ts {
let globalIterableType: ObjectType;
let anyArrayType: Type;
let globalTypedPropertyDescriptorType: ObjectType;
let globalClassDecoratorType: ObjectType;
let globalParameterDecoratorType: ObjectType;
let globalPropertyDecoratorType: ObjectType;
let globalMethodDecoratorType: ObjectType;
let tupleTypes: Map<TupleType> = {};
let unionTypes: Map<UnionType> = {};
let stringLiteralTypes: Map<StringLiteralType> = {};
let emitExtends = false;
let emitDecorate = false;
let mergedSymbols: Symbol[] = [];
let symbolLinks: SymbolLinks[] = [];
@@ -292,7 +298,6 @@ module ts {
if (symbol.flags & meaning) {
return symbol;
}
if (symbol.flags & SymbolFlags.Alias) {
let target = resolveAlias(symbol);
// Unknown symbol means an error occurred in alias resolution, treat it as positive answer to avoid cascading errors
@@ -301,7 +306,6 @@ module ts {
}
}
}
// return undefined if we can't find a symbol.
}
@@ -329,6 +333,7 @@ module ts {
let lastLocation: Node;
let propertyWithInvalidInitializer: Node;
let errorLocation = location;
let grandparent: Node;
loop: while (location) {
// Locals of a source file are not in scope (because they get merged into the global symbol table)
@@ -342,7 +347,7 @@ module ts {
if (!isExternalModule(<SourceFile>location)) break;
case SyntaxKind.ModuleDeclaration:
if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & SymbolFlags.ModuleMember)) {
if (!(result.flags & SymbolFlags.Alias && getDeclarationOfAliasSymbol(result).kind === SyntaxKind.ExportSpecifier)) {
if (result.flags & meaning || !(result.flags & SymbolFlags.Alias && getDeclarationOfAliasSymbol(result).kind === SyntaxKind.ExportSpecifier)) {
break loop;
}
result = undefined;
@@ -394,7 +399,7 @@ module ts {
// }
//
case SyntaxKind.ComputedPropertyName:
let grandparent = location.parent.parent;
grandparent = location.parent.parent;
if (grandparent.kind === SyntaxKind.ClassDeclaration || grandparent.kind === SyntaxKind.InterfaceDeclaration) {
// A reference to this grandparent's type parameters would be an error
if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & SymbolFlags.Type)) {
@@ -426,6 +431,28 @@ module ts {
break loop;
}
break;
case SyntaxKind.Decorator:
// Decorators are resolved at the class declaration. Resolving at the parameter
// or member would result in looking up locals in the method.
//
// function y() {}
// class C {
// method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter.
// }
//
if (location.parent && location.parent.kind === SyntaxKind.Parameter) {
location = location.parent;
}
//
// function y() {}
// class C {
// @y method(x, y) {} // <-- decorator y should be resolved at the class declaration, not the method.
// }
//
if (location.parent && isClassElement(location.parent)) {
location = location.parent;
}
break;
}
lastLocation = location;
location = location.parent;
@@ -514,29 +541,13 @@ module ts {
return false;
}
// An alias symbol is created by one of the following declarations:
// import <symbol> = ...
// import <symbol> from ...
// import * as <symbol> from ...
// import { x as <symbol> } from ...
// export { x as <symbol> } from ...
// export default ...
function isAliasSymbolDeclaration(node: Node): boolean {
return node.kind === SyntaxKind.ImportEqualsDeclaration ||
node.kind === SyntaxKind.ImportClause && !!(<ImportClause>node).name ||
node.kind === SyntaxKind.NamespaceImport ||
node.kind === SyntaxKind.ImportSpecifier ||
node.kind === SyntaxKind.ExportSpecifier ||
node.kind === SyntaxKind.ExportAssignment;
}
function getAnyImportSyntax(node: Node): AnyImportSyntax {
if (isAliasSymbolDeclaration(node)) {
if (node.kind === SyntaxKind.ImportEqualsDeclaration) {
return <ImportEqualsDeclaration>node;
}
while (node.kind !== SyntaxKind.ImportDeclaration) {
while (node && node.kind !== SyntaxKind.ImportDeclaration) {
node = node.parent;
}
return <ImportDeclaration>node;
@@ -549,9 +560,7 @@ module ts {
function getTargetOfImportEqualsDeclaration(node: ImportEqualsDeclaration): Symbol {
if (node.moduleReference.kind === SyntaxKind.ExternalModuleReference) {
let moduleSymbol = resolveExternalModuleName(node, getExternalModuleImportEqualsDeclarationExpression(node));
let exportAssignmentSymbol = moduleSymbol && getResolvedExportAssignmentSymbol(moduleSymbol);
return exportAssignmentSymbol || moduleSymbol;
return resolveExternalModuleSymbol(resolveExternalModuleName(node, getExternalModuleImportEqualsDeclarationExpression(node)));
}
return getSymbolOfPartOfRightHandSideOfImportEquals(<EntityName>node.moduleReference, node);
}
@@ -559,29 +568,92 @@ module ts {
function getTargetOfImportClause(node: ImportClause): Symbol {
let moduleSymbol = resolveExternalModuleName(node, (<ImportDeclaration>node.parent).moduleSpecifier);
if (moduleSymbol) {
let exportAssignmentSymbol = getResolvedExportAssignmentSymbol(moduleSymbol);
if (!exportAssignmentSymbol) {
error(node.name, Diagnostics.External_module_0_has_no_default_export_or_export_assignment, symbolToString(moduleSymbol));
let exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]);
if (!exportDefaultSymbol) {
error(node.name, Diagnostics.External_module_0_has_no_default_export, symbolToString(moduleSymbol));
}
return exportAssignmentSymbol;
return exportDefaultSymbol;
}
}
function getTargetOfNamespaceImport(node: NamespaceImport): Symbol {
return resolveExternalModuleName(node, (<ImportDeclaration>node.parent.parent).moduleSpecifier);
var moduleSpecifier = (<ImportDeclaration>node.parent.parent).moduleSpecifier;
return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier);
}
function getMemberOfModuleVariable(moduleSymbol: Symbol, name: string): Symbol {
if (moduleSymbol.flags & SymbolFlags.Variable) {
let typeAnnotation = (<VariableDeclaration>moduleSymbol.valueDeclaration).type;
if (typeAnnotation) {
return getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name);
}
}
}
// This function creates a synthetic symbol that combines the value side of one symbol with the
// type/namespace side of another symbol. Consider this example:
//
// declare module graphics {
// interface Point {
// x: number;
// y: number;
// }
// }
// declare var graphics: {
// Point: new (x: number, y: number) => graphics.Point;
// }
// declare module "graphics" {
// export = graphics;
// }
//
// An 'import { Point } from "graphics"' needs to create a symbol that combines the value side 'Point'
// property with the type/namespace side interface 'Point'.
function combineValueAndTypeSymbols(valueSymbol: Symbol, typeSymbol: Symbol): Symbol {
if (valueSymbol.flags & (SymbolFlags.Type | SymbolFlags.Namespace)) {
return valueSymbol;
}
let result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.name);
result.declarations = concatenate(valueSymbol.declarations, typeSymbol.declarations);
result.parent = valueSymbol.parent || typeSymbol.parent;
if (valueSymbol.valueDeclaration) result.valueDeclaration = valueSymbol.valueDeclaration;
if (typeSymbol.members) result.members = typeSymbol.members;
if (valueSymbol.exports) result.exports = valueSymbol.exports;
return result;
}
function getExportOfModule(symbol: Symbol, name: string): Symbol {
if (symbol.flags & SymbolFlags.Module) {
let exports = getExportsOfSymbol(symbol);
if (hasProperty(exports, name)) {
return resolveSymbol(exports[name]);
}
}
}
function getPropertyOfVariable(symbol: Symbol, name: string): Symbol {
if (symbol.flags & SymbolFlags.Variable) {
var typeAnnotation = (<VariableDeclaration>symbol.valueDeclaration).type;
if (typeAnnotation) {
return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name));
}
}
}
function getExternalModuleMember(node: ImportDeclaration | ExportDeclaration, specifier: ImportOrExportSpecifier): Symbol {
let moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
if (moduleSymbol) {
let targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier);
if (targetSymbol) {
let name = specifier.propertyName || specifier.name;
if (name.text) {
let symbol = getSymbol(getExportsOfSymbol(moduleSymbol), name.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace);
let symbolFromModule = getExportOfModule(targetSymbol, name.text);
let symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text);
let symbol = symbolFromModule && symbolFromVariable ?
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
symbolFromModule || symbolFromVariable;
if (!symbol) {
error(name, Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), declarationNameToString(name));
return;
}
return symbol.flags & (SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace) ? symbol : resolveAlias(symbol);
return symbol;
}
}
}
@@ -600,7 +672,7 @@ module ts {
return node.expression && resolveEntityName(<Identifier>node.expression, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace);
}
function getTargetOfImportDeclaration(node: Declaration): Symbol {
function getTargetOfAliasDeclaration(node: Declaration): Symbol {
switch (node.kind) {
case SyntaxKind.ImportEqualsDeclaration:
return getTargetOfImportEqualsDeclaration(<ImportEqualsDeclaration>node);
@@ -617,13 +689,17 @@ module ts {
}
}
function resolveSymbol(symbol: Symbol): Symbol {
return symbol && symbol.flags & SymbolFlags.Alias && !(symbol.flags & (SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace)) ? resolveAlias(symbol) : symbol;
}
function resolveAlias(symbol: Symbol): Symbol {
Debug.assert((symbol.flags & SymbolFlags.Alias) !== 0, "Should only get Alias here.");
let links = getSymbolLinks(symbol);
if (!links.target) {
links.target = resolvingSymbol;
let node = getDeclarationOfAliasSymbol(symbol);
let target = getTargetOfImportDeclaration(node);
let target = getTargetOfAliasDeclaration(node);
if (links.target === resolvingSymbol) {
links.target = target || unknownSymbol;
}
@@ -754,7 +830,6 @@ module ts {
return symbol;
}
}
let sourceFile: SourceFile;
while (true) {
let fileName = normalizePath(combinePaths(searchPath, moduleName));
@@ -762,12 +837,10 @@ module ts {
if (sourceFile || isRelative) {
break;
}
let parentPath = getDirectoryPath(searchPath);
if (parentPath === searchPath) {
break;
}
searchPath = parentPath;
}
if (sourceFile) {
@@ -780,25 +853,30 @@ module ts {
error(moduleReferenceLiteral, Diagnostics.Cannot_find_external_module_0, moduleName);
}
function getExportAssignmentSymbol(moduleSymbol: Symbol): Symbol {
return moduleSymbol.exports["default"];
// An external module with an 'export =' declaration resolves to the target of the 'export =' declaration,
// and an external module with no 'export =' declaration resolves to the module itself.
function resolveExternalModuleSymbol(moduleSymbol: Symbol): Symbol {
return moduleSymbol && resolveSymbol(moduleSymbol.exports["export="]) || moduleSymbol;
}
function getResolvedExportAssignmentSymbol(moduleSymbol: Symbol): Symbol {
let symbol = getExportAssignmentSymbol(moduleSymbol);
if (symbol) {
if (symbol.flags & (SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace)) {
return symbol;
}
if (symbol.flags & SymbolFlags.Alias) {
return resolveAlias(symbol);
}
// An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export ='
// references a symbol that is at least declared as a module or a variable. The target of the 'export =' may
// combine other declarations with the module or variable (e.g. a class/module, function/module, interface/variable).
function resolveESModuleSymbol(moduleSymbol: Symbol, moduleReferenceExpression: Expression): Symbol {
let symbol = resolveExternalModuleSymbol(moduleSymbol);
if (symbol && !(symbol.flags & (SymbolFlags.Module | SymbolFlags.Variable))) {
error(moduleReferenceExpression, Diagnostics.External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol));
symbol = undefined;
}
return symbol;
}
function getExportAssignmentSymbol(moduleSymbol: Symbol): Symbol {
return moduleSymbol.exports["export="];
}
function getExportsOfSymbol(symbol: Symbol): SymbolTable {
// TODO (drosen): Why do we not use getExportsOfModule for exteral modules as weel?
return symbol.flags & SymbolFlags.Module ? getExportsOfModule(symbol) : symbol.exports;
return symbol.flags & SymbolFlags.Module ? getExportsOfModule(symbol) : symbol.exports || emptySymbols;
}
function getExportsOfModule(moduleSymbol: Symbol): SymbolTable {
@@ -815,15 +893,6 @@ module ts {
}
function getExportsForModule(moduleSymbol: Symbol): SymbolTable {
if (languageVersion < ScriptTarget.ES6) {
// A default export hides all other exports in CommonJS and AMD modules
let defaultSymbol = getExportAssignmentSymbol(moduleSymbol);
if (defaultSymbol) {
return {
"default": defaultSymbol
};
}
}
let result: SymbolTable;
let visitedSymbols: Symbol[] = [];
visit(moduleSymbol);
@@ -832,7 +901,7 @@ module ts {
// The ES6 spec permits export * declarations in a module to circularly reference the module itself. For example,
// module 'a' can 'export * from "b"' and 'b' can 'export * from "a"' without error.
function visit(symbol: Symbol) {
if (!contains(visitedSymbols, symbol)) {
if (symbol.flags & SymbolFlags.HasExports && !contains(visitedSymbols, symbol)) {
visitedSymbols.push(symbol);
if (symbol !== moduleSymbol) {
if (!result) {
@@ -843,9 +912,9 @@ module ts {
// All export * declarations are collected in an __export symbol by the binder
let exportStars = symbol.exports["__export"];
if (exportStars) {
forEach(exportStars.declarations, node => {
for (let node of exportStars.declarations) {
visit(resolveExternalModuleName(node, (<ExportDeclaration>node).moduleSpecifier));
});
}
}
}
}
@@ -2925,17 +2994,25 @@ module ts {
return result;
}
function symbolsToArray(symbols: SymbolTable): Symbol[] {
let result: Symbol[] = [];
for (let id in symbols) {
if (!isReservedMemberName(id)) {
result.push(symbols[id]);
}
}
return result;
}
function getExportsOfImportDeclaration(node: ImportDeclaration): Symbol[] {
if (!node.moduleSpecifier) {
return emptyArray;
}
let module = resolveExternalModuleName(node, node.moduleSpecifier);
if (!module || !module.exports) {
if (!module) {
return emptyArray;
}
return mapToArray(getExportsOfModule(module))
return symbolsToArray(getExportsOfModule(module));
}
function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature {
@@ -4511,7 +4588,7 @@ module ts {
* Check if a Type was written as a tuple type literal.
* Prefer using isTupleLikeType() unless the use of `elementTypes` is required.
*/
function isTupleType(type: Type) : boolean {
function isTupleType(type: Type): boolean {
return (type.flags & TypeFlags.Tuple) && !!(<TupleType>type).elementTypes;
}
@@ -7650,7 +7727,7 @@ module ts {
if (!checkForDisallowedESSymbolOperand(operator)) {
return booleanType;
}
// Fall through
// Fall through
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.EqualsEqualsEqualsToken:
@@ -7951,7 +8028,7 @@ module ts {
// strict mode FunctionLikeDeclaration or FunctionExpression(13.1)
// Grammar checking
checkGrammarModifiers(node) || checkGrammarEvalOrArgumentsInStrictMode(node, <Identifier>node.name);
checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarEvalOrArgumentsInStrictMode(node, <Identifier>node.name);
checkVariableLikeDeclaration(node);
let func = getContainingFunction(node);
@@ -8053,7 +8130,7 @@ module ts {
function checkPropertyDeclaration(node: PropertyDeclaration) {
// Grammar checking
checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name);
checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name);
checkVariableLikeDeclaration(node);
}
@@ -8192,6 +8269,10 @@ module ts {
checkFunctionLikeDeclaration(node);
}
function checkMissingDeclaration(node: Node) {
checkDecorators(node);
}
function checkTypeReference(node: TypeReferenceNode) {
// Grammar checking
checkGrammarTypeArguments(node, node.typeArguments);
@@ -8583,6 +8664,60 @@ module ts {
}
}
/** Check a decorator */
function checkDecorator(node: Decorator): void {
let expression: Expression = node.expression;
let exprType = checkExpression(expression);
switch (node.parent.kind) {
case SyntaxKind.ClassDeclaration:
let classSymbol = getSymbolOfNode(node.parent);
let classConstructorType = getTypeOfSymbol(classSymbol);
let classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType, [classConstructorType]);
checkTypeAssignableTo(exprType, classDecoratorType, node);
break;
case SyntaxKind.PropertyDeclaration:
checkTypeAssignableTo(exprType, globalPropertyDecoratorType, node);
break;
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
let methodType = getTypeOfNode(node.parent);
let methodDecoratorType = instantiateSingleCallFunctionType(globalMethodDecoratorType, [methodType]);
checkTypeAssignableTo(exprType, methodDecoratorType, node);
break;
case SyntaxKind.Parameter:
checkTypeAssignableTo(exprType, globalParameterDecoratorType, node);
break;
}
}
/** Check the decorators of a node */
function checkDecorators(node: Node): void {
if (!node.decorators) {
return;
}
switch (node.kind) {
case SyntaxKind.ClassDeclaration:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.Parameter:
emitDecorate = true;
break;
default:
return;
}
forEach(node.decorators, checkDecorator);
}
function checkFunctionDeclaration(node: FunctionDeclaration): void {
if (produceDiagnostics) {
checkFunctionLikeDeclaration(node) ||
@@ -8597,6 +8732,7 @@ module ts {
}
function checkFunctionLikeDeclaration(node: FunctionLikeDeclaration): void {
checkDecorators(node);
checkSignatureDeclaration(node);
// Do not use hasDynamicName here, because that returns false for well known symbols.
@@ -8879,6 +9015,7 @@ module ts {
// Check variable, parameter, or property declaration
function checkVariableLikeDeclaration(node: VariableLikeDeclaration) {
checkDecorators(node);
checkSourceElement(node.type);
// For a computed property, just check the initializer and exit
// Do not use hasDynamicName here, because that returns false for well known symbols.
@@ -8951,7 +9088,7 @@ module ts {
function checkVariableStatement(node: VariableStatement) {
// Grammar checking
checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarModifiers(node) || checkGrammarVariableDeclarationList(node.declarationList) || checkGrammarForDisallowedLetOrConstStatement(node);
checkGrammarDecorators(node) || checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarModifiers(node) || checkGrammarVariableDeclarationList(node.declarationList) || checkGrammarForDisallowedLetOrConstStatement(node);
forEach(node.declarationList.declarations, checkSourceElement);
}
@@ -9582,7 +9719,7 @@ module ts {
function checkClassDeclaration(node: ClassDeclaration) {
// Grammar checking
checkGrammarClassDeclarationHeritageClauses(node);
checkDecorators(node);
if (node.name) {
checkTypeNameIsReserved(node.name, Diagnostics.Class_name_cannot_be_0);
checkCollisionWithCapturedThisVariable(node, node.name);
@@ -9677,7 +9814,7 @@ module ts {
if (derived) {
let baseDeclarationFlags = getDeclarationFlagsFromSymbol(base);
let derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived);
if ((baseDeclarationFlags & NodeFlags.Private) || (derivedDeclarationFlags & NodeFlags.Private)) {
if ((baseDeclarationFlags & NodeFlags.Private) || (derivedDeclarationFlags & NodeFlags.Private)) {
// either base or derived property is private - not override, skip it
continue;
}
@@ -9787,7 +9924,7 @@ module ts {
function checkInterfaceDeclaration(node: InterfaceDeclaration) {
// Grammar checking
checkGrammarModifiers(node) || checkGrammarInterfaceDeclaration(node);
checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarInterfaceDeclaration(node);
checkTypeParameters(node.typeParameters);
if (produceDiagnostics) {
@@ -9808,7 +9945,7 @@ module ts {
// run subsequent checks only if first set succeeded
if (checkInheritedPropertiesAreIdentical(type, node.name)) {
forEach(type.baseTypes, baseType => {
checkTypeAssignableTo(type, baseType, node.name , Diagnostics.Interface_0_incorrectly_extends_interface_1);
checkTypeAssignableTo(type, baseType, node.name, Diagnostics.Interface_0_incorrectly_extends_interface_1);
});
checkIndexConstraints(type);
}
@@ -9824,7 +9961,7 @@ module ts {
function checkTypeAliasDeclaration(node: TypeAliasDeclaration) {
// Grammar checking
checkGrammarModifiers(node);
checkGrammarDecorators(node) || checkGrammarModifiers(node);
checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0);
checkSourceElement(node.type);
@@ -10006,7 +10143,7 @@ module ts {
}
// Grammar checking
checkGrammarModifiers(node) || checkGrammarEnumDeclaration(node);
checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarEnumDeclaration(node);
checkTypeNameIsReserved(node.name, Diagnostics.Enum_name_cannot_be_0);
checkCollisionWithCapturedThisVariable(node, node.name);
@@ -10072,7 +10209,7 @@ module ts {
function checkModuleDeclaration(node: ModuleDeclaration) {
if (produceDiagnostics) {
// Grammar checking
if (!checkGrammarModifiers(node)) {
if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node)) {
if (!isInAmbientContext(node) && node.name.kind === SyntaxKind.StringLiteral) {
grammarErrorOnNode(node.name, Diagnostics.Only_ambient_modules_can_use_quoted_names);
}
@@ -10167,7 +10304,7 @@ module ts {
}
function checkImportDeclaration(node: ImportDeclaration) {
if (!checkGrammarModifiers(node) && (node.flags & NodeFlags.Modifier)) {
if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & NodeFlags.Modifier)) {
grammarErrorOnFirstToken(node, Diagnostics.An_import_declaration_cannot_have_modifiers);
}
if (checkExternalImportOrExportDeclaration(node)) {
@@ -10189,7 +10326,7 @@ module ts {
}
function checkImportEqualsDeclaration(node: ImportEqualsDeclaration) {
checkGrammarModifiers(node);
checkGrammarDecorators(node) || checkGrammarModifiers(node);
if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
checkImportBinding(node);
if (node.flags & NodeFlags.Export) {
@@ -10220,12 +10357,26 @@ module ts {
}
function checkExportDeclaration(node: ExportDeclaration) {
if (!checkGrammarModifiers(node) && (node.flags & NodeFlags.Modifier)) {
if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & NodeFlags.Modifier)) {
grammarErrorOnFirstToken(node, Diagnostics.An_export_declaration_cannot_have_modifiers);
}
if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) {
if (node.exportClause) {
// export { x, y }
// export { x, y } from "foo"
forEach(node.exportClause.elements, checkExportSpecifier);
let inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && (<ModuleDeclaration>node.parent.parent).name.kind === SyntaxKind.StringLiteral;
if (node.parent.kind !== SyntaxKind.SourceFile && !inAmbientExternalModule) {
error(node, Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module);
}
}
else {
// export * from "foo"
let moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
if (moduleSymbol && moduleSymbol.exports["export="]) {
error(node.moduleSpecifier, Diagnostics.External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
}
}
}
}
@@ -10244,7 +10395,7 @@ module ts {
return;
}
// Grammar checking
if (!checkGrammarModifiers(node) && (node.flags & NodeFlags.Modifier)) {
if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & NodeFlags.Modifier)) {
grammarErrorOnFirstToken(node, Diagnostics.An_export_assignment_cannot_have_modifiers);
}
if (node.expression) {
@@ -10281,39 +10432,22 @@ module ts {
}
function hasExportedMembers(moduleSymbol: Symbol) {
let declarations = moduleSymbol.declarations;
for (let current of declarations) {
let statements = getModuleStatements(current);
for (let node of statements) {
if (node.kind === SyntaxKind.ExportDeclaration) {
let exportClause = (<ExportDeclaration>node).exportClause;
if (!exportClause) {
return true;
}
let specifiers = exportClause.elements;
for (let specifier of specifiers) {
if (!(specifier.propertyName && specifier.name && specifier.name.text === "default")) {
return true;
}
}
}
else if (node.kind !== SyntaxKind.ExportAssignment && node.flags & NodeFlags.Export && !(node.flags & NodeFlags.Default)) {
return true;
}
for (var id in moduleSymbol.exports) {
if (id !== "export=") {
return true;
}
}
return false;
}
function checkExternalModuleExports(node: SourceFile | ModuleDeclaration) {
let moduleSymbol = getSymbolOfNode(node);
let links = getSymbolLinks(moduleSymbol);
if (!links.exportsChecked) {
let defaultSymbol = getExportAssignmentSymbol(moduleSymbol);
if (defaultSymbol) {
if (languageVersion < ScriptTarget.ES6 && hasExportedMembers(moduleSymbol)) {
let declaration = getDeclarationOfAliasSymbol(defaultSymbol) || defaultSymbol.valueDeclaration;
error(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
}
let exportEqualsSymbol = moduleSymbol.exports["export="];
if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) {
let declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration;
error(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
}
links.exportsChecked = true;
}
@@ -10422,6 +10556,8 @@ module ts {
case SyntaxKind.DebuggerStatement:
checkGrammarStatementInAmbientContext(node);
return;
case SyntaxKind.MissingDeclaration:
return checkMissingDeclaration(node);
}
}
@@ -10548,6 +10684,10 @@ module ts {
links.flags |= NodeCheckFlags.EmitExtends;
}
if (emitDecorate) {
links.flags |= NodeCheckFlags.EmitDecorate;
}
links.flags |= NodeCheckFlags.TypeChecked;
}
}
@@ -10599,7 +10739,7 @@ module ts {
populateSymbols();
return mapToArray(symbols);
return symbolsToArray(symbols);
function populateSymbols() {
while (location) {
@@ -10657,6 +10797,42 @@ module ts {
}
}
}
if (isInsideWithStatementBody(location)) {
// We cannot answer semantic questions within a with block, do not proceed any further
return [];
}
while (location) {
if (location.locals && !isGlobalSourceFile(location)) {
copySymbols(location.locals, meaning);
}
switch (location.kind) {
case SyntaxKind.SourceFile:
if (!isExternalModule(<SourceFile>location)) break;
case SyntaxKind.ModuleDeclaration:
copySymbols(getSymbolOfNode(location).exports, meaning & SymbolFlags.ModuleMember);
break;
case SyntaxKind.EnumDeclaration:
copySymbols(getSymbolOfNode(location).exports, meaning & SymbolFlags.EnumMember);
break;
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
if (!(memberFlags & NodeFlags.Static)) {
copySymbols(getSymbolOfNode(location).members, meaning & SymbolFlags.Type);
}
break;
case SyntaxKind.FunctionExpression:
if ((<FunctionExpression>location).name) {
copySymbol(location.symbol, meaning);
}
break;
}
memberFlags = location.flags;
location = location.parent;
}
copySymbols(globals, meaning);
return symbolsToArray(symbols);
}
function isTypeDeclarationName(name: Node): boolean {
@@ -11008,26 +11184,34 @@ module ts {
return symbol.flags & SymbolFlags.ValueModule && symbol.declarations.length === 1 && symbol.declarations[0].kind === SyntaxKind.SourceFile;
}
function getAliasNameSubstitution(symbol: Symbol, getGeneratedNameForNode: (Node: Node) => string): string {
let declaration = getDeclarationOfAliasSymbol(symbol);
if (declaration && declaration.kind === SyntaxKind.ImportSpecifier) {
let moduleName = getGeneratedNameForNode(<ImportDeclaration>declaration.parent.parent.parent);
let propertyName = (<ImportSpecifier>declaration).propertyName || (<ImportSpecifier>declaration).name;
return moduleName + "." + unescapeIdentifier(propertyName.text);
function getAliasNameSubstitution(symbol: Symbol, getGeneratedNameForNode: (node: Node) => string): string {
// If this is es6 or higher, just use the name of the export
// no need to qualify it.
if (languageVersion >= ScriptTarget.ES6) {
return undefined;
}
let node = getDeclarationOfAliasSymbol(symbol);
if (node) {
if (node.kind === SyntaxKind.ImportClause) {
return getGeneratedNameForNode(<ImportDeclaration>node.parent) + ".default";
}
if (node.kind === SyntaxKind.ImportSpecifier) {
let moduleName = getGeneratedNameForNode(<ImportDeclaration>node.parent.parent.parent);
let propertyName = (<ImportSpecifier>node).propertyName || (<ImportSpecifier>node).name;
return moduleName + "." + unescapeIdentifier(propertyName.text);
}
}
}
function getExportNameSubstitution(symbol: Symbol, location: Node, getGeneratedNameForNode: (Node: Node) => string): string {
if (isExternalModuleSymbol(symbol.parent)) {
var symbolName = unescapeIdentifier(symbol.name);
// If this is es6 or higher, just use the name of the export
// no need to qualify it.
if (languageVersion >= ScriptTarget.ES6) {
return symbolName;
}
else {
return "exports." + symbolName;
return undefined;
}
return "exports." + unescapeIdentifier(symbol.name);
}
let node = location;
let containerSymbol = getParentOfSymbol(symbol);
@@ -11040,7 +11224,7 @@ module ts {
}
function getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (Node: Node) => string): string {
let symbol = getNodeLinks(node).resolvedSymbol;
let symbol = getNodeLinks(node).resolvedSymbol || (isDeclarationName(node) ? getSymbolOfNode(node.parent) : undefined);
if (symbol) {
// Whan an identifier resolves to a parented symbol, it references an exported entity from
// another declaration of the same internal module.
@@ -11055,15 +11239,27 @@ module ts {
return getExportNameSubstitution(exportSymbol, node.parent, getGeneratedNameForNode);
}
// Named imports from ES6 import declarations are rewritten
if (symbol.flags & SymbolFlags.Alias && languageVersion < ScriptTarget.ES6) {
if (symbol.flags & SymbolFlags.Alias) {
return getAliasNameSubstitution(symbol, getGeneratedNameForNode);
}
}
}
function hasExportDefaultValue(node: SourceFile): boolean {
let symbol = getResolvedExportAssignmentSymbol(getSymbolOfNode(node));
return symbol && symbol !== unknownSymbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol);
function isValueAliasDeclaration(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.ImportClause:
case SyntaxKind.NamespaceImport:
case SyntaxKind.ImportSpecifier:
case SyntaxKind.ExportSpecifier:
return isAliasResolvedToValue(getSymbolOfNode(node));
case SyntaxKind.ExportDeclaration:
let exportClause = (<ExportDeclaration>node).exportClause;
return exportClause && forEach(exportClause.elements, isValueAliasDeclaration);
case SyntaxKind.ExportAssignment:
return (<ExportAssignment>node).expression && (<ExportAssignment>node).expression.kind === SyntaxKind.Identifier ? isAliasResolvedToValue(getSymbolOfNode(node)) : true;
}
return false;
}
function isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean {
@@ -11084,13 +11280,18 @@ module ts {
return isConstEnumSymbol(s) || s.constEnumOnlyModule;
}
function isReferencedAliasDeclaration(node: Node): boolean {
function isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean {
if (isAliasSymbolDeclaration(node)) {
let symbol = getSymbolOfNode(node);
if (getSymbolLinks(symbol).referenced) {
return true;
}
}
if (checkChildren) {
return forEachChild(node, node => isReferencedAliasDeclaration(node, checkChildren));
}
return false;
}
function isImplementationOfOverload(node: FunctionLikeDeclaration) {
@@ -11193,11 +11394,25 @@ module ts {
return undefined;
}
function instantiateSingleCallFunctionType(functionType: Type, typeArguments: Type[]): Type {
if (functionType === unknownType) {
return unknownType;
}
let signature = getSingleCallSignature(functionType);
if (!signature) {
return unknownType;
}
let instantiatedSignature = getSignatureInstantiation(signature, typeArguments);
return getOrCreateTypeFromSignature(instantiatedSignature);
}
function createResolver(): EmitResolver {
return {
getExpressionNameSubstitution,
isValueAliasDeclaration,
hasGlobalName,
hasExportDefaultValue,
isReferencedAliasDeclaration,
getNodeCheckFlags,
isTopLevelValueImportEqualsWithEntityName,
@@ -11242,6 +11457,11 @@ module ts {
globalNumberType = getGlobalType("Number");
globalBooleanType = getGlobalType("Boolean");
globalRegExpType = getGlobalType("RegExp");
globalTypedPropertyDescriptorType = getTypeOfGlobalSymbol(getGlobalTypeSymbol("TypedPropertyDescriptor"), 1);
globalClassDecoratorType = getGlobalType("ClassDecorator");
globalPropertyDecoratorType = getGlobalType("PropertyDecorator");
globalMethodDecoratorType = getGlobalType("MethodDecorator");
globalParameterDecoratorType = getGlobalType("ParameterDecorator");
// If we're in ES6 mode, load the TemplateStringsArray.
// Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios.
@@ -11266,6 +11486,25 @@ module ts {
// GRAMMAR CHECKING
function checkGrammarDecorators(node: Node): boolean {
if (!node.decorators) {
return false;
}
if (!nodeCanBeDecorated(node)) {
return grammarErrorOnNode(node, Diagnostics.Decorators_are_not_valid_here);
}
else if (languageVersion < ScriptTarget.ES5) {
return grammarErrorOnNode(node, Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher);
}
else if (node.kind === SyntaxKind.GetAccessor || node.kind === SyntaxKind.SetAccessor) {
let accessors = getAllAccessorDeclarations((<ClassDeclaration>node.parent).members, <AccessorDeclaration>node);
if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) {
return grammarErrorOnNode(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
}
}
return false;
}
function checkGrammarModifiers(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.GetAccessor:
@@ -11462,7 +11701,7 @@ module ts {
function checkGrammarFunctionLikeDeclaration(node: FunctionLikeDeclaration): boolean {
// Prevent cascading error by short-circuit
let file = getSourceFileOfNode(node);
return checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters, file) ||
return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters, file) ||
checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file);
}
@@ -11519,7 +11758,7 @@ module ts {
function checkGrammarIndexSignature(node: SignatureDeclaration) {
// Prevent cascading error by short-circuit
checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node) || checkGrammarForIndexSignatureModifier(node);
return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node) || checkGrammarForIndexSignatureModifier(node);
}
function checkGrammarForAtLeastOneTypeArgument(node: Node, typeArguments: NodeArray<TypeNode>): boolean {
@@ -11568,7 +11807,7 @@ module ts {
let seenExtendsClause = false;
let seenImplementsClause = false;
if (!checkGrammarModifiers(node) && node.heritageClauses) {
if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) {
for (let heritageClause of node.heritageClauses) {
if (heritageClause.token === SyntaxKind.ExtendsKeyword) {
if (seenExtendsClause) {
+33 -10
View File
@@ -162,6 +162,39 @@ module ts {
return ~low;
}
export function reduceLeft<T>(array: T[], f: (a: T, x: T) => T): T;
export function reduceLeft<T, U>(array: T[], f: (a: U, x: T) => U, initial: U): U;
export function reduceLeft<T, U>(array: T[], f: (a: U, x: T) => U, initial?: U): U {
if (array) {
var count = array.length;
if (count > 0) {
var pos = 0;
var result = arguments.length <= 2 ? array[pos++] : initial;
while (pos < count) {
result = f(<U>result, array[pos++]);
}
return <U>result;
}
}
return initial;
}
export function reduceRight<T>(array: T[], f: (a: T, x: T) => T): T;
export function reduceRight<T, U>(array: T[], f: (a: U, x: T) => U, initial: U): U;
export function reduceRight<T, U>(array: T[], f: (a: U, x: T) => U, initial?: U): U {
if (array) {
var pos = array.length - 1;
if (pos >= 0) {
var result = arguments.length <= 2 ? array[pos--] : initial;
while (pos >= 0) {
result = f(<U>result, array[pos--]);
}
return <U>result;
}
}
return initial;
}
let hasOwnProperty = Object.prototype.hasOwnProperty;
export function hasProperty<T>(map: Map<T>, key: string): boolean {
@@ -222,16 +255,6 @@ module ts {
return hasProperty(map, key) ? map[key] : undefined;
}
export function mapToArray<T>(map: Map<T>): T[] {
let result: T[] = [];
for (let id in map) {
result.push(map[id]);
}
return result;
}
export function copyMap<T>(source: Map<T>, target: Map<T>): void {
for (let p in source) {
target[p] = source[p];
@@ -149,7 +149,7 @@ module ts {
The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...in' statement cannot have an initializer." },
The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...of' statement cannot have an initializer." },
An_import_declaration_cannot_have_modifiers: { code: 1191, category: DiagnosticCategory.Error, key: "An import declaration cannot have modifiers." },
External_module_0_has_no_default_export_or_export_assignment: { code: 1192, category: DiagnosticCategory.Error, key: "External module '{0}' has no default export or export assignment." },
External_module_0_has_no_default_export: { code: 1192, category: DiagnosticCategory.Error, key: "External module '{0}' has no default export." },
An_export_declaration_cannot_have_modifiers: { code: 1193, category: DiagnosticCategory.Error, key: "An export declaration cannot have modifiers." },
Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: DiagnosticCategory.Error, key: "Export declarations are not permitted in an internal module." },
Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: DiagnosticCategory.Error, key: "Catch clause variable name must be an identifier." },
@@ -162,6 +162,9 @@ module ts {
Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." },
Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." },
Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile external modules into amd or commonjs when targeting es6 or higher." },
Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." },
Decorators_are_not_valid_here: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid here." },
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
@@ -346,6 +349,8 @@ module ts {
Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: DiagnosticCategory.Error, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." },
Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type or a string type." },
The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 2496, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." },
External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." },
External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "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: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
+21 -1
View File
@@ -587,7 +587,7 @@
"category": "Error",
"code": 1191
},
"External module '{0}' has no default export or export assignment.": {
"External module '{0}' has no default export.": {
"category": "Error",
"code": 1192
},
@@ -639,6 +639,18 @@
"category": "Error",
"code": 1204
},
"Decorators are only available when targeting ECMAScript 5 and higher.": {
"category": "Error",
"code": 1205
},
"Decorators are not valid here.": {
"category": "Error",
"code": 1206
},
"Decorators cannot be applied to multiple get/set accessors of the same name.": {
"category": "Error",
"code": 1207
},
"Duplicate identifier '{0}'.": {
"category": "Error",
@@ -1376,6 +1388,14 @@
"category": "Error",
"code": 2496
},
"External module '{0}' resolves to a non-module entity and cannot be imported using this construct.": {
"category": "Error",
"code": 2497
},
"External module '{0}' uses 'export =' and cannot be used with 'export *'.": {
"category": "Error",
"code": 2498
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
+731 -365
View File
File diff suppressed because it is too large Load Diff
+257 -101
View File
@@ -64,7 +64,8 @@ module ts {
case SyntaxKind.ShorthandPropertyAssignment:
case SyntaxKind.VariableDeclaration:
case SyntaxKind.BindingElement:
return visitNodes(cbNodes, node.modifiers) ||
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<VariableLikeDeclaration>node).propertyName) ||
visitNode(cbNode, (<VariableLikeDeclaration>node).dotDotDotToken) ||
visitNode(cbNode, (<VariableLikeDeclaration>node).name) ||
@@ -76,7 +77,8 @@ module ts {
case SyntaxKind.CallSignature:
case SyntaxKind.ConstructSignature:
case SyntaxKind.IndexSignature:
return visitNodes(cbNodes, node.modifiers) ||
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNodes(cbNodes, (<SignatureDeclaration>node).typeParameters) ||
visitNodes(cbNodes, (<SignatureDeclaration>node).parameters) ||
visitNode(cbNode, (<SignatureDeclaration>node).type);
@@ -88,7 +90,8 @@ module ts {
case SyntaxKind.FunctionExpression:
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.ArrowFunction:
return visitNodes(cbNodes, node.modifiers) ||
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<FunctionLikeDeclaration>node).asteriskToken) ||
visitNode(cbNode, (<FunctionLikeDeclaration>node).name) ||
visitNode(cbNode, (<FunctionLikeDeclaration>node).questionToken) ||
@@ -171,7 +174,8 @@ module ts {
return visitNodes(cbNodes, (<SourceFile>node).statements) ||
visitNode(cbNode, (<SourceFile>node).endOfFileToken);
case SyntaxKind.VariableStatement:
return visitNodes(cbNodes, node.modifiers) ||
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<VariableStatement>node).declarationList);
case SyntaxKind.VariableDeclarationList:
return visitNodes(cbNodes, (<VariableDeclarationList>node).declarations);
@@ -230,39 +234,48 @@ module ts {
case SyntaxKind.CatchClause:
return visitNode(cbNode, (<CatchClause>node).variableDeclaration) ||
visitNode(cbNode, (<CatchClause>node).block);
case SyntaxKind.Decorator:
return visitNode(cbNode, (<Decorator>node).expression);
case SyntaxKind.ClassDeclaration:
return visitNodes(cbNodes, node.modifiers) ||
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<ClassDeclaration>node).name) ||
visitNodes(cbNodes, (<ClassDeclaration>node).typeParameters) ||
visitNodes(cbNodes, (<ClassDeclaration>node).heritageClauses) ||
visitNodes(cbNodes, (<ClassDeclaration>node).members);
case SyntaxKind.InterfaceDeclaration:
return visitNodes(cbNodes, node.modifiers) ||
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<InterfaceDeclaration>node).name) ||
visitNodes(cbNodes, (<InterfaceDeclaration>node).typeParameters) ||
visitNodes(cbNodes, (<ClassDeclaration>node).heritageClauses) ||
visitNodes(cbNodes, (<InterfaceDeclaration>node).members);
case SyntaxKind.TypeAliasDeclaration:
return visitNodes(cbNodes, node.modifiers) ||
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<TypeAliasDeclaration>node).name) ||
visitNode(cbNode, (<TypeAliasDeclaration>node).type);
case SyntaxKind.EnumDeclaration:
return visitNodes(cbNodes, node.modifiers) ||
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<EnumDeclaration>node).name) ||
visitNodes(cbNodes, (<EnumDeclaration>node).members);
case SyntaxKind.EnumMember:
return visitNode(cbNode, (<EnumMember>node).name) ||
visitNode(cbNode, (<EnumMember>node).initializer);
case SyntaxKind.ModuleDeclaration:
return visitNodes(cbNodes, node.modifiers) ||
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<ModuleDeclaration>node).name) ||
visitNode(cbNode, (<ModuleDeclaration>node).body);
case SyntaxKind.ImportEqualsDeclaration:
return visitNodes(cbNodes, node.modifiers) ||
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<ImportEqualsDeclaration>node).name) ||
visitNode(cbNode, (<ImportEqualsDeclaration>node).moduleReference);
case SyntaxKind.ImportDeclaration:
return visitNodes(cbNodes, node.modifiers) ||
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<ImportDeclaration>node).importClause) ||
visitNode(cbNode, (<ImportDeclaration>node).moduleSpecifier);
case SyntaxKind.ImportClause:
@@ -274,7 +287,8 @@ module ts {
case SyntaxKind.NamedExports:
return visitNodes(cbNodes, (<NamedImportsOrExports>node).elements);
case SyntaxKind.ExportDeclaration:
return visitNodes(cbNodes, node.modifiers) ||
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<ExportDeclaration>node).exportClause) ||
visitNode(cbNode, (<ExportDeclaration>node).moduleSpecifier);
case SyntaxKind.ImportSpecifier:
@@ -282,7 +296,8 @@ module ts {
return visitNode(cbNode, (<ImportOrExportSpecifier>node).propertyName) ||
visitNode(cbNode, (<ImportOrExportSpecifier>node).name);
case SyntaxKind.ExportAssignment:
return visitNodes(cbNodes, node.modifiers) ||
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<ExportAssignment>node).expression) ||
visitNode(cbNode, (<ExportAssignment>node).type);
case SyntaxKind.TemplateExpression:
@@ -295,6 +310,8 @@ module ts {
return visitNodes(cbNodes, (<HeritageClause>node).types);
case SyntaxKind.ExternalModuleReference:
return visitNode(cbNode, (<ExternalModuleReference>node).expression);
case SyntaxKind.MissingDeclaration:
return visitNodes(cbNodes, node.decorators);
}
}
@@ -987,6 +1004,8 @@ module ts {
}
function parseSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, syntaxCursor: SyntaxCursor, setParentNodes = false): SourceFile {
const disallowInAndDecoratorContext = ParserContextFlags.DisallowIn | ParserContextFlags.Decorator;
let parsingContext: ParsingContext = 0;
let identifiers: Map<string> = {};
let identifierCount = 0;
@@ -1130,6 +1149,23 @@ module ts {
setContextFlag(val, ParserContextFlags.GeneratorParameter);
}
function setDecoratorContext(val: boolean) {
setContextFlag(val, ParserContextFlags.Decorator);
}
function doOutsideOfContext<T>(flags: ParserContextFlags, func: () => T): T {
let currentContextFlags = contextFlags & flags;
if (currentContextFlags) {
setContextFlag(false, currentContextFlags);
let result = func();
setContextFlag(true, currentContextFlags);
return result;
}
// no need to do anything special as we are not in any of the requested contexts
return func();
}
function allowInAnd<T>(func: () => T): T {
if (contextFlags & ParserContextFlags.DisallowIn) {
setDisallowInContext(false);
@@ -1178,6 +1214,18 @@ module ts {
return func();
}
function doInDecoratorContext<T>(func: () => T): T {
if (contextFlags & ParserContextFlags.Decorator) {
// no need to do anything special if we're already in the [Decorator] context.
return func();
}
setDecoratorContext(true);
let result = func();
setDecoratorContext(false);
return result;
}
function inYieldContext() {
return (contextFlags & ParserContextFlags.Yield) !== 0;
}
@@ -1194,6 +1242,10 @@ module ts {
return (contextFlags & ParserContextFlags.DisallowIn) !== 0;
}
function inDecoratorContext() {
return (contextFlags & ParserContextFlags.Decorator) !== 0;
}
function parseErrorAtCurrentToken(message: DiagnosticMessage, arg0?: any): void {
let start = scanner.getTokenPos();
let length = scanner.getTextPos() - start;
@@ -1403,7 +1455,7 @@ module ts {
return node;
}
function createMissingNode(kind: SyntaxKind, reportAtCurrentPosition: boolean, diagnosticMessage: DiagnosticMessage, arg0?: any): Node {
if (reportAtCurrentPosition) {
parseErrorAtPosition(scanner.getStartPos(), 0, diagnosticMessage, arg0);
@@ -2273,7 +2325,7 @@ module ts {
}
function isStartOfParameter(): boolean {
return token === SyntaxKind.DotDotDotToken || isIdentifierOrPattern() || isModifier(token);
return token === SyntaxKind.DotDotDotToken || isIdentifierOrPattern() || isModifier(token) || token === SyntaxKind.AtToken;
}
function setModifiers(node: Node, modifiers: ModifiersArray) {
@@ -2285,6 +2337,7 @@ module ts {
function parseParameter(): ParameterDeclaration {
let node = <ParameterDeclaration>createNode(SyntaxKind.Parameter);
node.decorators = parseDecorators();
setModifiers(node, parseModifiers());
node.dotDotDotToken = parseOptionalToken(SyntaxKind.DotDotDotToken);
@@ -2473,9 +2526,9 @@ module ts {
return token === SyntaxKind.ColonToken || token === SyntaxKind.CommaToken || token === SyntaxKind.CloseBracketToken;
}
function parseIndexSignatureDeclaration(modifiers: ModifiersArray): IndexSignatureDeclaration {
let fullStart = modifiers ? modifiers.pos : scanner.getStartPos();
function parseIndexSignatureDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): IndexSignatureDeclaration {
let node = <IndexSignatureDeclaration>createNode(SyntaxKind.IndexSignature, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
node.parameters = parseBracketedList(ParsingContext.Parameters, parseParameter, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken);
node.type = parseTypeAnnotation();
@@ -2552,7 +2605,7 @@ module ts {
case SyntaxKind.OpenBracketToken:
// Indexer or computed property
return isIndexSignature()
? parseIndexSignatureDeclaration(/*modifiers:*/ undefined)
? parseIndexSignatureDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined)
: parsePropertyOrMethodSignature();
case SyntaxKind.NewKeyword:
if (lookAhead(isStartOfConstructSignature)) {
@@ -2583,9 +2636,11 @@ module ts {
}
function parseIndexSignatureWithModifiers() {
let fullStart = scanner.getStartPos();
let decorators = parseDecorators();
let modifiers = parseModifiers();
return isIndexSignature()
? parseIndexSignatureDeclaration(modifiers)
? parseIndexSignatureDeclaration(fullStart, decorators, modifiers)
: undefined;
}
@@ -2841,7 +2896,7 @@ module ts {
function isStartOfExpressionStatement(): boolean {
// As per the grammar, neither '{' nor 'function' can start an expression statement.
return token !== SyntaxKind.OpenBraceToken && token !== SyntaxKind.FunctionKeyword && isStartOfExpression();
return token !== SyntaxKind.OpenBraceToken && token !== SyntaxKind.FunctionKeyword && token !== SyntaxKind.AtToken && isStartOfExpression();
}
function parseExpression(): Expression {
@@ -2849,11 +2904,21 @@ module ts {
// AssignmentExpression[in]
// Expression[in] , AssignmentExpression[in]
// clear the decorator context when parsing Expression, as it should be unambiguous when parsing a decorator
let saveDecoratorContext = inDecoratorContext();
if (saveDecoratorContext) {
setDecoratorContext(false);
}
let expr = parseAssignmentExpressionOrHigher();
let operatorToken: Node;
while ((operatorToken = parseOptionalToken(SyntaxKind.CommaToken))) {
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher());
}
if (saveDecoratorContext) {
setDecoratorContext(true);
}
return expr;
}
@@ -3209,7 +3274,7 @@ module ts {
let node = <ConditionalExpression>createNode(SyntaxKind.ConditionalExpression, leftOperand.pos);
node.condition = leftOperand;
node.questionToken = questionToken;
node.whenTrue = allowInAnd(parseAssignmentExpressionOrHigher);
node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);
node.colonToken = parseExpectedToken(SyntaxKind.ColonToken, /*reportAtCurrentPosition:*/ false,
Diagnostics._0_expected, tokenToString(SyntaxKind.ColonToken));
node.whenFalse = parseAssignmentExpressionOrHigher();
@@ -3500,7 +3565,8 @@ module ts {
continue;
}
if (parseOptional(SyntaxKind.OpenBracketToken)) {
// when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName
if (!inDecoratorContext() && parseOptional(SyntaxKind.OpenBracketToken)) {
let indexedAccess = <ElementAccessExpression>createNode(SyntaxKind.ElementAccessExpression, expression.pos);
indexedAccess.expression = expression;
@@ -3536,7 +3602,6 @@ module ts {
function parseCallExpressionRest(expression: LeftHandSideExpression): LeftHandSideExpression {
while (true) {
expression = parseMemberExpressionRest(expression);
if (token === SyntaxKind.LessThanToken) {
// See if this is the start of a generic invocation. If so, consume it and
// keep checking for postfix expressions. Otherwise, it's just a '<' that's
@@ -3683,7 +3748,7 @@ module ts {
}
function parseArgumentExpression(): Expression {
return allowInAnd(parseArgumentOrArrayLiteralElement);
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
}
function parseArrayLiteralExpression(): ArrayLiteralExpression {
@@ -3695,12 +3760,12 @@ module ts {
return finishNode(node);
}
function tryParseAccessorDeclaration(fullStart: number, modifiers: ModifiersArray): AccessorDeclaration {
function tryParseAccessorDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): AccessorDeclaration {
if (parseContextualModifier(SyntaxKind.GetKeyword)) {
return parseAccessorDeclaration(SyntaxKind.GetAccessor, fullStart, modifiers);
return parseAccessorDeclaration(SyntaxKind.GetAccessor, fullStart, decorators, modifiers);
}
else if (parseContextualModifier(SyntaxKind.SetKeyword)) {
return parseAccessorDeclaration(SyntaxKind.SetAccessor, fullStart, modifiers);
return parseAccessorDeclaration(SyntaxKind.SetAccessor, fullStart, decorators, modifiers);
}
return undefined;
@@ -3708,9 +3773,10 @@ module ts {
function parseObjectLiteralElement(): ObjectLiteralElement {
let fullStart = scanner.getStartPos();
let decorators = parseDecorators();
let modifiers = parseModifiers();
let accessor = tryParseAccessorDeclaration(fullStart, modifiers);
let accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers);
if (accessor) {
return accessor;
}
@@ -3723,7 +3789,7 @@ module ts {
// Disallowing of optional property assignments happens in the grammar checker.
let questionToken = parseOptionalToken(SyntaxKind.QuestionToken);
if (asteriskToken || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
return parseMethodDeclaration(fullStart, modifiers, asteriskToken, propertyName, questionToken);
return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken);
}
// Parse to check if it is short-hand property assignment or normal property assignment
@@ -3760,12 +3826,19 @@ module ts {
// function * BindingIdentifier[Yield]opt (FormalParameters[Yield, GeneratorParameter]) { GeneratorBody[Yield] }
// FunctionExpression:
// function BindingIdentifieropt(FormalParameters) { FunctionBody }
let saveDecoratorContext = inDecoratorContext();
if (saveDecoratorContext) {
setDecoratorContext(false);
}
let node = <FunctionExpression>createNode(SyntaxKind.FunctionExpression);
parseExpected(SyntaxKind.FunctionKeyword);
node.asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
node.name = node.asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier();
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ !!node.asteriskToken, /*requireCompleteParameterList:*/ false, node);
node.body = parseFunctionBlock(/*allowYield:*/ !!node.asteriskToken, /* ignoreMissingOpenBrace */ false);
if (saveDecoratorContext) {
setDecoratorContext(true);
}
return finishNode(node);
}
@@ -3802,8 +3875,19 @@ module ts {
let savedYieldContext = inYieldContext();
setYieldContext(allowYield);
// We may be in a [Decorator] context when parsing a function expression or
// arrow function. The body of the function is not in [Decorator] context.
let saveDecoratorContext = inDecoratorContext();
if (saveDecoratorContext) {
setDecoratorContext(false);
}
let block = parseBlock(ignoreMissingOpenBrace, /*checkForStrictMode*/ true, diagnosticMessage);
if (saveDecoratorContext) {
setDecoratorContext(true);
}
setYieldContext(savedYieldContext);
return block;
@@ -4051,7 +4135,7 @@ module ts {
// as the parser will produce the same FunctionDeclaraiton or VariableStatement if it has
// the same text regardless of whether it is inside a block or not.
if (isModifier(token)) {
let result = lookAhead(parseVariableStatementOrFunctionDeclarationWithModifiers);
let result = lookAhead(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers);
if (result) {
return true;
}
@@ -4135,9 +4219,9 @@ module ts {
case SyntaxKind.VarKeyword:
case SyntaxKind.ConstKeyword:
// const here should always be parsed as const declaration because of check in 'isStatement'
return parseVariableStatement(scanner.getStartPos(), /*modifiers:*/ undefined);
return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
case SyntaxKind.FunctionKeyword:
return parseFunctionDeclaration(scanner.getStartPos(), /*modifiers:*/ undefined);
return parseFunctionDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
case SyntaxKind.SemicolonToken:
return parseEmptyStatement();
case SyntaxKind.IfKeyword:
@@ -4170,7 +4254,7 @@ module ts {
case SyntaxKind.LetKeyword:
// If let follows identifier on the same line, it is declaration parse it as variable statement
if (isLetDeclaration()) {
return parseVariableStatement(scanner.getStartPos(), /*modifiers:*/ undefined);
return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
}
// Else parse it like identifier - fall through
default:
@@ -4180,8 +4264,10 @@ module ts {
// work properly when incrementally parsing as the parser will produce the
// same FunctionDeclaraiton or VariableStatement if it has the same text
// regardless of whether it is inside a block or not.
if (isModifier(token)) {
let result = tryParse(parseVariableStatementOrFunctionDeclarationWithModifiers);
// Even though variable statements and function declarations cannot have decorators,
// we parse them here to provide better error recovery.
if (isModifier(token) || token === SyntaxKind.AtToken) {
let result = tryParse(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers);
if (result) {
return result;
}
@@ -4191,8 +4277,9 @@ module ts {
}
}
function parseVariableStatementOrFunctionDeclarationWithModifiers(): FunctionDeclaration | VariableStatement {
function parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers(): FunctionDeclaration | VariableStatement {
let start = scanner.getStartPos();
let decorators = parseDecorators();
let modifiers = parseModifiers();
switch (token) {
case SyntaxKind.ConstKeyword:
@@ -4200,18 +4287,18 @@ module ts {
if (nextTokenIsEnum) {
return undefined;
}
return parseVariableStatement(start, modifiers);
return parseVariableStatement(start, decorators, modifiers);
case SyntaxKind.LetKeyword:
if (!isLetDeclaration()) {
return undefined;
}
return parseVariableStatement(start, modifiers);
return parseVariableStatement(start, decorators, modifiers);
case SyntaxKind.VarKeyword:
return parseVariableStatement(start, modifiers);
return parseVariableStatement(start, decorators, modifiers);
case SyntaxKind.FunctionKeyword:
return parseFunctionDeclaration(start, modifiers);
return parseFunctionDeclaration(start, decorators, modifiers);
}
return undefined;
@@ -4341,16 +4428,18 @@ module ts {
return nextTokenIsIdentifier() && nextToken() === SyntaxKind.CloseParenToken;
}
function parseVariableStatement(fullStart: number, modifiers: ModifiersArray): VariableStatement {
function parseVariableStatement(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): VariableStatement {
let node = <VariableStatement>createNode(SyntaxKind.VariableStatement, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer:*/ false);
parseSemicolon();
return finishNode(node);
}
function parseFunctionDeclaration(fullStart: number, modifiers: ModifiersArray): FunctionDeclaration {
function parseFunctionDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): FunctionDeclaration {
let node = <FunctionDeclaration>createNode(SyntaxKind.FunctionDeclaration, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
parseExpected(SyntaxKind.FunctionKeyword);
node.asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
@@ -4360,8 +4449,9 @@ module ts {
return finishNode(node);
}
function parseConstructorDeclaration(pos: number, modifiers: ModifiersArray): ConstructorDeclaration {
function parseConstructorDeclaration(pos: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ConstructorDeclaration {
let node = <ConstructorDeclaration>createNode(SyntaxKind.Constructor, pos);
node.decorators = decorators;
setModifiers(node, modifiers);
parseExpected(SyntaxKind.ConstructorKeyword);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, node);
@@ -4369,8 +4459,9 @@ module ts {
return finishNode(node);
}
function parseMethodDeclaration(fullStart: number, modifiers: ModifiersArray, asteriskToken: Node, name: DeclarationName, questionToken: Node, diagnosticMessage?: DiagnosticMessage): MethodDeclaration {
function parseMethodDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, asteriskToken: Node, name: DeclarationName, questionToken: Node, diagnosticMessage?: DiagnosticMessage): MethodDeclaration {
let method = <MethodDeclaration>createNode(SyntaxKind.MethodDeclaration, fullStart);
method.decorators = decorators;
setModifiers(method, modifiers);
method.asteriskToken = asteriskToken;
method.name = name;
@@ -4380,25 +4471,30 @@ module ts {
return finishNode(method);
}
function parsePropertyOrMethodDeclaration(fullStart: number, modifiers: ModifiersArray): ClassElement {
function parsePropertyDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, name: DeclarationName, questionToken: Node): ClassElement {
let property = <PropertyDeclaration>createNode(SyntaxKind.PropertyDeclaration, fullStart);
property.decorators = decorators;
setModifiers(property, modifiers);
property.name = name;
property.questionToken = questionToken;
property.type = parseTypeAnnotation();
property.initializer = allowInAnd(parseNonParameterInitializer);
parseSemicolon();
return finishNode(property);
}
function parsePropertyOrMethodDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ClassElement {
let asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
let name = parsePropertyName();
// Note: this is not legal as per the grammar. But we allow it in the parser and
// report an error in the grammar checker.
let questionToken = parseOptionalToken(SyntaxKind.QuestionToken);
if (asteriskToken || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, Diagnostics.or_expected);
return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, Diagnostics.or_expected);
}
else {
let property = <PropertyDeclaration>createNode(SyntaxKind.PropertyDeclaration, fullStart);
setModifiers(property, modifiers);
property.name = name;
property.questionToken = questionToken;
property.type = parseTypeAnnotation();
property.initializer = allowInAnd(parseNonParameterInitializer);
parseSemicolon();
return finishNode(property);
return parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken);
}
}
@@ -4406,8 +4502,9 @@ module ts {
return parseInitializer(/*inParameter*/ false);
}
function parseAccessorDeclaration(kind: SyntaxKind, fullStart: number, modifiers: ModifiersArray): AccessorDeclaration {
function parseAccessorDeclaration(kind: SyntaxKind, fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): AccessorDeclaration {
let node = <AccessorDeclaration>createNode(kind, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
node.name = parsePropertyName();
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, node);
@@ -4418,6 +4515,10 @@ module ts {
function isClassMemberStart(): boolean {
let idToken: SyntaxKind;
if (token === SyntaxKind.AtToken) {
return true;
}
// Eat up all modifiers, but hold on to the last one in case it is actually an identifier.
while (isModifier(token)) {
idToken = token;
@@ -4469,6 +4570,29 @@ module ts {
return false;
}
function parseDecorators(): NodeArray<Decorator> {
let decorators: NodeArray<Decorator>;
while (true) {
let decoratorStart = getNodePos();
if (!parseOptional(SyntaxKind.AtToken)) {
break;
}
if (!decorators) {
decorators = <NodeArray<Decorator>>[];
decorators.pos = scanner.getStartPos();
}
let decorator = <Decorator>createNode(SyntaxKind.Decorator, decoratorStart);
decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher);
decorators.push(finishNode(decorator));
}
if (decorators) {
decorators.end = getNodeEnd();
}
return decorators;
}
function parseModifiers(): ModifiersArray {
let flags = 0;
let modifiers: ModifiersArray;
@@ -4496,19 +4620,20 @@ module ts {
function parseClassElement(): ClassElement {
let fullStart = getNodePos();
let decorators = parseDecorators();
let modifiers = parseModifiers();
let accessor = tryParseAccessorDeclaration(fullStart, modifiers);
let accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers);
if (accessor) {
return accessor;
}
if (token === SyntaxKind.ConstructorKeyword) {
return parseConstructorDeclaration(fullStart, modifiers);
return parseConstructorDeclaration(fullStart, decorators, modifiers);
}
if (isIndexSignature()) {
return parseIndexSignatureDeclaration(modifiers);
return parseIndexSignatureDeclaration(fullStart, decorators, modifiers);
}
// It is very important that we check this *after* checking indexers because
@@ -4519,14 +4644,20 @@ module ts {
token === SyntaxKind.AsteriskToken ||
token === SyntaxKind.OpenBracketToken) {
return parsePropertyOrMethodDeclaration(fullStart, modifiers);
return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers);
}
if (decorators) {
// treat this as a property declaration with a missing name.
let name = <Identifier>createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected);
return parsePropertyDeclaration(fullStart, decorators, modifiers, name, /*questionToken*/ undefined);
}
// 'isClassMemberStart' should have hinted not to attempt parsing.
Debug.fail("Should not have attempted to parse class member declaration.");
}
function parseClassDeclaration(fullStart: number, modifiers: ModifiersArray): ClassDeclaration {
function parseClassDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ClassDeclaration {
// In ES6 specification, All parts of a ClassDeclaration or a ClassExpression are strict mode code
let savedStrictModeContext = inStrictModeContext();
if (languageVersion >= ScriptTarget.ES6) {
@@ -4534,6 +4665,7 @@ module ts {
}
var node = <ClassDeclaration>createNode(SyntaxKind.ClassDeclaration, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
parseExpected(SyntaxKind.ClassKeyword);
node.name = node.flags & NodeFlags.Default ? parseOptionalIdentifier() : parseIdentifier();
@@ -4597,8 +4729,9 @@ module ts {
return parseList(ParsingContext.ClassMembers, /*checkForStrictMode*/ false, parseClassElement);
}
function parseInterfaceDeclaration(fullStart: number, modifiers: ModifiersArray): InterfaceDeclaration {
function parseInterfaceDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): InterfaceDeclaration {
let node = <InterfaceDeclaration>createNode(SyntaxKind.InterfaceDeclaration, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
parseExpected(SyntaxKind.InterfaceKeyword);
node.name = parseIdentifier();
@@ -4608,8 +4741,9 @@ module ts {
return finishNode(node);
}
function parseTypeAliasDeclaration(fullStart: number, modifiers: ModifiersArray): TypeAliasDeclaration {
function parseTypeAliasDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): TypeAliasDeclaration {
let node = <TypeAliasDeclaration>createNode(SyntaxKind.TypeAliasDeclaration, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
parseExpected(SyntaxKind.TypeKeyword);
node.name = parseIdentifier();
@@ -4630,8 +4764,9 @@ module ts {
return finishNode(node);
}
function parseEnumDeclaration(fullStart: number, modifiers: ModifiersArray): EnumDeclaration {
function parseEnumDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): EnumDeclaration {
let node = <EnumDeclaration>createNode(SyntaxKind.EnumDeclaration, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
parseExpected(SyntaxKind.EnumKeyword);
node.name = parseIdentifier();
@@ -4657,30 +4792,32 @@ module ts {
return finishNode(node);
}
function parseInternalModuleTail(fullStart: number, modifiers: ModifiersArray, flags: NodeFlags): ModuleDeclaration {
function parseInternalModuleTail(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, flags: NodeFlags): ModuleDeclaration {
let node = <ModuleDeclaration>createNode(SyntaxKind.ModuleDeclaration, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
node.flags |= flags;
node.name = parseIdentifier();
node.body = parseOptional(SyntaxKind.DotToken)
? parseInternalModuleTail(getNodePos(), /*modifiers:*/undefined, NodeFlags.Export)
? parseInternalModuleTail(getNodePos(), /*decorators*/ undefined, /*modifiers:*/undefined, NodeFlags.Export)
: parseModuleBlock();
return finishNode(node);
}
function parseAmbientExternalModuleDeclaration(fullStart: number, modifiers: ModifiersArray): ModuleDeclaration {
function parseAmbientExternalModuleDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ModuleDeclaration {
let node = <ModuleDeclaration>createNode(SyntaxKind.ModuleDeclaration, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
node.name = parseLiteralNode(/*internName:*/ true);
node.body = parseModuleBlock();
return finishNode(node);
}
function parseModuleDeclaration(fullStart: number, modifiers: ModifiersArray): ModuleDeclaration {
function parseModuleDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ModuleDeclaration {
parseExpected(SyntaxKind.ModuleKeyword);
return token === SyntaxKind.StringLiteral
? parseAmbientExternalModuleDeclaration(fullStart, modifiers)
: parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0);
? parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers)
: parseInternalModuleTail(fullStart, decorators, modifiers, modifiers ? modifiers.flags : 0);
}
function isExternalModuleReference() {
@@ -4698,7 +4835,7 @@ module ts {
token === SyntaxKind.FromKeyword;
}
function parseImportDeclarationOrImportEqualsDeclaration(fullStart: number, modifiers: ModifiersArray): ImportEqualsDeclaration | ImportDeclaration {
function parseImportDeclarationOrImportEqualsDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ImportEqualsDeclaration | ImportDeclaration {
parseExpected(SyntaxKind.ImportKeyword);
let afterImportPos = scanner.getStartPos();
@@ -4710,6 +4847,7 @@ module ts {
// import x = require("mod"); or
// import x = M.x;
let importEqualsDeclaration = <ImportEqualsDeclaration>createNode(SyntaxKind.ImportEqualsDeclaration, fullStart);
importEqualsDeclaration.decorators = decorators;
setModifiers(importEqualsDeclaration, modifiers);
importEqualsDeclaration.name = identifier;
parseExpected(SyntaxKind.EqualsToken);
@@ -4721,6 +4859,7 @@ module ts {
// Import statement
let importDeclaration = <ImportDeclaration>createNode(SyntaxKind.ImportDeclaration, fullStart);
importDeclaration.decorators = decorators;
setModifiers(importDeclaration, modifiers);
// ImportDeclaration:
@@ -4829,34 +4968,36 @@ module ts {
function parseImportOrExportSpecifier(kind: SyntaxKind): ImportOrExportSpecifier {
let node = <ImportSpecifier>createNode(kind);
// ImportSpecifier:
// ImportedBinding
// IdentifierName as ImportedBinding
let isFirstIdentifierNameNotAnIdentifier = isKeyword(token) && !isIdentifier();
let start = scanner.getTokenPos();
// BindingIdentifier
// IdentifierName as BindingIdentifier
// ExportSpecififer:
// IdentifierName
// IdentifierName as IdentifierName
let checkIdentifierIsKeyword = isKeyword(token) && !isIdentifier();
let checkIdentifierStart = scanner.getTokenPos();
let checkIdentifierEnd = scanner.getTextPos();
let identifierName = parseIdentifierName();
if (token === SyntaxKind.AsKeyword) {
node.propertyName = identifierName;
parseExpected(SyntaxKind.AsKeyword);
if (isIdentifier()) {
node.name = parseIdentifierName();
}
else {
parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
}
checkIdentifierIsKeyword = isKeyword(token) && !isIdentifier();
checkIdentifierStart = scanner.getTokenPos();
checkIdentifierEnd = scanner.getTextPos();
node.name = parseIdentifierName();
}
else {
node.name = identifierName;
if (isFirstIdentifierNameNotAnIdentifier) {
// Report error identifier expected
parseErrorAtPosition(start, identifierName.end - start, Diagnostics.Identifier_expected);
}
}
if (kind === SyntaxKind.ImportSpecifier && checkIdentifierIsKeyword) {
// Report error identifier expected
parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, Diagnostics.Identifier_expected);
}
return finishNode(node);
}
function parseExportDeclaration(fullStart: number, modifiers: ModifiersArray): ExportDeclaration {
function parseExportDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ExportDeclaration {
let node = <ExportDeclaration>createNode(SyntaxKind.ExportDeclaration, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
if (parseOptional(SyntaxKind.AsteriskToken)) {
parseExpected(SyntaxKind.FromKeyword);
@@ -4872,8 +5013,9 @@ module ts {
return finishNode(node);
}
function parseExportAssignment(fullStart: number, modifiers: ModifiersArray): ExportAssignment {
function parseExportAssignment(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ExportAssignment {
let node = <ExportAssignment>createNode(SyntaxKind.ExportAssignment, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
if (parseOptional(SyntaxKind.EqualsToken)) {
node.isExportEquals = true;
@@ -4898,7 +5040,7 @@ module ts {
return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine);
}
function isDeclarationStart(): boolean {
function isDeclarationStart(followsModifier?: boolean): boolean {
switch (token) {
case SyntaxKind.VarKeyword:
case SyntaxKind.ConstKeyword:
@@ -4928,6 +5070,10 @@ module ts {
case SyntaxKind.StaticKeyword:
// Check for modifier on source element
return lookAhead(nextTokenIsDeclarationStart);
case SyntaxKind.AtToken:
// a lookahead here is too costly, and decorators are only valid on a declaration.
// We will assume we are parsing a declaration here and report an error later
return !followsModifier;
}
}
@@ -4954,12 +5100,12 @@ module ts {
function nextTokenCanFollowExportKeyword() {
nextToken();
return token === SyntaxKind.EqualsToken || token === SyntaxKind.AsteriskToken ||
token === SyntaxKind.OpenBraceToken || token === SyntaxKind.DefaultKeyword || isDeclarationStart();
token === SyntaxKind.OpenBraceToken || token === SyntaxKind.DefaultKeyword || isDeclarationStart(/*followsModifier*/ true);
}
function nextTokenIsDeclarationStart() {
nextToken();
return isDeclarationStart();
return isDeclarationStart(/*followsModifier*/ true);
}
function nextTokenIsAsKeyword() {
@@ -4968,14 +5114,15 @@ module ts {
function parseDeclaration(): ModuleElement {
let fullStart = getNodePos();
let decorators = parseDecorators();
let modifiers = parseModifiers();
if (token === SyntaxKind.ExportKeyword) {
nextToken();
if (token === SyntaxKind.DefaultKeyword || token === SyntaxKind.EqualsToken) {
return parseExportAssignment(fullStart, modifiers);
return parseExportAssignment(fullStart, decorators, modifiers);
}
if (token === SyntaxKind.AsteriskToken || token === SyntaxKind.OpenBraceToken) {
return parseExportDeclaration(fullStart, modifiers);
return parseExportDeclaration(fullStart, decorators, modifiers);
}
}
@@ -4983,22 +5130,31 @@ module ts {
case SyntaxKind.VarKeyword:
case SyntaxKind.LetKeyword:
case SyntaxKind.ConstKeyword:
return parseVariableStatement(fullStart, modifiers);
return parseVariableStatement(fullStart, decorators, modifiers);
case SyntaxKind.FunctionKeyword:
return parseFunctionDeclaration(fullStart, modifiers);
return parseFunctionDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ClassKeyword:
return parseClassDeclaration(fullStart, modifiers);
return parseClassDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.InterfaceKeyword:
return parseInterfaceDeclaration(fullStart, modifiers);
return parseInterfaceDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.TypeKeyword:
return parseTypeAliasDeclaration(fullStart, modifiers);
return parseTypeAliasDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.EnumKeyword:
return parseEnumDeclaration(fullStart, modifiers);
return parseEnumDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ModuleKeyword:
return parseModuleDeclaration(fullStart, modifiers);
return parseModuleDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ImportKeyword:
return parseImportDeclarationOrImportEqualsDeclaration(fullStart, modifiers);
return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers);
default:
if (decorators) {
// We reached this point because we encountered an AtToken and assumed a declaration would
// follow. For recovery and error reporting purposes, return an incomplete declaration.
let node = <ModuleElement>createMissingNode(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected);
node.pos = fullStart;
node.decorators = decorators;
setModifiers(node, modifiers);
return finishNode(node);
}
Debug.fail("Mismatch between isDeclarationStart and parseDeclaration");
}
}
+3
View File
@@ -148,6 +148,7 @@ module ts {
"&=": SyntaxKind.AmpersandEqualsToken,
"|=": SyntaxKind.BarEqualsToken,
"^=": SyntaxKind.CaretEqualsToken,
"@": SyntaxKind.AtToken,
};
/*
@@ -1284,6 +1285,8 @@ module ts {
return pos++, token = SyntaxKind.CloseBraceToken;
case CharacterCodes.tilde:
return pos++, token = SyntaxKind.TildeToken;
case CharacterCodes.at:
return pos++, token = SyntaxKind.AtToken;
case CharacterCodes.backslash:
let cookedChar = peekUnicodeEscape();
if (cookedChar >= 0 && isIdentifierStart(cookedChar)) {
+35 -22
View File
@@ -67,6 +67,7 @@ module ts {
BarBarToken,
QuestionToken,
ColonToken,
AtToken,
// Assignments
EqualsToken,
PlusEqualsToken,
@@ -154,6 +155,7 @@ module ts {
// Signature elements
TypeParameter,
Parameter,
Decorator,
// TypeMember
PropertySignature,
PropertyDeclaration,
@@ -244,6 +246,7 @@ module ts {
ExportDeclaration,
NamedExports,
ExportSpecifier,
MissingDeclaration,
// Module references
ExternalModuleReference,
@@ -307,6 +310,7 @@ module ts {
Let = 0x00001000, // Variable declaration
Const = 0x00002000, // Variable declaration
OctalLiteral = 0x00004000,
ExportContext = 0x00008000, // Export context (initialized by binding)
Modifier = Export | Ambient | Public | Private | Protected | Static | Default,
AccessibilityModifier = Public | Private | Protected,
@@ -327,22 +331,25 @@ module ts {
// If this node was parsed in the parameters of a generator.
GeneratorParameter = 1 << 3,
// If this node was parsed as part of a decorator
Decorator = 1 << 4,
// If the parser encountered an error when parsing the code that created this node. Note
// the parser only sets this directly on the node it creates right after encountering the
// error.
ThisNodeHasError = 1 << 4,
ThisNodeHasError = 1 << 5,
// Context flags set directly by the parser.
ParserGeneratedFlags = StrictMode | DisallowIn | Yield | GeneratorParameter | ThisNodeHasError,
ParserGeneratedFlags = StrictMode | DisallowIn | Yield | GeneratorParameter | Decorator | ThisNodeHasError,
// Context flags computed by aggregating child flags upwards.
// Used during incremental parsing to determine if this node or any of its children had an
// error. Computed only once and then cached.
ThisNodeOrAnySubNodesHasError = 1 << 5,
ThisNodeOrAnySubNodesHasError = 1 << 6,
// Used to know if we've computed data from children and cached it in this node.
HasAggregatedChildData = 1 << 6
HasAggregatedChildData = 1 << 7
}
export const enum RelationComparisonResult {
@@ -357,13 +364,14 @@ module ts {
// Specific context the parser was in when this node was created. Normally undefined.
// Only set when the parser was in some interesting context (like async/yield).
parserContextFlags?: ParserContextFlags;
modifiers?: ModifiersArray; // Array of modifiers
id?: number; // Unique id (used to look up NodeLinks)
parent?: Node; // Parent node (initialized by binding)
symbol?: Symbol; // Symbol declared by node (initialized by binding)
locals?: SymbolTable; // Locals associated with node (initialized by binding)
nextContainer?: Node; // Next container in declaration order (initialized by binding)
localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes)
decorators?: NodeArray<Decorator>; // Array of decorators (in document order)
modifiers?: ModifiersArray; // Array of modifiers
id?: number; // Unique id (used to look up NodeLinks)
parent?: Node; // Parent node (initialized by binding)
symbol?: Symbol; // Symbol declared by node (initialized by binding)
locals?: SymbolTable; // Locals associated with node (initialized by binding)
nextContainer?: Node; // Next container in declaration order (initialized by binding)
localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes)
}
export interface NodeArray<T> extends Array<T>, TextRange {
@@ -397,6 +405,10 @@ module ts {
expression: Expression;
}
export interface Decorator extends Node {
expression: LeftHandSideExpression;
}
export interface TypeParameterDeclaration extends Declaration {
name: Identifier;
constraint?: TypeNode;
@@ -1209,8 +1221,8 @@ module ts {
export interface EmitResolver {
hasGlobalName(name: string): boolean;
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
hasExportDefaultValue(node: SourceFile): boolean;
isReferencedAliasDeclaration(node: Node): boolean;
isValueAliasDeclaration(node: Node): boolean;
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
isDeclarationVisible(node: Declaration): boolean;
@@ -1338,17 +1350,18 @@ module ts {
}
export const enum NodeCheckFlags {
TypeChecked = 0x00000001, // Node has been type checked
LexicalThis = 0x00000002, // Lexical 'this' reference
CaptureThis = 0x00000004, // Lexical 'this' used in body
EmitExtends = 0x00000008, // Emit __extends
SuperInstance = 0x00000010, // Instance 'super' reference
SuperStatic = 0x00000020, // Static 'super' reference
ContextChecked = 0x00000040, // Contextual types have been assigned
TypeChecked = 0x00000001, // Node has been type checked
LexicalThis = 0x00000002, // Lexical 'this' reference
CaptureThis = 0x00000004, // Lexical 'this' used in body
EmitExtends = 0x00000008, // Emit __extends
SuperInstance = 0x00000010, // Instance 'super' reference
SuperStatic = 0x00000020, // Static 'super' reference
ContextChecked = 0x00000040, // Contextual types have been assigned
// Values for enum members have been computed, and any errors have been reported for them.
EnumValuesComputed = 0x00000080,
BlockScopedBindingInLoop = 0x00000100,
EnumValuesComputed = 0x00000080,
BlockScopedBindingInLoop = 0x00000100,
EmitDecorate = 0x00000200, // Emit __decorate
}
export interface NodeLinks {
+114 -1
View File
@@ -1,4 +1,4 @@
/// <reference path="types.ts" />
/// <reference path="binder.ts" />
module ts {
export interface ReferencePathMatchResult {
@@ -575,6 +575,83 @@ module ts {
return (<CallExpression>node).expression;
}
export function nodeCanBeDecorated(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.ClassDeclaration:
// classes are valid targets
return true;
case SyntaxKind.PropertyDeclaration:
// property declarations are valid if their parent is a class declaration.
return node.parent.kind === SyntaxKind.ClassDeclaration;
case SyntaxKind.Parameter:
// if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;
return (<FunctionLikeDeclaration>node.parent).body && node.parent.parent.kind === SyntaxKind.ClassDeclaration;
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.MethodDeclaration:
// if this method has a body and its parent is a class declaration, this is a valid target.
return (<FunctionLikeDeclaration>node).body && node.parent.kind === SyntaxKind.ClassDeclaration;
}
return false;
}
export function nodeIsDecorated(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.ClassDeclaration:
if (node.decorators) {
return true;
}
return false;
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.Parameter:
if (node.decorators) {
return true;
}
return false;
case SyntaxKind.GetAccessor:
if ((<FunctionLikeDeclaration>node).body && node.decorators) {
return true;
}
return false;
case SyntaxKind.MethodDeclaration:
case SyntaxKind.SetAccessor:
if ((<FunctionLikeDeclaration>node).body && node.decorators) {
return true;
}
return false;
}
return false;
}
export function childIsDecorated(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.ClassDeclaration:
return forEach((<ClassDeclaration>node).members, nodeOrChildIsDecorated);
case SyntaxKind.MethodDeclaration:
case SyntaxKind.SetAccessor:
return forEach((<FunctionLikeDeclaration>node).parameters, nodeIsDecorated);
}
return false;
}
export function nodeOrChildIsDecorated(node: Node): boolean {
return nodeIsDecorated(node) || childIsDecorated(node);
}
export function isExpression(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.ThisKeyword:
@@ -814,6 +891,20 @@ module ts {
}
}
export function isClassElement(n: Node): boolean {
switch (n.kind) {
case SyntaxKind.Constructor:
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.IndexSignature:
return true;
default:
return false;
}
}
// True if the given identifier, string literal, or number literal is the name of a declaration node
export function isDeclarationName(name: Node): boolean {
if (name.kind !== SyntaxKind.Identifier && name.kind !== SyntaxKind.StringLiteral && name.kind !== SyntaxKind.NumericLiteral) {
@@ -834,6 +925,23 @@ module ts {
return false;
}
// An alias symbol is created by one of the following declarations:
// import <symbol> = ...
// import <symbol> from ...
// import * as <symbol> from ...
// import { x as <symbol> } from ...
// export { x as <symbol> } from ...
// export = ...
// export default ...
export function isAliasSymbolDeclaration(node: Node): boolean {
return node.kind === SyntaxKind.ImportEqualsDeclaration ||
node.kind === SyntaxKind.ImportClause && !!(<ImportClause>node).name ||
node.kind === SyntaxKind.NamespaceImport ||
node.kind === SyntaxKind.ImportSpecifier ||
node.kind === SyntaxKind.ExportSpecifier ||
node.kind === SyntaxKind.ExportAssignment && (<ExportAssignment>node).expression.kind === SyntaxKind.Identifier;
}
export function getClassBaseTypeNode(node: ClassDeclaration) {
let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword);
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
@@ -1485,6 +1593,7 @@ module ts {
export function getAllAccessorDeclarations(declarations: NodeArray<Declaration>, accessor: AccessorDeclaration) {
let firstAccessor: AccessorDeclaration;
let secondAccessor: AccessorDeclaration;
let getAccessor: AccessorDeclaration;
let setAccessor: AccessorDeclaration;
if (hasDynamicName(accessor)) {
@@ -1509,6 +1618,9 @@ module ts {
if (!firstAccessor) {
firstAccessor = <AccessorDeclaration>member;
}
else if (!secondAccessor) {
secondAccessor = <AccessorDeclaration>member;
}
if (member.kind === SyntaxKind.GetAccessor && !getAccessor) {
getAccessor = <AccessorDeclaration>member;
@@ -1523,6 +1635,7 @@ module ts {
}
return {
firstAccessor,
secondAccessor,
getAccessor,
setAccessor
};
+14
View File
@@ -1155,3 +1155,17 @@ interface ArrayConstructor {
}
declare var Array: ArrayConstructor;
interface TypedPropertyDescriptor<T> {
enumerable?: boolean;
configurable?: boolean;
writable?: boolean;
value?: T;
get?: () => T;
set?: (value: T) => void;
}
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
declare type ParameterDecorator = (target: Function, propertyKey: string | symbol, parameterIndex: number) => void;
+29 -1
View File
@@ -433,7 +433,35 @@ module ts.server {
}
getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems {
throw new Error("Not Implemented Yet.");
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
var args: protocol.SignatureHelpRequestArgs = {
file: fileName,
line: lineOffset.line,
offset: lineOffset.offset
};
var request = this.processRequest<protocol.SignatureHelpRequest>(CommandNames.SignatureHelp, args);
var response = this.processResponse<protocol.SignatureHelpResponse>(request);
if (!response.body) {
return undefined;
}
var helpItems: protocol.SignatureHelpItems = response.body;
var span = helpItems.applicableSpan;
var start = this.lineOffsetToPosition(fileName, span.start);
var end = this.lineOffsetToPosition(fileName, span.end);
var result: SignatureHelpItems = {
items: helpItems.items,
applicableSpan: {
start: start,
length: end - start
},
selectedItemIndex: helpItems.selectedItemIndex,
argumentIndex: helpItems.argumentIndex,
argumentCount: helpItems.argumentCount,
}
return result;
}
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
+116
View File
@@ -592,6 +592,122 @@ declare module ts.server.protocol {
body?: CompletionEntryDetails[];
}
/**
* Signature help information for a single parameter
*/
export interface SignatureHelpParameter {
/**
* The parameter's name
*/
name: string;
/**
* Documentation of the parameter.
*/
documentation: SymbolDisplayPart[];
/**
* Display parts of the parameter.
*/
displayParts: SymbolDisplayPart[];
/**
* Whether the parameter is optional or not.
*/
isOptional: boolean;
}
/**
* Represents a single signature to show in signature help.
*/
export interface SignatureHelpItem {
/**
* Whether the signature accepts a variable number of arguments.
*/
isVariadic: boolean;
/**
* The prefix display parts.
*/
prefixDisplayParts: SymbolDisplayPart[];
/**
* The suffix disaply parts.
*/
suffixDisplayParts: SymbolDisplayPart[];
/**
* The separator display parts.
*/
separatorDisplayParts: SymbolDisplayPart[];
/**
* The signature helps items for the parameters.
*/
parameters: SignatureHelpParameter[];
/**
* The signature's documentation
*/
documentation: SymbolDisplayPart[];
}
/**
* Signature help items found in the response of a signature help request.
*/
export interface SignatureHelpItems {
/**
* The signature help items.
*/
items: SignatureHelpItem[];
/**
* The span for which signature help should appear on a signature
*/
applicableSpan: TextSpan;
/**
* The item selected in the set of available help items.
*/
selectedItemIndex: number;
/**
* The argument selected in the set of parameters.
*/
argumentIndex: number;
/**
* The argument count
*/
argumentCount: number;
}
/**
* Arguments of a signature help request.
*/
export interface SignatureHelpRequestArgs extends FileLocationRequestArgs {
}
/**
* Signature help request; value of command field is "signatureHelp".
* Given a file location (file, line, col), return the signature
* help.
*/
export interface SignatureHelpRequest extends FileLocationRequest {
arguments: SignatureHelpRequestArgs;
}
/**
* Repsonse object for a SignatureHelpRequest.
*/
export interface SignatureHelpResponse extends Response {
body?: SignatureHelpItems;
}
/**
* Arguments for geterr messages.
*/
+35
View File
@@ -80,6 +80,7 @@ module ts.server {
export var Close = "close";
export var Completions = "completions";
export var CompletionDetails = "completionEntryDetails";
export var SignatureHelp = "signatureHelp";
export var Configure = "configure";
export var Definition = "definition";
export var Format = "format";
@@ -577,6 +578,35 @@ module ts.server {
}, []);
}
getSignatureHelpItems(line: number, offset: number, fileName: string): protocol.SignatureHelpItems {
var file = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(file);
if (!project) {
throw Errors.NoProject;
}
var compilerService = project.compilerService;
var position = compilerService.host.lineOffsetToPosition(file, line, offset);
var helpItems = compilerService.languageService.getSignatureHelpItems(file, position);
if (!helpItems) {
return undefined;
}
var span = helpItems.applicableSpan;
var result: protocol.SignatureHelpItems = {
items: helpItems.items,
applicableSpan: {
start: compilerService.host.positionToLineOffset(file, span.start),
end: compilerService.host.positionToLineOffset(file, span.start + span.length)
},
selectedItemIndex: helpItems.selectedItemIndex,
argumentIndex: helpItems.argumentIndex,
argumentCount: helpItems.argumentCount,
}
return result;
}
getDiagnostics(delay: number, fileNames: string[]) {
var checkList = fileNames.reduce((accum: PendingErrorCheck[], fileName: string) => {
fileName = ts.normalizePath(fileName);
@@ -790,6 +820,11 @@ module ts.server {
completionDetailsArgs.entryNames,completionDetailsArgs.file);
break;
}
case CommandNames.SignatureHelp: {
var signatureHelpArgs = <protocol.SignatureHelpRequestArgs>request.arguments;
response = this.getSignatureHelpItems(signatureHelpArgs.line, signatureHelpArgs.offset, signatureHelpArgs.file);
break;
}
case CommandNames.Geterr: {
var geterrArgs = <protocol.GeterrRequestArgs>request.arguments;
response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files);
+30
View File
@@ -419,6 +419,29 @@ module ts.formatting {
}
}
function getFirstNonDecoratorTokenOfNode(node: Node) {
if (node.modifiers && node.modifiers.length) {
return node.modifiers[0].kind;
}
switch (node.kind) {
case SyntaxKind.ClassDeclaration: return SyntaxKind.ClassKeyword;
case SyntaxKind.InterfaceDeclaration: return SyntaxKind.InterfaceKeyword;
case SyntaxKind.FunctionDeclaration: return SyntaxKind.FunctionKeyword;
case SyntaxKind.EnumDeclaration: return SyntaxKind.EnumDeclaration;
case SyntaxKind.GetAccessor: return SyntaxKind.GetKeyword;
case SyntaxKind.SetAccessor: return SyntaxKind.SetKeyword;
case SyntaxKind.MethodDeclaration:
if ((<MethodDeclaration>node).asteriskToken) {
return SyntaxKind.AsteriskToken;
}
// fall-through
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.Parameter:
return (<Declaration>node).name.kind;
}
}
function getDynamicIndentation(node: Node, nodeStartLine: number, indentation: number, delta: number): DynamicIndentation {
return {
getIndentationForComment: kind => {
@@ -434,6 +457,12 @@ module ts.formatting {
return indentation;
},
getIndentationForToken: (line, kind) => {
if (nodeStartLine !== line && node.decorators) {
if (kind === getFirstNonDecoratorTokenOfNode(node)) {
// if this token is the first token following the list of decorators, we do not need to indent
return indentation;
}
}
switch (kind) {
// open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent
case SyntaxKind.OpenBraceToken:
@@ -442,6 +471,7 @@ module ts.formatting {
case SyntaxKind.CloseBracketToken:
case SyntaxKind.ElseKeyword:
case SyntaxKind.WhileKeyword:
case SyntaxKind.AtToken:
return indentation;
default:
// if token line equals to the line of containing node (this is a first token in the node) - use node indentation
+54 -20
View File
@@ -2476,36 +2476,38 @@ module ts {
return undefined;
}
// The decision to provide completion depends on the previous token, so find it
// Note: previousToken can be undefined if we are the beginning of the file
start = new Date().getTime();
let previousToken = findPrecedingToken(position, sourceFile);
log("getCompletionData: Get previous token 1: " + (new Date().getTime() - start));
// The caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS|
// Skip this partial identifier to the previous token
if (previousToken && position <= previousToken.end && previousToken.kind === SyntaxKind.Identifier) {
// The decision to provide completion depends on the contextToken, which is determined through the previousToken.
// Note: 'previousToken' (and thus 'contextToken') can be undefined if we are the beginning of the file
let contextToken = previousToken;
// Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS|
// Skip this partial identifier and adjust the contextToken to the token that precedes it.
if (contextToken && position <= contextToken.end && isWord(contextToken.kind)) {
let start = new Date().getTime();
previousToken = findPrecedingToken(previousToken.pos, sourceFile);
contextToken = findPrecedingToken(contextToken.getFullStart(), sourceFile);
log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start));
}
// Check if this is a valid completion location
if (previousToken && isCompletionListBlocker(previousToken)) {
if (contextToken && isCompletionListBlocker(contextToken)) {
log("Returning an empty list because completion was requested in an invalid position.");
return undefined;
}
// Find the node where completion is requested on, in the case of a completion after a dot, it is the member access expression
// other wise, it is a request for all visible symbols in the scope, and the node is the current location
// otherwise, it is a request for all visible symbols in the scope, and the node is the current location
let node = currentToken;
let isRightOfDot = false;
if (previousToken && previousToken.kind === SyntaxKind.DotToken && previousToken.parent.kind === SyntaxKind.PropertyAccessExpression) {
node = (<PropertyAccessExpression>previousToken.parent).expression;
if (contextToken && contextToken.kind === SyntaxKind.DotToken && contextToken.parent.kind === SyntaxKind.PropertyAccessExpression) {
node = (<PropertyAccessExpression>contextToken.parent).expression;
isRightOfDot = true;
}
else if (previousToken && previousToken.kind === SyntaxKind.DotToken && previousToken.parent.kind === SyntaxKind.QualifiedName) {
node = (<QualifiedName>previousToken.parent).left;
else if (contextToken && contextToken.kind === SyntaxKind.DotToken && contextToken.parent.kind === SyntaxKind.QualifiedName) {
node = (<QualifiedName>contextToken.parent).left;
isRightOfDot = true;
}
@@ -2554,7 +2556,7 @@ module ts {
}
}
else {
let containingObjectLiteral = getContainingObjectLiteralApplicableForCompletion(previousToken);
let containingObjectLiteral = getContainingObjectLiteralApplicableForCompletion(contextToken);
if (containingObjectLiteral) {
// Object literal expression, look up possible property names from contextual type
isMemberCompletion = true;
@@ -2571,13 +2573,13 @@ module ts {
symbols = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties);
}
}
else if (getAncestor(previousToken, SyntaxKind.ImportClause)) {
else if (getAncestor(contextToken, SyntaxKind.ImportClause)) {
// cursor is in import clause
// try to show exported member for imported module
isMemberCompletion = true;
isNewIdentifierLocation = true;
if (showCompletionsInImportsClause(previousToken)) {
let importDeclaration = <ImportDeclaration>getAncestor(previousToken, SyntaxKind.ImportDeclaration);
if (showCompletionsInImportsClause(contextToken)) {
let importDeclaration = <ImportDeclaration>getAncestor(contextToken, SyntaxKind.ImportDeclaration);
Debug.assert(importDeclaration !== undefined);
let exports = typeInfoResolver.getExportsOfImportDeclaration(importDeclaration);
@@ -2585,14 +2587,46 @@ module ts {
}
}
else {
// Get scope members
// Get all entities in the current scope.
isMemberCompletion = false;
isNewIdentifierLocation = isNewIdentifierDefinitionLocation(previousToken);
isNewIdentifierLocation = isNewIdentifierDefinitionLocation(contextToken);
if (previousToken !== contextToken) {
Debug.assert(!!previousToken, "Expected 'contextToken' to be defined when different from 'previousToken'.");
}
// We need to find the node that will give us an appropriate scope to begin
// aggregating completion candidates. This is achieved in 'getScopeNode'
// by finding the first node that encompasses a position, accounting for whether a node
// is "complete" to decide whether a position belongs to the node.
//
// However, at the end of an identifier, we are interested in the scope of the identifier
// itself, but fall outside of the identifier. For instance:
//
// xyz => x$
//
// the cursor is outside of both the 'x' and the arrow function 'xyz => x',
// so 'xyz' is not returned in our results.
//
// We define 'adjustedPosition' so that we may appropriately account for
// being at the end of an identifier. The intention is that if requesting completion
// at the end of an identifier, it should be effectively equivalent to requesting completion
// anywhere inside/at the beginning of the identifier. So in the previous case, the
// 'adjustedPosition' will work as if requesting completion in the following:
//
// xyz => $x
//
// If previousToken !== contextToken, then
// - 'contextToken' was adjusted to the token prior to 'previousToken'
// because we were at the end of an identifier.
// - 'previousToken' is defined.
let adjustedPosition = previousToken !== contextToken ?
previousToken.getStart() :
position;
let scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile);
/// TODO filter meaning based on the current context
let scopeNode = getScopeNode(previousToken, position, sourceFile);
let symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace | SymbolFlags.Alias;
symbols = typeInfoResolver.getSymbolsInScope(scopeNode, symbolMeanings);
}
}
+1 -1
View File
@@ -450,7 +450,7 @@ module ts {
return n.kind >= SyntaxKind.FirstToken && n.kind <= SyntaxKind.LastToken;
}
function isWord(kind: SyntaxKind): boolean {
export function isWord(kind: SyntaxKind): boolean {
return kind === SyntaxKind.Identifier || isKeyword(kind);
}
+202 -192
View File
@@ -111,192 +111,195 @@ declare module "typescript" {
BarBarToken = 49,
QuestionToken = 50,
ColonToken = 51,
EqualsToken = 52,
PlusEqualsToken = 53,
MinusEqualsToken = 54,
AsteriskEqualsToken = 55,
SlashEqualsToken = 56,
PercentEqualsToken = 57,
LessThanLessThanEqualsToken = 58,
GreaterThanGreaterThanEqualsToken = 59,
GreaterThanGreaterThanGreaterThanEqualsToken = 60,
AmpersandEqualsToken = 61,
BarEqualsToken = 62,
CaretEqualsToken = 63,
Identifier = 64,
BreakKeyword = 65,
CaseKeyword = 66,
CatchKeyword = 67,
ClassKeyword = 68,
ConstKeyword = 69,
ContinueKeyword = 70,
DebuggerKeyword = 71,
DefaultKeyword = 72,
DeleteKeyword = 73,
DoKeyword = 74,
ElseKeyword = 75,
EnumKeyword = 76,
ExportKeyword = 77,
ExtendsKeyword = 78,
FalseKeyword = 79,
FinallyKeyword = 80,
ForKeyword = 81,
FunctionKeyword = 82,
IfKeyword = 83,
ImportKeyword = 84,
InKeyword = 85,
InstanceOfKeyword = 86,
NewKeyword = 87,
NullKeyword = 88,
ReturnKeyword = 89,
SuperKeyword = 90,
SwitchKeyword = 91,
ThisKeyword = 92,
ThrowKeyword = 93,
TrueKeyword = 94,
TryKeyword = 95,
TypeOfKeyword = 96,
VarKeyword = 97,
VoidKeyword = 98,
WhileKeyword = 99,
WithKeyword = 100,
AsKeyword = 101,
ImplementsKeyword = 102,
InterfaceKeyword = 103,
LetKeyword = 104,
PackageKeyword = 105,
PrivateKeyword = 106,
ProtectedKeyword = 107,
PublicKeyword = 108,
StaticKeyword = 109,
YieldKeyword = 110,
AnyKeyword = 111,
BooleanKeyword = 112,
ConstructorKeyword = 113,
DeclareKeyword = 114,
GetKeyword = 115,
ModuleKeyword = 116,
RequireKeyword = 117,
NumberKeyword = 118,
SetKeyword = 119,
StringKeyword = 120,
SymbolKeyword = 121,
TypeKeyword = 122,
FromKeyword = 123,
OfKeyword = 124,
QualifiedName = 125,
ComputedPropertyName = 126,
TypeParameter = 127,
Parameter = 128,
PropertySignature = 129,
PropertyDeclaration = 130,
MethodSignature = 131,
MethodDeclaration = 132,
Constructor = 133,
GetAccessor = 134,
SetAccessor = 135,
CallSignature = 136,
ConstructSignature = 137,
IndexSignature = 138,
TypeReference = 139,
FunctionType = 140,
ConstructorType = 141,
TypeQuery = 142,
TypeLiteral = 143,
ArrayType = 144,
TupleType = 145,
UnionType = 146,
ParenthesizedType = 147,
ObjectBindingPattern = 148,
ArrayBindingPattern = 149,
BindingElement = 150,
ArrayLiteralExpression = 151,
ObjectLiteralExpression = 152,
PropertyAccessExpression = 153,
ElementAccessExpression = 154,
CallExpression = 155,
NewExpression = 156,
TaggedTemplateExpression = 157,
TypeAssertionExpression = 158,
ParenthesizedExpression = 159,
FunctionExpression = 160,
ArrowFunction = 161,
DeleteExpression = 162,
TypeOfExpression = 163,
VoidExpression = 164,
PrefixUnaryExpression = 165,
PostfixUnaryExpression = 166,
BinaryExpression = 167,
ConditionalExpression = 168,
TemplateExpression = 169,
YieldExpression = 170,
SpreadElementExpression = 171,
OmittedExpression = 172,
TemplateSpan = 173,
Block = 174,
VariableStatement = 175,
EmptyStatement = 176,
ExpressionStatement = 177,
IfStatement = 178,
DoStatement = 179,
WhileStatement = 180,
ForStatement = 181,
ForInStatement = 182,
ForOfStatement = 183,
ContinueStatement = 184,
BreakStatement = 185,
ReturnStatement = 186,
WithStatement = 187,
SwitchStatement = 188,
LabeledStatement = 189,
ThrowStatement = 190,
TryStatement = 191,
DebuggerStatement = 192,
VariableDeclaration = 193,
VariableDeclarationList = 194,
FunctionDeclaration = 195,
ClassDeclaration = 196,
InterfaceDeclaration = 197,
TypeAliasDeclaration = 198,
EnumDeclaration = 199,
ModuleDeclaration = 200,
ModuleBlock = 201,
CaseBlock = 202,
ImportEqualsDeclaration = 203,
ImportDeclaration = 204,
ImportClause = 205,
NamespaceImport = 206,
NamedImports = 207,
ImportSpecifier = 208,
ExportAssignment = 209,
ExportDeclaration = 210,
NamedExports = 211,
ExportSpecifier = 212,
ExternalModuleReference = 213,
CaseClause = 214,
DefaultClause = 215,
HeritageClause = 216,
CatchClause = 217,
PropertyAssignment = 218,
ShorthandPropertyAssignment = 219,
EnumMember = 220,
SourceFile = 221,
SyntaxList = 222,
Count = 223,
FirstAssignment = 52,
LastAssignment = 63,
FirstReservedWord = 65,
LastReservedWord = 100,
FirstKeyword = 65,
LastKeyword = 124,
FirstFutureReservedWord = 102,
LastFutureReservedWord = 110,
FirstTypeNode = 139,
LastTypeNode = 147,
AtToken = 52,
EqualsToken = 53,
PlusEqualsToken = 54,
MinusEqualsToken = 55,
AsteriskEqualsToken = 56,
SlashEqualsToken = 57,
PercentEqualsToken = 58,
LessThanLessThanEqualsToken = 59,
GreaterThanGreaterThanEqualsToken = 60,
GreaterThanGreaterThanGreaterThanEqualsToken = 61,
AmpersandEqualsToken = 62,
BarEqualsToken = 63,
CaretEqualsToken = 64,
Identifier = 65,
BreakKeyword = 66,
CaseKeyword = 67,
CatchKeyword = 68,
ClassKeyword = 69,
ConstKeyword = 70,
ContinueKeyword = 71,
DebuggerKeyword = 72,
DefaultKeyword = 73,
DeleteKeyword = 74,
DoKeyword = 75,
ElseKeyword = 76,
EnumKeyword = 77,
ExportKeyword = 78,
ExtendsKeyword = 79,
FalseKeyword = 80,
FinallyKeyword = 81,
ForKeyword = 82,
FunctionKeyword = 83,
IfKeyword = 84,
ImportKeyword = 85,
InKeyword = 86,
InstanceOfKeyword = 87,
NewKeyword = 88,
NullKeyword = 89,
ReturnKeyword = 90,
SuperKeyword = 91,
SwitchKeyword = 92,
ThisKeyword = 93,
ThrowKeyword = 94,
TrueKeyword = 95,
TryKeyword = 96,
TypeOfKeyword = 97,
VarKeyword = 98,
VoidKeyword = 99,
WhileKeyword = 100,
WithKeyword = 101,
AsKeyword = 102,
ImplementsKeyword = 103,
InterfaceKeyword = 104,
LetKeyword = 105,
PackageKeyword = 106,
PrivateKeyword = 107,
ProtectedKeyword = 108,
PublicKeyword = 109,
StaticKeyword = 110,
YieldKeyword = 111,
AnyKeyword = 112,
BooleanKeyword = 113,
ConstructorKeyword = 114,
DeclareKeyword = 115,
GetKeyword = 116,
ModuleKeyword = 117,
RequireKeyword = 118,
NumberKeyword = 119,
SetKeyword = 120,
StringKeyword = 121,
SymbolKeyword = 122,
TypeKeyword = 123,
FromKeyword = 124,
OfKeyword = 125,
QualifiedName = 126,
ComputedPropertyName = 127,
TypeParameter = 128,
Parameter = 129,
Decorator = 130,
PropertySignature = 131,
PropertyDeclaration = 132,
MethodSignature = 133,
MethodDeclaration = 134,
Constructor = 135,
GetAccessor = 136,
SetAccessor = 137,
CallSignature = 138,
ConstructSignature = 139,
IndexSignature = 140,
TypeReference = 141,
FunctionType = 142,
ConstructorType = 143,
TypeQuery = 144,
TypeLiteral = 145,
ArrayType = 146,
TupleType = 147,
UnionType = 148,
ParenthesizedType = 149,
ObjectBindingPattern = 150,
ArrayBindingPattern = 151,
BindingElement = 152,
ArrayLiteralExpression = 153,
ObjectLiteralExpression = 154,
PropertyAccessExpression = 155,
ElementAccessExpression = 156,
CallExpression = 157,
NewExpression = 158,
TaggedTemplateExpression = 159,
TypeAssertionExpression = 160,
ParenthesizedExpression = 161,
FunctionExpression = 162,
ArrowFunction = 163,
DeleteExpression = 164,
TypeOfExpression = 165,
VoidExpression = 166,
PrefixUnaryExpression = 167,
PostfixUnaryExpression = 168,
BinaryExpression = 169,
ConditionalExpression = 170,
TemplateExpression = 171,
YieldExpression = 172,
SpreadElementExpression = 173,
OmittedExpression = 174,
TemplateSpan = 175,
Block = 176,
VariableStatement = 177,
EmptyStatement = 178,
ExpressionStatement = 179,
IfStatement = 180,
DoStatement = 181,
WhileStatement = 182,
ForStatement = 183,
ForInStatement = 184,
ForOfStatement = 185,
ContinueStatement = 186,
BreakStatement = 187,
ReturnStatement = 188,
WithStatement = 189,
SwitchStatement = 190,
LabeledStatement = 191,
ThrowStatement = 192,
TryStatement = 193,
DebuggerStatement = 194,
VariableDeclaration = 195,
VariableDeclarationList = 196,
FunctionDeclaration = 197,
ClassDeclaration = 198,
InterfaceDeclaration = 199,
TypeAliasDeclaration = 200,
EnumDeclaration = 201,
ModuleDeclaration = 202,
ModuleBlock = 203,
CaseBlock = 204,
ImportEqualsDeclaration = 205,
ImportDeclaration = 206,
ImportClause = 207,
NamespaceImport = 208,
NamedImports = 209,
ImportSpecifier = 210,
ExportAssignment = 211,
ExportDeclaration = 212,
NamedExports = 213,
ExportSpecifier = 214,
MissingDeclaration = 215,
ExternalModuleReference = 216,
CaseClause = 217,
DefaultClause = 218,
HeritageClause = 219,
CatchClause = 220,
PropertyAssignment = 221,
ShorthandPropertyAssignment = 222,
EnumMember = 223,
SourceFile = 224,
SyntaxList = 225,
Count = 226,
FirstAssignment = 53,
LastAssignment = 64,
FirstReservedWord = 66,
LastReservedWord = 101,
FirstKeyword = 66,
LastKeyword = 125,
FirstFutureReservedWord = 103,
LastFutureReservedWord = 111,
FirstTypeNode = 141,
LastTypeNode = 149,
FirstPunctuation = 14,
LastPunctuation = 63,
LastPunctuation = 64,
FirstToken = 0,
LastToken = 124,
LastToken = 125,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -304,8 +307,8 @@ declare module "typescript" {
FirstTemplateToken = 10,
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 63,
FirstNode = 125,
LastBinaryOperator = 64,
FirstNode = 126,
}
const enum NodeFlags {
Export = 1,
@@ -321,6 +324,7 @@ declare module "typescript" {
Let = 4096,
Const = 8192,
OctalLiteral = 16384,
ExportContext = 32768,
Modifier = 499,
AccessibilityModifier = 112,
BlockScoped = 12288,
@@ -330,10 +334,11 @@ declare module "typescript" {
DisallowIn = 2,
Yield = 4,
GeneratorParameter = 8,
ThisNodeHasError = 16,
ParserGeneratedFlags = 31,
ThisNodeOrAnySubNodesHasError = 32,
HasAggregatedChildData = 64,
Decorator = 16,
ThisNodeHasError = 32,
ParserGeneratedFlags = 63,
ThisNodeOrAnySubNodesHasError = 64,
HasAggregatedChildData = 128,
}
const enum RelationComparisonResult {
Succeeded = 1,
@@ -344,6 +349,7 @@ declare module "typescript" {
kind: SyntaxKind;
flags: NodeFlags;
parserContextFlags?: ParserContextFlags;
decorators?: NodeArray<Decorator>;
modifiers?: ModifiersArray;
id?: number;
parent?: Node;
@@ -374,6 +380,9 @@ declare module "typescript" {
interface ComputedPropertyName extends Node {
expression: Expression;
}
interface Decorator extends Node {
expression: LeftHandSideExpression;
}
interface TypeParameterDeclaration extends Declaration {
name: Identifier;
constraint?: TypeNode;
@@ -940,8 +949,8 @@ declare module "typescript" {
interface EmitResolver {
hasGlobalName(name: string): boolean;
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
hasExportDefaultValue(node: SourceFile): boolean;
isReferencedAliasDeclaration(node: Node): boolean;
isValueAliasDeclaration(node: Node): boolean;
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
isDeclarationVisible(node: Declaration): boolean;
@@ -1060,6 +1069,7 @@ declare module "typescript" {
ContextChecked = 64,
EnumValuesComputed = 128,
BlockScopedBindingInLoop = 256,
EmitDecorate = 512,
}
interface NodeLinks {
resolvedType?: Type;
+229 -197
View File
@@ -351,562 +351,571 @@ declare module "typescript" {
ColonToken = 51,
>ColonToken : SyntaxKind
EqualsToken = 52,
AtToken = 52,
>AtToken : SyntaxKind
EqualsToken = 53,
>EqualsToken : SyntaxKind
PlusEqualsToken = 53,
PlusEqualsToken = 54,
>PlusEqualsToken : SyntaxKind
MinusEqualsToken = 54,
MinusEqualsToken = 55,
>MinusEqualsToken : SyntaxKind
AsteriskEqualsToken = 55,
AsteriskEqualsToken = 56,
>AsteriskEqualsToken : SyntaxKind
SlashEqualsToken = 56,
SlashEqualsToken = 57,
>SlashEqualsToken : SyntaxKind
PercentEqualsToken = 57,
PercentEqualsToken = 58,
>PercentEqualsToken : SyntaxKind
LessThanLessThanEqualsToken = 58,
LessThanLessThanEqualsToken = 59,
>LessThanLessThanEqualsToken : SyntaxKind
GreaterThanGreaterThanEqualsToken = 59,
GreaterThanGreaterThanEqualsToken = 60,
>GreaterThanGreaterThanEqualsToken : SyntaxKind
GreaterThanGreaterThanGreaterThanEqualsToken = 60,
GreaterThanGreaterThanGreaterThanEqualsToken = 61,
>GreaterThanGreaterThanGreaterThanEqualsToken : SyntaxKind
AmpersandEqualsToken = 61,
AmpersandEqualsToken = 62,
>AmpersandEqualsToken : SyntaxKind
BarEqualsToken = 62,
BarEqualsToken = 63,
>BarEqualsToken : SyntaxKind
CaretEqualsToken = 63,
CaretEqualsToken = 64,
>CaretEqualsToken : SyntaxKind
Identifier = 64,
Identifier = 65,
>Identifier : SyntaxKind
BreakKeyword = 65,
BreakKeyword = 66,
>BreakKeyword : SyntaxKind
CaseKeyword = 66,
CaseKeyword = 67,
>CaseKeyword : SyntaxKind
CatchKeyword = 67,
CatchKeyword = 68,
>CatchKeyword : SyntaxKind
ClassKeyword = 68,
ClassKeyword = 69,
>ClassKeyword : SyntaxKind
ConstKeyword = 69,
ConstKeyword = 70,
>ConstKeyword : SyntaxKind
ContinueKeyword = 70,
ContinueKeyword = 71,
>ContinueKeyword : SyntaxKind
DebuggerKeyword = 71,
DebuggerKeyword = 72,
>DebuggerKeyword : SyntaxKind
DefaultKeyword = 72,
DefaultKeyword = 73,
>DefaultKeyword : SyntaxKind
DeleteKeyword = 73,
DeleteKeyword = 74,
>DeleteKeyword : SyntaxKind
DoKeyword = 74,
DoKeyword = 75,
>DoKeyword : SyntaxKind
ElseKeyword = 75,
ElseKeyword = 76,
>ElseKeyword : SyntaxKind
EnumKeyword = 76,
EnumKeyword = 77,
>EnumKeyword : SyntaxKind
ExportKeyword = 77,
ExportKeyword = 78,
>ExportKeyword : SyntaxKind
ExtendsKeyword = 78,
ExtendsKeyword = 79,
>ExtendsKeyword : SyntaxKind
FalseKeyword = 79,
FalseKeyword = 80,
>FalseKeyword : SyntaxKind
FinallyKeyword = 80,
FinallyKeyword = 81,
>FinallyKeyword : SyntaxKind
ForKeyword = 81,
ForKeyword = 82,
>ForKeyword : SyntaxKind
FunctionKeyword = 82,
FunctionKeyword = 83,
>FunctionKeyword : SyntaxKind
IfKeyword = 83,
IfKeyword = 84,
>IfKeyword : SyntaxKind
ImportKeyword = 84,
ImportKeyword = 85,
>ImportKeyword : SyntaxKind
InKeyword = 85,
InKeyword = 86,
>InKeyword : SyntaxKind
InstanceOfKeyword = 86,
InstanceOfKeyword = 87,
>InstanceOfKeyword : SyntaxKind
NewKeyword = 87,
NewKeyword = 88,
>NewKeyword : SyntaxKind
NullKeyword = 88,
NullKeyword = 89,
>NullKeyword : SyntaxKind
ReturnKeyword = 89,
ReturnKeyword = 90,
>ReturnKeyword : SyntaxKind
SuperKeyword = 90,
SuperKeyword = 91,
>SuperKeyword : SyntaxKind
SwitchKeyword = 91,
SwitchKeyword = 92,
>SwitchKeyword : SyntaxKind
ThisKeyword = 92,
ThisKeyword = 93,
>ThisKeyword : SyntaxKind
ThrowKeyword = 93,
ThrowKeyword = 94,
>ThrowKeyword : SyntaxKind
TrueKeyword = 94,
TrueKeyword = 95,
>TrueKeyword : SyntaxKind
TryKeyword = 95,
TryKeyword = 96,
>TryKeyword : SyntaxKind
TypeOfKeyword = 96,
TypeOfKeyword = 97,
>TypeOfKeyword : SyntaxKind
VarKeyword = 97,
VarKeyword = 98,
>VarKeyword : SyntaxKind
VoidKeyword = 98,
VoidKeyword = 99,
>VoidKeyword : SyntaxKind
WhileKeyword = 99,
WhileKeyword = 100,
>WhileKeyword : SyntaxKind
WithKeyword = 100,
WithKeyword = 101,
>WithKeyword : SyntaxKind
AsKeyword = 101,
AsKeyword = 102,
>AsKeyword : SyntaxKind
ImplementsKeyword = 102,
ImplementsKeyword = 103,
>ImplementsKeyword : SyntaxKind
InterfaceKeyword = 103,
InterfaceKeyword = 104,
>InterfaceKeyword : SyntaxKind
LetKeyword = 104,
LetKeyword = 105,
>LetKeyword : SyntaxKind
PackageKeyword = 105,
PackageKeyword = 106,
>PackageKeyword : SyntaxKind
PrivateKeyword = 106,
PrivateKeyword = 107,
>PrivateKeyword : SyntaxKind
ProtectedKeyword = 107,
ProtectedKeyword = 108,
>ProtectedKeyword : SyntaxKind
PublicKeyword = 108,
PublicKeyword = 109,
>PublicKeyword : SyntaxKind
StaticKeyword = 109,
StaticKeyword = 110,
>StaticKeyword : SyntaxKind
YieldKeyword = 110,
YieldKeyword = 111,
>YieldKeyword : SyntaxKind
AnyKeyword = 111,
AnyKeyword = 112,
>AnyKeyword : SyntaxKind
BooleanKeyword = 112,
BooleanKeyword = 113,
>BooleanKeyword : SyntaxKind
ConstructorKeyword = 113,
ConstructorKeyword = 114,
>ConstructorKeyword : SyntaxKind
DeclareKeyword = 114,
DeclareKeyword = 115,
>DeclareKeyword : SyntaxKind
GetKeyword = 115,
GetKeyword = 116,
>GetKeyword : SyntaxKind
ModuleKeyword = 116,
ModuleKeyword = 117,
>ModuleKeyword : SyntaxKind
RequireKeyword = 117,
RequireKeyword = 118,
>RequireKeyword : SyntaxKind
NumberKeyword = 118,
NumberKeyword = 119,
>NumberKeyword : SyntaxKind
SetKeyword = 119,
SetKeyword = 120,
>SetKeyword : SyntaxKind
StringKeyword = 120,
StringKeyword = 121,
>StringKeyword : SyntaxKind
SymbolKeyword = 121,
SymbolKeyword = 122,
>SymbolKeyword : SyntaxKind
TypeKeyword = 122,
TypeKeyword = 123,
>TypeKeyword : SyntaxKind
FromKeyword = 123,
FromKeyword = 124,
>FromKeyword : SyntaxKind
OfKeyword = 124,
OfKeyword = 125,
>OfKeyword : SyntaxKind
QualifiedName = 125,
QualifiedName = 126,
>QualifiedName : SyntaxKind
ComputedPropertyName = 126,
ComputedPropertyName = 127,
>ComputedPropertyName : SyntaxKind
TypeParameter = 127,
TypeParameter = 128,
>TypeParameter : SyntaxKind
Parameter = 128,
Parameter = 129,
>Parameter : SyntaxKind
PropertySignature = 129,
Decorator = 130,
>Decorator : SyntaxKind
PropertySignature = 131,
>PropertySignature : SyntaxKind
PropertyDeclaration = 130,
PropertyDeclaration = 132,
>PropertyDeclaration : SyntaxKind
MethodSignature = 131,
MethodSignature = 133,
>MethodSignature : SyntaxKind
MethodDeclaration = 132,
MethodDeclaration = 134,
>MethodDeclaration : SyntaxKind
Constructor = 133,
Constructor = 135,
>Constructor : SyntaxKind
GetAccessor = 134,
GetAccessor = 136,
>GetAccessor : SyntaxKind
SetAccessor = 135,
SetAccessor = 137,
>SetAccessor : SyntaxKind
CallSignature = 136,
CallSignature = 138,
>CallSignature : SyntaxKind
ConstructSignature = 137,
ConstructSignature = 139,
>ConstructSignature : SyntaxKind
IndexSignature = 138,
IndexSignature = 140,
>IndexSignature : SyntaxKind
TypeReference = 139,
TypeReference = 141,
>TypeReference : SyntaxKind
FunctionType = 140,
FunctionType = 142,
>FunctionType : SyntaxKind
ConstructorType = 141,
ConstructorType = 143,
>ConstructorType : SyntaxKind
TypeQuery = 142,
TypeQuery = 144,
>TypeQuery : SyntaxKind
TypeLiteral = 143,
TypeLiteral = 145,
>TypeLiteral : SyntaxKind
ArrayType = 144,
ArrayType = 146,
>ArrayType : SyntaxKind
TupleType = 145,
TupleType = 147,
>TupleType : SyntaxKind
UnionType = 146,
UnionType = 148,
>UnionType : SyntaxKind
ParenthesizedType = 147,
ParenthesizedType = 149,
>ParenthesizedType : SyntaxKind
ObjectBindingPattern = 148,
ObjectBindingPattern = 150,
>ObjectBindingPattern : SyntaxKind
ArrayBindingPattern = 149,
ArrayBindingPattern = 151,
>ArrayBindingPattern : SyntaxKind
BindingElement = 150,
BindingElement = 152,
>BindingElement : SyntaxKind
ArrayLiteralExpression = 151,
ArrayLiteralExpression = 153,
>ArrayLiteralExpression : SyntaxKind
ObjectLiteralExpression = 152,
ObjectLiteralExpression = 154,
>ObjectLiteralExpression : SyntaxKind
PropertyAccessExpression = 153,
PropertyAccessExpression = 155,
>PropertyAccessExpression : SyntaxKind
ElementAccessExpression = 154,
ElementAccessExpression = 156,
>ElementAccessExpression : SyntaxKind
CallExpression = 155,
CallExpression = 157,
>CallExpression : SyntaxKind
NewExpression = 156,
NewExpression = 158,
>NewExpression : SyntaxKind
TaggedTemplateExpression = 157,
TaggedTemplateExpression = 159,
>TaggedTemplateExpression : SyntaxKind
TypeAssertionExpression = 158,
TypeAssertionExpression = 160,
>TypeAssertionExpression : SyntaxKind
ParenthesizedExpression = 159,
ParenthesizedExpression = 161,
>ParenthesizedExpression : SyntaxKind
FunctionExpression = 160,
FunctionExpression = 162,
>FunctionExpression : SyntaxKind
ArrowFunction = 161,
ArrowFunction = 163,
>ArrowFunction : SyntaxKind
DeleteExpression = 162,
DeleteExpression = 164,
>DeleteExpression : SyntaxKind
TypeOfExpression = 163,
TypeOfExpression = 165,
>TypeOfExpression : SyntaxKind
VoidExpression = 164,
VoidExpression = 166,
>VoidExpression : SyntaxKind
PrefixUnaryExpression = 165,
PrefixUnaryExpression = 167,
>PrefixUnaryExpression : SyntaxKind
PostfixUnaryExpression = 166,
PostfixUnaryExpression = 168,
>PostfixUnaryExpression : SyntaxKind
BinaryExpression = 167,
BinaryExpression = 169,
>BinaryExpression : SyntaxKind
ConditionalExpression = 168,
ConditionalExpression = 170,
>ConditionalExpression : SyntaxKind
TemplateExpression = 169,
TemplateExpression = 171,
>TemplateExpression : SyntaxKind
YieldExpression = 170,
YieldExpression = 172,
>YieldExpression : SyntaxKind
SpreadElementExpression = 171,
SpreadElementExpression = 173,
>SpreadElementExpression : SyntaxKind
OmittedExpression = 172,
OmittedExpression = 174,
>OmittedExpression : SyntaxKind
TemplateSpan = 173,
TemplateSpan = 175,
>TemplateSpan : SyntaxKind
Block = 174,
Block = 176,
>Block : SyntaxKind
VariableStatement = 175,
VariableStatement = 177,
>VariableStatement : SyntaxKind
EmptyStatement = 176,
EmptyStatement = 178,
>EmptyStatement : SyntaxKind
ExpressionStatement = 177,
ExpressionStatement = 179,
>ExpressionStatement : SyntaxKind
IfStatement = 178,
IfStatement = 180,
>IfStatement : SyntaxKind
DoStatement = 179,
DoStatement = 181,
>DoStatement : SyntaxKind
WhileStatement = 180,
WhileStatement = 182,
>WhileStatement : SyntaxKind
ForStatement = 181,
ForStatement = 183,
>ForStatement : SyntaxKind
ForInStatement = 182,
ForInStatement = 184,
>ForInStatement : SyntaxKind
ForOfStatement = 183,
ForOfStatement = 185,
>ForOfStatement : SyntaxKind
ContinueStatement = 184,
ContinueStatement = 186,
>ContinueStatement : SyntaxKind
BreakStatement = 185,
BreakStatement = 187,
>BreakStatement : SyntaxKind
ReturnStatement = 186,
ReturnStatement = 188,
>ReturnStatement : SyntaxKind
WithStatement = 187,
WithStatement = 189,
>WithStatement : SyntaxKind
SwitchStatement = 188,
SwitchStatement = 190,
>SwitchStatement : SyntaxKind
LabeledStatement = 189,
LabeledStatement = 191,
>LabeledStatement : SyntaxKind
ThrowStatement = 190,
ThrowStatement = 192,
>ThrowStatement : SyntaxKind
TryStatement = 191,
TryStatement = 193,
>TryStatement : SyntaxKind
DebuggerStatement = 192,
DebuggerStatement = 194,
>DebuggerStatement : SyntaxKind
VariableDeclaration = 193,
VariableDeclaration = 195,
>VariableDeclaration : SyntaxKind
VariableDeclarationList = 194,
VariableDeclarationList = 196,
>VariableDeclarationList : SyntaxKind
FunctionDeclaration = 195,
FunctionDeclaration = 197,
>FunctionDeclaration : SyntaxKind
ClassDeclaration = 196,
ClassDeclaration = 198,
>ClassDeclaration : SyntaxKind
InterfaceDeclaration = 197,
InterfaceDeclaration = 199,
>InterfaceDeclaration : SyntaxKind
TypeAliasDeclaration = 198,
TypeAliasDeclaration = 200,
>TypeAliasDeclaration : SyntaxKind
EnumDeclaration = 199,
EnumDeclaration = 201,
>EnumDeclaration : SyntaxKind
ModuleDeclaration = 200,
ModuleDeclaration = 202,
>ModuleDeclaration : SyntaxKind
ModuleBlock = 201,
ModuleBlock = 203,
>ModuleBlock : SyntaxKind
CaseBlock = 202,
CaseBlock = 204,
>CaseBlock : SyntaxKind
ImportEqualsDeclaration = 203,
ImportEqualsDeclaration = 205,
>ImportEqualsDeclaration : SyntaxKind
ImportDeclaration = 204,
ImportDeclaration = 206,
>ImportDeclaration : SyntaxKind
ImportClause = 205,
ImportClause = 207,
>ImportClause : SyntaxKind
NamespaceImport = 206,
NamespaceImport = 208,
>NamespaceImport : SyntaxKind
NamedImports = 207,
NamedImports = 209,
>NamedImports : SyntaxKind
ImportSpecifier = 208,
ImportSpecifier = 210,
>ImportSpecifier : SyntaxKind
ExportAssignment = 209,
ExportAssignment = 211,
>ExportAssignment : SyntaxKind
ExportDeclaration = 210,
ExportDeclaration = 212,
>ExportDeclaration : SyntaxKind
NamedExports = 211,
NamedExports = 213,
>NamedExports : SyntaxKind
ExportSpecifier = 212,
ExportSpecifier = 214,
>ExportSpecifier : SyntaxKind
ExternalModuleReference = 213,
MissingDeclaration = 215,
>MissingDeclaration : SyntaxKind
ExternalModuleReference = 216,
>ExternalModuleReference : SyntaxKind
CaseClause = 214,
CaseClause = 217,
>CaseClause : SyntaxKind
DefaultClause = 215,
DefaultClause = 218,
>DefaultClause : SyntaxKind
HeritageClause = 216,
HeritageClause = 219,
>HeritageClause : SyntaxKind
CatchClause = 217,
CatchClause = 220,
>CatchClause : SyntaxKind
PropertyAssignment = 218,
PropertyAssignment = 221,
>PropertyAssignment : SyntaxKind
ShorthandPropertyAssignment = 219,
ShorthandPropertyAssignment = 222,
>ShorthandPropertyAssignment : SyntaxKind
EnumMember = 220,
EnumMember = 223,
>EnumMember : SyntaxKind
SourceFile = 221,
SourceFile = 224,
>SourceFile : SyntaxKind
SyntaxList = 222,
SyntaxList = 225,
>SyntaxList : SyntaxKind
Count = 223,
Count = 226,
>Count : SyntaxKind
FirstAssignment = 52,
FirstAssignment = 53,
>FirstAssignment : SyntaxKind
LastAssignment = 63,
LastAssignment = 64,
>LastAssignment : SyntaxKind
FirstReservedWord = 65,
FirstReservedWord = 66,
>FirstReservedWord : SyntaxKind
LastReservedWord = 100,
LastReservedWord = 101,
>LastReservedWord : SyntaxKind
FirstKeyword = 65,
FirstKeyword = 66,
>FirstKeyword : SyntaxKind
LastKeyword = 124,
LastKeyword = 125,
>LastKeyword : SyntaxKind
FirstFutureReservedWord = 102,
FirstFutureReservedWord = 103,
>FirstFutureReservedWord : SyntaxKind
LastFutureReservedWord = 110,
LastFutureReservedWord = 111,
>LastFutureReservedWord : SyntaxKind
FirstTypeNode = 139,
FirstTypeNode = 141,
>FirstTypeNode : SyntaxKind
LastTypeNode = 147,
LastTypeNode = 149,
>LastTypeNode : SyntaxKind
FirstPunctuation = 14,
>FirstPunctuation : SyntaxKind
LastPunctuation = 63,
LastPunctuation = 64,
>LastPunctuation : SyntaxKind
FirstToken = 0,
>FirstToken : SyntaxKind
LastToken = 124,
LastToken = 125,
>LastToken : SyntaxKind
FirstTriviaToken = 2,
@@ -930,10 +939,10 @@ declare module "typescript" {
FirstBinaryOperator = 24,
>FirstBinaryOperator : SyntaxKind
LastBinaryOperator = 63,
LastBinaryOperator = 64,
>LastBinaryOperator : SyntaxKind
FirstNode = 125,
FirstNode = 126,
>FirstNode : SyntaxKind
}
const enum NodeFlags {
@@ -978,6 +987,9 @@ declare module "typescript" {
OctalLiteral = 16384,
>OctalLiteral : NodeFlags
ExportContext = 32768,
>ExportContext : NodeFlags
Modifier = 499,
>Modifier : NodeFlags
@@ -1002,16 +1014,19 @@ declare module "typescript" {
GeneratorParameter = 8,
>GeneratorParameter : ParserContextFlags
ThisNodeHasError = 16,
Decorator = 16,
>Decorator : ParserContextFlags
ThisNodeHasError = 32,
>ThisNodeHasError : ParserContextFlags
ParserGeneratedFlags = 31,
ParserGeneratedFlags = 63,
>ParserGeneratedFlags : ParserContextFlags
ThisNodeOrAnySubNodesHasError = 32,
ThisNodeOrAnySubNodesHasError = 64,
>ThisNodeOrAnySubNodesHasError : ParserContextFlags
HasAggregatedChildData = 64,
HasAggregatedChildData = 128,
>HasAggregatedChildData : ParserContextFlags
}
const enum RelationComparisonResult {
@@ -1042,6 +1057,11 @@ declare module "typescript" {
>parserContextFlags : ParserContextFlags
>ParserContextFlags : ParserContextFlags
decorators?: NodeArray<Decorator>;
>decorators : NodeArray<Decorator>
>NodeArray : NodeArray<T>
>Decorator : Decorator
modifiers?: ModifiersArray;
>modifiers : ModifiersArray
>ModifiersArray : ModifiersArray
@@ -1136,6 +1156,14 @@ declare module "typescript" {
expression: Expression;
>expression : Expression
>Expression : Expression
}
interface Decorator extends Node {
>Decorator : Decorator
>Node : Node
expression: LeftHandSideExpression;
>expression : LeftHandSideExpression
>LeftHandSideExpression : LeftHandSideExpression
}
interface TypeParameterDeclaration extends Declaration {
>TypeParameterDeclaration : TypeParameterDeclaration
@@ -3015,16 +3043,17 @@ declare module "typescript" {
>node : Node
>Node : Node
hasExportDefaultValue(node: SourceFile): boolean;
>hasExportDefaultValue : (node: SourceFile) => boolean
>node : SourceFile
>SourceFile : SourceFile
isReferencedAliasDeclaration(node: Node): boolean;
>isReferencedAliasDeclaration : (node: Node) => boolean
isValueAliasDeclaration(node: Node): boolean;
>isValueAliasDeclaration : (node: Node) => boolean
>node : Node
>Node : Node
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
>isReferencedAliasDeclaration : (node: Node, checkChildren?: boolean) => boolean
>node : Node
>Node : Node
>checkChildren : boolean
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean
>node : ImportEqualsDeclaration
@@ -3434,6 +3463,9 @@ declare module "typescript" {
BlockScopedBindingInLoop = 256,
>BlockScopedBindingInLoop : NodeCheckFlags
EmitDecorate = 512,
>EmitDecorate : NodeCheckFlags
}
interface NodeLinks {
>NodeLinks : NodeLinks
+211 -201
View File
@@ -142,192 +142,195 @@ declare module "typescript" {
BarBarToken = 49,
QuestionToken = 50,
ColonToken = 51,
EqualsToken = 52,
PlusEqualsToken = 53,
MinusEqualsToken = 54,
AsteriskEqualsToken = 55,
SlashEqualsToken = 56,
PercentEqualsToken = 57,
LessThanLessThanEqualsToken = 58,
GreaterThanGreaterThanEqualsToken = 59,
GreaterThanGreaterThanGreaterThanEqualsToken = 60,
AmpersandEqualsToken = 61,
BarEqualsToken = 62,
CaretEqualsToken = 63,
Identifier = 64,
BreakKeyword = 65,
CaseKeyword = 66,
CatchKeyword = 67,
ClassKeyword = 68,
ConstKeyword = 69,
ContinueKeyword = 70,
DebuggerKeyword = 71,
DefaultKeyword = 72,
DeleteKeyword = 73,
DoKeyword = 74,
ElseKeyword = 75,
EnumKeyword = 76,
ExportKeyword = 77,
ExtendsKeyword = 78,
FalseKeyword = 79,
FinallyKeyword = 80,
ForKeyword = 81,
FunctionKeyword = 82,
IfKeyword = 83,
ImportKeyword = 84,
InKeyword = 85,
InstanceOfKeyword = 86,
NewKeyword = 87,
NullKeyword = 88,
ReturnKeyword = 89,
SuperKeyword = 90,
SwitchKeyword = 91,
ThisKeyword = 92,
ThrowKeyword = 93,
TrueKeyword = 94,
TryKeyword = 95,
TypeOfKeyword = 96,
VarKeyword = 97,
VoidKeyword = 98,
WhileKeyword = 99,
WithKeyword = 100,
AsKeyword = 101,
ImplementsKeyword = 102,
InterfaceKeyword = 103,
LetKeyword = 104,
PackageKeyword = 105,
PrivateKeyword = 106,
ProtectedKeyword = 107,
PublicKeyword = 108,
StaticKeyword = 109,
YieldKeyword = 110,
AnyKeyword = 111,
BooleanKeyword = 112,
ConstructorKeyword = 113,
DeclareKeyword = 114,
GetKeyword = 115,
ModuleKeyword = 116,
RequireKeyword = 117,
NumberKeyword = 118,
SetKeyword = 119,
StringKeyword = 120,
SymbolKeyword = 121,
TypeKeyword = 122,
FromKeyword = 123,
OfKeyword = 124,
QualifiedName = 125,
ComputedPropertyName = 126,
TypeParameter = 127,
Parameter = 128,
PropertySignature = 129,
PropertyDeclaration = 130,
MethodSignature = 131,
MethodDeclaration = 132,
Constructor = 133,
GetAccessor = 134,
SetAccessor = 135,
CallSignature = 136,
ConstructSignature = 137,
IndexSignature = 138,
TypeReference = 139,
FunctionType = 140,
ConstructorType = 141,
TypeQuery = 142,
TypeLiteral = 143,
ArrayType = 144,
TupleType = 145,
UnionType = 146,
ParenthesizedType = 147,
ObjectBindingPattern = 148,
ArrayBindingPattern = 149,
BindingElement = 150,
ArrayLiteralExpression = 151,
ObjectLiteralExpression = 152,
PropertyAccessExpression = 153,
ElementAccessExpression = 154,
CallExpression = 155,
NewExpression = 156,
TaggedTemplateExpression = 157,
TypeAssertionExpression = 158,
ParenthesizedExpression = 159,
FunctionExpression = 160,
ArrowFunction = 161,
DeleteExpression = 162,
TypeOfExpression = 163,
VoidExpression = 164,
PrefixUnaryExpression = 165,
PostfixUnaryExpression = 166,
BinaryExpression = 167,
ConditionalExpression = 168,
TemplateExpression = 169,
YieldExpression = 170,
SpreadElementExpression = 171,
OmittedExpression = 172,
TemplateSpan = 173,
Block = 174,
VariableStatement = 175,
EmptyStatement = 176,
ExpressionStatement = 177,
IfStatement = 178,
DoStatement = 179,
WhileStatement = 180,
ForStatement = 181,
ForInStatement = 182,
ForOfStatement = 183,
ContinueStatement = 184,
BreakStatement = 185,
ReturnStatement = 186,
WithStatement = 187,
SwitchStatement = 188,
LabeledStatement = 189,
ThrowStatement = 190,
TryStatement = 191,
DebuggerStatement = 192,
VariableDeclaration = 193,
VariableDeclarationList = 194,
FunctionDeclaration = 195,
ClassDeclaration = 196,
InterfaceDeclaration = 197,
TypeAliasDeclaration = 198,
EnumDeclaration = 199,
ModuleDeclaration = 200,
ModuleBlock = 201,
CaseBlock = 202,
ImportEqualsDeclaration = 203,
ImportDeclaration = 204,
ImportClause = 205,
NamespaceImport = 206,
NamedImports = 207,
ImportSpecifier = 208,
ExportAssignment = 209,
ExportDeclaration = 210,
NamedExports = 211,
ExportSpecifier = 212,
ExternalModuleReference = 213,
CaseClause = 214,
DefaultClause = 215,
HeritageClause = 216,
CatchClause = 217,
PropertyAssignment = 218,
ShorthandPropertyAssignment = 219,
EnumMember = 220,
SourceFile = 221,
SyntaxList = 222,
Count = 223,
FirstAssignment = 52,
LastAssignment = 63,
FirstReservedWord = 65,
LastReservedWord = 100,
FirstKeyword = 65,
LastKeyword = 124,
FirstFutureReservedWord = 102,
LastFutureReservedWord = 110,
FirstTypeNode = 139,
LastTypeNode = 147,
AtToken = 52,
EqualsToken = 53,
PlusEqualsToken = 54,
MinusEqualsToken = 55,
AsteriskEqualsToken = 56,
SlashEqualsToken = 57,
PercentEqualsToken = 58,
LessThanLessThanEqualsToken = 59,
GreaterThanGreaterThanEqualsToken = 60,
GreaterThanGreaterThanGreaterThanEqualsToken = 61,
AmpersandEqualsToken = 62,
BarEqualsToken = 63,
CaretEqualsToken = 64,
Identifier = 65,
BreakKeyword = 66,
CaseKeyword = 67,
CatchKeyword = 68,
ClassKeyword = 69,
ConstKeyword = 70,
ContinueKeyword = 71,
DebuggerKeyword = 72,
DefaultKeyword = 73,
DeleteKeyword = 74,
DoKeyword = 75,
ElseKeyword = 76,
EnumKeyword = 77,
ExportKeyword = 78,
ExtendsKeyword = 79,
FalseKeyword = 80,
FinallyKeyword = 81,
ForKeyword = 82,
FunctionKeyword = 83,
IfKeyword = 84,
ImportKeyword = 85,
InKeyword = 86,
InstanceOfKeyword = 87,
NewKeyword = 88,
NullKeyword = 89,
ReturnKeyword = 90,
SuperKeyword = 91,
SwitchKeyword = 92,
ThisKeyword = 93,
ThrowKeyword = 94,
TrueKeyword = 95,
TryKeyword = 96,
TypeOfKeyword = 97,
VarKeyword = 98,
VoidKeyword = 99,
WhileKeyword = 100,
WithKeyword = 101,
AsKeyword = 102,
ImplementsKeyword = 103,
InterfaceKeyword = 104,
LetKeyword = 105,
PackageKeyword = 106,
PrivateKeyword = 107,
ProtectedKeyword = 108,
PublicKeyword = 109,
StaticKeyword = 110,
YieldKeyword = 111,
AnyKeyword = 112,
BooleanKeyword = 113,
ConstructorKeyword = 114,
DeclareKeyword = 115,
GetKeyword = 116,
ModuleKeyword = 117,
RequireKeyword = 118,
NumberKeyword = 119,
SetKeyword = 120,
StringKeyword = 121,
SymbolKeyword = 122,
TypeKeyword = 123,
FromKeyword = 124,
OfKeyword = 125,
QualifiedName = 126,
ComputedPropertyName = 127,
TypeParameter = 128,
Parameter = 129,
Decorator = 130,
PropertySignature = 131,
PropertyDeclaration = 132,
MethodSignature = 133,
MethodDeclaration = 134,
Constructor = 135,
GetAccessor = 136,
SetAccessor = 137,
CallSignature = 138,
ConstructSignature = 139,
IndexSignature = 140,
TypeReference = 141,
FunctionType = 142,
ConstructorType = 143,
TypeQuery = 144,
TypeLiteral = 145,
ArrayType = 146,
TupleType = 147,
UnionType = 148,
ParenthesizedType = 149,
ObjectBindingPattern = 150,
ArrayBindingPattern = 151,
BindingElement = 152,
ArrayLiteralExpression = 153,
ObjectLiteralExpression = 154,
PropertyAccessExpression = 155,
ElementAccessExpression = 156,
CallExpression = 157,
NewExpression = 158,
TaggedTemplateExpression = 159,
TypeAssertionExpression = 160,
ParenthesizedExpression = 161,
FunctionExpression = 162,
ArrowFunction = 163,
DeleteExpression = 164,
TypeOfExpression = 165,
VoidExpression = 166,
PrefixUnaryExpression = 167,
PostfixUnaryExpression = 168,
BinaryExpression = 169,
ConditionalExpression = 170,
TemplateExpression = 171,
YieldExpression = 172,
SpreadElementExpression = 173,
OmittedExpression = 174,
TemplateSpan = 175,
Block = 176,
VariableStatement = 177,
EmptyStatement = 178,
ExpressionStatement = 179,
IfStatement = 180,
DoStatement = 181,
WhileStatement = 182,
ForStatement = 183,
ForInStatement = 184,
ForOfStatement = 185,
ContinueStatement = 186,
BreakStatement = 187,
ReturnStatement = 188,
WithStatement = 189,
SwitchStatement = 190,
LabeledStatement = 191,
ThrowStatement = 192,
TryStatement = 193,
DebuggerStatement = 194,
VariableDeclaration = 195,
VariableDeclarationList = 196,
FunctionDeclaration = 197,
ClassDeclaration = 198,
InterfaceDeclaration = 199,
TypeAliasDeclaration = 200,
EnumDeclaration = 201,
ModuleDeclaration = 202,
ModuleBlock = 203,
CaseBlock = 204,
ImportEqualsDeclaration = 205,
ImportDeclaration = 206,
ImportClause = 207,
NamespaceImport = 208,
NamedImports = 209,
ImportSpecifier = 210,
ExportAssignment = 211,
ExportDeclaration = 212,
NamedExports = 213,
ExportSpecifier = 214,
MissingDeclaration = 215,
ExternalModuleReference = 216,
CaseClause = 217,
DefaultClause = 218,
HeritageClause = 219,
CatchClause = 220,
PropertyAssignment = 221,
ShorthandPropertyAssignment = 222,
EnumMember = 223,
SourceFile = 224,
SyntaxList = 225,
Count = 226,
FirstAssignment = 53,
LastAssignment = 64,
FirstReservedWord = 66,
LastReservedWord = 101,
FirstKeyword = 66,
LastKeyword = 125,
FirstFutureReservedWord = 103,
LastFutureReservedWord = 111,
FirstTypeNode = 141,
LastTypeNode = 149,
FirstPunctuation = 14,
LastPunctuation = 63,
LastPunctuation = 64,
FirstToken = 0,
LastToken = 124,
LastToken = 125,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -335,8 +338,8 @@ declare module "typescript" {
FirstTemplateToken = 10,
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 63,
FirstNode = 125,
LastBinaryOperator = 64,
FirstNode = 126,
}
const enum NodeFlags {
Export = 1,
@@ -352,6 +355,7 @@ declare module "typescript" {
Let = 4096,
Const = 8192,
OctalLiteral = 16384,
ExportContext = 32768,
Modifier = 499,
AccessibilityModifier = 112,
BlockScoped = 12288,
@@ -361,10 +365,11 @@ declare module "typescript" {
DisallowIn = 2,
Yield = 4,
GeneratorParameter = 8,
ThisNodeHasError = 16,
ParserGeneratedFlags = 31,
ThisNodeOrAnySubNodesHasError = 32,
HasAggregatedChildData = 64,
Decorator = 16,
ThisNodeHasError = 32,
ParserGeneratedFlags = 63,
ThisNodeOrAnySubNodesHasError = 64,
HasAggregatedChildData = 128,
}
const enum RelationComparisonResult {
Succeeded = 1,
@@ -375,6 +380,7 @@ declare module "typescript" {
kind: SyntaxKind;
flags: NodeFlags;
parserContextFlags?: ParserContextFlags;
decorators?: NodeArray<Decorator>;
modifiers?: ModifiersArray;
id?: number;
parent?: Node;
@@ -405,6 +411,9 @@ declare module "typescript" {
interface ComputedPropertyName extends Node {
expression: Expression;
}
interface Decorator extends Node {
expression: LeftHandSideExpression;
}
interface TypeParameterDeclaration extends Declaration {
name: Identifier;
constraint?: TypeNode;
@@ -971,8 +980,8 @@ declare module "typescript" {
interface EmitResolver {
hasGlobalName(name: string): boolean;
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
hasExportDefaultValue(node: SourceFile): boolean;
isReferencedAliasDeclaration(node: Node): boolean;
isValueAliasDeclaration(node: Node): boolean;
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
isDeclarationVisible(node: Declaration): boolean;
@@ -1091,6 +1100,7 @@ declare module "typescript" {
ContextChecked = 64,
EnumValuesComputed = 128,
BlockScopedBindingInLoop = 256,
EmitDecorate = 512,
}
interface NodeLinks {
resolvedType?: Type;
@@ -2032,24 +2042,24 @@ function delint(sourceFile) {
delintNode(sourceFile);
function delintNode(node) {
switch (node.kind) {
case 181 /* ForStatement */:
case 182 /* ForInStatement */:
case 180 /* WhileStatement */:
case 179 /* DoStatement */:
if (node.statement.kind !== 174 /* Block */) {
case 183 /* ForStatement */:
case 184 /* ForInStatement */:
case 182 /* WhileStatement */:
case 181 /* DoStatement */:
if (node.statement.kind !== 176 /* Block */) {
report(node, "A looping statement's contents should be wrapped in a block body.");
}
break;
case 178 /* IfStatement */:
case 180 /* IfStatement */:
var ifStatement = node;
if (ifStatement.thenStatement.kind !== 174 /* Block */) {
if (ifStatement.thenStatement.kind !== 176 /* Block */) {
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
}
if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 174 /* Block */ && ifStatement.elseStatement.kind !== 178 /* IfStatement */) {
if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 176 /* Block */ && ifStatement.elseStatement.kind !== 180 /* IfStatement */) {
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
}
break;
case 167 /* BinaryExpression */:
case 169 /* BinaryExpression */:
var op = node.operatorToken.kind;
if (op === 28 /* EqualsEqualsToken */ || op === 29 /* ExclamationEqualsToken */) {
report(node, "Use '===' and '!=='.");
+229 -197
View File
@@ -497,562 +497,571 @@ declare module "typescript" {
ColonToken = 51,
>ColonToken : SyntaxKind
EqualsToken = 52,
AtToken = 52,
>AtToken : SyntaxKind
EqualsToken = 53,
>EqualsToken : SyntaxKind
PlusEqualsToken = 53,
PlusEqualsToken = 54,
>PlusEqualsToken : SyntaxKind
MinusEqualsToken = 54,
MinusEqualsToken = 55,
>MinusEqualsToken : SyntaxKind
AsteriskEqualsToken = 55,
AsteriskEqualsToken = 56,
>AsteriskEqualsToken : SyntaxKind
SlashEqualsToken = 56,
SlashEqualsToken = 57,
>SlashEqualsToken : SyntaxKind
PercentEqualsToken = 57,
PercentEqualsToken = 58,
>PercentEqualsToken : SyntaxKind
LessThanLessThanEqualsToken = 58,
LessThanLessThanEqualsToken = 59,
>LessThanLessThanEqualsToken : SyntaxKind
GreaterThanGreaterThanEqualsToken = 59,
GreaterThanGreaterThanEqualsToken = 60,
>GreaterThanGreaterThanEqualsToken : SyntaxKind
GreaterThanGreaterThanGreaterThanEqualsToken = 60,
GreaterThanGreaterThanGreaterThanEqualsToken = 61,
>GreaterThanGreaterThanGreaterThanEqualsToken : SyntaxKind
AmpersandEqualsToken = 61,
AmpersandEqualsToken = 62,
>AmpersandEqualsToken : SyntaxKind
BarEqualsToken = 62,
BarEqualsToken = 63,
>BarEqualsToken : SyntaxKind
CaretEqualsToken = 63,
CaretEqualsToken = 64,
>CaretEqualsToken : SyntaxKind
Identifier = 64,
Identifier = 65,
>Identifier : SyntaxKind
BreakKeyword = 65,
BreakKeyword = 66,
>BreakKeyword : SyntaxKind
CaseKeyword = 66,
CaseKeyword = 67,
>CaseKeyword : SyntaxKind
CatchKeyword = 67,
CatchKeyword = 68,
>CatchKeyword : SyntaxKind
ClassKeyword = 68,
ClassKeyword = 69,
>ClassKeyword : SyntaxKind
ConstKeyword = 69,
ConstKeyword = 70,
>ConstKeyword : SyntaxKind
ContinueKeyword = 70,
ContinueKeyword = 71,
>ContinueKeyword : SyntaxKind
DebuggerKeyword = 71,
DebuggerKeyword = 72,
>DebuggerKeyword : SyntaxKind
DefaultKeyword = 72,
DefaultKeyword = 73,
>DefaultKeyword : SyntaxKind
DeleteKeyword = 73,
DeleteKeyword = 74,
>DeleteKeyword : SyntaxKind
DoKeyword = 74,
DoKeyword = 75,
>DoKeyword : SyntaxKind
ElseKeyword = 75,
ElseKeyword = 76,
>ElseKeyword : SyntaxKind
EnumKeyword = 76,
EnumKeyword = 77,
>EnumKeyword : SyntaxKind
ExportKeyword = 77,
ExportKeyword = 78,
>ExportKeyword : SyntaxKind
ExtendsKeyword = 78,
ExtendsKeyword = 79,
>ExtendsKeyword : SyntaxKind
FalseKeyword = 79,
FalseKeyword = 80,
>FalseKeyword : SyntaxKind
FinallyKeyword = 80,
FinallyKeyword = 81,
>FinallyKeyword : SyntaxKind
ForKeyword = 81,
ForKeyword = 82,
>ForKeyword : SyntaxKind
FunctionKeyword = 82,
FunctionKeyword = 83,
>FunctionKeyword : SyntaxKind
IfKeyword = 83,
IfKeyword = 84,
>IfKeyword : SyntaxKind
ImportKeyword = 84,
ImportKeyword = 85,
>ImportKeyword : SyntaxKind
InKeyword = 85,
InKeyword = 86,
>InKeyword : SyntaxKind
InstanceOfKeyword = 86,
InstanceOfKeyword = 87,
>InstanceOfKeyword : SyntaxKind
NewKeyword = 87,
NewKeyword = 88,
>NewKeyword : SyntaxKind
NullKeyword = 88,
NullKeyword = 89,
>NullKeyword : SyntaxKind
ReturnKeyword = 89,
ReturnKeyword = 90,
>ReturnKeyword : SyntaxKind
SuperKeyword = 90,
SuperKeyword = 91,
>SuperKeyword : SyntaxKind
SwitchKeyword = 91,
SwitchKeyword = 92,
>SwitchKeyword : SyntaxKind
ThisKeyword = 92,
ThisKeyword = 93,
>ThisKeyword : SyntaxKind
ThrowKeyword = 93,
ThrowKeyword = 94,
>ThrowKeyword : SyntaxKind
TrueKeyword = 94,
TrueKeyword = 95,
>TrueKeyword : SyntaxKind
TryKeyword = 95,
TryKeyword = 96,
>TryKeyword : SyntaxKind
TypeOfKeyword = 96,
TypeOfKeyword = 97,
>TypeOfKeyword : SyntaxKind
VarKeyword = 97,
VarKeyword = 98,
>VarKeyword : SyntaxKind
VoidKeyword = 98,
VoidKeyword = 99,
>VoidKeyword : SyntaxKind
WhileKeyword = 99,
WhileKeyword = 100,
>WhileKeyword : SyntaxKind
WithKeyword = 100,
WithKeyword = 101,
>WithKeyword : SyntaxKind
AsKeyword = 101,
AsKeyword = 102,
>AsKeyword : SyntaxKind
ImplementsKeyword = 102,
ImplementsKeyword = 103,
>ImplementsKeyword : SyntaxKind
InterfaceKeyword = 103,
InterfaceKeyword = 104,
>InterfaceKeyword : SyntaxKind
LetKeyword = 104,
LetKeyword = 105,
>LetKeyword : SyntaxKind
PackageKeyword = 105,
PackageKeyword = 106,
>PackageKeyword : SyntaxKind
PrivateKeyword = 106,
PrivateKeyword = 107,
>PrivateKeyword : SyntaxKind
ProtectedKeyword = 107,
ProtectedKeyword = 108,
>ProtectedKeyword : SyntaxKind
PublicKeyword = 108,
PublicKeyword = 109,
>PublicKeyword : SyntaxKind
StaticKeyword = 109,
StaticKeyword = 110,
>StaticKeyword : SyntaxKind
YieldKeyword = 110,
YieldKeyword = 111,
>YieldKeyword : SyntaxKind
AnyKeyword = 111,
AnyKeyword = 112,
>AnyKeyword : SyntaxKind
BooleanKeyword = 112,
BooleanKeyword = 113,
>BooleanKeyword : SyntaxKind
ConstructorKeyword = 113,
ConstructorKeyword = 114,
>ConstructorKeyword : SyntaxKind
DeclareKeyword = 114,
DeclareKeyword = 115,
>DeclareKeyword : SyntaxKind
GetKeyword = 115,
GetKeyword = 116,
>GetKeyword : SyntaxKind
ModuleKeyword = 116,
ModuleKeyword = 117,
>ModuleKeyword : SyntaxKind
RequireKeyword = 117,
RequireKeyword = 118,
>RequireKeyword : SyntaxKind
NumberKeyword = 118,
NumberKeyword = 119,
>NumberKeyword : SyntaxKind
SetKeyword = 119,
SetKeyword = 120,
>SetKeyword : SyntaxKind
StringKeyword = 120,
StringKeyword = 121,
>StringKeyword : SyntaxKind
SymbolKeyword = 121,
SymbolKeyword = 122,
>SymbolKeyword : SyntaxKind
TypeKeyword = 122,
TypeKeyword = 123,
>TypeKeyword : SyntaxKind
FromKeyword = 123,
FromKeyword = 124,
>FromKeyword : SyntaxKind
OfKeyword = 124,
OfKeyword = 125,
>OfKeyword : SyntaxKind
QualifiedName = 125,
QualifiedName = 126,
>QualifiedName : SyntaxKind
ComputedPropertyName = 126,
ComputedPropertyName = 127,
>ComputedPropertyName : SyntaxKind
TypeParameter = 127,
TypeParameter = 128,
>TypeParameter : SyntaxKind
Parameter = 128,
Parameter = 129,
>Parameter : SyntaxKind
PropertySignature = 129,
Decorator = 130,
>Decorator : SyntaxKind
PropertySignature = 131,
>PropertySignature : SyntaxKind
PropertyDeclaration = 130,
PropertyDeclaration = 132,
>PropertyDeclaration : SyntaxKind
MethodSignature = 131,
MethodSignature = 133,
>MethodSignature : SyntaxKind
MethodDeclaration = 132,
MethodDeclaration = 134,
>MethodDeclaration : SyntaxKind
Constructor = 133,
Constructor = 135,
>Constructor : SyntaxKind
GetAccessor = 134,
GetAccessor = 136,
>GetAccessor : SyntaxKind
SetAccessor = 135,
SetAccessor = 137,
>SetAccessor : SyntaxKind
CallSignature = 136,
CallSignature = 138,
>CallSignature : SyntaxKind
ConstructSignature = 137,
ConstructSignature = 139,
>ConstructSignature : SyntaxKind
IndexSignature = 138,
IndexSignature = 140,
>IndexSignature : SyntaxKind
TypeReference = 139,
TypeReference = 141,
>TypeReference : SyntaxKind
FunctionType = 140,
FunctionType = 142,
>FunctionType : SyntaxKind
ConstructorType = 141,
ConstructorType = 143,
>ConstructorType : SyntaxKind
TypeQuery = 142,
TypeQuery = 144,
>TypeQuery : SyntaxKind
TypeLiteral = 143,
TypeLiteral = 145,
>TypeLiteral : SyntaxKind
ArrayType = 144,
ArrayType = 146,
>ArrayType : SyntaxKind
TupleType = 145,
TupleType = 147,
>TupleType : SyntaxKind
UnionType = 146,
UnionType = 148,
>UnionType : SyntaxKind
ParenthesizedType = 147,
ParenthesizedType = 149,
>ParenthesizedType : SyntaxKind
ObjectBindingPattern = 148,
ObjectBindingPattern = 150,
>ObjectBindingPattern : SyntaxKind
ArrayBindingPattern = 149,
ArrayBindingPattern = 151,
>ArrayBindingPattern : SyntaxKind
BindingElement = 150,
BindingElement = 152,
>BindingElement : SyntaxKind
ArrayLiteralExpression = 151,
ArrayLiteralExpression = 153,
>ArrayLiteralExpression : SyntaxKind
ObjectLiteralExpression = 152,
ObjectLiteralExpression = 154,
>ObjectLiteralExpression : SyntaxKind
PropertyAccessExpression = 153,
PropertyAccessExpression = 155,
>PropertyAccessExpression : SyntaxKind
ElementAccessExpression = 154,
ElementAccessExpression = 156,
>ElementAccessExpression : SyntaxKind
CallExpression = 155,
CallExpression = 157,
>CallExpression : SyntaxKind
NewExpression = 156,
NewExpression = 158,
>NewExpression : SyntaxKind
TaggedTemplateExpression = 157,
TaggedTemplateExpression = 159,
>TaggedTemplateExpression : SyntaxKind
TypeAssertionExpression = 158,
TypeAssertionExpression = 160,
>TypeAssertionExpression : SyntaxKind
ParenthesizedExpression = 159,
ParenthesizedExpression = 161,
>ParenthesizedExpression : SyntaxKind
FunctionExpression = 160,
FunctionExpression = 162,
>FunctionExpression : SyntaxKind
ArrowFunction = 161,
ArrowFunction = 163,
>ArrowFunction : SyntaxKind
DeleteExpression = 162,
DeleteExpression = 164,
>DeleteExpression : SyntaxKind
TypeOfExpression = 163,
TypeOfExpression = 165,
>TypeOfExpression : SyntaxKind
VoidExpression = 164,
VoidExpression = 166,
>VoidExpression : SyntaxKind
PrefixUnaryExpression = 165,
PrefixUnaryExpression = 167,
>PrefixUnaryExpression : SyntaxKind
PostfixUnaryExpression = 166,
PostfixUnaryExpression = 168,
>PostfixUnaryExpression : SyntaxKind
BinaryExpression = 167,
BinaryExpression = 169,
>BinaryExpression : SyntaxKind
ConditionalExpression = 168,
ConditionalExpression = 170,
>ConditionalExpression : SyntaxKind
TemplateExpression = 169,
TemplateExpression = 171,
>TemplateExpression : SyntaxKind
YieldExpression = 170,
YieldExpression = 172,
>YieldExpression : SyntaxKind
SpreadElementExpression = 171,
SpreadElementExpression = 173,
>SpreadElementExpression : SyntaxKind
OmittedExpression = 172,
OmittedExpression = 174,
>OmittedExpression : SyntaxKind
TemplateSpan = 173,
TemplateSpan = 175,
>TemplateSpan : SyntaxKind
Block = 174,
Block = 176,
>Block : SyntaxKind
VariableStatement = 175,
VariableStatement = 177,
>VariableStatement : SyntaxKind
EmptyStatement = 176,
EmptyStatement = 178,
>EmptyStatement : SyntaxKind
ExpressionStatement = 177,
ExpressionStatement = 179,
>ExpressionStatement : SyntaxKind
IfStatement = 178,
IfStatement = 180,
>IfStatement : SyntaxKind
DoStatement = 179,
DoStatement = 181,
>DoStatement : SyntaxKind
WhileStatement = 180,
WhileStatement = 182,
>WhileStatement : SyntaxKind
ForStatement = 181,
ForStatement = 183,
>ForStatement : SyntaxKind
ForInStatement = 182,
ForInStatement = 184,
>ForInStatement : SyntaxKind
ForOfStatement = 183,
ForOfStatement = 185,
>ForOfStatement : SyntaxKind
ContinueStatement = 184,
ContinueStatement = 186,
>ContinueStatement : SyntaxKind
BreakStatement = 185,
BreakStatement = 187,
>BreakStatement : SyntaxKind
ReturnStatement = 186,
ReturnStatement = 188,
>ReturnStatement : SyntaxKind
WithStatement = 187,
WithStatement = 189,
>WithStatement : SyntaxKind
SwitchStatement = 188,
SwitchStatement = 190,
>SwitchStatement : SyntaxKind
LabeledStatement = 189,
LabeledStatement = 191,
>LabeledStatement : SyntaxKind
ThrowStatement = 190,
ThrowStatement = 192,
>ThrowStatement : SyntaxKind
TryStatement = 191,
TryStatement = 193,
>TryStatement : SyntaxKind
DebuggerStatement = 192,
DebuggerStatement = 194,
>DebuggerStatement : SyntaxKind
VariableDeclaration = 193,
VariableDeclaration = 195,
>VariableDeclaration : SyntaxKind
VariableDeclarationList = 194,
VariableDeclarationList = 196,
>VariableDeclarationList : SyntaxKind
FunctionDeclaration = 195,
FunctionDeclaration = 197,
>FunctionDeclaration : SyntaxKind
ClassDeclaration = 196,
ClassDeclaration = 198,
>ClassDeclaration : SyntaxKind
InterfaceDeclaration = 197,
InterfaceDeclaration = 199,
>InterfaceDeclaration : SyntaxKind
TypeAliasDeclaration = 198,
TypeAliasDeclaration = 200,
>TypeAliasDeclaration : SyntaxKind
EnumDeclaration = 199,
EnumDeclaration = 201,
>EnumDeclaration : SyntaxKind
ModuleDeclaration = 200,
ModuleDeclaration = 202,
>ModuleDeclaration : SyntaxKind
ModuleBlock = 201,
ModuleBlock = 203,
>ModuleBlock : SyntaxKind
CaseBlock = 202,
CaseBlock = 204,
>CaseBlock : SyntaxKind
ImportEqualsDeclaration = 203,
ImportEqualsDeclaration = 205,
>ImportEqualsDeclaration : SyntaxKind
ImportDeclaration = 204,
ImportDeclaration = 206,
>ImportDeclaration : SyntaxKind
ImportClause = 205,
ImportClause = 207,
>ImportClause : SyntaxKind
NamespaceImport = 206,
NamespaceImport = 208,
>NamespaceImport : SyntaxKind
NamedImports = 207,
NamedImports = 209,
>NamedImports : SyntaxKind
ImportSpecifier = 208,
ImportSpecifier = 210,
>ImportSpecifier : SyntaxKind
ExportAssignment = 209,
ExportAssignment = 211,
>ExportAssignment : SyntaxKind
ExportDeclaration = 210,
ExportDeclaration = 212,
>ExportDeclaration : SyntaxKind
NamedExports = 211,
NamedExports = 213,
>NamedExports : SyntaxKind
ExportSpecifier = 212,
ExportSpecifier = 214,
>ExportSpecifier : SyntaxKind
ExternalModuleReference = 213,
MissingDeclaration = 215,
>MissingDeclaration : SyntaxKind
ExternalModuleReference = 216,
>ExternalModuleReference : SyntaxKind
CaseClause = 214,
CaseClause = 217,
>CaseClause : SyntaxKind
DefaultClause = 215,
DefaultClause = 218,
>DefaultClause : SyntaxKind
HeritageClause = 216,
HeritageClause = 219,
>HeritageClause : SyntaxKind
CatchClause = 217,
CatchClause = 220,
>CatchClause : SyntaxKind
PropertyAssignment = 218,
PropertyAssignment = 221,
>PropertyAssignment : SyntaxKind
ShorthandPropertyAssignment = 219,
ShorthandPropertyAssignment = 222,
>ShorthandPropertyAssignment : SyntaxKind
EnumMember = 220,
EnumMember = 223,
>EnumMember : SyntaxKind
SourceFile = 221,
SourceFile = 224,
>SourceFile : SyntaxKind
SyntaxList = 222,
SyntaxList = 225,
>SyntaxList : SyntaxKind
Count = 223,
Count = 226,
>Count : SyntaxKind
FirstAssignment = 52,
FirstAssignment = 53,
>FirstAssignment : SyntaxKind
LastAssignment = 63,
LastAssignment = 64,
>LastAssignment : SyntaxKind
FirstReservedWord = 65,
FirstReservedWord = 66,
>FirstReservedWord : SyntaxKind
LastReservedWord = 100,
LastReservedWord = 101,
>LastReservedWord : SyntaxKind
FirstKeyword = 65,
FirstKeyword = 66,
>FirstKeyword : SyntaxKind
LastKeyword = 124,
LastKeyword = 125,
>LastKeyword : SyntaxKind
FirstFutureReservedWord = 102,
FirstFutureReservedWord = 103,
>FirstFutureReservedWord : SyntaxKind
LastFutureReservedWord = 110,
LastFutureReservedWord = 111,
>LastFutureReservedWord : SyntaxKind
FirstTypeNode = 139,
FirstTypeNode = 141,
>FirstTypeNode : SyntaxKind
LastTypeNode = 147,
LastTypeNode = 149,
>LastTypeNode : SyntaxKind
FirstPunctuation = 14,
>FirstPunctuation : SyntaxKind
LastPunctuation = 63,
LastPunctuation = 64,
>LastPunctuation : SyntaxKind
FirstToken = 0,
>FirstToken : SyntaxKind
LastToken = 124,
LastToken = 125,
>LastToken : SyntaxKind
FirstTriviaToken = 2,
@@ -1076,10 +1085,10 @@ declare module "typescript" {
FirstBinaryOperator = 24,
>FirstBinaryOperator : SyntaxKind
LastBinaryOperator = 63,
LastBinaryOperator = 64,
>LastBinaryOperator : SyntaxKind
FirstNode = 125,
FirstNode = 126,
>FirstNode : SyntaxKind
}
const enum NodeFlags {
@@ -1124,6 +1133,9 @@ declare module "typescript" {
OctalLiteral = 16384,
>OctalLiteral : NodeFlags
ExportContext = 32768,
>ExportContext : NodeFlags
Modifier = 499,
>Modifier : NodeFlags
@@ -1148,16 +1160,19 @@ declare module "typescript" {
GeneratorParameter = 8,
>GeneratorParameter : ParserContextFlags
ThisNodeHasError = 16,
Decorator = 16,
>Decorator : ParserContextFlags
ThisNodeHasError = 32,
>ThisNodeHasError : ParserContextFlags
ParserGeneratedFlags = 31,
ParserGeneratedFlags = 63,
>ParserGeneratedFlags : ParserContextFlags
ThisNodeOrAnySubNodesHasError = 32,
ThisNodeOrAnySubNodesHasError = 64,
>ThisNodeOrAnySubNodesHasError : ParserContextFlags
HasAggregatedChildData = 64,
HasAggregatedChildData = 128,
>HasAggregatedChildData : ParserContextFlags
}
const enum RelationComparisonResult {
@@ -1188,6 +1203,11 @@ declare module "typescript" {
>parserContextFlags : ParserContextFlags
>ParserContextFlags : ParserContextFlags
decorators?: NodeArray<Decorator>;
>decorators : NodeArray<Decorator>
>NodeArray : NodeArray<T>
>Decorator : Decorator
modifiers?: ModifiersArray;
>modifiers : ModifiersArray
>ModifiersArray : ModifiersArray
@@ -1282,6 +1302,14 @@ declare module "typescript" {
expression: Expression;
>expression : Expression
>Expression : Expression
}
interface Decorator extends Node {
>Decorator : Decorator
>Node : Node
expression: LeftHandSideExpression;
>expression : LeftHandSideExpression
>LeftHandSideExpression : LeftHandSideExpression
}
interface TypeParameterDeclaration extends Declaration {
>TypeParameterDeclaration : TypeParameterDeclaration
@@ -3161,16 +3189,17 @@ declare module "typescript" {
>node : Node
>Node : Node
hasExportDefaultValue(node: SourceFile): boolean;
>hasExportDefaultValue : (node: SourceFile) => boolean
>node : SourceFile
>SourceFile : SourceFile
isReferencedAliasDeclaration(node: Node): boolean;
>isReferencedAliasDeclaration : (node: Node) => boolean
isValueAliasDeclaration(node: Node): boolean;
>isValueAliasDeclaration : (node: Node) => boolean
>node : Node
>Node : Node
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
>isReferencedAliasDeclaration : (node: Node, checkChildren?: boolean) => boolean
>node : Node
>Node : Node
>checkChildren : boolean
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean
>node : ImportEqualsDeclaration
@@ -3580,6 +3609,9 @@ declare module "typescript" {
BlockScopedBindingInLoop = 256,
>BlockScopedBindingInLoop : NodeCheckFlags
EmitDecorate = 512,
>EmitDecorate : NodeCheckFlags
}
interface NodeLinks {
>NodeLinks : NodeLinks
+202 -192
View File
@@ -143,192 +143,195 @@ declare module "typescript" {
BarBarToken = 49,
QuestionToken = 50,
ColonToken = 51,
EqualsToken = 52,
PlusEqualsToken = 53,
MinusEqualsToken = 54,
AsteriskEqualsToken = 55,
SlashEqualsToken = 56,
PercentEqualsToken = 57,
LessThanLessThanEqualsToken = 58,
GreaterThanGreaterThanEqualsToken = 59,
GreaterThanGreaterThanGreaterThanEqualsToken = 60,
AmpersandEqualsToken = 61,
BarEqualsToken = 62,
CaretEqualsToken = 63,
Identifier = 64,
BreakKeyword = 65,
CaseKeyword = 66,
CatchKeyword = 67,
ClassKeyword = 68,
ConstKeyword = 69,
ContinueKeyword = 70,
DebuggerKeyword = 71,
DefaultKeyword = 72,
DeleteKeyword = 73,
DoKeyword = 74,
ElseKeyword = 75,
EnumKeyword = 76,
ExportKeyword = 77,
ExtendsKeyword = 78,
FalseKeyword = 79,
FinallyKeyword = 80,
ForKeyword = 81,
FunctionKeyword = 82,
IfKeyword = 83,
ImportKeyword = 84,
InKeyword = 85,
InstanceOfKeyword = 86,
NewKeyword = 87,
NullKeyword = 88,
ReturnKeyword = 89,
SuperKeyword = 90,
SwitchKeyword = 91,
ThisKeyword = 92,
ThrowKeyword = 93,
TrueKeyword = 94,
TryKeyword = 95,
TypeOfKeyword = 96,
VarKeyword = 97,
VoidKeyword = 98,
WhileKeyword = 99,
WithKeyword = 100,
AsKeyword = 101,
ImplementsKeyword = 102,
InterfaceKeyword = 103,
LetKeyword = 104,
PackageKeyword = 105,
PrivateKeyword = 106,
ProtectedKeyword = 107,
PublicKeyword = 108,
StaticKeyword = 109,
YieldKeyword = 110,
AnyKeyword = 111,
BooleanKeyword = 112,
ConstructorKeyword = 113,
DeclareKeyword = 114,
GetKeyword = 115,
ModuleKeyword = 116,
RequireKeyword = 117,
NumberKeyword = 118,
SetKeyword = 119,
StringKeyword = 120,
SymbolKeyword = 121,
TypeKeyword = 122,
FromKeyword = 123,
OfKeyword = 124,
QualifiedName = 125,
ComputedPropertyName = 126,
TypeParameter = 127,
Parameter = 128,
PropertySignature = 129,
PropertyDeclaration = 130,
MethodSignature = 131,
MethodDeclaration = 132,
Constructor = 133,
GetAccessor = 134,
SetAccessor = 135,
CallSignature = 136,
ConstructSignature = 137,
IndexSignature = 138,
TypeReference = 139,
FunctionType = 140,
ConstructorType = 141,
TypeQuery = 142,
TypeLiteral = 143,
ArrayType = 144,
TupleType = 145,
UnionType = 146,
ParenthesizedType = 147,
ObjectBindingPattern = 148,
ArrayBindingPattern = 149,
BindingElement = 150,
ArrayLiteralExpression = 151,
ObjectLiteralExpression = 152,
PropertyAccessExpression = 153,
ElementAccessExpression = 154,
CallExpression = 155,
NewExpression = 156,
TaggedTemplateExpression = 157,
TypeAssertionExpression = 158,
ParenthesizedExpression = 159,
FunctionExpression = 160,
ArrowFunction = 161,
DeleteExpression = 162,
TypeOfExpression = 163,
VoidExpression = 164,
PrefixUnaryExpression = 165,
PostfixUnaryExpression = 166,
BinaryExpression = 167,
ConditionalExpression = 168,
TemplateExpression = 169,
YieldExpression = 170,
SpreadElementExpression = 171,
OmittedExpression = 172,
TemplateSpan = 173,
Block = 174,
VariableStatement = 175,
EmptyStatement = 176,
ExpressionStatement = 177,
IfStatement = 178,
DoStatement = 179,
WhileStatement = 180,
ForStatement = 181,
ForInStatement = 182,
ForOfStatement = 183,
ContinueStatement = 184,
BreakStatement = 185,
ReturnStatement = 186,
WithStatement = 187,
SwitchStatement = 188,
LabeledStatement = 189,
ThrowStatement = 190,
TryStatement = 191,
DebuggerStatement = 192,
VariableDeclaration = 193,
VariableDeclarationList = 194,
FunctionDeclaration = 195,
ClassDeclaration = 196,
InterfaceDeclaration = 197,
TypeAliasDeclaration = 198,
EnumDeclaration = 199,
ModuleDeclaration = 200,
ModuleBlock = 201,
CaseBlock = 202,
ImportEqualsDeclaration = 203,
ImportDeclaration = 204,
ImportClause = 205,
NamespaceImport = 206,
NamedImports = 207,
ImportSpecifier = 208,
ExportAssignment = 209,
ExportDeclaration = 210,
NamedExports = 211,
ExportSpecifier = 212,
ExternalModuleReference = 213,
CaseClause = 214,
DefaultClause = 215,
HeritageClause = 216,
CatchClause = 217,
PropertyAssignment = 218,
ShorthandPropertyAssignment = 219,
EnumMember = 220,
SourceFile = 221,
SyntaxList = 222,
Count = 223,
FirstAssignment = 52,
LastAssignment = 63,
FirstReservedWord = 65,
LastReservedWord = 100,
FirstKeyword = 65,
LastKeyword = 124,
FirstFutureReservedWord = 102,
LastFutureReservedWord = 110,
FirstTypeNode = 139,
LastTypeNode = 147,
AtToken = 52,
EqualsToken = 53,
PlusEqualsToken = 54,
MinusEqualsToken = 55,
AsteriskEqualsToken = 56,
SlashEqualsToken = 57,
PercentEqualsToken = 58,
LessThanLessThanEqualsToken = 59,
GreaterThanGreaterThanEqualsToken = 60,
GreaterThanGreaterThanGreaterThanEqualsToken = 61,
AmpersandEqualsToken = 62,
BarEqualsToken = 63,
CaretEqualsToken = 64,
Identifier = 65,
BreakKeyword = 66,
CaseKeyword = 67,
CatchKeyword = 68,
ClassKeyword = 69,
ConstKeyword = 70,
ContinueKeyword = 71,
DebuggerKeyword = 72,
DefaultKeyword = 73,
DeleteKeyword = 74,
DoKeyword = 75,
ElseKeyword = 76,
EnumKeyword = 77,
ExportKeyword = 78,
ExtendsKeyword = 79,
FalseKeyword = 80,
FinallyKeyword = 81,
ForKeyword = 82,
FunctionKeyword = 83,
IfKeyword = 84,
ImportKeyword = 85,
InKeyword = 86,
InstanceOfKeyword = 87,
NewKeyword = 88,
NullKeyword = 89,
ReturnKeyword = 90,
SuperKeyword = 91,
SwitchKeyword = 92,
ThisKeyword = 93,
ThrowKeyword = 94,
TrueKeyword = 95,
TryKeyword = 96,
TypeOfKeyword = 97,
VarKeyword = 98,
VoidKeyword = 99,
WhileKeyword = 100,
WithKeyword = 101,
AsKeyword = 102,
ImplementsKeyword = 103,
InterfaceKeyword = 104,
LetKeyword = 105,
PackageKeyword = 106,
PrivateKeyword = 107,
ProtectedKeyword = 108,
PublicKeyword = 109,
StaticKeyword = 110,
YieldKeyword = 111,
AnyKeyword = 112,
BooleanKeyword = 113,
ConstructorKeyword = 114,
DeclareKeyword = 115,
GetKeyword = 116,
ModuleKeyword = 117,
RequireKeyword = 118,
NumberKeyword = 119,
SetKeyword = 120,
StringKeyword = 121,
SymbolKeyword = 122,
TypeKeyword = 123,
FromKeyword = 124,
OfKeyword = 125,
QualifiedName = 126,
ComputedPropertyName = 127,
TypeParameter = 128,
Parameter = 129,
Decorator = 130,
PropertySignature = 131,
PropertyDeclaration = 132,
MethodSignature = 133,
MethodDeclaration = 134,
Constructor = 135,
GetAccessor = 136,
SetAccessor = 137,
CallSignature = 138,
ConstructSignature = 139,
IndexSignature = 140,
TypeReference = 141,
FunctionType = 142,
ConstructorType = 143,
TypeQuery = 144,
TypeLiteral = 145,
ArrayType = 146,
TupleType = 147,
UnionType = 148,
ParenthesizedType = 149,
ObjectBindingPattern = 150,
ArrayBindingPattern = 151,
BindingElement = 152,
ArrayLiteralExpression = 153,
ObjectLiteralExpression = 154,
PropertyAccessExpression = 155,
ElementAccessExpression = 156,
CallExpression = 157,
NewExpression = 158,
TaggedTemplateExpression = 159,
TypeAssertionExpression = 160,
ParenthesizedExpression = 161,
FunctionExpression = 162,
ArrowFunction = 163,
DeleteExpression = 164,
TypeOfExpression = 165,
VoidExpression = 166,
PrefixUnaryExpression = 167,
PostfixUnaryExpression = 168,
BinaryExpression = 169,
ConditionalExpression = 170,
TemplateExpression = 171,
YieldExpression = 172,
SpreadElementExpression = 173,
OmittedExpression = 174,
TemplateSpan = 175,
Block = 176,
VariableStatement = 177,
EmptyStatement = 178,
ExpressionStatement = 179,
IfStatement = 180,
DoStatement = 181,
WhileStatement = 182,
ForStatement = 183,
ForInStatement = 184,
ForOfStatement = 185,
ContinueStatement = 186,
BreakStatement = 187,
ReturnStatement = 188,
WithStatement = 189,
SwitchStatement = 190,
LabeledStatement = 191,
ThrowStatement = 192,
TryStatement = 193,
DebuggerStatement = 194,
VariableDeclaration = 195,
VariableDeclarationList = 196,
FunctionDeclaration = 197,
ClassDeclaration = 198,
InterfaceDeclaration = 199,
TypeAliasDeclaration = 200,
EnumDeclaration = 201,
ModuleDeclaration = 202,
ModuleBlock = 203,
CaseBlock = 204,
ImportEqualsDeclaration = 205,
ImportDeclaration = 206,
ImportClause = 207,
NamespaceImport = 208,
NamedImports = 209,
ImportSpecifier = 210,
ExportAssignment = 211,
ExportDeclaration = 212,
NamedExports = 213,
ExportSpecifier = 214,
MissingDeclaration = 215,
ExternalModuleReference = 216,
CaseClause = 217,
DefaultClause = 218,
HeritageClause = 219,
CatchClause = 220,
PropertyAssignment = 221,
ShorthandPropertyAssignment = 222,
EnumMember = 223,
SourceFile = 224,
SyntaxList = 225,
Count = 226,
FirstAssignment = 53,
LastAssignment = 64,
FirstReservedWord = 66,
LastReservedWord = 101,
FirstKeyword = 66,
LastKeyword = 125,
FirstFutureReservedWord = 103,
LastFutureReservedWord = 111,
FirstTypeNode = 141,
LastTypeNode = 149,
FirstPunctuation = 14,
LastPunctuation = 63,
LastPunctuation = 64,
FirstToken = 0,
LastToken = 124,
LastToken = 125,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -336,8 +339,8 @@ declare module "typescript" {
FirstTemplateToken = 10,
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 63,
FirstNode = 125,
LastBinaryOperator = 64,
FirstNode = 126,
}
const enum NodeFlags {
Export = 1,
@@ -353,6 +356,7 @@ declare module "typescript" {
Let = 4096,
Const = 8192,
OctalLiteral = 16384,
ExportContext = 32768,
Modifier = 499,
AccessibilityModifier = 112,
BlockScoped = 12288,
@@ -362,10 +366,11 @@ declare module "typescript" {
DisallowIn = 2,
Yield = 4,
GeneratorParameter = 8,
ThisNodeHasError = 16,
ParserGeneratedFlags = 31,
ThisNodeOrAnySubNodesHasError = 32,
HasAggregatedChildData = 64,
Decorator = 16,
ThisNodeHasError = 32,
ParserGeneratedFlags = 63,
ThisNodeOrAnySubNodesHasError = 64,
HasAggregatedChildData = 128,
}
const enum RelationComparisonResult {
Succeeded = 1,
@@ -376,6 +381,7 @@ declare module "typescript" {
kind: SyntaxKind;
flags: NodeFlags;
parserContextFlags?: ParserContextFlags;
decorators?: NodeArray<Decorator>;
modifiers?: ModifiersArray;
id?: number;
parent?: Node;
@@ -406,6 +412,9 @@ declare module "typescript" {
interface ComputedPropertyName extends Node {
expression: Expression;
}
interface Decorator extends Node {
expression: LeftHandSideExpression;
}
interface TypeParameterDeclaration extends Declaration {
name: Identifier;
constraint?: TypeNode;
@@ -972,8 +981,8 @@ declare module "typescript" {
interface EmitResolver {
hasGlobalName(name: string): boolean;
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
hasExportDefaultValue(node: SourceFile): boolean;
isReferencedAliasDeclaration(node: Node): boolean;
isValueAliasDeclaration(node: Node): boolean;
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
isDeclarationVisible(node: Declaration): boolean;
@@ -1092,6 +1101,7 @@ declare module "typescript" {
ContextChecked = 64,
EnumValuesComputed = 128,
BlockScopedBindingInLoop = 256,
EmitDecorate = 512,
}
interface NodeLinks {
resolvedType?: Type;
@@ -447,562 +447,571 @@ declare module "typescript" {
ColonToken = 51,
>ColonToken : SyntaxKind
EqualsToken = 52,
AtToken = 52,
>AtToken : SyntaxKind
EqualsToken = 53,
>EqualsToken : SyntaxKind
PlusEqualsToken = 53,
PlusEqualsToken = 54,
>PlusEqualsToken : SyntaxKind
MinusEqualsToken = 54,
MinusEqualsToken = 55,
>MinusEqualsToken : SyntaxKind
AsteriskEqualsToken = 55,
AsteriskEqualsToken = 56,
>AsteriskEqualsToken : SyntaxKind
SlashEqualsToken = 56,
SlashEqualsToken = 57,
>SlashEqualsToken : SyntaxKind
PercentEqualsToken = 57,
PercentEqualsToken = 58,
>PercentEqualsToken : SyntaxKind
LessThanLessThanEqualsToken = 58,
LessThanLessThanEqualsToken = 59,
>LessThanLessThanEqualsToken : SyntaxKind
GreaterThanGreaterThanEqualsToken = 59,
GreaterThanGreaterThanEqualsToken = 60,
>GreaterThanGreaterThanEqualsToken : SyntaxKind
GreaterThanGreaterThanGreaterThanEqualsToken = 60,
GreaterThanGreaterThanGreaterThanEqualsToken = 61,
>GreaterThanGreaterThanGreaterThanEqualsToken : SyntaxKind
AmpersandEqualsToken = 61,
AmpersandEqualsToken = 62,
>AmpersandEqualsToken : SyntaxKind
BarEqualsToken = 62,
BarEqualsToken = 63,
>BarEqualsToken : SyntaxKind
CaretEqualsToken = 63,
CaretEqualsToken = 64,
>CaretEqualsToken : SyntaxKind
Identifier = 64,
Identifier = 65,
>Identifier : SyntaxKind
BreakKeyword = 65,
BreakKeyword = 66,
>BreakKeyword : SyntaxKind
CaseKeyword = 66,
CaseKeyword = 67,
>CaseKeyword : SyntaxKind
CatchKeyword = 67,
CatchKeyword = 68,
>CatchKeyword : SyntaxKind
ClassKeyword = 68,
ClassKeyword = 69,
>ClassKeyword : SyntaxKind
ConstKeyword = 69,
ConstKeyword = 70,
>ConstKeyword : SyntaxKind
ContinueKeyword = 70,
ContinueKeyword = 71,
>ContinueKeyword : SyntaxKind
DebuggerKeyword = 71,
DebuggerKeyword = 72,
>DebuggerKeyword : SyntaxKind
DefaultKeyword = 72,
DefaultKeyword = 73,
>DefaultKeyword : SyntaxKind
DeleteKeyword = 73,
DeleteKeyword = 74,
>DeleteKeyword : SyntaxKind
DoKeyword = 74,
DoKeyword = 75,
>DoKeyword : SyntaxKind
ElseKeyword = 75,
ElseKeyword = 76,
>ElseKeyword : SyntaxKind
EnumKeyword = 76,
EnumKeyword = 77,
>EnumKeyword : SyntaxKind
ExportKeyword = 77,
ExportKeyword = 78,
>ExportKeyword : SyntaxKind
ExtendsKeyword = 78,
ExtendsKeyword = 79,
>ExtendsKeyword : SyntaxKind
FalseKeyword = 79,
FalseKeyword = 80,
>FalseKeyword : SyntaxKind
FinallyKeyword = 80,
FinallyKeyword = 81,
>FinallyKeyword : SyntaxKind
ForKeyword = 81,
ForKeyword = 82,
>ForKeyword : SyntaxKind
FunctionKeyword = 82,
FunctionKeyword = 83,
>FunctionKeyword : SyntaxKind
IfKeyword = 83,
IfKeyword = 84,
>IfKeyword : SyntaxKind
ImportKeyword = 84,
ImportKeyword = 85,
>ImportKeyword : SyntaxKind
InKeyword = 85,
InKeyword = 86,
>InKeyword : SyntaxKind
InstanceOfKeyword = 86,
InstanceOfKeyword = 87,
>InstanceOfKeyword : SyntaxKind
NewKeyword = 87,
NewKeyword = 88,
>NewKeyword : SyntaxKind
NullKeyword = 88,
NullKeyword = 89,
>NullKeyword : SyntaxKind
ReturnKeyword = 89,
ReturnKeyword = 90,
>ReturnKeyword : SyntaxKind
SuperKeyword = 90,
SuperKeyword = 91,
>SuperKeyword : SyntaxKind
SwitchKeyword = 91,
SwitchKeyword = 92,
>SwitchKeyword : SyntaxKind
ThisKeyword = 92,
ThisKeyword = 93,
>ThisKeyword : SyntaxKind
ThrowKeyword = 93,
ThrowKeyword = 94,
>ThrowKeyword : SyntaxKind
TrueKeyword = 94,
TrueKeyword = 95,
>TrueKeyword : SyntaxKind
TryKeyword = 95,
TryKeyword = 96,
>TryKeyword : SyntaxKind
TypeOfKeyword = 96,
TypeOfKeyword = 97,
>TypeOfKeyword : SyntaxKind
VarKeyword = 97,
VarKeyword = 98,
>VarKeyword : SyntaxKind
VoidKeyword = 98,
VoidKeyword = 99,
>VoidKeyword : SyntaxKind
WhileKeyword = 99,
WhileKeyword = 100,
>WhileKeyword : SyntaxKind
WithKeyword = 100,
WithKeyword = 101,
>WithKeyword : SyntaxKind
AsKeyword = 101,
AsKeyword = 102,
>AsKeyword : SyntaxKind
ImplementsKeyword = 102,
ImplementsKeyword = 103,
>ImplementsKeyword : SyntaxKind
InterfaceKeyword = 103,
InterfaceKeyword = 104,
>InterfaceKeyword : SyntaxKind
LetKeyword = 104,
LetKeyword = 105,
>LetKeyword : SyntaxKind
PackageKeyword = 105,
PackageKeyword = 106,
>PackageKeyword : SyntaxKind
PrivateKeyword = 106,
PrivateKeyword = 107,
>PrivateKeyword : SyntaxKind
ProtectedKeyword = 107,
ProtectedKeyword = 108,
>ProtectedKeyword : SyntaxKind
PublicKeyword = 108,
PublicKeyword = 109,
>PublicKeyword : SyntaxKind
StaticKeyword = 109,
StaticKeyword = 110,
>StaticKeyword : SyntaxKind
YieldKeyword = 110,
YieldKeyword = 111,
>YieldKeyword : SyntaxKind
AnyKeyword = 111,
AnyKeyword = 112,
>AnyKeyword : SyntaxKind
BooleanKeyword = 112,
BooleanKeyword = 113,
>BooleanKeyword : SyntaxKind
ConstructorKeyword = 113,
ConstructorKeyword = 114,
>ConstructorKeyword : SyntaxKind
DeclareKeyword = 114,
DeclareKeyword = 115,
>DeclareKeyword : SyntaxKind
GetKeyword = 115,
GetKeyword = 116,
>GetKeyword : SyntaxKind
ModuleKeyword = 116,
ModuleKeyword = 117,
>ModuleKeyword : SyntaxKind
RequireKeyword = 117,
RequireKeyword = 118,
>RequireKeyword : SyntaxKind
NumberKeyword = 118,
NumberKeyword = 119,
>NumberKeyword : SyntaxKind
SetKeyword = 119,
SetKeyword = 120,
>SetKeyword : SyntaxKind
StringKeyword = 120,
StringKeyword = 121,
>StringKeyword : SyntaxKind
SymbolKeyword = 121,
SymbolKeyword = 122,
>SymbolKeyword : SyntaxKind
TypeKeyword = 122,
TypeKeyword = 123,
>TypeKeyword : SyntaxKind
FromKeyword = 123,
FromKeyword = 124,
>FromKeyword : SyntaxKind
OfKeyword = 124,
OfKeyword = 125,
>OfKeyword : SyntaxKind
QualifiedName = 125,
QualifiedName = 126,
>QualifiedName : SyntaxKind
ComputedPropertyName = 126,
ComputedPropertyName = 127,
>ComputedPropertyName : SyntaxKind
TypeParameter = 127,
TypeParameter = 128,
>TypeParameter : SyntaxKind
Parameter = 128,
Parameter = 129,
>Parameter : SyntaxKind
PropertySignature = 129,
Decorator = 130,
>Decorator : SyntaxKind
PropertySignature = 131,
>PropertySignature : SyntaxKind
PropertyDeclaration = 130,
PropertyDeclaration = 132,
>PropertyDeclaration : SyntaxKind
MethodSignature = 131,
MethodSignature = 133,
>MethodSignature : SyntaxKind
MethodDeclaration = 132,
MethodDeclaration = 134,
>MethodDeclaration : SyntaxKind
Constructor = 133,
Constructor = 135,
>Constructor : SyntaxKind
GetAccessor = 134,
GetAccessor = 136,
>GetAccessor : SyntaxKind
SetAccessor = 135,
SetAccessor = 137,
>SetAccessor : SyntaxKind
CallSignature = 136,
CallSignature = 138,
>CallSignature : SyntaxKind
ConstructSignature = 137,
ConstructSignature = 139,
>ConstructSignature : SyntaxKind
IndexSignature = 138,
IndexSignature = 140,
>IndexSignature : SyntaxKind
TypeReference = 139,
TypeReference = 141,
>TypeReference : SyntaxKind
FunctionType = 140,
FunctionType = 142,
>FunctionType : SyntaxKind
ConstructorType = 141,
ConstructorType = 143,
>ConstructorType : SyntaxKind
TypeQuery = 142,
TypeQuery = 144,
>TypeQuery : SyntaxKind
TypeLiteral = 143,
TypeLiteral = 145,
>TypeLiteral : SyntaxKind
ArrayType = 144,
ArrayType = 146,
>ArrayType : SyntaxKind
TupleType = 145,
TupleType = 147,
>TupleType : SyntaxKind
UnionType = 146,
UnionType = 148,
>UnionType : SyntaxKind
ParenthesizedType = 147,
ParenthesizedType = 149,
>ParenthesizedType : SyntaxKind
ObjectBindingPattern = 148,
ObjectBindingPattern = 150,
>ObjectBindingPattern : SyntaxKind
ArrayBindingPattern = 149,
ArrayBindingPattern = 151,
>ArrayBindingPattern : SyntaxKind
BindingElement = 150,
BindingElement = 152,
>BindingElement : SyntaxKind
ArrayLiteralExpression = 151,
ArrayLiteralExpression = 153,
>ArrayLiteralExpression : SyntaxKind
ObjectLiteralExpression = 152,
ObjectLiteralExpression = 154,
>ObjectLiteralExpression : SyntaxKind
PropertyAccessExpression = 153,
PropertyAccessExpression = 155,
>PropertyAccessExpression : SyntaxKind
ElementAccessExpression = 154,
ElementAccessExpression = 156,
>ElementAccessExpression : SyntaxKind
CallExpression = 155,
CallExpression = 157,
>CallExpression : SyntaxKind
NewExpression = 156,
NewExpression = 158,
>NewExpression : SyntaxKind
TaggedTemplateExpression = 157,
TaggedTemplateExpression = 159,
>TaggedTemplateExpression : SyntaxKind
TypeAssertionExpression = 158,
TypeAssertionExpression = 160,
>TypeAssertionExpression : SyntaxKind
ParenthesizedExpression = 159,
ParenthesizedExpression = 161,
>ParenthesizedExpression : SyntaxKind
FunctionExpression = 160,
FunctionExpression = 162,
>FunctionExpression : SyntaxKind
ArrowFunction = 161,
ArrowFunction = 163,
>ArrowFunction : SyntaxKind
DeleteExpression = 162,
DeleteExpression = 164,
>DeleteExpression : SyntaxKind
TypeOfExpression = 163,
TypeOfExpression = 165,
>TypeOfExpression : SyntaxKind
VoidExpression = 164,
VoidExpression = 166,
>VoidExpression : SyntaxKind
PrefixUnaryExpression = 165,
PrefixUnaryExpression = 167,
>PrefixUnaryExpression : SyntaxKind
PostfixUnaryExpression = 166,
PostfixUnaryExpression = 168,
>PostfixUnaryExpression : SyntaxKind
BinaryExpression = 167,
BinaryExpression = 169,
>BinaryExpression : SyntaxKind
ConditionalExpression = 168,
ConditionalExpression = 170,
>ConditionalExpression : SyntaxKind
TemplateExpression = 169,
TemplateExpression = 171,
>TemplateExpression : SyntaxKind
YieldExpression = 170,
YieldExpression = 172,
>YieldExpression : SyntaxKind
SpreadElementExpression = 171,
SpreadElementExpression = 173,
>SpreadElementExpression : SyntaxKind
OmittedExpression = 172,
OmittedExpression = 174,
>OmittedExpression : SyntaxKind
TemplateSpan = 173,
TemplateSpan = 175,
>TemplateSpan : SyntaxKind
Block = 174,
Block = 176,
>Block : SyntaxKind
VariableStatement = 175,
VariableStatement = 177,
>VariableStatement : SyntaxKind
EmptyStatement = 176,
EmptyStatement = 178,
>EmptyStatement : SyntaxKind
ExpressionStatement = 177,
ExpressionStatement = 179,
>ExpressionStatement : SyntaxKind
IfStatement = 178,
IfStatement = 180,
>IfStatement : SyntaxKind
DoStatement = 179,
DoStatement = 181,
>DoStatement : SyntaxKind
WhileStatement = 180,
WhileStatement = 182,
>WhileStatement : SyntaxKind
ForStatement = 181,
ForStatement = 183,
>ForStatement : SyntaxKind
ForInStatement = 182,
ForInStatement = 184,
>ForInStatement : SyntaxKind
ForOfStatement = 183,
ForOfStatement = 185,
>ForOfStatement : SyntaxKind
ContinueStatement = 184,
ContinueStatement = 186,
>ContinueStatement : SyntaxKind
BreakStatement = 185,
BreakStatement = 187,
>BreakStatement : SyntaxKind
ReturnStatement = 186,
ReturnStatement = 188,
>ReturnStatement : SyntaxKind
WithStatement = 187,
WithStatement = 189,
>WithStatement : SyntaxKind
SwitchStatement = 188,
SwitchStatement = 190,
>SwitchStatement : SyntaxKind
LabeledStatement = 189,
LabeledStatement = 191,
>LabeledStatement : SyntaxKind
ThrowStatement = 190,
ThrowStatement = 192,
>ThrowStatement : SyntaxKind
TryStatement = 191,
TryStatement = 193,
>TryStatement : SyntaxKind
DebuggerStatement = 192,
DebuggerStatement = 194,
>DebuggerStatement : SyntaxKind
VariableDeclaration = 193,
VariableDeclaration = 195,
>VariableDeclaration : SyntaxKind
VariableDeclarationList = 194,
VariableDeclarationList = 196,
>VariableDeclarationList : SyntaxKind
FunctionDeclaration = 195,
FunctionDeclaration = 197,
>FunctionDeclaration : SyntaxKind
ClassDeclaration = 196,
ClassDeclaration = 198,
>ClassDeclaration : SyntaxKind
InterfaceDeclaration = 197,
InterfaceDeclaration = 199,
>InterfaceDeclaration : SyntaxKind
TypeAliasDeclaration = 198,
TypeAliasDeclaration = 200,
>TypeAliasDeclaration : SyntaxKind
EnumDeclaration = 199,
EnumDeclaration = 201,
>EnumDeclaration : SyntaxKind
ModuleDeclaration = 200,
ModuleDeclaration = 202,
>ModuleDeclaration : SyntaxKind
ModuleBlock = 201,
ModuleBlock = 203,
>ModuleBlock : SyntaxKind
CaseBlock = 202,
CaseBlock = 204,
>CaseBlock : SyntaxKind
ImportEqualsDeclaration = 203,
ImportEqualsDeclaration = 205,
>ImportEqualsDeclaration : SyntaxKind
ImportDeclaration = 204,
ImportDeclaration = 206,
>ImportDeclaration : SyntaxKind
ImportClause = 205,
ImportClause = 207,
>ImportClause : SyntaxKind
NamespaceImport = 206,
NamespaceImport = 208,
>NamespaceImport : SyntaxKind
NamedImports = 207,
NamedImports = 209,
>NamedImports : SyntaxKind
ImportSpecifier = 208,
ImportSpecifier = 210,
>ImportSpecifier : SyntaxKind
ExportAssignment = 209,
ExportAssignment = 211,
>ExportAssignment : SyntaxKind
ExportDeclaration = 210,
ExportDeclaration = 212,
>ExportDeclaration : SyntaxKind
NamedExports = 211,
NamedExports = 213,
>NamedExports : SyntaxKind
ExportSpecifier = 212,
ExportSpecifier = 214,
>ExportSpecifier : SyntaxKind
ExternalModuleReference = 213,
MissingDeclaration = 215,
>MissingDeclaration : SyntaxKind
ExternalModuleReference = 216,
>ExternalModuleReference : SyntaxKind
CaseClause = 214,
CaseClause = 217,
>CaseClause : SyntaxKind
DefaultClause = 215,
DefaultClause = 218,
>DefaultClause : SyntaxKind
HeritageClause = 216,
HeritageClause = 219,
>HeritageClause : SyntaxKind
CatchClause = 217,
CatchClause = 220,
>CatchClause : SyntaxKind
PropertyAssignment = 218,
PropertyAssignment = 221,
>PropertyAssignment : SyntaxKind
ShorthandPropertyAssignment = 219,
ShorthandPropertyAssignment = 222,
>ShorthandPropertyAssignment : SyntaxKind
EnumMember = 220,
EnumMember = 223,
>EnumMember : SyntaxKind
SourceFile = 221,
SourceFile = 224,
>SourceFile : SyntaxKind
SyntaxList = 222,
SyntaxList = 225,
>SyntaxList : SyntaxKind
Count = 223,
Count = 226,
>Count : SyntaxKind
FirstAssignment = 52,
FirstAssignment = 53,
>FirstAssignment : SyntaxKind
LastAssignment = 63,
LastAssignment = 64,
>LastAssignment : SyntaxKind
FirstReservedWord = 65,
FirstReservedWord = 66,
>FirstReservedWord : SyntaxKind
LastReservedWord = 100,
LastReservedWord = 101,
>LastReservedWord : SyntaxKind
FirstKeyword = 65,
FirstKeyword = 66,
>FirstKeyword : SyntaxKind
LastKeyword = 124,
LastKeyword = 125,
>LastKeyword : SyntaxKind
FirstFutureReservedWord = 102,
FirstFutureReservedWord = 103,
>FirstFutureReservedWord : SyntaxKind
LastFutureReservedWord = 110,
LastFutureReservedWord = 111,
>LastFutureReservedWord : SyntaxKind
FirstTypeNode = 139,
FirstTypeNode = 141,
>FirstTypeNode : SyntaxKind
LastTypeNode = 147,
LastTypeNode = 149,
>LastTypeNode : SyntaxKind
FirstPunctuation = 14,
>FirstPunctuation : SyntaxKind
LastPunctuation = 63,
LastPunctuation = 64,
>LastPunctuation : SyntaxKind
FirstToken = 0,
>FirstToken : SyntaxKind
LastToken = 124,
LastToken = 125,
>LastToken : SyntaxKind
FirstTriviaToken = 2,
@@ -1026,10 +1035,10 @@ declare module "typescript" {
FirstBinaryOperator = 24,
>FirstBinaryOperator : SyntaxKind
LastBinaryOperator = 63,
LastBinaryOperator = 64,
>LastBinaryOperator : SyntaxKind
FirstNode = 125,
FirstNode = 126,
>FirstNode : SyntaxKind
}
const enum NodeFlags {
@@ -1074,6 +1083,9 @@ declare module "typescript" {
OctalLiteral = 16384,
>OctalLiteral : NodeFlags
ExportContext = 32768,
>ExportContext : NodeFlags
Modifier = 499,
>Modifier : NodeFlags
@@ -1098,16 +1110,19 @@ declare module "typescript" {
GeneratorParameter = 8,
>GeneratorParameter : ParserContextFlags
ThisNodeHasError = 16,
Decorator = 16,
>Decorator : ParserContextFlags
ThisNodeHasError = 32,
>ThisNodeHasError : ParserContextFlags
ParserGeneratedFlags = 31,
ParserGeneratedFlags = 63,
>ParserGeneratedFlags : ParserContextFlags
ThisNodeOrAnySubNodesHasError = 32,
ThisNodeOrAnySubNodesHasError = 64,
>ThisNodeOrAnySubNodesHasError : ParserContextFlags
HasAggregatedChildData = 64,
HasAggregatedChildData = 128,
>HasAggregatedChildData : ParserContextFlags
}
const enum RelationComparisonResult {
@@ -1138,6 +1153,11 @@ declare module "typescript" {
>parserContextFlags : ParserContextFlags
>ParserContextFlags : ParserContextFlags
decorators?: NodeArray<Decorator>;
>decorators : NodeArray<Decorator>
>NodeArray : NodeArray<T>
>Decorator : Decorator
modifiers?: ModifiersArray;
>modifiers : ModifiersArray
>ModifiersArray : ModifiersArray
@@ -1232,6 +1252,14 @@ declare module "typescript" {
expression: Expression;
>expression : Expression
>Expression : Expression
}
interface Decorator extends Node {
>Decorator : Decorator
>Node : Node
expression: LeftHandSideExpression;
>expression : LeftHandSideExpression
>LeftHandSideExpression : LeftHandSideExpression
}
interface TypeParameterDeclaration extends Declaration {
>TypeParameterDeclaration : TypeParameterDeclaration
@@ -3111,16 +3139,17 @@ declare module "typescript" {
>node : Node
>Node : Node
hasExportDefaultValue(node: SourceFile): boolean;
>hasExportDefaultValue : (node: SourceFile) => boolean
>node : SourceFile
>SourceFile : SourceFile
isReferencedAliasDeclaration(node: Node): boolean;
>isReferencedAliasDeclaration : (node: Node) => boolean
isValueAliasDeclaration(node: Node): boolean;
>isValueAliasDeclaration : (node: Node) => boolean
>node : Node
>Node : Node
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
>isReferencedAliasDeclaration : (node: Node, checkChildren?: boolean) => boolean
>node : Node
>Node : Node
>checkChildren : boolean
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean
>node : ImportEqualsDeclaration
@@ -3530,6 +3559,9 @@ declare module "typescript" {
BlockScopedBindingInLoop = 256,
>BlockScopedBindingInLoop : NodeCheckFlags
EmitDecorate = 512,
>EmitDecorate : NodeCheckFlags
}
interface NodeLinks {
>NodeLinks : NodeLinks
+202 -192
View File
@@ -180,192 +180,195 @@ declare module "typescript" {
BarBarToken = 49,
QuestionToken = 50,
ColonToken = 51,
EqualsToken = 52,
PlusEqualsToken = 53,
MinusEqualsToken = 54,
AsteriskEqualsToken = 55,
SlashEqualsToken = 56,
PercentEqualsToken = 57,
LessThanLessThanEqualsToken = 58,
GreaterThanGreaterThanEqualsToken = 59,
GreaterThanGreaterThanGreaterThanEqualsToken = 60,
AmpersandEqualsToken = 61,
BarEqualsToken = 62,
CaretEqualsToken = 63,
Identifier = 64,
BreakKeyword = 65,
CaseKeyword = 66,
CatchKeyword = 67,
ClassKeyword = 68,
ConstKeyword = 69,
ContinueKeyword = 70,
DebuggerKeyword = 71,
DefaultKeyword = 72,
DeleteKeyword = 73,
DoKeyword = 74,
ElseKeyword = 75,
EnumKeyword = 76,
ExportKeyword = 77,
ExtendsKeyword = 78,
FalseKeyword = 79,
FinallyKeyword = 80,
ForKeyword = 81,
FunctionKeyword = 82,
IfKeyword = 83,
ImportKeyword = 84,
InKeyword = 85,
InstanceOfKeyword = 86,
NewKeyword = 87,
NullKeyword = 88,
ReturnKeyword = 89,
SuperKeyword = 90,
SwitchKeyword = 91,
ThisKeyword = 92,
ThrowKeyword = 93,
TrueKeyword = 94,
TryKeyword = 95,
TypeOfKeyword = 96,
VarKeyword = 97,
VoidKeyword = 98,
WhileKeyword = 99,
WithKeyword = 100,
AsKeyword = 101,
ImplementsKeyword = 102,
InterfaceKeyword = 103,
LetKeyword = 104,
PackageKeyword = 105,
PrivateKeyword = 106,
ProtectedKeyword = 107,
PublicKeyword = 108,
StaticKeyword = 109,
YieldKeyword = 110,
AnyKeyword = 111,
BooleanKeyword = 112,
ConstructorKeyword = 113,
DeclareKeyword = 114,
GetKeyword = 115,
ModuleKeyword = 116,
RequireKeyword = 117,
NumberKeyword = 118,
SetKeyword = 119,
StringKeyword = 120,
SymbolKeyword = 121,
TypeKeyword = 122,
FromKeyword = 123,
OfKeyword = 124,
QualifiedName = 125,
ComputedPropertyName = 126,
TypeParameter = 127,
Parameter = 128,
PropertySignature = 129,
PropertyDeclaration = 130,
MethodSignature = 131,
MethodDeclaration = 132,
Constructor = 133,
GetAccessor = 134,
SetAccessor = 135,
CallSignature = 136,
ConstructSignature = 137,
IndexSignature = 138,
TypeReference = 139,
FunctionType = 140,
ConstructorType = 141,
TypeQuery = 142,
TypeLiteral = 143,
ArrayType = 144,
TupleType = 145,
UnionType = 146,
ParenthesizedType = 147,
ObjectBindingPattern = 148,
ArrayBindingPattern = 149,
BindingElement = 150,
ArrayLiteralExpression = 151,
ObjectLiteralExpression = 152,
PropertyAccessExpression = 153,
ElementAccessExpression = 154,
CallExpression = 155,
NewExpression = 156,
TaggedTemplateExpression = 157,
TypeAssertionExpression = 158,
ParenthesizedExpression = 159,
FunctionExpression = 160,
ArrowFunction = 161,
DeleteExpression = 162,
TypeOfExpression = 163,
VoidExpression = 164,
PrefixUnaryExpression = 165,
PostfixUnaryExpression = 166,
BinaryExpression = 167,
ConditionalExpression = 168,
TemplateExpression = 169,
YieldExpression = 170,
SpreadElementExpression = 171,
OmittedExpression = 172,
TemplateSpan = 173,
Block = 174,
VariableStatement = 175,
EmptyStatement = 176,
ExpressionStatement = 177,
IfStatement = 178,
DoStatement = 179,
WhileStatement = 180,
ForStatement = 181,
ForInStatement = 182,
ForOfStatement = 183,
ContinueStatement = 184,
BreakStatement = 185,
ReturnStatement = 186,
WithStatement = 187,
SwitchStatement = 188,
LabeledStatement = 189,
ThrowStatement = 190,
TryStatement = 191,
DebuggerStatement = 192,
VariableDeclaration = 193,
VariableDeclarationList = 194,
FunctionDeclaration = 195,
ClassDeclaration = 196,
InterfaceDeclaration = 197,
TypeAliasDeclaration = 198,
EnumDeclaration = 199,
ModuleDeclaration = 200,
ModuleBlock = 201,
CaseBlock = 202,
ImportEqualsDeclaration = 203,
ImportDeclaration = 204,
ImportClause = 205,
NamespaceImport = 206,
NamedImports = 207,
ImportSpecifier = 208,
ExportAssignment = 209,
ExportDeclaration = 210,
NamedExports = 211,
ExportSpecifier = 212,
ExternalModuleReference = 213,
CaseClause = 214,
DefaultClause = 215,
HeritageClause = 216,
CatchClause = 217,
PropertyAssignment = 218,
ShorthandPropertyAssignment = 219,
EnumMember = 220,
SourceFile = 221,
SyntaxList = 222,
Count = 223,
FirstAssignment = 52,
LastAssignment = 63,
FirstReservedWord = 65,
LastReservedWord = 100,
FirstKeyword = 65,
LastKeyword = 124,
FirstFutureReservedWord = 102,
LastFutureReservedWord = 110,
FirstTypeNode = 139,
LastTypeNode = 147,
AtToken = 52,
EqualsToken = 53,
PlusEqualsToken = 54,
MinusEqualsToken = 55,
AsteriskEqualsToken = 56,
SlashEqualsToken = 57,
PercentEqualsToken = 58,
LessThanLessThanEqualsToken = 59,
GreaterThanGreaterThanEqualsToken = 60,
GreaterThanGreaterThanGreaterThanEqualsToken = 61,
AmpersandEqualsToken = 62,
BarEqualsToken = 63,
CaretEqualsToken = 64,
Identifier = 65,
BreakKeyword = 66,
CaseKeyword = 67,
CatchKeyword = 68,
ClassKeyword = 69,
ConstKeyword = 70,
ContinueKeyword = 71,
DebuggerKeyword = 72,
DefaultKeyword = 73,
DeleteKeyword = 74,
DoKeyword = 75,
ElseKeyword = 76,
EnumKeyword = 77,
ExportKeyword = 78,
ExtendsKeyword = 79,
FalseKeyword = 80,
FinallyKeyword = 81,
ForKeyword = 82,
FunctionKeyword = 83,
IfKeyword = 84,
ImportKeyword = 85,
InKeyword = 86,
InstanceOfKeyword = 87,
NewKeyword = 88,
NullKeyword = 89,
ReturnKeyword = 90,
SuperKeyword = 91,
SwitchKeyword = 92,
ThisKeyword = 93,
ThrowKeyword = 94,
TrueKeyword = 95,
TryKeyword = 96,
TypeOfKeyword = 97,
VarKeyword = 98,
VoidKeyword = 99,
WhileKeyword = 100,
WithKeyword = 101,
AsKeyword = 102,
ImplementsKeyword = 103,
InterfaceKeyword = 104,
LetKeyword = 105,
PackageKeyword = 106,
PrivateKeyword = 107,
ProtectedKeyword = 108,
PublicKeyword = 109,
StaticKeyword = 110,
YieldKeyword = 111,
AnyKeyword = 112,
BooleanKeyword = 113,
ConstructorKeyword = 114,
DeclareKeyword = 115,
GetKeyword = 116,
ModuleKeyword = 117,
RequireKeyword = 118,
NumberKeyword = 119,
SetKeyword = 120,
StringKeyword = 121,
SymbolKeyword = 122,
TypeKeyword = 123,
FromKeyword = 124,
OfKeyword = 125,
QualifiedName = 126,
ComputedPropertyName = 127,
TypeParameter = 128,
Parameter = 129,
Decorator = 130,
PropertySignature = 131,
PropertyDeclaration = 132,
MethodSignature = 133,
MethodDeclaration = 134,
Constructor = 135,
GetAccessor = 136,
SetAccessor = 137,
CallSignature = 138,
ConstructSignature = 139,
IndexSignature = 140,
TypeReference = 141,
FunctionType = 142,
ConstructorType = 143,
TypeQuery = 144,
TypeLiteral = 145,
ArrayType = 146,
TupleType = 147,
UnionType = 148,
ParenthesizedType = 149,
ObjectBindingPattern = 150,
ArrayBindingPattern = 151,
BindingElement = 152,
ArrayLiteralExpression = 153,
ObjectLiteralExpression = 154,
PropertyAccessExpression = 155,
ElementAccessExpression = 156,
CallExpression = 157,
NewExpression = 158,
TaggedTemplateExpression = 159,
TypeAssertionExpression = 160,
ParenthesizedExpression = 161,
FunctionExpression = 162,
ArrowFunction = 163,
DeleteExpression = 164,
TypeOfExpression = 165,
VoidExpression = 166,
PrefixUnaryExpression = 167,
PostfixUnaryExpression = 168,
BinaryExpression = 169,
ConditionalExpression = 170,
TemplateExpression = 171,
YieldExpression = 172,
SpreadElementExpression = 173,
OmittedExpression = 174,
TemplateSpan = 175,
Block = 176,
VariableStatement = 177,
EmptyStatement = 178,
ExpressionStatement = 179,
IfStatement = 180,
DoStatement = 181,
WhileStatement = 182,
ForStatement = 183,
ForInStatement = 184,
ForOfStatement = 185,
ContinueStatement = 186,
BreakStatement = 187,
ReturnStatement = 188,
WithStatement = 189,
SwitchStatement = 190,
LabeledStatement = 191,
ThrowStatement = 192,
TryStatement = 193,
DebuggerStatement = 194,
VariableDeclaration = 195,
VariableDeclarationList = 196,
FunctionDeclaration = 197,
ClassDeclaration = 198,
InterfaceDeclaration = 199,
TypeAliasDeclaration = 200,
EnumDeclaration = 201,
ModuleDeclaration = 202,
ModuleBlock = 203,
CaseBlock = 204,
ImportEqualsDeclaration = 205,
ImportDeclaration = 206,
ImportClause = 207,
NamespaceImport = 208,
NamedImports = 209,
ImportSpecifier = 210,
ExportAssignment = 211,
ExportDeclaration = 212,
NamedExports = 213,
ExportSpecifier = 214,
MissingDeclaration = 215,
ExternalModuleReference = 216,
CaseClause = 217,
DefaultClause = 218,
HeritageClause = 219,
CatchClause = 220,
PropertyAssignment = 221,
ShorthandPropertyAssignment = 222,
EnumMember = 223,
SourceFile = 224,
SyntaxList = 225,
Count = 226,
FirstAssignment = 53,
LastAssignment = 64,
FirstReservedWord = 66,
LastReservedWord = 101,
FirstKeyword = 66,
LastKeyword = 125,
FirstFutureReservedWord = 103,
LastFutureReservedWord = 111,
FirstTypeNode = 141,
LastTypeNode = 149,
FirstPunctuation = 14,
LastPunctuation = 63,
LastPunctuation = 64,
FirstToken = 0,
LastToken = 124,
LastToken = 125,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -373,8 +376,8 @@ declare module "typescript" {
FirstTemplateToken = 10,
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 63,
FirstNode = 125,
LastBinaryOperator = 64,
FirstNode = 126,
}
const enum NodeFlags {
Export = 1,
@@ -390,6 +393,7 @@ declare module "typescript" {
Let = 4096,
Const = 8192,
OctalLiteral = 16384,
ExportContext = 32768,
Modifier = 499,
AccessibilityModifier = 112,
BlockScoped = 12288,
@@ -399,10 +403,11 @@ declare module "typescript" {
DisallowIn = 2,
Yield = 4,
GeneratorParameter = 8,
ThisNodeHasError = 16,
ParserGeneratedFlags = 31,
ThisNodeOrAnySubNodesHasError = 32,
HasAggregatedChildData = 64,
Decorator = 16,
ThisNodeHasError = 32,
ParserGeneratedFlags = 63,
ThisNodeOrAnySubNodesHasError = 64,
HasAggregatedChildData = 128,
}
const enum RelationComparisonResult {
Succeeded = 1,
@@ -413,6 +418,7 @@ declare module "typescript" {
kind: SyntaxKind;
flags: NodeFlags;
parserContextFlags?: ParserContextFlags;
decorators?: NodeArray<Decorator>;
modifiers?: ModifiersArray;
id?: number;
parent?: Node;
@@ -443,6 +449,9 @@ declare module "typescript" {
interface ComputedPropertyName extends Node {
expression: Expression;
}
interface Decorator extends Node {
expression: LeftHandSideExpression;
}
interface TypeParameterDeclaration extends Declaration {
name: Identifier;
constraint?: TypeNode;
@@ -1009,8 +1018,8 @@ declare module "typescript" {
interface EmitResolver {
hasGlobalName(name: string): boolean;
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
hasExportDefaultValue(node: SourceFile): boolean;
isReferencedAliasDeclaration(node: Node): boolean;
isValueAliasDeclaration(node: Node): boolean;
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
isDeclarationVisible(node: Declaration): boolean;
@@ -1129,6 +1138,7 @@ declare module "typescript" {
ContextChecked = 64,
EnumValuesComputed = 128,
BlockScopedBindingInLoop = 256,
EmitDecorate = 512,
}
interface NodeLinks {
resolvedType?: Type;
+229 -197
View File
@@ -620,562 +620,571 @@ declare module "typescript" {
ColonToken = 51,
>ColonToken : SyntaxKind
EqualsToken = 52,
AtToken = 52,
>AtToken : SyntaxKind
EqualsToken = 53,
>EqualsToken : SyntaxKind
PlusEqualsToken = 53,
PlusEqualsToken = 54,
>PlusEqualsToken : SyntaxKind
MinusEqualsToken = 54,
MinusEqualsToken = 55,
>MinusEqualsToken : SyntaxKind
AsteriskEqualsToken = 55,
AsteriskEqualsToken = 56,
>AsteriskEqualsToken : SyntaxKind
SlashEqualsToken = 56,
SlashEqualsToken = 57,
>SlashEqualsToken : SyntaxKind
PercentEqualsToken = 57,
PercentEqualsToken = 58,
>PercentEqualsToken : SyntaxKind
LessThanLessThanEqualsToken = 58,
LessThanLessThanEqualsToken = 59,
>LessThanLessThanEqualsToken : SyntaxKind
GreaterThanGreaterThanEqualsToken = 59,
GreaterThanGreaterThanEqualsToken = 60,
>GreaterThanGreaterThanEqualsToken : SyntaxKind
GreaterThanGreaterThanGreaterThanEqualsToken = 60,
GreaterThanGreaterThanGreaterThanEqualsToken = 61,
>GreaterThanGreaterThanGreaterThanEqualsToken : SyntaxKind
AmpersandEqualsToken = 61,
AmpersandEqualsToken = 62,
>AmpersandEqualsToken : SyntaxKind
BarEqualsToken = 62,
BarEqualsToken = 63,
>BarEqualsToken : SyntaxKind
CaretEqualsToken = 63,
CaretEqualsToken = 64,
>CaretEqualsToken : SyntaxKind
Identifier = 64,
Identifier = 65,
>Identifier : SyntaxKind
BreakKeyword = 65,
BreakKeyword = 66,
>BreakKeyword : SyntaxKind
CaseKeyword = 66,
CaseKeyword = 67,
>CaseKeyword : SyntaxKind
CatchKeyword = 67,
CatchKeyword = 68,
>CatchKeyword : SyntaxKind
ClassKeyword = 68,
ClassKeyword = 69,
>ClassKeyword : SyntaxKind
ConstKeyword = 69,
ConstKeyword = 70,
>ConstKeyword : SyntaxKind
ContinueKeyword = 70,
ContinueKeyword = 71,
>ContinueKeyword : SyntaxKind
DebuggerKeyword = 71,
DebuggerKeyword = 72,
>DebuggerKeyword : SyntaxKind
DefaultKeyword = 72,
DefaultKeyword = 73,
>DefaultKeyword : SyntaxKind
DeleteKeyword = 73,
DeleteKeyword = 74,
>DeleteKeyword : SyntaxKind
DoKeyword = 74,
DoKeyword = 75,
>DoKeyword : SyntaxKind
ElseKeyword = 75,
ElseKeyword = 76,
>ElseKeyword : SyntaxKind
EnumKeyword = 76,
EnumKeyword = 77,
>EnumKeyword : SyntaxKind
ExportKeyword = 77,
ExportKeyword = 78,
>ExportKeyword : SyntaxKind
ExtendsKeyword = 78,
ExtendsKeyword = 79,
>ExtendsKeyword : SyntaxKind
FalseKeyword = 79,
FalseKeyword = 80,
>FalseKeyword : SyntaxKind
FinallyKeyword = 80,
FinallyKeyword = 81,
>FinallyKeyword : SyntaxKind
ForKeyword = 81,
ForKeyword = 82,
>ForKeyword : SyntaxKind
FunctionKeyword = 82,
FunctionKeyword = 83,
>FunctionKeyword : SyntaxKind
IfKeyword = 83,
IfKeyword = 84,
>IfKeyword : SyntaxKind
ImportKeyword = 84,
ImportKeyword = 85,
>ImportKeyword : SyntaxKind
InKeyword = 85,
InKeyword = 86,
>InKeyword : SyntaxKind
InstanceOfKeyword = 86,
InstanceOfKeyword = 87,
>InstanceOfKeyword : SyntaxKind
NewKeyword = 87,
NewKeyword = 88,
>NewKeyword : SyntaxKind
NullKeyword = 88,
NullKeyword = 89,
>NullKeyword : SyntaxKind
ReturnKeyword = 89,
ReturnKeyword = 90,
>ReturnKeyword : SyntaxKind
SuperKeyword = 90,
SuperKeyword = 91,
>SuperKeyword : SyntaxKind
SwitchKeyword = 91,
SwitchKeyword = 92,
>SwitchKeyword : SyntaxKind
ThisKeyword = 92,
ThisKeyword = 93,
>ThisKeyword : SyntaxKind
ThrowKeyword = 93,
ThrowKeyword = 94,
>ThrowKeyword : SyntaxKind
TrueKeyword = 94,
TrueKeyword = 95,
>TrueKeyword : SyntaxKind
TryKeyword = 95,
TryKeyword = 96,
>TryKeyword : SyntaxKind
TypeOfKeyword = 96,
TypeOfKeyword = 97,
>TypeOfKeyword : SyntaxKind
VarKeyword = 97,
VarKeyword = 98,
>VarKeyword : SyntaxKind
VoidKeyword = 98,
VoidKeyword = 99,
>VoidKeyword : SyntaxKind
WhileKeyword = 99,
WhileKeyword = 100,
>WhileKeyword : SyntaxKind
WithKeyword = 100,
WithKeyword = 101,
>WithKeyword : SyntaxKind
AsKeyword = 101,
AsKeyword = 102,
>AsKeyword : SyntaxKind
ImplementsKeyword = 102,
ImplementsKeyword = 103,
>ImplementsKeyword : SyntaxKind
InterfaceKeyword = 103,
InterfaceKeyword = 104,
>InterfaceKeyword : SyntaxKind
LetKeyword = 104,
LetKeyword = 105,
>LetKeyword : SyntaxKind
PackageKeyword = 105,
PackageKeyword = 106,
>PackageKeyword : SyntaxKind
PrivateKeyword = 106,
PrivateKeyword = 107,
>PrivateKeyword : SyntaxKind
ProtectedKeyword = 107,
ProtectedKeyword = 108,
>ProtectedKeyword : SyntaxKind
PublicKeyword = 108,
PublicKeyword = 109,
>PublicKeyword : SyntaxKind
StaticKeyword = 109,
StaticKeyword = 110,
>StaticKeyword : SyntaxKind
YieldKeyword = 110,
YieldKeyword = 111,
>YieldKeyword : SyntaxKind
AnyKeyword = 111,
AnyKeyword = 112,
>AnyKeyword : SyntaxKind
BooleanKeyword = 112,
BooleanKeyword = 113,
>BooleanKeyword : SyntaxKind
ConstructorKeyword = 113,
ConstructorKeyword = 114,
>ConstructorKeyword : SyntaxKind
DeclareKeyword = 114,
DeclareKeyword = 115,
>DeclareKeyword : SyntaxKind
GetKeyword = 115,
GetKeyword = 116,
>GetKeyword : SyntaxKind
ModuleKeyword = 116,
ModuleKeyword = 117,
>ModuleKeyword : SyntaxKind
RequireKeyword = 117,
RequireKeyword = 118,
>RequireKeyword : SyntaxKind
NumberKeyword = 118,
NumberKeyword = 119,
>NumberKeyword : SyntaxKind
SetKeyword = 119,
SetKeyword = 120,
>SetKeyword : SyntaxKind
StringKeyword = 120,
StringKeyword = 121,
>StringKeyword : SyntaxKind
SymbolKeyword = 121,
SymbolKeyword = 122,
>SymbolKeyword : SyntaxKind
TypeKeyword = 122,
TypeKeyword = 123,
>TypeKeyword : SyntaxKind
FromKeyword = 123,
FromKeyword = 124,
>FromKeyword : SyntaxKind
OfKeyword = 124,
OfKeyword = 125,
>OfKeyword : SyntaxKind
QualifiedName = 125,
QualifiedName = 126,
>QualifiedName : SyntaxKind
ComputedPropertyName = 126,
ComputedPropertyName = 127,
>ComputedPropertyName : SyntaxKind
TypeParameter = 127,
TypeParameter = 128,
>TypeParameter : SyntaxKind
Parameter = 128,
Parameter = 129,
>Parameter : SyntaxKind
PropertySignature = 129,
Decorator = 130,
>Decorator : SyntaxKind
PropertySignature = 131,
>PropertySignature : SyntaxKind
PropertyDeclaration = 130,
PropertyDeclaration = 132,
>PropertyDeclaration : SyntaxKind
MethodSignature = 131,
MethodSignature = 133,
>MethodSignature : SyntaxKind
MethodDeclaration = 132,
MethodDeclaration = 134,
>MethodDeclaration : SyntaxKind
Constructor = 133,
Constructor = 135,
>Constructor : SyntaxKind
GetAccessor = 134,
GetAccessor = 136,
>GetAccessor : SyntaxKind
SetAccessor = 135,
SetAccessor = 137,
>SetAccessor : SyntaxKind
CallSignature = 136,
CallSignature = 138,
>CallSignature : SyntaxKind
ConstructSignature = 137,
ConstructSignature = 139,
>ConstructSignature : SyntaxKind
IndexSignature = 138,
IndexSignature = 140,
>IndexSignature : SyntaxKind
TypeReference = 139,
TypeReference = 141,
>TypeReference : SyntaxKind
FunctionType = 140,
FunctionType = 142,
>FunctionType : SyntaxKind
ConstructorType = 141,
ConstructorType = 143,
>ConstructorType : SyntaxKind
TypeQuery = 142,
TypeQuery = 144,
>TypeQuery : SyntaxKind
TypeLiteral = 143,
TypeLiteral = 145,
>TypeLiteral : SyntaxKind
ArrayType = 144,
ArrayType = 146,
>ArrayType : SyntaxKind
TupleType = 145,
TupleType = 147,
>TupleType : SyntaxKind
UnionType = 146,
UnionType = 148,
>UnionType : SyntaxKind
ParenthesizedType = 147,
ParenthesizedType = 149,
>ParenthesizedType : SyntaxKind
ObjectBindingPattern = 148,
ObjectBindingPattern = 150,
>ObjectBindingPattern : SyntaxKind
ArrayBindingPattern = 149,
ArrayBindingPattern = 151,
>ArrayBindingPattern : SyntaxKind
BindingElement = 150,
BindingElement = 152,
>BindingElement : SyntaxKind
ArrayLiteralExpression = 151,
ArrayLiteralExpression = 153,
>ArrayLiteralExpression : SyntaxKind
ObjectLiteralExpression = 152,
ObjectLiteralExpression = 154,
>ObjectLiteralExpression : SyntaxKind
PropertyAccessExpression = 153,
PropertyAccessExpression = 155,
>PropertyAccessExpression : SyntaxKind
ElementAccessExpression = 154,
ElementAccessExpression = 156,
>ElementAccessExpression : SyntaxKind
CallExpression = 155,
CallExpression = 157,
>CallExpression : SyntaxKind
NewExpression = 156,
NewExpression = 158,
>NewExpression : SyntaxKind
TaggedTemplateExpression = 157,
TaggedTemplateExpression = 159,
>TaggedTemplateExpression : SyntaxKind
TypeAssertionExpression = 158,
TypeAssertionExpression = 160,
>TypeAssertionExpression : SyntaxKind
ParenthesizedExpression = 159,
ParenthesizedExpression = 161,
>ParenthesizedExpression : SyntaxKind
FunctionExpression = 160,
FunctionExpression = 162,
>FunctionExpression : SyntaxKind
ArrowFunction = 161,
ArrowFunction = 163,
>ArrowFunction : SyntaxKind
DeleteExpression = 162,
DeleteExpression = 164,
>DeleteExpression : SyntaxKind
TypeOfExpression = 163,
TypeOfExpression = 165,
>TypeOfExpression : SyntaxKind
VoidExpression = 164,
VoidExpression = 166,
>VoidExpression : SyntaxKind
PrefixUnaryExpression = 165,
PrefixUnaryExpression = 167,
>PrefixUnaryExpression : SyntaxKind
PostfixUnaryExpression = 166,
PostfixUnaryExpression = 168,
>PostfixUnaryExpression : SyntaxKind
BinaryExpression = 167,
BinaryExpression = 169,
>BinaryExpression : SyntaxKind
ConditionalExpression = 168,
ConditionalExpression = 170,
>ConditionalExpression : SyntaxKind
TemplateExpression = 169,
TemplateExpression = 171,
>TemplateExpression : SyntaxKind
YieldExpression = 170,
YieldExpression = 172,
>YieldExpression : SyntaxKind
SpreadElementExpression = 171,
SpreadElementExpression = 173,
>SpreadElementExpression : SyntaxKind
OmittedExpression = 172,
OmittedExpression = 174,
>OmittedExpression : SyntaxKind
TemplateSpan = 173,
TemplateSpan = 175,
>TemplateSpan : SyntaxKind
Block = 174,
Block = 176,
>Block : SyntaxKind
VariableStatement = 175,
VariableStatement = 177,
>VariableStatement : SyntaxKind
EmptyStatement = 176,
EmptyStatement = 178,
>EmptyStatement : SyntaxKind
ExpressionStatement = 177,
ExpressionStatement = 179,
>ExpressionStatement : SyntaxKind
IfStatement = 178,
IfStatement = 180,
>IfStatement : SyntaxKind
DoStatement = 179,
DoStatement = 181,
>DoStatement : SyntaxKind
WhileStatement = 180,
WhileStatement = 182,
>WhileStatement : SyntaxKind
ForStatement = 181,
ForStatement = 183,
>ForStatement : SyntaxKind
ForInStatement = 182,
ForInStatement = 184,
>ForInStatement : SyntaxKind
ForOfStatement = 183,
ForOfStatement = 185,
>ForOfStatement : SyntaxKind
ContinueStatement = 184,
ContinueStatement = 186,
>ContinueStatement : SyntaxKind
BreakStatement = 185,
BreakStatement = 187,
>BreakStatement : SyntaxKind
ReturnStatement = 186,
ReturnStatement = 188,
>ReturnStatement : SyntaxKind
WithStatement = 187,
WithStatement = 189,
>WithStatement : SyntaxKind
SwitchStatement = 188,
SwitchStatement = 190,
>SwitchStatement : SyntaxKind
LabeledStatement = 189,
LabeledStatement = 191,
>LabeledStatement : SyntaxKind
ThrowStatement = 190,
ThrowStatement = 192,
>ThrowStatement : SyntaxKind
TryStatement = 191,
TryStatement = 193,
>TryStatement : SyntaxKind
DebuggerStatement = 192,
DebuggerStatement = 194,
>DebuggerStatement : SyntaxKind
VariableDeclaration = 193,
VariableDeclaration = 195,
>VariableDeclaration : SyntaxKind
VariableDeclarationList = 194,
VariableDeclarationList = 196,
>VariableDeclarationList : SyntaxKind
FunctionDeclaration = 195,
FunctionDeclaration = 197,
>FunctionDeclaration : SyntaxKind
ClassDeclaration = 196,
ClassDeclaration = 198,
>ClassDeclaration : SyntaxKind
InterfaceDeclaration = 197,
InterfaceDeclaration = 199,
>InterfaceDeclaration : SyntaxKind
TypeAliasDeclaration = 198,
TypeAliasDeclaration = 200,
>TypeAliasDeclaration : SyntaxKind
EnumDeclaration = 199,
EnumDeclaration = 201,
>EnumDeclaration : SyntaxKind
ModuleDeclaration = 200,
ModuleDeclaration = 202,
>ModuleDeclaration : SyntaxKind
ModuleBlock = 201,
ModuleBlock = 203,
>ModuleBlock : SyntaxKind
CaseBlock = 202,
CaseBlock = 204,
>CaseBlock : SyntaxKind
ImportEqualsDeclaration = 203,
ImportEqualsDeclaration = 205,
>ImportEqualsDeclaration : SyntaxKind
ImportDeclaration = 204,
ImportDeclaration = 206,
>ImportDeclaration : SyntaxKind
ImportClause = 205,
ImportClause = 207,
>ImportClause : SyntaxKind
NamespaceImport = 206,
NamespaceImport = 208,
>NamespaceImport : SyntaxKind
NamedImports = 207,
NamedImports = 209,
>NamedImports : SyntaxKind
ImportSpecifier = 208,
ImportSpecifier = 210,
>ImportSpecifier : SyntaxKind
ExportAssignment = 209,
ExportAssignment = 211,
>ExportAssignment : SyntaxKind
ExportDeclaration = 210,
ExportDeclaration = 212,
>ExportDeclaration : SyntaxKind
NamedExports = 211,
NamedExports = 213,
>NamedExports : SyntaxKind
ExportSpecifier = 212,
ExportSpecifier = 214,
>ExportSpecifier : SyntaxKind
ExternalModuleReference = 213,
MissingDeclaration = 215,
>MissingDeclaration : SyntaxKind
ExternalModuleReference = 216,
>ExternalModuleReference : SyntaxKind
CaseClause = 214,
CaseClause = 217,
>CaseClause : SyntaxKind
DefaultClause = 215,
DefaultClause = 218,
>DefaultClause : SyntaxKind
HeritageClause = 216,
HeritageClause = 219,
>HeritageClause : SyntaxKind
CatchClause = 217,
CatchClause = 220,
>CatchClause : SyntaxKind
PropertyAssignment = 218,
PropertyAssignment = 221,
>PropertyAssignment : SyntaxKind
ShorthandPropertyAssignment = 219,
ShorthandPropertyAssignment = 222,
>ShorthandPropertyAssignment : SyntaxKind
EnumMember = 220,
EnumMember = 223,
>EnumMember : SyntaxKind
SourceFile = 221,
SourceFile = 224,
>SourceFile : SyntaxKind
SyntaxList = 222,
SyntaxList = 225,
>SyntaxList : SyntaxKind
Count = 223,
Count = 226,
>Count : SyntaxKind
FirstAssignment = 52,
FirstAssignment = 53,
>FirstAssignment : SyntaxKind
LastAssignment = 63,
LastAssignment = 64,
>LastAssignment : SyntaxKind
FirstReservedWord = 65,
FirstReservedWord = 66,
>FirstReservedWord : SyntaxKind
LastReservedWord = 100,
LastReservedWord = 101,
>LastReservedWord : SyntaxKind
FirstKeyword = 65,
FirstKeyword = 66,
>FirstKeyword : SyntaxKind
LastKeyword = 124,
LastKeyword = 125,
>LastKeyword : SyntaxKind
FirstFutureReservedWord = 102,
FirstFutureReservedWord = 103,
>FirstFutureReservedWord : SyntaxKind
LastFutureReservedWord = 110,
LastFutureReservedWord = 111,
>LastFutureReservedWord : SyntaxKind
FirstTypeNode = 139,
FirstTypeNode = 141,
>FirstTypeNode : SyntaxKind
LastTypeNode = 147,
LastTypeNode = 149,
>LastTypeNode : SyntaxKind
FirstPunctuation = 14,
>FirstPunctuation : SyntaxKind
LastPunctuation = 63,
LastPunctuation = 64,
>LastPunctuation : SyntaxKind
FirstToken = 0,
>FirstToken : SyntaxKind
LastToken = 124,
LastToken = 125,
>LastToken : SyntaxKind
FirstTriviaToken = 2,
@@ -1199,10 +1208,10 @@ declare module "typescript" {
FirstBinaryOperator = 24,
>FirstBinaryOperator : SyntaxKind
LastBinaryOperator = 63,
LastBinaryOperator = 64,
>LastBinaryOperator : SyntaxKind
FirstNode = 125,
FirstNode = 126,
>FirstNode : SyntaxKind
}
const enum NodeFlags {
@@ -1247,6 +1256,9 @@ declare module "typescript" {
OctalLiteral = 16384,
>OctalLiteral : NodeFlags
ExportContext = 32768,
>ExportContext : NodeFlags
Modifier = 499,
>Modifier : NodeFlags
@@ -1271,16 +1283,19 @@ declare module "typescript" {
GeneratorParameter = 8,
>GeneratorParameter : ParserContextFlags
ThisNodeHasError = 16,
Decorator = 16,
>Decorator : ParserContextFlags
ThisNodeHasError = 32,
>ThisNodeHasError : ParserContextFlags
ParserGeneratedFlags = 31,
ParserGeneratedFlags = 63,
>ParserGeneratedFlags : ParserContextFlags
ThisNodeOrAnySubNodesHasError = 32,
ThisNodeOrAnySubNodesHasError = 64,
>ThisNodeOrAnySubNodesHasError : ParserContextFlags
HasAggregatedChildData = 64,
HasAggregatedChildData = 128,
>HasAggregatedChildData : ParserContextFlags
}
const enum RelationComparisonResult {
@@ -1311,6 +1326,11 @@ declare module "typescript" {
>parserContextFlags : ParserContextFlags
>ParserContextFlags : ParserContextFlags
decorators?: NodeArray<Decorator>;
>decorators : NodeArray<Decorator>
>NodeArray : NodeArray<T>
>Decorator : Decorator
modifiers?: ModifiersArray;
>modifiers : ModifiersArray
>ModifiersArray : ModifiersArray
@@ -1405,6 +1425,14 @@ declare module "typescript" {
expression: Expression;
>expression : Expression
>Expression : Expression
}
interface Decorator extends Node {
>Decorator : Decorator
>Node : Node
expression: LeftHandSideExpression;
>expression : LeftHandSideExpression
>LeftHandSideExpression : LeftHandSideExpression
}
interface TypeParameterDeclaration extends Declaration {
>TypeParameterDeclaration : TypeParameterDeclaration
@@ -3284,16 +3312,17 @@ declare module "typescript" {
>node : Node
>Node : Node
hasExportDefaultValue(node: SourceFile): boolean;
>hasExportDefaultValue : (node: SourceFile) => boolean
>node : SourceFile
>SourceFile : SourceFile
isReferencedAliasDeclaration(node: Node): boolean;
>isReferencedAliasDeclaration : (node: Node) => boolean
isValueAliasDeclaration(node: Node): boolean;
>isValueAliasDeclaration : (node: Node) => boolean
>node : Node
>Node : Node
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
>isReferencedAliasDeclaration : (node: Node, checkChildren?: boolean) => boolean
>node : Node
>Node : Node
>checkChildren : boolean
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean
>node : ImportEqualsDeclaration
@@ -3703,6 +3732,9 @@ declare module "typescript" {
BlockScopedBindingInLoop = 256,
>BlockScopedBindingInLoop : NodeCheckFlags
EmitDecorate = 512,
>EmitDecorate : NodeCheckFlags
}
interface NodeLinks {
>NodeLinks : NodeLinks
@@ -11,23 +11,23 @@ var c = new A();
=== tests/cases/compiler/ambientExternalModuleWithInternalImportDeclaration_0.ts ===
declare module 'M' {
module C {
>C : typeof X
>C : typeof C
export var f: number;
>f : number
}
class C {
>C : X
>C : C
foo(): void;
>foo : () => void
}
import X = C;
>X : typeof X
>C : X
>X : typeof C
>C : C
export = X;
>X : X
>X : C
}
@@ -20,5 +20,5 @@ var C = (function () {
_a)[0]] = function () {
};
return C;
var _a;
})();
var _a;
@@ -35,5 +35,5 @@ var C = (function (_super) {
_a)[0]] = function () {
};
return C;
var _a;
})(Base);
var _a;
@@ -42,23 +42,23 @@ module m2 {
}
var m2: {
>m2 : { (): default.connectExport; test1: default.connectModule; test2(): default.connectModule; }
>m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; }
(): m2.connectExport;
>m2 : unknown
>connectExport : default.connectExport
>connectExport : export=.connectExport
test1: m2.connectModule;
>test1 : default.connectModule
>test1 : export=.connectModule
>m2 : unknown
>connectModule : default.connectModule
>connectModule : export=.connectModule
test2(): m2.connectModule;
>test2 : () => default.connectModule
>test2 : () => export=.connectModule
>m2 : unknown
>connectModule : default.connectModule
>connectModule : export=.connectModule
};
export = m2;
>m2 : { (): default.connectExport; test1: default.connectModule; test2(): default.connectModule; }
>m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; }
@@ -3,7 +3,7 @@ export default class {
}
//// [declarationEmitDefaultExport2.js]
export default class {
export default class {
}
@@ -7,7 +7,7 @@ declare module "express" {
function express(): express.ExpressServer;
>express : typeof express
>express : unknown
>ExpressServer : default.ExpressServer
>ExpressServer : export=.ExpressServer
module express {
>express : typeof express
@@ -27,24 +27,24 @@ module m2 {
}
var m2: {
>m2 : { (): default.connectExport; test1: default.connectModule; test2(): default.connectModule; }
>m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; }
(): m2.connectExport;
>m2 : unknown
>connectExport : default.connectExport
>connectExport : export=.connectExport
test1: m2.connectModule;
>test1 : default.connectModule
>test1 : export=.connectModule
>m2 : unknown
>connectModule : default.connectModule
>connectModule : export=.connectModule
test2(): m2.connectModule;
>test2 : () => default.connectModule
>test2 : () => export=.connectModule
>m2 : unknown
>connectModule : default.connectModule
>connectModule : export=.connectModule
};
export = m2;
>m2 : { (): default.connectExport; test1: default.connectModule; test2(): default.connectModule; }
>m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; }
@@ -28,24 +28,24 @@ module m2 {
var x = 10, m2: {
>x : number
>m2 : { (): default.connectExport; test1: default.connectModule; test2(): default.connectModule; }
>m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; }
(): m2.connectExport;
>m2 : unknown
>connectExport : default.connectExport
>connectExport : export=.connectExport
test1: m2.connectModule;
>test1 : default.connectModule
>test1 : export=.connectModule
>m2 : unknown
>connectModule : default.connectModule
>connectModule : export=.connectModule
test2(): m2.connectModule;
>test2 : () => default.connectModule
>test2 : () => export=.connectModule
>m2 : unknown
>connectModule : default.connectModule
>connectModule : export=.connectModule
};
export = m2;
>m2 : { (): default.connectExport; test1: default.connectModule; test2(): default.connectModule; }
>m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; }
@@ -0,0 +1,16 @@
tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,9): error TS1109: Expression expected.
tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,16): error TS1146: Declaration expected.
tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,17): error TS1128: Declaration or statement expected.
==== tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts (3 errors) ====
declare function dec<T>(target: T): T;
var F = @dec () => {
~
!!! error TS1109: Expression expected.
!!! error TS1146: Declaration expected.
~~
!!! error TS1128: Declaration or statement expected.
}
@@ -0,0 +1,10 @@
//// [decoratorOnArrowFunction.ts]
declare function dec<T>(target: T): T;
var F = @dec () => {
}
//// [decoratorOnArrowFunction.js]
var F = ;
{
}
@@ -0,0 +1,27 @@
//// [decoratorOnClass1.ts]
declare function dec<T>(target: T): T;
@dec
class C {
}
//// [decoratorOnClass1.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
C = __decorate([dec], C);
return C;
})();
@@ -0,0 +1,14 @@
=== tests/cases/conformance/decorators/class/decoratorOnClass1.ts ===
declare function dec<T>(target: T): T;
>dec : <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
@dec
>dec : unknown
class C {
>C : C
}
@@ -0,0 +1,28 @@
//// [decoratorOnClass2.ts]
declare function dec<T>(target: T): T;
@dec
export class C {
}
//// [decoratorOnClass2.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
C = __decorate([dec], C);
return C;
})();
exports.C = C;
@@ -0,0 +1,14 @@
=== tests/cases/conformance/decorators/class/decoratorOnClass2.ts ===
declare function dec<T>(target: T): T;
>dec : <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
@dec
>dec : unknown
export class C {
>C : C
}
@@ -0,0 +1,12 @@
tests/cases/conformance/decorators/class/decoratorOnClass3.ts(3,1): error TS1128: Declaration or statement expected.
==== tests/cases/conformance/decorators/class/decoratorOnClass3.ts (1 errors) ====
declare function dec<T>(target: T): T;
export
~~~~~~
!!! error TS1128: Declaration or statement expected.
@dec
class C {
}
@@ -0,0 +1,28 @@
//// [decoratorOnClass3.ts]
declare function dec<T>(target: T): T;
export
@dec
class C {
}
//// [decoratorOnClass3.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
C = __decorate([dec], C);
return C;
})();
@@ -0,0 +1,27 @@
//// [decoratorOnClass4.ts]
declare function dec(): <T>(target: T) => T;
@dec()
class C {
}
//// [decoratorOnClass4.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
C = __decorate([dec()], C);
return C;
})();
@@ -0,0 +1,15 @@
=== tests/cases/conformance/decorators/class/decoratorOnClass4.ts ===
declare function dec(): <T>(target: T) => T;
>dec : () => <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
@dec()
>dec() : <T>(target: T) => T
>dec : () => <T>(target: T) => T
class C {
>C : C
}
@@ -0,0 +1,27 @@
//// [decoratorOnClass5.ts]
declare function dec(): <T>(target: T) => T;
@dec()
class C {
}
//// [decoratorOnClass5.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
C = __decorate([dec()], C);
return C;
})();
@@ -0,0 +1,15 @@
=== tests/cases/conformance/decorators/class/decoratorOnClass5.ts ===
declare function dec(): <T>(target: T) => T;
>dec : () => <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
@dec()
>dec() : <T>(target: T) => T
>dec : () => <T>(target: T) => T
class C {
>C : C
}
@@ -0,0 +1,11 @@
tests/cases/conformance/decorators/class/decoratorOnClass8.ts(3,1): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: typeof C) => void | typeof C'.
==== tests/cases/conformance/decorators/class/decoratorOnClass8.ts (1 errors) ====
declare function dec(): (target: Function, paramIndex: number) => void;
@dec()
~~~~~~
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: typeof C) => void | typeof C'.
class C {
}
@@ -0,0 +1,27 @@
//// [decoratorOnClass8.ts]
declare function dec(): (target: Function, paramIndex: number) => void;
@dec()
class C {
}
//// [decoratorOnClass8.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
C = __decorate([dec()], C);
return C;
})();
@@ -0,0 +1,34 @@
//// [decoratorOnClassAccessor1.ts]
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
@dec get accessor() { return 1; }
}
//// [decoratorOnClassAccessor1.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "accessor", {
get: function () {
return 1;
},
enumerable: true,
configurable: true
});
Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
return C;
})();
@@ -0,0 +1,19 @@
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor1.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec get accessor() { return 1; }
>dec : unknown
>accessor : number
}
@@ -0,0 +1,34 @@
//// [decoratorOnClassAccessor2.ts]
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
@dec public get accessor() { return 1; }
}
//// [decoratorOnClassAccessor2.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "accessor", {
get: function () {
return 1;
},
enumerable: true,
configurable: true
});
Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
return C;
})();
@@ -0,0 +1,19 @@
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor2.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec public get accessor() { return 1; }
>dec : unknown
>accessor : number
}
@@ -0,0 +1,35 @@
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,5): error TS2304: Cannot find name 'public'.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,12): error TS1005: ';' expected.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,16): error TS1146: Declaration expected.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,17): error TS2304: Cannot find name 'get'.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,21): error TS1005: ';' expected.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,21): error TS2304: Cannot find name 'accessor'.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,32): error TS1005: ';' expected.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(5,1): error TS1128: Declaration or statement expected.
==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts (9 errors) ====
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
public @dec get accessor() { return 1; }
~~~~~~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~~~~~~
!!! error TS2304: Cannot find name 'public'.
~
!!! error TS1005: ';' expected.
!!! error TS1146: Declaration expected.
~~~
!!! error TS2304: Cannot find name 'get'.
~~~~~~~~
!!! error TS1005: ';' expected.
~~~~~~~~
!!! error TS2304: Cannot find name 'accessor'.
~
!!! error TS1005: ';' expected.
}
~
!!! error TS1128: Declaration or statement expected.
@@ -0,0 +1,19 @@
//// [decoratorOnClassAccessor3.ts]
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
public @dec get accessor() { return 1; }
}
//// [decoratorOnClassAccessor3.js]
var C = (function () {
function C() {
}
return C;
})();
public;
get;
accessor();
{
return 1;
}
@@ -0,0 +1,33 @@
//// [decoratorOnClassAccessor4.ts]
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
@dec set accessor(value: number) { }
}
//// [decoratorOnClassAccessor4.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "accessor", {
set: function (value) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
return C;
})();
@@ -0,0 +1,20 @@
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor4.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec set accessor(value: number) { }
>dec : unknown
>accessor : number
>value : number
}
@@ -0,0 +1,33 @@
//// [decoratorOnClassAccessor5.ts]
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
@dec public set accessor(value: number) { }
}
//// [decoratorOnClassAccessor5.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "accessor", {
set: function (value) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
return C;
})();
@@ -0,0 +1,20 @@
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor5.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec public set accessor(value: number) { }
>dec : unknown
>accessor : number
>value : number
}
@@ -0,0 +1,44 @@
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,5): error TS2304: Cannot find name 'public'.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,12): error TS1005: ';' expected.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,16): error TS1146: Declaration expected.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,17): error TS2304: Cannot find name 'set'.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,21): error TS1005: ';' expected.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,21): error TS2304: Cannot find name 'accessor'.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,30): error TS2304: Cannot find name 'value'.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,35): error TS1005: ',' expected.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,37): error TS2304: Cannot find name 'number'.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,45): error TS1005: ';' expected.
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(5,1): error TS1128: Declaration or statement expected.
==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts (12 errors) ====
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
public @dec set accessor(value: number) { }
~~~~~~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~~~~~~
!!! error TS2304: Cannot find name 'public'.
~
!!! error TS1005: ';' expected.
!!! error TS1146: Declaration expected.
~~~
!!! error TS2304: Cannot find name 'set'.
~~~~~~~~
!!! error TS1005: ';' expected.
~~~~~~~~
!!! error TS2304: Cannot find name 'accessor'.
~~~~~
!!! error TS2304: Cannot find name 'value'.
~
!!! error TS1005: ',' expected.
~~~~~~
!!! error TS2304: Cannot find name 'number'.
~
!!! error TS1005: ';' expected.
}
~
!!! error TS1128: Declaration or statement expected.
@@ -0,0 +1,18 @@
//// [decoratorOnClassAccessor6.ts]
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
public @dec set accessor(value: number) { }
}
//// [decoratorOnClassAccessor6.js]
var C = (function () {
function C() {
}
return C;
})();
public;
set;
accessor(value, number);
{
}
@@ -0,0 +1,11 @@
tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor1.ts(4,5): error TS1206: Decorators are not valid here.
==== tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor1.ts (1 errors) ====
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
@dec constructor() {}
~~~~~~~~~~~~~~~~~~~~~
!!! error TS1206: Decorators are not valid here.
}
@@ -0,0 +1,13 @@
//// [decoratorOnClassConstructor1.ts]
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
@dec constructor() {}
}
//// [decoratorOnClassConstructor1.js]
var C = (function () {
function C() {
}
return C;
})();
@@ -0,0 +1,27 @@
//// [decoratorOnClassConstructorParameter1.ts]
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
class C {
constructor(@dec p: number) {}
}
//// [decoratorOnClassConstructorParameter1.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C(p) {
}
__decorate([dec], C, void 0, 0);
return C;
})();
@@ -0,0 +1,15 @@
=== tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter1.ts ===
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
>dec : (target: Function, propertyKey: string | symbol, parameterIndex: number) => void
>target : Function
>Function : Function
>propertyKey : string | symbol
>parameterIndex : number
class C {
>C : C
constructor(@dec p: number) {}
>dec : unknown
>p : number
}
@@ -0,0 +1,11 @@
tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter4.ts(4,24): error TS1005: ',' expected.
==== tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter4.ts (1 errors) ====
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
class C {
constructor(public @dec p: number) {}
~
!!! error TS1005: ',' expected.
}
@@ -0,0 +1,27 @@
//// [decoratorOnClassConstructorParameter4.ts]
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
class C {
constructor(public @dec p: number) {}
}
//// [decoratorOnClassConstructorParameter4.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C(public, p) {
}
__decorate([dec], C, void 0, 1);
return C;
})();
@@ -0,0 +1,29 @@
//// [decoratorOnClassMethod1.ts]
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
@dec method() {}
}
//// [decoratorOnClassMethod1.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
C.prototype.method = function () {
};
Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
return C;
})();
@@ -0,0 +1,19 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod1.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec method() {}
>dec : unknown
>method : () => void
}
@@ -0,0 +1,17 @@
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts(4,5): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<() => void>) => void | TypedPropertyDescriptor<() => void>'.
Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
Type 'number' is not assignable to type 'string | symbol'.
Type 'number' is not assignable to type 'symbol'.
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts (1 errors) ====
declare function dec(target: Function, paramIndex: number): void;
class C {
@dec method() {}
~~~~
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<() => void>) => void | TypedPropertyDescriptor<() => void>'.
!!! error TS2322: Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string | symbol'.
!!! error TS2322: Type 'number' is not assignable to type 'symbol'.
}
@@ -0,0 +1,29 @@
//// [decoratorOnClassMethod10.ts]
declare function dec(target: Function, paramIndex: number): void;
class C {
@dec method() {}
}
//// [decoratorOnClassMethod10.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
C.prototype.method = function () {
};
Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
return C;
})();
@@ -0,0 +1,29 @@
//// [decoratorOnClassMethod2.ts]
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
@dec public method() {}
}
//// [decoratorOnClassMethod2.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
C.prototype.method = function () {
};
Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
return C;
})();
@@ -0,0 +1,19 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod2.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec public method() {}
>dec : unknown
>method : () => void
}
@@ -0,0 +1,29 @@
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,5): error TS2304: Cannot find name 'public'.
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,12): error TS1005: ';' expected.
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,16): error TS1146: Declaration expected.
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,17): error TS2304: Cannot find name 'method'.
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,26): error TS1005: ';' expected.
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(5,1): error TS1128: Declaration or statement expected.
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts (7 errors) ====
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
public @dec method() {}
~~~~~~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~~~~~~
!!! error TS2304: Cannot find name 'public'.
~
!!! error TS1005: ';' expected.
!!! error TS1146: Declaration expected.
~~~~~~
!!! error TS2304: Cannot find name 'method'.
~
!!! error TS1005: ';' expected.
}
~
!!! error TS1128: Declaration or statement expected.
@@ -0,0 +1,17 @@
//// [decoratorOnClassMethod3.ts]
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
public @dec method() {}
}
//// [decoratorOnClassMethod3.js]
var C = (function () {
function C() {
}
return C;
})();
public;
method();
{
}
@@ -0,0 +1,27 @@
//// [decoratorOnClassMethod4.ts]
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
@dec ["method"]() {}
}
//// [decoratorOnClassMethod4.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
class C {
[_a = "method"]() {
}
}
Object.defineProperty(C.prototype, _a, __decorate([dec], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
var _a;
@@ -0,0 +1,18 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod4.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec ["method"]() {}
>dec : unknown
}
@@ -0,0 +1,27 @@
//// [decoratorOnClassMethod5.ts]
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
class C {
@dec() ["method"]() {}
}
//// [decoratorOnClassMethod5.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
class C {
[_a = "method"]() {
}
}
Object.defineProperty(C.prototype, _a, __decorate([dec()], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
var _a;
@@ -0,0 +1,19 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod5.ts ===
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec() ["method"]() {}
>dec() : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
}
@@ -0,0 +1,27 @@
//// [decoratorOnClassMethod6.ts]
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
class C {
@dec ["method"]() {}
}
//// [decoratorOnClassMethod6.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
class C {
[_a = "method"]() {
}
}
Object.defineProperty(C.prototype, _a, __decorate([dec], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
var _a;
@@ -0,0 +1,18 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts ===
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec ["method"]() {}
>dec : unknown
}
@@ -0,0 +1,27 @@
//// [decoratorOnClassMethod7.ts]
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
@dec public ["method"]() {}
}
//// [decoratorOnClassMethod7.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
class C {
[_a = "method"]() {
}
}
Object.defineProperty(C.prototype, _a, __decorate([dec], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
var _a;
@@ -0,0 +1,18 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod7.ts ===
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec public ["method"]() {}
>dec : unknown
}
@@ -0,0 +1,29 @@
//// [decoratorOnClassMethod8.ts]
declare function dec<T>(target: T): T;
class C {
@dec method() {}
}
//// [decoratorOnClassMethod8.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
C.prototype.method = function () {
};
Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
return C;
})();
@@ -0,0 +1,15 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts ===
declare function dec<T>(target: T): T;
>dec : <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
class C {
>C : C
@dec method() {}
>dec : unknown
>method : () => void
}
@@ -0,0 +1,29 @@
//// [decoratorOnClassMethodParameter1.ts]
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
class C {
method(@dec p: number) {}
}
//// [decoratorOnClassMethodParameter1.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
C.prototype.method = function (p) {
};
__decorate([dec], C.prototype, "method", 0);
return C;
})();
@@ -0,0 +1,16 @@
=== tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodParameter1.ts ===
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
>dec : (target: Function, propertyKey: string | symbol, parameterIndex: number) => void
>target : Function
>Function : Function
>propertyKey : string | symbol
>parameterIndex : number
class C {
>C : C
method(@dec p: number) {}
>method : (p: number) => void
>dec : unknown
>p : number
}
@@ -0,0 +1,27 @@
//// [decoratorOnClassProperty1.ts]
declare function dec(target: any, propertyKey: string): void;
class C {
@dec prop;
}
//// [decoratorOnClassProperty1.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
__decorate([dec], C.prototype, "prop");
return C;
})();
@@ -0,0 +1,13 @@
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty1.ts ===
declare function dec(target: any, propertyKey: string): void;
>dec : (target: any, propertyKey: string) => void
>target : any
>propertyKey : string
class C {
>C : C
@dec prop;
>dec : unknown
>prop : any
}
@@ -0,0 +1,27 @@
//// [decoratorOnClassProperty10.ts]
declare function dec(): <T>(target: any, propertyKey: string) => void;
class C {
@dec() prop;
}
//// [decoratorOnClassProperty10.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
__decorate([dec()], C.prototype, "prop");
return C;
})();
@@ -0,0 +1,15 @@
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty10.ts ===
declare function dec(): <T>(target: any, propertyKey: string) => void;
>dec : () => <T>(target: any, propertyKey: string) => void
>T : T
>target : any
>propertyKey : string
class C {
>C : C
@dec() prop;
>dec() : <T>(target: any, propertyKey: string) => void
>dec : () => <T>(target: any, propertyKey: string) => void
>prop : any
}
@@ -0,0 +1,27 @@
//// [decoratorOnClassProperty11.ts]
declare function dec(): <T>(target: any, propertyKey: string) => void;
class C {
@dec prop;
}
//// [decoratorOnClassProperty11.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
__decorate([dec], C.prototype, "prop");
return C;
})();
@@ -0,0 +1,14 @@
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts ===
declare function dec(): <T>(target: any, propertyKey: string) => void;
>dec : () => <T>(target: any, propertyKey: string) => void
>T : T
>target : any
>propertyKey : string
class C {
>C : C
@dec prop;
>dec : unknown
>prop : any
}
@@ -0,0 +1,27 @@
//// [decoratorOnClassProperty2.ts]
declare function dec(target: any, propertyKey: string): void;
class C {
@dec public prop;
}
//// [decoratorOnClassProperty2.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
__decorate([dec], C.prototype, "prop");
return C;
})();
@@ -0,0 +1,13 @@
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty2.ts ===
declare function dec(target: any, propertyKey: string): void;
>dec : (target: any, propertyKey: string) => void
>target : any
>propertyKey : string
class C {
>C : C
@dec public prop;
>dec : unknown
>prop : any
}
@@ -0,0 +1,26 @@
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,5): error TS2304: Cannot find name 'public'.
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,12): error TS1005: ';' expected.
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,16): error TS1146: Declaration expected.
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,17): error TS2304: Cannot find name 'prop'.
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(5,1): error TS1128: Declaration or statement expected.
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts (6 errors) ====
declare function dec(target: any, propertyKey: string): void;
class C {
public @dec prop;
~~~~~~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~~~~~~
!!! error TS2304: Cannot find name 'public'.
~
!!! error TS1005: ';' expected.
!!! error TS1146: Declaration expected.
~~~~
!!! error TS2304: Cannot find name 'prop'.
}
~
!!! error TS1128: Declaration or statement expected.
@@ -0,0 +1,15 @@
//// [decoratorOnClassProperty3.ts]
declare function dec(target: any, propertyKey: string): void;
class C {
public @dec prop;
}
//// [decoratorOnClassProperty3.js]
var C = (function () {
function C() {
}
return C;
})();
public;
prop;
@@ -0,0 +1,27 @@
//// [decoratorOnClassProperty6.ts]
declare function dec(target: Function): void;
class C {
@dec prop;
}
//// [decoratorOnClassProperty6.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
__decorate([dec], C.prototype, "prop");
return C;
})();
@@ -0,0 +1,13 @@
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts ===
declare function dec(target: Function): void;
>dec : (target: Function) => void
>target : Function
>Function : Function
class C {
>C : C
@dec prop;
>dec : unknown
>prop : any
}
@@ -0,0 +1,11 @@
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty7.ts(4,5): error TS2322: Type '(target: Function, propertyKey: string | symbol, paramIndex: number) => void' is not assignable to type '(target: Object, propertyKey: string | symbol) => void'.
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty7.ts (1 errors) ====
declare function dec(target: Function, propertyKey: string | symbol, paramIndex: number): void;
class C {
@dec prop;
~~~~
!!! error TS2322: Type '(target: Function, propertyKey: string | symbol, paramIndex: number) => void' is not assignable to type '(target: Object, propertyKey: string | symbol) => void'.
}
@@ -0,0 +1,27 @@
//// [decoratorOnClassProperty7.ts]
declare function dec(target: Function, propertyKey: string | symbol, paramIndex: number): void;
class C {
@dec prop;
}
//// [decoratorOnClassProperty7.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
__decorate([dec], C.prototype, "prop");
return C;
})();
@@ -0,0 +1,11 @@
tests/cases/conformance/decorators/invalid/decoratorOnEnum.ts(4,6): error TS1206: Decorators are not valid here.
==== tests/cases/conformance/decorators/invalid/decoratorOnEnum.ts (1 errors) ====
declare function dec<T>(target: T): T;
@dec
enum E {
~
!!! error TS1206: Decorators are not valid here.
}

Some files were not shown because too many files have changed in this diff Show More