mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Add support for parsing and emitting class expressions.
This commit is contained in:
parent
a1e18fc22b
commit
f7aaf09603
@ -126,6 +126,7 @@ module ts {
|
||||
return (<ExportAssignment>node).isExportEquals ? "export=" : "default";
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
return node.flags & NodeFlags.Default ? "default" : undefined;
|
||||
}
|
||||
}
|
||||
@ -168,7 +169,7 @@ module ts {
|
||||
addDeclarationToSymbol(symbol, node, includes);
|
||||
symbol.parent = parent;
|
||||
|
||||
if (node.kind === SyntaxKind.ClassDeclaration && symbol.exports) {
|
||||
if ((node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.ClassExpression) && symbol.exports) {
|
||||
// TypeScript 1.0 spec (April 2014): 8.4
|
||||
// Every class automatically contains a static property member named 'prototype',
|
||||
// the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter.
|
||||
@ -286,6 +287,7 @@ module ts {
|
||||
case SyntaxKind.ArrowFunction:
|
||||
declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes);
|
||||
break;
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
if (node.flags & NodeFlags.Static) {
|
||||
declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes);
|
||||
@ -485,6 +487,9 @@ module ts {
|
||||
case SyntaxKind.ArrowFunction:
|
||||
bindAnonymousDeclaration(<FunctionExpression>node, SymbolFlags.Function, "__function", /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
case SyntaxKind.ClassExpression:
|
||||
bindAnonymousDeclaration(<ClassExpression>node, SymbolFlags.Class, "__class", /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.CatchClause:
|
||||
bindCatchVariableDeclaration(<CatchClause>node);
|
||||
break;
|
||||
@ -584,9 +589,9 @@ module ts {
|
||||
// containing class.
|
||||
if (node.flags & NodeFlags.AccessibilityModifier &&
|
||||
node.parent.kind === SyntaxKind.Constructor &&
|
||||
node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
(node.parent.parent.kind === SyntaxKind.ClassDeclaration || node.parent.parent.kind === SyntaxKind.ClassExpression)) {
|
||||
|
||||
let classDeclaration = <ClassDeclaration>node.parent.parent;
|
||||
let classDeclaration = <ClassLikeDeclaration>node.parent.parent;
|
||||
declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
|
||||
}
|
||||
}
|
||||
|
||||
@ -422,8 +422,15 @@ module ts {
|
||||
result = argumentsSymbol;
|
||||
break loop;
|
||||
}
|
||||
let id = (<FunctionExpression>location).name;
|
||||
if (id && name === id.text) {
|
||||
let functionName = (<FunctionExpression>location).name;
|
||||
if (functionName && name === functionName.text) {
|
||||
result = location.symbol;
|
||||
break loop;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.ClassExpression:
|
||||
let className = (<ClassExpression>location).name;
|
||||
if (className && name === className.text) {
|
||||
result = location.symbol;
|
||||
break loop;
|
||||
}
|
||||
@ -7991,6 +7998,8 @@ module ts {
|
||||
return checkTypeAssertion(<TypeAssertion>node);
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return checkExpression((<ParenthesizedExpression>node).expression, contextualMapper);
|
||||
case SyntaxKind.ClassExpression:
|
||||
return checkClassExpression(<ClassExpression>node);
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return checkFunctionExpressionOrObjectLiteralMethod(<FunctionExpression>node, contextualMapper);
|
||||
@ -9732,8 +9741,18 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkClassExpression(node: ClassExpression): Type {
|
||||
grammarErrorOnNode(node, Diagnostics.class_expressions_are_not_currently_supported);
|
||||
forEach(node.members, checkSourceElement);
|
||||
return unknownType;
|
||||
}
|
||||
|
||||
function checkClassDeclaration(node: ClassDeclaration) {
|
||||
// Grammar checking
|
||||
if (node.parent.kind !== SyntaxKind.ModuleBlock && node.parent.kind !== SyntaxKind.SourceFile) {
|
||||
grammarErrorOnNode(node, Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration);
|
||||
}
|
||||
|
||||
checkGrammarClassDeclarationHeritageClauses(node);
|
||||
checkDecorators(node);
|
||||
if (node.name) {
|
||||
|
||||
@ -501,5 +501,7 @@ module ts {
|
||||
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
|
||||
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." },
|
||||
Only_type_references_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: DiagnosticCategory.Error, key: "Only type references are currently supported in a class 'extends' clauses." },
|
||||
class_expressions_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'class' expressions are not currently supported." },
|
||||
class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { code: 9004, category: DiagnosticCategory.Error, key: "'class' declarations are only supported directly inside a module or as a top level declaration." },
|
||||
};
|
||||
}
|
||||
@ -1997,5 +1997,13 @@
|
||||
"Only type references are currently supported in a class 'extends' clauses.": {
|
||||
"category": "Error",
|
||||
"code": 9002
|
||||
},
|
||||
"'class' expressions are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9003
|
||||
},
|
||||
"'class' declarations are only supported directly inside a module or as a top level declaration.": {
|
||||
"category": "Error",
|
||||
"code": 9004
|
||||
}
|
||||
}
|
||||
|
||||
@ -3193,7 +3193,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitMemberAssignments(node: ClassDeclaration, staticFlag: NodeFlags) {
|
||||
function emitMemberAssignments(node: ClassLikeDeclaration, staticFlag: NodeFlags) {
|
||||
forEach(node.members, member => {
|
||||
if (member.kind === SyntaxKind.PropertyDeclaration && (member.flags & NodeFlags.Static) === staticFlag && (<PropertyDeclaration>member).initializer) {
|
||||
writeLine();
|
||||
@ -3217,7 +3217,7 @@ module ts {
|
||||
});
|
||||
}
|
||||
|
||||
function emitMemberFunctionsForES5AndLower(node: ClassDeclaration) {
|
||||
function emitMemberFunctionsForES5AndLower(node: ClassLikeDeclaration) {
|
||||
forEach(node.members, member => {
|
||||
if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) {
|
||||
if (!(<MethodDeclaration>member).body) {
|
||||
@ -3287,7 +3287,7 @@ module ts {
|
||||
});
|
||||
}
|
||||
|
||||
function emitMemberFunctionsForES6AndHigher(node: ClassDeclaration) {
|
||||
function emitMemberFunctionsForES6AndHigher(node: ClassLikeDeclaration) {
|
||||
for (let member of node.members) {
|
||||
if ((member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) && !(<MethodDeclaration>member).body) {
|
||||
emitOnlyPinnedOrTripleSlashComments(member);
|
||||
@ -3314,7 +3314,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitConstructor(node: ClassDeclaration, baseTypeElement: HeritageClauseElement) {
|
||||
function emitConstructor(node: ClassLikeDeclaration, baseTypeElement: HeritageClauseElement) {
|
||||
let saveTempFlags = tempFlags;
|
||||
let saveTempVariables = tempVariables;
|
||||
let saveTempParameters = tempParameters;
|
||||
@ -3435,82 +3435,92 @@ module ts {
|
||||
tempParameters = saveTempParameters;
|
||||
}
|
||||
|
||||
function emitClassExpression(node: ClassExpression) {
|
||||
return emitClassLikeDeclaration(node);
|
||||
}
|
||||
|
||||
function emitClassDeclaration(node: ClassDeclaration) {
|
||||
return emitClassLikeDeclaration(node);
|
||||
}
|
||||
|
||||
function emitClassLikeDeclaration(node: ClassLikeDeclaration) {
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
emitClassDeclarationBelowES6(<ClassDeclaration>node);
|
||||
emitClassLikeDeclarationBelowES6(node);
|
||||
}
|
||||
else {
|
||||
emitClassDeclarationForES6AndHigher(<ClassDeclaration>node);
|
||||
emitClassLikeDeclarationForES6AndHigher(node);
|
||||
}
|
||||
}
|
||||
|
||||
function emitClassDeclarationForES6AndHigher(node: ClassDeclaration) {
|
||||
function emitClassLikeDeclarationForES6AndHigher(node: ClassLikeDeclaration) {
|
||||
let thisNodeIsDecorated = nodeIsDecorated(node);
|
||||
if (thisNodeIsDecorated) {
|
||||
// To preserve the correct runtime semantics when decorators are applied to the class,
|
||||
// the emit needs to follow one of the following rules:
|
||||
//
|
||||
// * For a local class declaration:
|
||||
//
|
||||
// @dec class C {
|
||||
// }
|
||||
//
|
||||
// The emit should be:
|
||||
//
|
||||
// let C = class {
|
||||
// };
|
||||
// Object.defineProperty(C, "name", { value: "C", configurable: true });
|
||||
// C = __decorate([dec], C);
|
||||
//
|
||||
// * For an exported class declaration:
|
||||
//
|
||||
// @dec export class C {
|
||||
// }
|
||||
//
|
||||
// The emit should be:
|
||||
//
|
||||
// export let C = class {
|
||||
// };
|
||||
// Object.defineProperty(C, "name", { value: "C", configurable: true });
|
||||
// C = __decorate([dec], C);
|
||||
//
|
||||
// * For a default export of a class declaration with a name:
|
||||
//
|
||||
// @dec default export class C {
|
||||
// }
|
||||
//
|
||||
// The emit should be:
|
||||
//
|
||||
// let C = class {
|
||||
// }
|
||||
// Object.defineProperty(C, "name", { value: "C", configurable: true });
|
||||
// C = __decorate([dec], C);
|
||||
// export default C;
|
||||
//
|
||||
// * For a default export of a class declaration without a name:
|
||||
//
|
||||
// @dec default export class {
|
||||
// }
|
||||
//
|
||||
// The emit should be:
|
||||
//
|
||||
// let _default = class {
|
||||
// }
|
||||
// _default = __decorate([dec], _default);
|
||||
// export default _default;
|
||||
//
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & NodeFlags.Default)) {
|
||||
write("export ");
|
||||
}
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
if (thisNodeIsDecorated) {
|
||||
// To preserve the correct runtime semantics when decorators are applied to the class,
|
||||
// the emit needs to follow one of the following rules:
|
||||
//
|
||||
// * For a local class declaration:
|
||||
//
|
||||
// @dec class C {
|
||||
// }
|
||||
//
|
||||
// The emit should be:
|
||||
//
|
||||
// let C = class {
|
||||
// };
|
||||
// Object.defineProperty(C, "name", { value: "C", configurable: true });
|
||||
// C = __decorate([dec], C);
|
||||
//
|
||||
// * For an exported class declaration:
|
||||
//
|
||||
// @dec export class C {
|
||||
// }
|
||||
//
|
||||
// The emit should be:
|
||||
//
|
||||
// export let C = class {
|
||||
// };
|
||||
// Object.defineProperty(C, "name", { value: "C", configurable: true });
|
||||
// C = __decorate([dec], C);
|
||||
//
|
||||
// * For a default export of a class declaration with a name:
|
||||
//
|
||||
// @dec default export class C {
|
||||
// }
|
||||
//
|
||||
// The emit should be:
|
||||
//
|
||||
// let C = class {
|
||||
// }
|
||||
// Object.defineProperty(C, "name", { value: "C", configurable: true });
|
||||
// C = __decorate([dec], C);
|
||||
// export default C;
|
||||
//
|
||||
// * For a default export of a class declaration without a name:
|
||||
//
|
||||
// @dec default export class {
|
||||
// }
|
||||
//
|
||||
// The emit should be:
|
||||
//
|
||||
// let _default = class {
|
||||
// }
|
||||
// _default = __decorate([dec], _default);
|
||||
// export default _default;
|
||||
//
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & NodeFlags.Default)) {
|
||||
write("export ");
|
||||
}
|
||||
|
||||
write("let ");
|
||||
emitDeclarationName(node);
|
||||
write(" = ");
|
||||
}
|
||||
else if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
if (node.flags & NodeFlags.Default) {
|
||||
write("default ");
|
||||
write("let ");
|
||||
emitDeclarationName(node);
|
||||
write(" = ");
|
||||
}
|
||||
else if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
if (node.flags & NodeFlags.Default) {
|
||||
write("default ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3588,10 +3598,14 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitClassDeclarationBelowES6(node: ClassDeclaration) {
|
||||
write("var ");
|
||||
emitDeclarationName(node);
|
||||
write(" = (function (");
|
||||
function emitClassLikeDeclarationBelowES6(node: ClassLikeDeclaration) {
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
write("var ");
|
||||
emitDeclarationName(node);
|
||||
write(" = ");
|
||||
}
|
||||
|
||||
write("(function (");
|
||||
let baseTypeNode = getClassBaseTypeNode(node);
|
||||
if (baseTypeNode) {
|
||||
write("_super");
|
||||
@ -3641,30 +3655,35 @@ module ts {
|
||||
if (baseTypeNode) {
|
||||
emit(baseTypeNode.expression);
|
||||
}
|
||||
write(");");
|
||||
write(")");
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
write(";");
|
||||
}
|
||||
emitEnd(node);
|
||||
|
||||
emitExportMemberAssignment(node);
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
emitExportMemberAssignment(<ClassDeclaration>node);
|
||||
}
|
||||
|
||||
if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile && node.name) {
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
}
|
||||
|
||||
function emitClassMemberPrefix(node: ClassDeclaration, member: Node) {
|
||||
function emitClassMemberPrefix(node: ClassLikeDeclaration, member: Node) {
|
||||
emitDeclarationName(node);
|
||||
if (!(member.flags & NodeFlags.Static)) {
|
||||
write(".prototype");
|
||||
}
|
||||
}
|
||||
|
||||
function emitDecoratorsOfClass(node: ClassDeclaration) {
|
||||
function emitDecoratorsOfClass(node: ClassLikeDeclaration) {
|
||||
emitDecoratorsOfMembers(node, /*staticFlag*/ 0);
|
||||
emitDecoratorsOfMembers(node, NodeFlags.Static);
|
||||
emitDecoratorsOfConstructor(node);
|
||||
}
|
||||
|
||||
function emitDecoratorsOfConstructor(node: ClassDeclaration) {
|
||||
function emitDecoratorsOfConstructor(node: ClassLikeDeclaration) {
|
||||
let constructor = getFirstConstructorWithBody(node);
|
||||
if (constructor) {
|
||||
emitDecoratorsOfParameters(node, constructor);
|
||||
@ -3696,7 +3715,7 @@ module ts {
|
||||
writeLine();
|
||||
}
|
||||
|
||||
function emitDecoratorsOfMembers(node: ClassDeclaration, staticFlag: NodeFlags) {
|
||||
function emitDecoratorsOfMembers(node: ClassLikeDeclaration, staticFlag: NodeFlags) {
|
||||
forEach(node.members, member => {
|
||||
if ((member.flags & NodeFlags.Static) !== staticFlag) {
|
||||
return;
|
||||
@ -3800,7 +3819,7 @@ module ts {
|
||||
});
|
||||
}
|
||||
|
||||
function emitDecoratorsOfParameters(node: ClassDeclaration, member: FunctionLikeDeclaration) {
|
||||
function emitDecoratorsOfParameters(node: ClassLikeDeclaration, member: FunctionLikeDeclaration) {
|
||||
forEach(member.parameters, (parameter, parameterIndex) => {
|
||||
if (!nodeIsDecorated(parameter)) {
|
||||
return;
|
||||
@ -4768,6 +4787,8 @@ var __decorate = this.__decorate || function (decorators, target, key, value) {
|
||||
return emitDebuggerStatement(node);
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
return emitVariableDeclaration(<VariableDeclaration>node);
|
||||
case SyntaxKind.ClassExpression:
|
||||
return emitClassExpression(<ClassExpression>node);
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
return emitClassDeclaration(<ClassDeclaration>node);
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
|
||||
@ -237,12 +237,13 @@ module ts {
|
||||
case SyntaxKind.Decorator:
|
||||
return visitNode(cbNode, (<Decorator>node).expression);
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
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);
|
||||
visitNode(cbNode, (<ClassLikeDeclaration>node).name) ||
|
||||
visitNodes(cbNodes, (<ClassLikeDeclaration>node).typeParameters) ||
|
||||
visitNodes(cbNodes, (<ClassLikeDeclaration>node).heritageClauses) ||
|
||||
visitNodes(cbNodes, (<ClassLikeDeclaration>node).members);
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
return visitNodes(cbNodes, node.decorators) ||
|
||||
visitNodes(cbNodes, node.modifiers) ||
|
||||
@ -2899,6 +2900,7 @@ module ts {
|
||||
case SyntaxKind.OpenBracketToken:
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
case SyntaxKind.FunctionKeyword:
|
||||
case SyntaxKind.ClassKeyword:
|
||||
case SyntaxKind.NewKeyword:
|
||||
case SyntaxKind.SlashToken:
|
||||
case SyntaxKind.SlashEqualsToken:
|
||||
@ -2944,8 +2946,12 @@ module ts {
|
||||
}
|
||||
|
||||
function isStartOfExpressionStatement(): boolean {
|
||||
// As per the grammar, neither '{' nor 'function' can start an expression statement.
|
||||
return token !== SyntaxKind.OpenBraceToken && token !== SyntaxKind.FunctionKeyword && token !== SyntaxKind.AtToken && isStartOfExpression();
|
||||
// As per the grammar, none of '{' or 'function' or 'class' can start an expression statement.
|
||||
return token !== SyntaxKind.OpenBraceToken &&
|
||||
token !== SyntaxKind.FunctionKeyword &&
|
||||
token !== SyntaxKind.ClassKeyword &&
|
||||
token !== SyntaxKind.AtToken &&
|
||||
isStartOfExpression();
|
||||
}
|
||||
|
||||
function parseExpression(): Expression {
|
||||
@ -3290,8 +3296,12 @@ module ts {
|
||||
return parseFunctionBlock(/*allowYield:*/ false, /* ignoreMissingOpenBrace */ false);
|
||||
}
|
||||
|
||||
if (isStartOfStatement(/*inErrorRecovery:*/ true) && !isStartOfExpressionStatement() && token !== SyntaxKind.FunctionKeyword) {
|
||||
// Check if we got a plain statement (i.e. no expression-statements, no functions expressions/declarations)
|
||||
if (isStartOfStatement(/*inErrorRecovery:*/ true) &&
|
||||
!isStartOfExpressionStatement() &&
|
||||
token !== SyntaxKind.FunctionKeyword &&
|
||||
token !== SyntaxKind.ClassKeyword) {
|
||||
|
||||
// Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations)
|
||||
//
|
||||
// Here we try to recover from a potential error situation in the case where the
|
||||
// user meant to supply a block. For example, if the user wrote:
|
||||
@ -3763,6 +3773,8 @@ module ts {
|
||||
return parseArrayLiteralExpression();
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
return parseObjectLiteralExpression();
|
||||
case SyntaxKind.ClassKeyword:
|
||||
return parseClassExpression();
|
||||
case SyntaxKind.FunctionKeyword:
|
||||
return parseFunctionExpression();
|
||||
case SyntaxKind.NewKeyword:
|
||||
@ -4183,13 +4195,14 @@ module ts {
|
||||
}
|
||||
|
||||
function isStartOfStatement(inErrorRecovery: boolean): boolean {
|
||||
// Functions and variable statements are allowed as a statement. But as per the grammar,
|
||||
// they also allow modifiers. So we have to check for those statements that might be
|
||||
// following modifiers.This ensures that things 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.
|
||||
// Functions, variable statements and classes are allowed as a statement. But as per
|
||||
// the grammar, they also allow modifiers. So we have to check for those statements
|
||||
// that might be following modifiers.This ensures that things work properly when
|
||||
// incrementally parsing as the parser will produce the same FunctionDeclaraiton,
|
||||
// VariableStatement or ClassDeclaration, if it has the same text regardless of whether
|
||||
// it is inside a block or not.
|
||||
if (isModifier(token)) {
|
||||
let result = lookAhead(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers);
|
||||
let result = lookAhead(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers);
|
||||
if (result) {
|
||||
return true;
|
||||
}
|
||||
@ -4208,6 +4221,7 @@ module ts {
|
||||
case SyntaxKind.VarKeyword:
|
||||
case SyntaxKind.LetKeyword:
|
||||
case SyntaxKind.FunctionKeyword:
|
||||
case SyntaxKind.ClassKeyword:
|
||||
case SyntaxKind.IfKeyword:
|
||||
case SyntaxKind.DoKeyword:
|
||||
case SyntaxKind.WhileKeyword:
|
||||
@ -4232,7 +4246,6 @@ module ts {
|
||||
let isConstEnum = lookAhead(nextTokenIsEnumKeyword);
|
||||
return !isConstEnum;
|
||||
case SyntaxKind.InterfaceKeyword:
|
||||
case SyntaxKind.ClassKeyword:
|
||||
case SyntaxKind.ModuleKeyword:
|
||||
case SyntaxKind.EnumKeyword:
|
||||
case SyntaxKind.TypeKeyword:
|
||||
@ -4276,6 +4289,8 @@ module ts {
|
||||
return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
|
||||
case SyntaxKind.FunctionKeyword:
|
||||
return parseFunctionDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
|
||||
case SyntaxKind.ClassKeyword:
|
||||
return parseClassDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
|
||||
case SyntaxKind.SemicolonToken:
|
||||
return parseEmptyStatement();
|
||||
case SyntaxKind.IfKeyword:
|
||||
@ -4321,7 +4336,7 @@ module ts {
|
||||
// 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);
|
||||
let result = tryParse(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
@ -4331,7 +4346,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers(): FunctionDeclaration | VariableStatement {
|
||||
function parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers(): FunctionDeclaration | VariableStatement | ClassDeclaration {
|
||||
let start = scanner.getStartPos();
|
||||
let decorators = parseDecorators();
|
||||
let modifiers = parseModifiers();
|
||||
@ -4351,8 +4366,12 @@ module ts {
|
||||
|
||||
case SyntaxKind.VarKeyword:
|
||||
return parseVariableStatement(start, decorators, modifiers);
|
||||
|
||||
case SyntaxKind.FunctionKeyword:
|
||||
return parseFunctionDeclaration(start, decorators, modifiers);
|
||||
|
||||
case SyntaxKind.ClassKeyword:
|
||||
return parseClassDeclaration(start, decorators, modifiers);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@ -4711,14 +4730,26 @@ module ts {
|
||||
Debug.fail("Should not have attempted to parse class member declaration.");
|
||||
}
|
||||
|
||||
function parseClassExpression(): ClassExpression {
|
||||
return <ClassExpression>parseClassDeclarationOrExpression(
|
||||
/*fullStart:*/ scanner.getStartPos(),
|
||||
/*decorators:*/ undefined,
|
||||
/*modifiers:*/ undefined,
|
||||
SyntaxKind.ClassExpression);
|
||||
}
|
||||
|
||||
function parseClassDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ClassDeclaration {
|
||||
return <ClassDeclaration>parseClassDeclarationOrExpression(fullStart, decorators, modifiers, SyntaxKind.ClassDeclaration);
|
||||
}
|
||||
|
||||
function parseClassDeclarationOrExpression(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, kind: SyntaxKind): ClassLikeDeclaration {
|
||||
// In ES6 specification, All parts of a ClassDeclaration or a ClassExpression are strict mode code
|
||||
let savedStrictModeContext = inStrictModeContext();
|
||||
if (languageVersion >= ScriptTarget.ES6) {
|
||||
setStrictModeContext(true);
|
||||
}
|
||||
|
||||
var node = <ClassDeclaration>createNode(SyntaxKind.ClassDeclaration, fullStart);
|
||||
var node = <ClassLikeDeclaration>createNode(kind, fullStart);
|
||||
node.decorators = decorators;
|
||||
setModifiers(node, modifiers);
|
||||
parseExpected(SyntaxKind.ClassKeyword);
|
||||
@ -5327,6 +5358,7 @@ module ts {
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.RegularExpressionLiteral:
|
||||
|
||||
@ -203,6 +203,7 @@ module ts {
|
||||
TemplateExpression,
|
||||
YieldExpression,
|
||||
SpreadElementExpression,
|
||||
ClassExpression,
|
||||
OmittedExpression,
|
||||
// Misc
|
||||
TemplateSpan,
|
||||
@ -855,13 +856,19 @@ module ts {
|
||||
_moduleElementBrand: any;
|
||||
}
|
||||
|
||||
export interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
export interface ClassLikeDeclaration extends Declaration {
|
||||
name?: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
heritageClauses?: NodeArray<HeritageClause>;
|
||||
members: NodeArray<ClassElement>;
|
||||
}
|
||||
|
||||
export interface ClassDeclaration extends ClassLikeDeclaration, Statement {
|
||||
}
|
||||
|
||||
export interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
|
||||
}
|
||||
|
||||
export interface ClassElement extends Declaration {
|
||||
_classElementBrand: any;
|
||||
}
|
||||
|
||||
@ -279,6 +279,7 @@ module ts {
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
@ -670,6 +671,7 @@ module ts {
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.VoidExpression:
|
||||
case SyntaxKind.DeleteExpression:
|
||||
@ -942,7 +944,7 @@ module ts {
|
||||
node.kind === SyntaxKind.ExportAssignment && (<ExportAssignment>node).expression.kind === SyntaxKind.Identifier;
|
||||
}
|
||||
|
||||
export function getClassBaseTypeNode(node: ClassDeclaration) {
|
||||
export function getClassBaseTypeNode(node: ClassLikeDeclaration) {
|
||||
let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword);
|
||||
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
|
||||
}
|
||||
@ -1573,7 +1575,7 @@ module ts {
|
||||
return getLineAndCharacterOfPosition(currentSourceFile, pos).line;
|
||||
}
|
||||
|
||||
export function getFirstConstructorWithBody(node: ClassDeclaration): ConstructorDeclaration {
|
||||
export function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration {
|
||||
return forEach(node.members, member => {
|
||||
if (member.kind === SyntaxKind.Constructor && nodeIsPresent((<ConstructorDeclaration>member).body)) {
|
||||
return <ConstructorDeclaration>member;
|
||||
|
||||
@ -233,60 +233,61 @@ declare module "typescript" {
|
||||
TemplateExpression = 171,
|
||||
YieldExpression = 172,
|
||||
SpreadElementExpression = 173,
|
||||
OmittedExpression = 174,
|
||||
TemplateSpan = 175,
|
||||
HeritageClauseElement = 176,
|
||||
Block = 177,
|
||||
VariableStatement = 178,
|
||||
EmptyStatement = 179,
|
||||
ExpressionStatement = 180,
|
||||
IfStatement = 181,
|
||||
DoStatement = 182,
|
||||
WhileStatement = 183,
|
||||
ForStatement = 184,
|
||||
ForInStatement = 185,
|
||||
ForOfStatement = 186,
|
||||
ContinueStatement = 187,
|
||||
BreakStatement = 188,
|
||||
ReturnStatement = 189,
|
||||
WithStatement = 190,
|
||||
SwitchStatement = 191,
|
||||
LabeledStatement = 192,
|
||||
ThrowStatement = 193,
|
||||
TryStatement = 194,
|
||||
DebuggerStatement = 195,
|
||||
VariableDeclaration = 196,
|
||||
VariableDeclarationList = 197,
|
||||
FunctionDeclaration = 198,
|
||||
ClassDeclaration = 199,
|
||||
InterfaceDeclaration = 200,
|
||||
TypeAliasDeclaration = 201,
|
||||
EnumDeclaration = 202,
|
||||
ModuleDeclaration = 203,
|
||||
ModuleBlock = 204,
|
||||
CaseBlock = 205,
|
||||
ImportEqualsDeclaration = 206,
|
||||
ImportDeclaration = 207,
|
||||
ImportClause = 208,
|
||||
NamespaceImport = 209,
|
||||
NamedImports = 210,
|
||||
ImportSpecifier = 211,
|
||||
ExportAssignment = 212,
|
||||
ExportDeclaration = 213,
|
||||
NamedExports = 214,
|
||||
ExportSpecifier = 215,
|
||||
MissingDeclaration = 216,
|
||||
ExternalModuleReference = 217,
|
||||
CaseClause = 218,
|
||||
DefaultClause = 219,
|
||||
HeritageClause = 220,
|
||||
CatchClause = 221,
|
||||
PropertyAssignment = 222,
|
||||
ShorthandPropertyAssignment = 223,
|
||||
EnumMember = 224,
|
||||
SourceFile = 225,
|
||||
SyntaxList = 226,
|
||||
Count = 227,
|
||||
ClassExpression = 174,
|
||||
OmittedExpression = 175,
|
||||
TemplateSpan = 176,
|
||||
HeritageClauseElement = 177,
|
||||
Block = 178,
|
||||
VariableStatement = 179,
|
||||
EmptyStatement = 180,
|
||||
ExpressionStatement = 181,
|
||||
IfStatement = 182,
|
||||
DoStatement = 183,
|
||||
WhileStatement = 184,
|
||||
ForStatement = 185,
|
||||
ForInStatement = 186,
|
||||
ForOfStatement = 187,
|
||||
ContinueStatement = 188,
|
||||
BreakStatement = 189,
|
||||
ReturnStatement = 190,
|
||||
WithStatement = 191,
|
||||
SwitchStatement = 192,
|
||||
LabeledStatement = 193,
|
||||
ThrowStatement = 194,
|
||||
TryStatement = 195,
|
||||
DebuggerStatement = 196,
|
||||
VariableDeclaration = 197,
|
||||
VariableDeclarationList = 198,
|
||||
FunctionDeclaration = 199,
|
||||
ClassDeclaration = 200,
|
||||
InterfaceDeclaration = 201,
|
||||
TypeAliasDeclaration = 202,
|
||||
EnumDeclaration = 203,
|
||||
ModuleDeclaration = 204,
|
||||
ModuleBlock = 205,
|
||||
CaseBlock = 206,
|
||||
ImportEqualsDeclaration = 207,
|
||||
ImportDeclaration = 208,
|
||||
ImportClause = 209,
|
||||
NamespaceImport = 210,
|
||||
NamedImports = 211,
|
||||
ImportSpecifier = 212,
|
||||
ExportAssignment = 213,
|
||||
ExportDeclaration = 214,
|
||||
NamedExports = 215,
|
||||
ExportSpecifier = 216,
|
||||
MissingDeclaration = 217,
|
||||
ExternalModuleReference = 218,
|
||||
CaseClause = 219,
|
||||
DefaultClause = 220,
|
||||
HeritageClause = 221,
|
||||
CatchClause = 222,
|
||||
PropertyAssignment = 223,
|
||||
ShorthandPropertyAssignment = 224,
|
||||
EnumMember = 225,
|
||||
SourceFile = 226,
|
||||
SyntaxList = 227,
|
||||
Count = 228,
|
||||
FirstAssignment = 53,
|
||||
LastAssignment = 64,
|
||||
FirstReservedWord = 66,
|
||||
@ -706,12 +707,16 @@ declare module "typescript" {
|
||||
interface ModuleElement extends Node {
|
||||
_moduleElementBrand: any;
|
||||
}
|
||||
interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
interface ClassLikeDeclaration extends Declaration {
|
||||
name?: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
heritageClauses?: NodeArray<HeritageClause>;
|
||||
members: NodeArray<ClassElement>;
|
||||
}
|
||||
interface ClassDeclaration extends ClassLikeDeclaration, Statement {
|
||||
}
|
||||
interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
|
||||
}
|
||||
interface ClassElement extends Declaration {
|
||||
_classElementBrand: any;
|
||||
}
|
||||
|
||||
@ -717,166 +717,169 @@ declare module "typescript" {
|
||||
SpreadElementExpression = 173,
|
||||
>SpreadElementExpression : SyntaxKind
|
||||
|
||||
OmittedExpression = 174,
|
||||
ClassExpression = 174,
|
||||
>ClassExpression : SyntaxKind
|
||||
|
||||
OmittedExpression = 175,
|
||||
>OmittedExpression : SyntaxKind
|
||||
|
||||
TemplateSpan = 175,
|
||||
TemplateSpan = 176,
|
||||
>TemplateSpan : SyntaxKind
|
||||
|
||||
HeritageClauseElement = 176,
|
||||
HeritageClauseElement = 177,
|
||||
>HeritageClauseElement : SyntaxKind
|
||||
|
||||
Block = 177,
|
||||
Block = 178,
|
||||
>Block : SyntaxKind
|
||||
|
||||
VariableStatement = 178,
|
||||
VariableStatement = 179,
|
||||
>VariableStatement : SyntaxKind
|
||||
|
||||
EmptyStatement = 179,
|
||||
EmptyStatement = 180,
|
||||
>EmptyStatement : SyntaxKind
|
||||
|
||||
ExpressionStatement = 180,
|
||||
ExpressionStatement = 181,
|
||||
>ExpressionStatement : SyntaxKind
|
||||
|
||||
IfStatement = 181,
|
||||
IfStatement = 182,
|
||||
>IfStatement : SyntaxKind
|
||||
|
||||
DoStatement = 182,
|
||||
DoStatement = 183,
|
||||
>DoStatement : SyntaxKind
|
||||
|
||||
WhileStatement = 183,
|
||||
WhileStatement = 184,
|
||||
>WhileStatement : SyntaxKind
|
||||
|
||||
ForStatement = 184,
|
||||
ForStatement = 185,
|
||||
>ForStatement : SyntaxKind
|
||||
|
||||
ForInStatement = 185,
|
||||
ForInStatement = 186,
|
||||
>ForInStatement : SyntaxKind
|
||||
|
||||
ForOfStatement = 186,
|
||||
ForOfStatement = 187,
|
||||
>ForOfStatement : SyntaxKind
|
||||
|
||||
ContinueStatement = 187,
|
||||
ContinueStatement = 188,
|
||||
>ContinueStatement : SyntaxKind
|
||||
|
||||
BreakStatement = 188,
|
||||
BreakStatement = 189,
|
||||
>BreakStatement : SyntaxKind
|
||||
|
||||
ReturnStatement = 189,
|
||||
ReturnStatement = 190,
|
||||
>ReturnStatement : SyntaxKind
|
||||
|
||||
WithStatement = 190,
|
||||
WithStatement = 191,
|
||||
>WithStatement : SyntaxKind
|
||||
|
||||
SwitchStatement = 191,
|
||||
SwitchStatement = 192,
|
||||
>SwitchStatement : SyntaxKind
|
||||
|
||||
LabeledStatement = 192,
|
||||
LabeledStatement = 193,
|
||||
>LabeledStatement : SyntaxKind
|
||||
|
||||
ThrowStatement = 193,
|
||||
ThrowStatement = 194,
|
||||
>ThrowStatement : SyntaxKind
|
||||
|
||||
TryStatement = 194,
|
||||
TryStatement = 195,
|
||||
>TryStatement : SyntaxKind
|
||||
|
||||
DebuggerStatement = 195,
|
||||
DebuggerStatement = 196,
|
||||
>DebuggerStatement : SyntaxKind
|
||||
|
||||
VariableDeclaration = 196,
|
||||
VariableDeclaration = 197,
|
||||
>VariableDeclaration : SyntaxKind
|
||||
|
||||
VariableDeclarationList = 197,
|
||||
VariableDeclarationList = 198,
|
||||
>VariableDeclarationList : SyntaxKind
|
||||
|
||||
FunctionDeclaration = 198,
|
||||
FunctionDeclaration = 199,
|
||||
>FunctionDeclaration : SyntaxKind
|
||||
|
||||
ClassDeclaration = 199,
|
||||
ClassDeclaration = 200,
|
||||
>ClassDeclaration : SyntaxKind
|
||||
|
||||
InterfaceDeclaration = 200,
|
||||
InterfaceDeclaration = 201,
|
||||
>InterfaceDeclaration : SyntaxKind
|
||||
|
||||
TypeAliasDeclaration = 201,
|
||||
TypeAliasDeclaration = 202,
|
||||
>TypeAliasDeclaration : SyntaxKind
|
||||
|
||||
EnumDeclaration = 202,
|
||||
EnumDeclaration = 203,
|
||||
>EnumDeclaration : SyntaxKind
|
||||
|
||||
ModuleDeclaration = 203,
|
||||
ModuleDeclaration = 204,
|
||||
>ModuleDeclaration : SyntaxKind
|
||||
|
||||
ModuleBlock = 204,
|
||||
ModuleBlock = 205,
|
||||
>ModuleBlock : SyntaxKind
|
||||
|
||||
CaseBlock = 205,
|
||||
CaseBlock = 206,
|
||||
>CaseBlock : SyntaxKind
|
||||
|
||||
ImportEqualsDeclaration = 206,
|
||||
ImportEqualsDeclaration = 207,
|
||||
>ImportEqualsDeclaration : SyntaxKind
|
||||
|
||||
ImportDeclaration = 207,
|
||||
ImportDeclaration = 208,
|
||||
>ImportDeclaration : SyntaxKind
|
||||
|
||||
ImportClause = 208,
|
||||
ImportClause = 209,
|
||||
>ImportClause : SyntaxKind
|
||||
|
||||
NamespaceImport = 209,
|
||||
NamespaceImport = 210,
|
||||
>NamespaceImport : SyntaxKind
|
||||
|
||||
NamedImports = 210,
|
||||
NamedImports = 211,
|
||||
>NamedImports : SyntaxKind
|
||||
|
||||
ImportSpecifier = 211,
|
||||
ImportSpecifier = 212,
|
||||
>ImportSpecifier : SyntaxKind
|
||||
|
||||
ExportAssignment = 212,
|
||||
ExportAssignment = 213,
|
||||
>ExportAssignment : SyntaxKind
|
||||
|
||||
ExportDeclaration = 213,
|
||||
ExportDeclaration = 214,
|
||||
>ExportDeclaration : SyntaxKind
|
||||
|
||||
NamedExports = 214,
|
||||
NamedExports = 215,
|
||||
>NamedExports : SyntaxKind
|
||||
|
||||
ExportSpecifier = 215,
|
||||
ExportSpecifier = 216,
|
||||
>ExportSpecifier : SyntaxKind
|
||||
|
||||
MissingDeclaration = 216,
|
||||
MissingDeclaration = 217,
|
||||
>MissingDeclaration : SyntaxKind
|
||||
|
||||
ExternalModuleReference = 217,
|
||||
ExternalModuleReference = 218,
|
||||
>ExternalModuleReference : SyntaxKind
|
||||
|
||||
CaseClause = 218,
|
||||
CaseClause = 219,
|
||||
>CaseClause : SyntaxKind
|
||||
|
||||
DefaultClause = 219,
|
||||
DefaultClause = 220,
|
||||
>DefaultClause : SyntaxKind
|
||||
|
||||
HeritageClause = 220,
|
||||
HeritageClause = 221,
|
||||
>HeritageClause : SyntaxKind
|
||||
|
||||
CatchClause = 221,
|
||||
CatchClause = 222,
|
||||
>CatchClause : SyntaxKind
|
||||
|
||||
PropertyAssignment = 222,
|
||||
PropertyAssignment = 223,
|
||||
>PropertyAssignment : SyntaxKind
|
||||
|
||||
ShorthandPropertyAssignment = 223,
|
||||
ShorthandPropertyAssignment = 224,
|
||||
>ShorthandPropertyAssignment : SyntaxKind
|
||||
|
||||
EnumMember = 224,
|
||||
EnumMember = 225,
|
||||
>EnumMember : SyntaxKind
|
||||
|
||||
SourceFile = 225,
|
||||
SourceFile = 226,
|
||||
>SourceFile : SyntaxKind
|
||||
|
||||
SyntaxList = 226,
|
||||
SyntaxList = 227,
|
||||
>SyntaxList : SyntaxKind
|
||||
|
||||
Count = 227,
|
||||
Count = 228,
|
||||
>Count : SyntaxKind
|
||||
|
||||
FirstAssignment = 53,
|
||||
@ -2131,10 +2134,9 @@ declare module "typescript" {
|
||||
_moduleElementBrand: any;
|
||||
>_moduleElementBrand : any
|
||||
}
|
||||
interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
>ClassDeclaration : ClassDeclaration
|
||||
interface ClassLikeDeclaration extends Declaration {
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>Declaration : Declaration
|
||||
>ModuleElement : ModuleElement
|
||||
|
||||
name?: Identifier;
|
||||
>name : Identifier
|
||||
@ -2154,6 +2156,16 @@ declare module "typescript" {
|
||||
>members : NodeArray<ClassElement>
|
||||
>NodeArray : NodeArray<T>
|
||||
>ClassElement : ClassElement
|
||||
}
|
||||
interface ClassDeclaration extends ClassLikeDeclaration, Statement {
|
||||
>ClassDeclaration : ClassDeclaration
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>Statement : Statement
|
||||
}
|
||||
interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
|
||||
>ClassExpression : ClassExpression
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>PrimaryExpression : PrimaryExpression
|
||||
}
|
||||
interface ClassElement extends Declaration {
|
||||
>ClassElement : ClassElement
|
||||
|
||||
@ -264,60 +264,61 @@ declare module "typescript" {
|
||||
TemplateExpression = 171,
|
||||
YieldExpression = 172,
|
||||
SpreadElementExpression = 173,
|
||||
OmittedExpression = 174,
|
||||
TemplateSpan = 175,
|
||||
HeritageClauseElement = 176,
|
||||
Block = 177,
|
||||
VariableStatement = 178,
|
||||
EmptyStatement = 179,
|
||||
ExpressionStatement = 180,
|
||||
IfStatement = 181,
|
||||
DoStatement = 182,
|
||||
WhileStatement = 183,
|
||||
ForStatement = 184,
|
||||
ForInStatement = 185,
|
||||
ForOfStatement = 186,
|
||||
ContinueStatement = 187,
|
||||
BreakStatement = 188,
|
||||
ReturnStatement = 189,
|
||||
WithStatement = 190,
|
||||
SwitchStatement = 191,
|
||||
LabeledStatement = 192,
|
||||
ThrowStatement = 193,
|
||||
TryStatement = 194,
|
||||
DebuggerStatement = 195,
|
||||
VariableDeclaration = 196,
|
||||
VariableDeclarationList = 197,
|
||||
FunctionDeclaration = 198,
|
||||
ClassDeclaration = 199,
|
||||
InterfaceDeclaration = 200,
|
||||
TypeAliasDeclaration = 201,
|
||||
EnumDeclaration = 202,
|
||||
ModuleDeclaration = 203,
|
||||
ModuleBlock = 204,
|
||||
CaseBlock = 205,
|
||||
ImportEqualsDeclaration = 206,
|
||||
ImportDeclaration = 207,
|
||||
ImportClause = 208,
|
||||
NamespaceImport = 209,
|
||||
NamedImports = 210,
|
||||
ImportSpecifier = 211,
|
||||
ExportAssignment = 212,
|
||||
ExportDeclaration = 213,
|
||||
NamedExports = 214,
|
||||
ExportSpecifier = 215,
|
||||
MissingDeclaration = 216,
|
||||
ExternalModuleReference = 217,
|
||||
CaseClause = 218,
|
||||
DefaultClause = 219,
|
||||
HeritageClause = 220,
|
||||
CatchClause = 221,
|
||||
PropertyAssignment = 222,
|
||||
ShorthandPropertyAssignment = 223,
|
||||
EnumMember = 224,
|
||||
SourceFile = 225,
|
||||
SyntaxList = 226,
|
||||
Count = 227,
|
||||
ClassExpression = 174,
|
||||
OmittedExpression = 175,
|
||||
TemplateSpan = 176,
|
||||
HeritageClauseElement = 177,
|
||||
Block = 178,
|
||||
VariableStatement = 179,
|
||||
EmptyStatement = 180,
|
||||
ExpressionStatement = 181,
|
||||
IfStatement = 182,
|
||||
DoStatement = 183,
|
||||
WhileStatement = 184,
|
||||
ForStatement = 185,
|
||||
ForInStatement = 186,
|
||||
ForOfStatement = 187,
|
||||
ContinueStatement = 188,
|
||||
BreakStatement = 189,
|
||||
ReturnStatement = 190,
|
||||
WithStatement = 191,
|
||||
SwitchStatement = 192,
|
||||
LabeledStatement = 193,
|
||||
ThrowStatement = 194,
|
||||
TryStatement = 195,
|
||||
DebuggerStatement = 196,
|
||||
VariableDeclaration = 197,
|
||||
VariableDeclarationList = 198,
|
||||
FunctionDeclaration = 199,
|
||||
ClassDeclaration = 200,
|
||||
InterfaceDeclaration = 201,
|
||||
TypeAliasDeclaration = 202,
|
||||
EnumDeclaration = 203,
|
||||
ModuleDeclaration = 204,
|
||||
ModuleBlock = 205,
|
||||
CaseBlock = 206,
|
||||
ImportEqualsDeclaration = 207,
|
||||
ImportDeclaration = 208,
|
||||
ImportClause = 209,
|
||||
NamespaceImport = 210,
|
||||
NamedImports = 211,
|
||||
ImportSpecifier = 212,
|
||||
ExportAssignment = 213,
|
||||
ExportDeclaration = 214,
|
||||
NamedExports = 215,
|
||||
ExportSpecifier = 216,
|
||||
MissingDeclaration = 217,
|
||||
ExternalModuleReference = 218,
|
||||
CaseClause = 219,
|
||||
DefaultClause = 220,
|
||||
HeritageClause = 221,
|
||||
CatchClause = 222,
|
||||
PropertyAssignment = 223,
|
||||
ShorthandPropertyAssignment = 224,
|
||||
EnumMember = 225,
|
||||
SourceFile = 226,
|
||||
SyntaxList = 227,
|
||||
Count = 228,
|
||||
FirstAssignment = 53,
|
||||
LastAssignment = 64,
|
||||
FirstReservedWord = 66,
|
||||
@ -737,12 +738,16 @@ declare module "typescript" {
|
||||
interface ModuleElement extends Node {
|
||||
_moduleElementBrand: any;
|
||||
}
|
||||
interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
interface ClassLikeDeclaration extends Declaration {
|
||||
name?: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
heritageClauses?: NodeArray<HeritageClause>;
|
||||
members: NodeArray<ClassElement>;
|
||||
}
|
||||
interface ClassDeclaration extends ClassLikeDeclaration, Statement {
|
||||
}
|
||||
interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
|
||||
}
|
||||
interface ClassElement extends Declaration {
|
||||
_classElementBrand: any;
|
||||
}
|
||||
@ -2047,21 +2052,21 @@ function delint(sourceFile) {
|
||||
delintNode(sourceFile);
|
||||
function delintNode(node) {
|
||||
switch (node.kind) {
|
||||
case 184 /* ForStatement */:
|
||||
case 185 /* ForInStatement */:
|
||||
case 183 /* WhileStatement */:
|
||||
case 182 /* DoStatement */:
|
||||
if (node.statement.kind !== 177 /* Block */) {
|
||||
case 185 /* ForStatement */:
|
||||
case 186 /* ForInStatement */:
|
||||
case 184 /* WhileStatement */:
|
||||
case 183 /* DoStatement */:
|
||||
if (node.statement.kind !== 178 /* Block */) {
|
||||
report(node, "A looping statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
case 181 /* IfStatement */:
|
||||
case 182 /* IfStatement */:
|
||||
var ifStatement = node;
|
||||
if (ifStatement.thenStatement.kind !== 177 /* Block */) {
|
||||
if (ifStatement.thenStatement.kind !== 178 /* Block */) {
|
||||
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
if (ifStatement.elseStatement &&
|
||||
ifStatement.elseStatement.kind !== 177 /* Block */ && ifStatement.elseStatement.kind !== 181 /* IfStatement */) {
|
||||
ifStatement.elseStatement.kind !== 178 /* Block */ && ifStatement.elseStatement.kind !== 182 /* IfStatement */) {
|
||||
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
|
||||
@ -863,166 +863,169 @@ declare module "typescript" {
|
||||
SpreadElementExpression = 173,
|
||||
>SpreadElementExpression : SyntaxKind
|
||||
|
||||
OmittedExpression = 174,
|
||||
ClassExpression = 174,
|
||||
>ClassExpression : SyntaxKind
|
||||
|
||||
OmittedExpression = 175,
|
||||
>OmittedExpression : SyntaxKind
|
||||
|
||||
TemplateSpan = 175,
|
||||
TemplateSpan = 176,
|
||||
>TemplateSpan : SyntaxKind
|
||||
|
||||
HeritageClauseElement = 176,
|
||||
HeritageClauseElement = 177,
|
||||
>HeritageClauseElement : SyntaxKind
|
||||
|
||||
Block = 177,
|
||||
Block = 178,
|
||||
>Block : SyntaxKind
|
||||
|
||||
VariableStatement = 178,
|
||||
VariableStatement = 179,
|
||||
>VariableStatement : SyntaxKind
|
||||
|
||||
EmptyStatement = 179,
|
||||
EmptyStatement = 180,
|
||||
>EmptyStatement : SyntaxKind
|
||||
|
||||
ExpressionStatement = 180,
|
||||
ExpressionStatement = 181,
|
||||
>ExpressionStatement : SyntaxKind
|
||||
|
||||
IfStatement = 181,
|
||||
IfStatement = 182,
|
||||
>IfStatement : SyntaxKind
|
||||
|
||||
DoStatement = 182,
|
||||
DoStatement = 183,
|
||||
>DoStatement : SyntaxKind
|
||||
|
||||
WhileStatement = 183,
|
||||
WhileStatement = 184,
|
||||
>WhileStatement : SyntaxKind
|
||||
|
||||
ForStatement = 184,
|
||||
ForStatement = 185,
|
||||
>ForStatement : SyntaxKind
|
||||
|
||||
ForInStatement = 185,
|
||||
ForInStatement = 186,
|
||||
>ForInStatement : SyntaxKind
|
||||
|
||||
ForOfStatement = 186,
|
||||
ForOfStatement = 187,
|
||||
>ForOfStatement : SyntaxKind
|
||||
|
||||
ContinueStatement = 187,
|
||||
ContinueStatement = 188,
|
||||
>ContinueStatement : SyntaxKind
|
||||
|
||||
BreakStatement = 188,
|
||||
BreakStatement = 189,
|
||||
>BreakStatement : SyntaxKind
|
||||
|
||||
ReturnStatement = 189,
|
||||
ReturnStatement = 190,
|
||||
>ReturnStatement : SyntaxKind
|
||||
|
||||
WithStatement = 190,
|
||||
WithStatement = 191,
|
||||
>WithStatement : SyntaxKind
|
||||
|
||||
SwitchStatement = 191,
|
||||
SwitchStatement = 192,
|
||||
>SwitchStatement : SyntaxKind
|
||||
|
||||
LabeledStatement = 192,
|
||||
LabeledStatement = 193,
|
||||
>LabeledStatement : SyntaxKind
|
||||
|
||||
ThrowStatement = 193,
|
||||
ThrowStatement = 194,
|
||||
>ThrowStatement : SyntaxKind
|
||||
|
||||
TryStatement = 194,
|
||||
TryStatement = 195,
|
||||
>TryStatement : SyntaxKind
|
||||
|
||||
DebuggerStatement = 195,
|
||||
DebuggerStatement = 196,
|
||||
>DebuggerStatement : SyntaxKind
|
||||
|
||||
VariableDeclaration = 196,
|
||||
VariableDeclaration = 197,
|
||||
>VariableDeclaration : SyntaxKind
|
||||
|
||||
VariableDeclarationList = 197,
|
||||
VariableDeclarationList = 198,
|
||||
>VariableDeclarationList : SyntaxKind
|
||||
|
||||
FunctionDeclaration = 198,
|
||||
FunctionDeclaration = 199,
|
||||
>FunctionDeclaration : SyntaxKind
|
||||
|
||||
ClassDeclaration = 199,
|
||||
ClassDeclaration = 200,
|
||||
>ClassDeclaration : SyntaxKind
|
||||
|
||||
InterfaceDeclaration = 200,
|
||||
InterfaceDeclaration = 201,
|
||||
>InterfaceDeclaration : SyntaxKind
|
||||
|
||||
TypeAliasDeclaration = 201,
|
||||
TypeAliasDeclaration = 202,
|
||||
>TypeAliasDeclaration : SyntaxKind
|
||||
|
||||
EnumDeclaration = 202,
|
||||
EnumDeclaration = 203,
|
||||
>EnumDeclaration : SyntaxKind
|
||||
|
||||
ModuleDeclaration = 203,
|
||||
ModuleDeclaration = 204,
|
||||
>ModuleDeclaration : SyntaxKind
|
||||
|
||||
ModuleBlock = 204,
|
||||
ModuleBlock = 205,
|
||||
>ModuleBlock : SyntaxKind
|
||||
|
||||
CaseBlock = 205,
|
||||
CaseBlock = 206,
|
||||
>CaseBlock : SyntaxKind
|
||||
|
||||
ImportEqualsDeclaration = 206,
|
||||
ImportEqualsDeclaration = 207,
|
||||
>ImportEqualsDeclaration : SyntaxKind
|
||||
|
||||
ImportDeclaration = 207,
|
||||
ImportDeclaration = 208,
|
||||
>ImportDeclaration : SyntaxKind
|
||||
|
||||
ImportClause = 208,
|
||||
ImportClause = 209,
|
||||
>ImportClause : SyntaxKind
|
||||
|
||||
NamespaceImport = 209,
|
||||
NamespaceImport = 210,
|
||||
>NamespaceImport : SyntaxKind
|
||||
|
||||
NamedImports = 210,
|
||||
NamedImports = 211,
|
||||
>NamedImports : SyntaxKind
|
||||
|
||||
ImportSpecifier = 211,
|
||||
ImportSpecifier = 212,
|
||||
>ImportSpecifier : SyntaxKind
|
||||
|
||||
ExportAssignment = 212,
|
||||
ExportAssignment = 213,
|
||||
>ExportAssignment : SyntaxKind
|
||||
|
||||
ExportDeclaration = 213,
|
||||
ExportDeclaration = 214,
|
||||
>ExportDeclaration : SyntaxKind
|
||||
|
||||
NamedExports = 214,
|
||||
NamedExports = 215,
|
||||
>NamedExports : SyntaxKind
|
||||
|
||||
ExportSpecifier = 215,
|
||||
ExportSpecifier = 216,
|
||||
>ExportSpecifier : SyntaxKind
|
||||
|
||||
MissingDeclaration = 216,
|
||||
MissingDeclaration = 217,
|
||||
>MissingDeclaration : SyntaxKind
|
||||
|
||||
ExternalModuleReference = 217,
|
||||
ExternalModuleReference = 218,
|
||||
>ExternalModuleReference : SyntaxKind
|
||||
|
||||
CaseClause = 218,
|
||||
CaseClause = 219,
|
||||
>CaseClause : SyntaxKind
|
||||
|
||||
DefaultClause = 219,
|
||||
DefaultClause = 220,
|
||||
>DefaultClause : SyntaxKind
|
||||
|
||||
HeritageClause = 220,
|
||||
HeritageClause = 221,
|
||||
>HeritageClause : SyntaxKind
|
||||
|
||||
CatchClause = 221,
|
||||
CatchClause = 222,
|
||||
>CatchClause : SyntaxKind
|
||||
|
||||
PropertyAssignment = 222,
|
||||
PropertyAssignment = 223,
|
||||
>PropertyAssignment : SyntaxKind
|
||||
|
||||
ShorthandPropertyAssignment = 223,
|
||||
ShorthandPropertyAssignment = 224,
|
||||
>ShorthandPropertyAssignment : SyntaxKind
|
||||
|
||||
EnumMember = 224,
|
||||
EnumMember = 225,
|
||||
>EnumMember : SyntaxKind
|
||||
|
||||
SourceFile = 225,
|
||||
SourceFile = 226,
|
||||
>SourceFile : SyntaxKind
|
||||
|
||||
SyntaxList = 226,
|
||||
SyntaxList = 227,
|
||||
>SyntaxList : SyntaxKind
|
||||
|
||||
Count = 227,
|
||||
Count = 228,
|
||||
>Count : SyntaxKind
|
||||
|
||||
FirstAssignment = 53,
|
||||
@ -2277,10 +2280,9 @@ declare module "typescript" {
|
||||
_moduleElementBrand: any;
|
||||
>_moduleElementBrand : any
|
||||
}
|
||||
interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
>ClassDeclaration : ClassDeclaration
|
||||
interface ClassLikeDeclaration extends Declaration {
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>Declaration : Declaration
|
||||
>ModuleElement : ModuleElement
|
||||
|
||||
name?: Identifier;
|
||||
>name : Identifier
|
||||
@ -2300,6 +2302,16 @@ declare module "typescript" {
|
||||
>members : NodeArray<ClassElement>
|
||||
>NodeArray : NodeArray<T>
|
||||
>ClassElement : ClassElement
|
||||
}
|
||||
interface ClassDeclaration extends ClassLikeDeclaration, Statement {
|
||||
>ClassDeclaration : ClassDeclaration
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>Statement : Statement
|
||||
}
|
||||
interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
|
||||
>ClassExpression : ClassExpression
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>PrimaryExpression : PrimaryExpression
|
||||
}
|
||||
interface ClassElement extends Declaration {
|
||||
>ClassElement : ClassElement
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -265,60 +265,61 @@ declare module "typescript" {
|
||||
TemplateExpression = 171,
|
||||
YieldExpression = 172,
|
||||
SpreadElementExpression = 173,
|
||||
OmittedExpression = 174,
|
||||
TemplateSpan = 175,
|
||||
HeritageClauseElement = 176,
|
||||
Block = 177,
|
||||
VariableStatement = 178,
|
||||
EmptyStatement = 179,
|
||||
ExpressionStatement = 180,
|
||||
IfStatement = 181,
|
||||
DoStatement = 182,
|
||||
WhileStatement = 183,
|
||||
ForStatement = 184,
|
||||
ForInStatement = 185,
|
||||
ForOfStatement = 186,
|
||||
ContinueStatement = 187,
|
||||
BreakStatement = 188,
|
||||
ReturnStatement = 189,
|
||||
WithStatement = 190,
|
||||
SwitchStatement = 191,
|
||||
LabeledStatement = 192,
|
||||
ThrowStatement = 193,
|
||||
TryStatement = 194,
|
||||
DebuggerStatement = 195,
|
||||
VariableDeclaration = 196,
|
||||
VariableDeclarationList = 197,
|
||||
FunctionDeclaration = 198,
|
||||
ClassDeclaration = 199,
|
||||
InterfaceDeclaration = 200,
|
||||
TypeAliasDeclaration = 201,
|
||||
EnumDeclaration = 202,
|
||||
ModuleDeclaration = 203,
|
||||
ModuleBlock = 204,
|
||||
CaseBlock = 205,
|
||||
ImportEqualsDeclaration = 206,
|
||||
ImportDeclaration = 207,
|
||||
ImportClause = 208,
|
||||
NamespaceImport = 209,
|
||||
NamedImports = 210,
|
||||
ImportSpecifier = 211,
|
||||
ExportAssignment = 212,
|
||||
ExportDeclaration = 213,
|
||||
NamedExports = 214,
|
||||
ExportSpecifier = 215,
|
||||
MissingDeclaration = 216,
|
||||
ExternalModuleReference = 217,
|
||||
CaseClause = 218,
|
||||
DefaultClause = 219,
|
||||
HeritageClause = 220,
|
||||
CatchClause = 221,
|
||||
PropertyAssignment = 222,
|
||||
ShorthandPropertyAssignment = 223,
|
||||
EnumMember = 224,
|
||||
SourceFile = 225,
|
||||
SyntaxList = 226,
|
||||
Count = 227,
|
||||
ClassExpression = 174,
|
||||
OmittedExpression = 175,
|
||||
TemplateSpan = 176,
|
||||
HeritageClauseElement = 177,
|
||||
Block = 178,
|
||||
VariableStatement = 179,
|
||||
EmptyStatement = 180,
|
||||
ExpressionStatement = 181,
|
||||
IfStatement = 182,
|
||||
DoStatement = 183,
|
||||
WhileStatement = 184,
|
||||
ForStatement = 185,
|
||||
ForInStatement = 186,
|
||||
ForOfStatement = 187,
|
||||
ContinueStatement = 188,
|
||||
BreakStatement = 189,
|
||||
ReturnStatement = 190,
|
||||
WithStatement = 191,
|
||||
SwitchStatement = 192,
|
||||
LabeledStatement = 193,
|
||||
ThrowStatement = 194,
|
||||
TryStatement = 195,
|
||||
DebuggerStatement = 196,
|
||||
VariableDeclaration = 197,
|
||||
VariableDeclarationList = 198,
|
||||
FunctionDeclaration = 199,
|
||||
ClassDeclaration = 200,
|
||||
InterfaceDeclaration = 201,
|
||||
TypeAliasDeclaration = 202,
|
||||
EnumDeclaration = 203,
|
||||
ModuleDeclaration = 204,
|
||||
ModuleBlock = 205,
|
||||
CaseBlock = 206,
|
||||
ImportEqualsDeclaration = 207,
|
||||
ImportDeclaration = 208,
|
||||
ImportClause = 209,
|
||||
NamespaceImport = 210,
|
||||
NamedImports = 211,
|
||||
ImportSpecifier = 212,
|
||||
ExportAssignment = 213,
|
||||
ExportDeclaration = 214,
|
||||
NamedExports = 215,
|
||||
ExportSpecifier = 216,
|
||||
MissingDeclaration = 217,
|
||||
ExternalModuleReference = 218,
|
||||
CaseClause = 219,
|
||||
DefaultClause = 220,
|
||||
HeritageClause = 221,
|
||||
CatchClause = 222,
|
||||
PropertyAssignment = 223,
|
||||
ShorthandPropertyAssignment = 224,
|
||||
EnumMember = 225,
|
||||
SourceFile = 226,
|
||||
SyntaxList = 227,
|
||||
Count = 228,
|
||||
FirstAssignment = 53,
|
||||
LastAssignment = 64,
|
||||
FirstReservedWord = 66,
|
||||
@ -738,12 +739,16 @@ declare module "typescript" {
|
||||
interface ModuleElement extends Node {
|
||||
_moduleElementBrand: any;
|
||||
}
|
||||
interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
interface ClassLikeDeclaration extends Declaration {
|
||||
name?: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
heritageClauses?: NodeArray<HeritageClause>;
|
||||
members: NodeArray<ClassElement>;
|
||||
}
|
||||
interface ClassDeclaration extends ClassLikeDeclaration, Statement {
|
||||
}
|
||||
interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
|
||||
}
|
||||
interface ClassElement extends Declaration {
|
||||
_classElementBrand: any;
|
||||
}
|
||||
|
||||
@ -813,166 +813,169 @@ declare module "typescript" {
|
||||
SpreadElementExpression = 173,
|
||||
>SpreadElementExpression : SyntaxKind
|
||||
|
||||
OmittedExpression = 174,
|
||||
ClassExpression = 174,
|
||||
>ClassExpression : SyntaxKind
|
||||
|
||||
OmittedExpression = 175,
|
||||
>OmittedExpression : SyntaxKind
|
||||
|
||||
TemplateSpan = 175,
|
||||
TemplateSpan = 176,
|
||||
>TemplateSpan : SyntaxKind
|
||||
|
||||
HeritageClauseElement = 176,
|
||||
HeritageClauseElement = 177,
|
||||
>HeritageClauseElement : SyntaxKind
|
||||
|
||||
Block = 177,
|
||||
Block = 178,
|
||||
>Block : SyntaxKind
|
||||
|
||||
VariableStatement = 178,
|
||||
VariableStatement = 179,
|
||||
>VariableStatement : SyntaxKind
|
||||
|
||||
EmptyStatement = 179,
|
||||
EmptyStatement = 180,
|
||||
>EmptyStatement : SyntaxKind
|
||||
|
||||
ExpressionStatement = 180,
|
||||
ExpressionStatement = 181,
|
||||
>ExpressionStatement : SyntaxKind
|
||||
|
||||
IfStatement = 181,
|
||||
IfStatement = 182,
|
||||
>IfStatement : SyntaxKind
|
||||
|
||||
DoStatement = 182,
|
||||
DoStatement = 183,
|
||||
>DoStatement : SyntaxKind
|
||||
|
||||
WhileStatement = 183,
|
||||
WhileStatement = 184,
|
||||
>WhileStatement : SyntaxKind
|
||||
|
||||
ForStatement = 184,
|
||||
ForStatement = 185,
|
||||
>ForStatement : SyntaxKind
|
||||
|
||||
ForInStatement = 185,
|
||||
ForInStatement = 186,
|
||||
>ForInStatement : SyntaxKind
|
||||
|
||||
ForOfStatement = 186,
|
||||
ForOfStatement = 187,
|
||||
>ForOfStatement : SyntaxKind
|
||||
|
||||
ContinueStatement = 187,
|
||||
ContinueStatement = 188,
|
||||
>ContinueStatement : SyntaxKind
|
||||
|
||||
BreakStatement = 188,
|
||||
BreakStatement = 189,
|
||||
>BreakStatement : SyntaxKind
|
||||
|
||||
ReturnStatement = 189,
|
||||
ReturnStatement = 190,
|
||||
>ReturnStatement : SyntaxKind
|
||||
|
||||
WithStatement = 190,
|
||||
WithStatement = 191,
|
||||
>WithStatement : SyntaxKind
|
||||
|
||||
SwitchStatement = 191,
|
||||
SwitchStatement = 192,
|
||||
>SwitchStatement : SyntaxKind
|
||||
|
||||
LabeledStatement = 192,
|
||||
LabeledStatement = 193,
|
||||
>LabeledStatement : SyntaxKind
|
||||
|
||||
ThrowStatement = 193,
|
||||
ThrowStatement = 194,
|
||||
>ThrowStatement : SyntaxKind
|
||||
|
||||
TryStatement = 194,
|
||||
TryStatement = 195,
|
||||
>TryStatement : SyntaxKind
|
||||
|
||||
DebuggerStatement = 195,
|
||||
DebuggerStatement = 196,
|
||||
>DebuggerStatement : SyntaxKind
|
||||
|
||||
VariableDeclaration = 196,
|
||||
VariableDeclaration = 197,
|
||||
>VariableDeclaration : SyntaxKind
|
||||
|
||||
VariableDeclarationList = 197,
|
||||
VariableDeclarationList = 198,
|
||||
>VariableDeclarationList : SyntaxKind
|
||||
|
||||
FunctionDeclaration = 198,
|
||||
FunctionDeclaration = 199,
|
||||
>FunctionDeclaration : SyntaxKind
|
||||
|
||||
ClassDeclaration = 199,
|
||||
ClassDeclaration = 200,
|
||||
>ClassDeclaration : SyntaxKind
|
||||
|
||||
InterfaceDeclaration = 200,
|
||||
InterfaceDeclaration = 201,
|
||||
>InterfaceDeclaration : SyntaxKind
|
||||
|
||||
TypeAliasDeclaration = 201,
|
||||
TypeAliasDeclaration = 202,
|
||||
>TypeAliasDeclaration : SyntaxKind
|
||||
|
||||
EnumDeclaration = 202,
|
||||
EnumDeclaration = 203,
|
||||
>EnumDeclaration : SyntaxKind
|
||||
|
||||
ModuleDeclaration = 203,
|
||||
ModuleDeclaration = 204,
|
||||
>ModuleDeclaration : SyntaxKind
|
||||
|
||||
ModuleBlock = 204,
|
||||
ModuleBlock = 205,
|
||||
>ModuleBlock : SyntaxKind
|
||||
|
||||
CaseBlock = 205,
|
||||
CaseBlock = 206,
|
||||
>CaseBlock : SyntaxKind
|
||||
|
||||
ImportEqualsDeclaration = 206,
|
||||
ImportEqualsDeclaration = 207,
|
||||
>ImportEqualsDeclaration : SyntaxKind
|
||||
|
||||
ImportDeclaration = 207,
|
||||
ImportDeclaration = 208,
|
||||
>ImportDeclaration : SyntaxKind
|
||||
|
||||
ImportClause = 208,
|
||||
ImportClause = 209,
|
||||
>ImportClause : SyntaxKind
|
||||
|
||||
NamespaceImport = 209,
|
||||
NamespaceImport = 210,
|
||||
>NamespaceImport : SyntaxKind
|
||||
|
||||
NamedImports = 210,
|
||||
NamedImports = 211,
|
||||
>NamedImports : SyntaxKind
|
||||
|
||||
ImportSpecifier = 211,
|
||||
ImportSpecifier = 212,
|
||||
>ImportSpecifier : SyntaxKind
|
||||
|
||||
ExportAssignment = 212,
|
||||
ExportAssignment = 213,
|
||||
>ExportAssignment : SyntaxKind
|
||||
|
||||
ExportDeclaration = 213,
|
||||
ExportDeclaration = 214,
|
||||
>ExportDeclaration : SyntaxKind
|
||||
|
||||
NamedExports = 214,
|
||||
NamedExports = 215,
|
||||
>NamedExports : SyntaxKind
|
||||
|
||||
ExportSpecifier = 215,
|
||||
ExportSpecifier = 216,
|
||||
>ExportSpecifier : SyntaxKind
|
||||
|
||||
MissingDeclaration = 216,
|
||||
MissingDeclaration = 217,
|
||||
>MissingDeclaration : SyntaxKind
|
||||
|
||||
ExternalModuleReference = 217,
|
||||
ExternalModuleReference = 218,
|
||||
>ExternalModuleReference : SyntaxKind
|
||||
|
||||
CaseClause = 218,
|
||||
CaseClause = 219,
|
||||
>CaseClause : SyntaxKind
|
||||
|
||||
DefaultClause = 219,
|
||||
DefaultClause = 220,
|
||||
>DefaultClause : SyntaxKind
|
||||
|
||||
HeritageClause = 220,
|
||||
HeritageClause = 221,
|
||||
>HeritageClause : SyntaxKind
|
||||
|
||||
CatchClause = 221,
|
||||
CatchClause = 222,
|
||||
>CatchClause : SyntaxKind
|
||||
|
||||
PropertyAssignment = 222,
|
||||
PropertyAssignment = 223,
|
||||
>PropertyAssignment : SyntaxKind
|
||||
|
||||
ShorthandPropertyAssignment = 223,
|
||||
ShorthandPropertyAssignment = 224,
|
||||
>ShorthandPropertyAssignment : SyntaxKind
|
||||
|
||||
EnumMember = 224,
|
||||
EnumMember = 225,
|
||||
>EnumMember : SyntaxKind
|
||||
|
||||
SourceFile = 225,
|
||||
SourceFile = 226,
|
||||
>SourceFile : SyntaxKind
|
||||
|
||||
SyntaxList = 226,
|
||||
SyntaxList = 227,
|
||||
>SyntaxList : SyntaxKind
|
||||
|
||||
Count = 227,
|
||||
Count = 228,
|
||||
>Count : SyntaxKind
|
||||
|
||||
FirstAssignment = 53,
|
||||
@ -2227,10 +2230,9 @@ declare module "typescript" {
|
||||
_moduleElementBrand: any;
|
||||
>_moduleElementBrand : any
|
||||
}
|
||||
interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
>ClassDeclaration : ClassDeclaration
|
||||
interface ClassLikeDeclaration extends Declaration {
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>Declaration : Declaration
|
||||
>ModuleElement : ModuleElement
|
||||
|
||||
name?: Identifier;
|
||||
>name : Identifier
|
||||
@ -2250,6 +2252,16 @@ declare module "typescript" {
|
||||
>members : NodeArray<ClassElement>
|
||||
>NodeArray : NodeArray<T>
|
||||
>ClassElement : ClassElement
|
||||
}
|
||||
interface ClassDeclaration extends ClassLikeDeclaration, Statement {
|
||||
>ClassDeclaration : ClassDeclaration
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>Statement : Statement
|
||||
}
|
||||
interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
|
||||
>ClassExpression : ClassExpression
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>PrimaryExpression : PrimaryExpression
|
||||
}
|
||||
interface ClassElement extends Declaration {
|
||||
>ClassElement : ClassElement
|
||||
|
||||
@ -302,60 +302,61 @@ declare module "typescript" {
|
||||
TemplateExpression = 171,
|
||||
YieldExpression = 172,
|
||||
SpreadElementExpression = 173,
|
||||
OmittedExpression = 174,
|
||||
TemplateSpan = 175,
|
||||
HeritageClauseElement = 176,
|
||||
Block = 177,
|
||||
VariableStatement = 178,
|
||||
EmptyStatement = 179,
|
||||
ExpressionStatement = 180,
|
||||
IfStatement = 181,
|
||||
DoStatement = 182,
|
||||
WhileStatement = 183,
|
||||
ForStatement = 184,
|
||||
ForInStatement = 185,
|
||||
ForOfStatement = 186,
|
||||
ContinueStatement = 187,
|
||||
BreakStatement = 188,
|
||||
ReturnStatement = 189,
|
||||
WithStatement = 190,
|
||||
SwitchStatement = 191,
|
||||
LabeledStatement = 192,
|
||||
ThrowStatement = 193,
|
||||
TryStatement = 194,
|
||||
DebuggerStatement = 195,
|
||||
VariableDeclaration = 196,
|
||||
VariableDeclarationList = 197,
|
||||
FunctionDeclaration = 198,
|
||||
ClassDeclaration = 199,
|
||||
InterfaceDeclaration = 200,
|
||||
TypeAliasDeclaration = 201,
|
||||
EnumDeclaration = 202,
|
||||
ModuleDeclaration = 203,
|
||||
ModuleBlock = 204,
|
||||
CaseBlock = 205,
|
||||
ImportEqualsDeclaration = 206,
|
||||
ImportDeclaration = 207,
|
||||
ImportClause = 208,
|
||||
NamespaceImport = 209,
|
||||
NamedImports = 210,
|
||||
ImportSpecifier = 211,
|
||||
ExportAssignment = 212,
|
||||
ExportDeclaration = 213,
|
||||
NamedExports = 214,
|
||||
ExportSpecifier = 215,
|
||||
MissingDeclaration = 216,
|
||||
ExternalModuleReference = 217,
|
||||
CaseClause = 218,
|
||||
DefaultClause = 219,
|
||||
HeritageClause = 220,
|
||||
CatchClause = 221,
|
||||
PropertyAssignment = 222,
|
||||
ShorthandPropertyAssignment = 223,
|
||||
EnumMember = 224,
|
||||
SourceFile = 225,
|
||||
SyntaxList = 226,
|
||||
Count = 227,
|
||||
ClassExpression = 174,
|
||||
OmittedExpression = 175,
|
||||
TemplateSpan = 176,
|
||||
HeritageClauseElement = 177,
|
||||
Block = 178,
|
||||
VariableStatement = 179,
|
||||
EmptyStatement = 180,
|
||||
ExpressionStatement = 181,
|
||||
IfStatement = 182,
|
||||
DoStatement = 183,
|
||||
WhileStatement = 184,
|
||||
ForStatement = 185,
|
||||
ForInStatement = 186,
|
||||
ForOfStatement = 187,
|
||||
ContinueStatement = 188,
|
||||
BreakStatement = 189,
|
||||
ReturnStatement = 190,
|
||||
WithStatement = 191,
|
||||
SwitchStatement = 192,
|
||||
LabeledStatement = 193,
|
||||
ThrowStatement = 194,
|
||||
TryStatement = 195,
|
||||
DebuggerStatement = 196,
|
||||
VariableDeclaration = 197,
|
||||
VariableDeclarationList = 198,
|
||||
FunctionDeclaration = 199,
|
||||
ClassDeclaration = 200,
|
||||
InterfaceDeclaration = 201,
|
||||
TypeAliasDeclaration = 202,
|
||||
EnumDeclaration = 203,
|
||||
ModuleDeclaration = 204,
|
||||
ModuleBlock = 205,
|
||||
CaseBlock = 206,
|
||||
ImportEqualsDeclaration = 207,
|
||||
ImportDeclaration = 208,
|
||||
ImportClause = 209,
|
||||
NamespaceImport = 210,
|
||||
NamedImports = 211,
|
||||
ImportSpecifier = 212,
|
||||
ExportAssignment = 213,
|
||||
ExportDeclaration = 214,
|
||||
NamedExports = 215,
|
||||
ExportSpecifier = 216,
|
||||
MissingDeclaration = 217,
|
||||
ExternalModuleReference = 218,
|
||||
CaseClause = 219,
|
||||
DefaultClause = 220,
|
||||
HeritageClause = 221,
|
||||
CatchClause = 222,
|
||||
PropertyAssignment = 223,
|
||||
ShorthandPropertyAssignment = 224,
|
||||
EnumMember = 225,
|
||||
SourceFile = 226,
|
||||
SyntaxList = 227,
|
||||
Count = 228,
|
||||
FirstAssignment = 53,
|
||||
LastAssignment = 64,
|
||||
FirstReservedWord = 66,
|
||||
@ -775,12 +776,16 @@ declare module "typescript" {
|
||||
interface ModuleElement extends Node {
|
||||
_moduleElementBrand: any;
|
||||
}
|
||||
interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
interface ClassLikeDeclaration extends Declaration {
|
||||
name?: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
heritageClauses?: NodeArray<HeritageClause>;
|
||||
members: NodeArray<ClassElement>;
|
||||
}
|
||||
interface ClassDeclaration extends ClassLikeDeclaration, Statement {
|
||||
}
|
||||
interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
|
||||
}
|
||||
interface ClassElement extends Declaration {
|
||||
_classElementBrand: any;
|
||||
}
|
||||
|
||||
@ -986,166 +986,169 @@ declare module "typescript" {
|
||||
SpreadElementExpression = 173,
|
||||
>SpreadElementExpression : SyntaxKind
|
||||
|
||||
OmittedExpression = 174,
|
||||
ClassExpression = 174,
|
||||
>ClassExpression : SyntaxKind
|
||||
|
||||
OmittedExpression = 175,
|
||||
>OmittedExpression : SyntaxKind
|
||||
|
||||
TemplateSpan = 175,
|
||||
TemplateSpan = 176,
|
||||
>TemplateSpan : SyntaxKind
|
||||
|
||||
HeritageClauseElement = 176,
|
||||
HeritageClauseElement = 177,
|
||||
>HeritageClauseElement : SyntaxKind
|
||||
|
||||
Block = 177,
|
||||
Block = 178,
|
||||
>Block : SyntaxKind
|
||||
|
||||
VariableStatement = 178,
|
||||
VariableStatement = 179,
|
||||
>VariableStatement : SyntaxKind
|
||||
|
||||
EmptyStatement = 179,
|
||||
EmptyStatement = 180,
|
||||
>EmptyStatement : SyntaxKind
|
||||
|
||||
ExpressionStatement = 180,
|
||||
ExpressionStatement = 181,
|
||||
>ExpressionStatement : SyntaxKind
|
||||
|
||||
IfStatement = 181,
|
||||
IfStatement = 182,
|
||||
>IfStatement : SyntaxKind
|
||||
|
||||
DoStatement = 182,
|
||||
DoStatement = 183,
|
||||
>DoStatement : SyntaxKind
|
||||
|
||||
WhileStatement = 183,
|
||||
WhileStatement = 184,
|
||||
>WhileStatement : SyntaxKind
|
||||
|
||||
ForStatement = 184,
|
||||
ForStatement = 185,
|
||||
>ForStatement : SyntaxKind
|
||||
|
||||
ForInStatement = 185,
|
||||
ForInStatement = 186,
|
||||
>ForInStatement : SyntaxKind
|
||||
|
||||
ForOfStatement = 186,
|
||||
ForOfStatement = 187,
|
||||
>ForOfStatement : SyntaxKind
|
||||
|
||||
ContinueStatement = 187,
|
||||
ContinueStatement = 188,
|
||||
>ContinueStatement : SyntaxKind
|
||||
|
||||
BreakStatement = 188,
|
||||
BreakStatement = 189,
|
||||
>BreakStatement : SyntaxKind
|
||||
|
||||
ReturnStatement = 189,
|
||||
ReturnStatement = 190,
|
||||
>ReturnStatement : SyntaxKind
|
||||
|
||||
WithStatement = 190,
|
||||
WithStatement = 191,
|
||||
>WithStatement : SyntaxKind
|
||||
|
||||
SwitchStatement = 191,
|
||||
SwitchStatement = 192,
|
||||
>SwitchStatement : SyntaxKind
|
||||
|
||||
LabeledStatement = 192,
|
||||
LabeledStatement = 193,
|
||||
>LabeledStatement : SyntaxKind
|
||||
|
||||
ThrowStatement = 193,
|
||||
ThrowStatement = 194,
|
||||
>ThrowStatement : SyntaxKind
|
||||
|
||||
TryStatement = 194,
|
||||
TryStatement = 195,
|
||||
>TryStatement : SyntaxKind
|
||||
|
||||
DebuggerStatement = 195,
|
||||
DebuggerStatement = 196,
|
||||
>DebuggerStatement : SyntaxKind
|
||||
|
||||
VariableDeclaration = 196,
|
||||
VariableDeclaration = 197,
|
||||
>VariableDeclaration : SyntaxKind
|
||||
|
||||
VariableDeclarationList = 197,
|
||||
VariableDeclarationList = 198,
|
||||
>VariableDeclarationList : SyntaxKind
|
||||
|
||||
FunctionDeclaration = 198,
|
||||
FunctionDeclaration = 199,
|
||||
>FunctionDeclaration : SyntaxKind
|
||||
|
||||
ClassDeclaration = 199,
|
||||
ClassDeclaration = 200,
|
||||
>ClassDeclaration : SyntaxKind
|
||||
|
||||
InterfaceDeclaration = 200,
|
||||
InterfaceDeclaration = 201,
|
||||
>InterfaceDeclaration : SyntaxKind
|
||||
|
||||
TypeAliasDeclaration = 201,
|
||||
TypeAliasDeclaration = 202,
|
||||
>TypeAliasDeclaration : SyntaxKind
|
||||
|
||||
EnumDeclaration = 202,
|
||||
EnumDeclaration = 203,
|
||||
>EnumDeclaration : SyntaxKind
|
||||
|
||||
ModuleDeclaration = 203,
|
||||
ModuleDeclaration = 204,
|
||||
>ModuleDeclaration : SyntaxKind
|
||||
|
||||
ModuleBlock = 204,
|
||||
ModuleBlock = 205,
|
||||
>ModuleBlock : SyntaxKind
|
||||
|
||||
CaseBlock = 205,
|
||||
CaseBlock = 206,
|
||||
>CaseBlock : SyntaxKind
|
||||
|
||||
ImportEqualsDeclaration = 206,
|
||||
ImportEqualsDeclaration = 207,
|
||||
>ImportEqualsDeclaration : SyntaxKind
|
||||
|
||||
ImportDeclaration = 207,
|
||||
ImportDeclaration = 208,
|
||||
>ImportDeclaration : SyntaxKind
|
||||
|
||||
ImportClause = 208,
|
||||
ImportClause = 209,
|
||||
>ImportClause : SyntaxKind
|
||||
|
||||
NamespaceImport = 209,
|
||||
NamespaceImport = 210,
|
||||
>NamespaceImport : SyntaxKind
|
||||
|
||||
NamedImports = 210,
|
||||
NamedImports = 211,
|
||||
>NamedImports : SyntaxKind
|
||||
|
||||
ImportSpecifier = 211,
|
||||
ImportSpecifier = 212,
|
||||
>ImportSpecifier : SyntaxKind
|
||||
|
||||
ExportAssignment = 212,
|
||||
ExportAssignment = 213,
|
||||
>ExportAssignment : SyntaxKind
|
||||
|
||||
ExportDeclaration = 213,
|
||||
ExportDeclaration = 214,
|
||||
>ExportDeclaration : SyntaxKind
|
||||
|
||||
NamedExports = 214,
|
||||
NamedExports = 215,
|
||||
>NamedExports : SyntaxKind
|
||||
|
||||
ExportSpecifier = 215,
|
||||
ExportSpecifier = 216,
|
||||
>ExportSpecifier : SyntaxKind
|
||||
|
||||
MissingDeclaration = 216,
|
||||
MissingDeclaration = 217,
|
||||
>MissingDeclaration : SyntaxKind
|
||||
|
||||
ExternalModuleReference = 217,
|
||||
ExternalModuleReference = 218,
|
||||
>ExternalModuleReference : SyntaxKind
|
||||
|
||||
CaseClause = 218,
|
||||
CaseClause = 219,
|
||||
>CaseClause : SyntaxKind
|
||||
|
||||
DefaultClause = 219,
|
||||
DefaultClause = 220,
|
||||
>DefaultClause : SyntaxKind
|
||||
|
||||
HeritageClause = 220,
|
||||
HeritageClause = 221,
|
||||
>HeritageClause : SyntaxKind
|
||||
|
||||
CatchClause = 221,
|
||||
CatchClause = 222,
|
||||
>CatchClause : SyntaxKind
|
||||
|
||||
PropertyAssignment = 222,
|
||||
PropertyAssignment = 223,
|
||||
>PropertyAssignment : SyntaxKind
|
||||
|
||||
ShorthandPropertyAssignment = 223,
|
||||
ShorthandPropertyAssignment = 224,
|
||||
>ShorthandPropertyAssignment : SyntaxKind
|
||||
|
||||
EnumMember = 224,
|
||||
EnumMember = 225,
|
||||
>EnumMember : SyntaxKind
|
||||
|
||||
SourceFile = 225,
|
||||
SourceFile = 226,
|
||||
>SourceFile : SyntaxKind
|
||||
|
||||
SyntaxList = 226,
|
||||
SyntaxList = 227,
|
||||
>SyntaxList : SyntaxKind
|
||||
|
||||
Count = 227,
|
||||
Count = 228,
|
||||
>Count : SyntaxKind
|
||||
|
||||
FirstAssignment = 53,
|
||||
@ -2400,10 +2403,9 @@ declare module "typescript" {
|
||||
_moduleElementBrand: any;
|
||||
>_moduleElementBrand : any
|
||||
}
|
||||
interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
>ClassDeclaration : ClassDeclaration
|
||||
interface ClassLikeDeclaration extends Declaration {
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>Declaration : Declaration
|
||||
>ModuleElement : ModuleElement
|
||||
|
||||
name?: Identifier;
|
||||
>name : Identifier
|
||||
@ -2423,6 +2425,16 @@ declare module "typescript" {
|
||||
>members : NodeArray<ClassElement>
|
||||
>NodeArray : NodeArray<T>
|
||||
>ClassElement : ClassElement
|
||||
}
|
||||
interface ClassDeclaration extends ClassLikeDeclaration, Statement {
|
||||
>ClassDeclaration : ClassDeclaration
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>Statement : Statement
|
||||
}
|
||||
interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
|
||||
>ClassExpression : ClassExpression
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>PrimaryExpression : PrimaryExpression
|
||||
}
|
||||
interface ClassElement extends Declaration {
|
||||
>ClassElement : ClassElement
|
||||
|
||||
@ -1,36 +1,24 @@
|
||||
tests/cases/conformance/classes/classExpression.ts(1,9): error TS1109: Expression expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(5,10): error TS1109: Expression expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(5,16): error TS1005: ':' expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(5,16): error TS2304: Cannot find name 'C2'.
|
||||
tests/cases/conformance/classes/classExpression.ts(5,19): error TS1005: ',' expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(7,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(10,13): error TS1109: Expression expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(1,15): error TS9003: 'class' expressions are not currently supported.
|
||||
tests/cases/conformance/classes/classExpression.ts(5,16): error TS9003: 'class' expressions are not currently supported.
|
||||
tests/cases/conformance/classes/classExpression.ts(10,19): error TS9003: 'class' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classExpression.ts (7 errors) ====
|
||||
==== tests/cases/conformance/classes/classExpression.ts (3 errors) ====
|
||||
var x = class C {
|
||||
~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
~
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
}
|
||||
|
||||
var y = {
|
||||
foo: class C2 {
|
||||
~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS1005: ':' expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'C2'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
}
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
|
||||
module M {
|
||||
var z = class C4 {
|
||||
~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
}
|
||||
}
|
||||
@ -13,18 +13,21 @@ module M {
|
||||
}
|
||||
|
||||
//// [classExpression.js]
|
||||
var x = ;
|
||||
var C = (function () {
|
||||
var x = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
var y = {
|
||||
foo: , class: C2 }, _a = void 0;
|
||||
foo: (function () {
|
||||
function C2() {
|
||||
}
|
||||
return C2;
|
||||
})()
|
||||
};
|
||||
var M;
|
||||
(function (M) {
|
||||
var z = ;
|
||||
var C4 = (function () {
|
||||
var z = (function () {
|
||||
function C4() {
|
||||
}
|
||||
return C4;
|
||||
|
||||
7
tests/baselines/reference/classExpression1.errors.txt
Normal file
7
tests/baselines/reference/classExpression1.errors.txt
Normal file
@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/classes/classExpressions/classExpression1.ts(1,15): error TS9003: 'class' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classExpressions/classExpression1.ts (1 errors) ====
|
||||
var v = class C {};
|
||||
~
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
9
tests/baselines/reference/classExpression1.js
Normal file
9
tests/baselines/reference/classExpression1.js
Normal file
@ -0,0 +1,9 @@
|
||||
//// [classExpression1.ts]
|
||||
var v = class C {};
|
||||
|
||||
//// [classExpression1.js]
|
||||
var v = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
8
tests/baselines/reference/classExpression2.errors.txt
Normal file
8
tests/baselines/reference/classExpression2.errors.txt
Normal file
@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/classes/classExpressions/classExpression2.ts(2,15): error TS9003: 'class' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classExpressions/classExpression2.ts (1 errors) ====
|
||||
class D { }
|
||||
var v = class C extends D {};
|
||||
~
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
17
tests/baselines/reference/classExpression2.js
Normal file
17
tests/baselines/reference/classExpression2.js
Normal file
@ -0,0 +1,17 @@
|
||||
//// [classExpression2.ts]
|
||||
class D { }
|
||||
var v = class C extends D {};
|
||||
|
||||
//// [classExpression2.js]
|
||||
var D = (function () {
|
||||
function D() {
|
||||
}
|
||||
return D;
|
||||
})();
|
||||
var v = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C;
|
||||
})(D);
|
||||
7
tests/baselines/reference/classExpressionES61.errors.txt
Normal file
7
tests/baselines/reference/classExpressionES61.errors.txt
Normal file
@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/classExpressions/classExpressionES61.ts(1,15): error TS9003: 'class' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/classExpressions/classExpressionES61.ts (1 errors) ====
|
||||
var v = class C {};
|
||||
~
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
7
tests/baselines/reference/classExpressionES61.js
Normal file
7
tests/baselines/reference/classExpressionES61.js
Normal file
@ -0,0 +1,7 @@
|
||||
//// [classExpressionES61.ts]
|
||||
var v = class C {};
|
||||
|
||||
//// [classExpressionES61.js]
|
||||
var v = class C {
|
||||
}
|
||||
;
|
||||
8
tests/baselines/reference/classExpressionES62.errors.txt
Normal file
8
tests/baselines/reference/classExpressionES62.errors.txt
Normal file
@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/es6/classExpressions/classExpressionES62.ts(2,15): error TS9003: 'class' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/classExpressions/classExpressionES62.ts (1 errors) ====
|
||||
class D { }
|
||||
var v = class C extends D {};
|
||||
~
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
10
tests/baselines/reference/classExpressionES62.js
Normal file
10
tests/baselines/reference/classExpressionES62.js
Normal file
@ -0,0 +1,10 @@
|
||||
//// [classExpressionES62.ts]
|
||||
class D { }
|
||||
var v = class C extends D {};
|
||||
|
||||
//// [classExpressionES62.js]
|
||||
class D {
|
||||
}
|
||||
var v = class C extends D {
|
||||
}
|
||||
;
|
||||
9
tests/baselines/reference/classInsideBlock.errors.txt
Normal file
9
tests/baselines/reference/classInsideBlock.errors.txt
Normal file
@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts (1 errors) ====
|
||||
function foo() {
|
||||
class C { }
|
||||
~
|
||||
!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
|
||||
}
|
||||
13
tests/baselines/reference/classInsideBlock.js
Normal file
13
tests/baselines/reference/classInsideBlock.js
Normal file
@ -0,0 +1,13 @@
|
||||
//// [classInsideBlock.ts]
|
||||
function foo() {
|
||||
class C { }
|
||||
}
|
||||
|
||||
//// [classInsideBlock.js]
|
||||
function foo() {
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/externalModules/foo1.ts(2,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
tests/cases/conformance/externalModules/foo3.ts(1,10): error TS1109: Expression expected.
|
||||
tests/cases/conformance/externalModules/foo3.ts(1,16): error TS9003: 'class' expressions are not currently supported.
|
||||
tests/cases/conformance/externalModules/foo6.ts(1,14): error TS1109: Expression expected.
|
||||
|
||||
|
||||
@ -14,8 +14,8 @@ tests/cases/conformance/externalModules/foo6.ts(1,14): error TS1109: Expression
|
||||
|
||||
==== tests/cases/conformance/externalModules/foo3.ts (1 errors) ====
|
||||
export = class Foo3 {}; // Error, not an expression
|
||||
~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
|
||||
==== tests/cases/conformance/externalModules/foo4.ts (0 errors) ====
|
||||
export = true; // Ok
|
||||
|
||||
@ -33,12 +33,11 @@ module.exports = typeof x;
|
||||
//// [foo2.js]
|
||||
module.exports = "sausages";
|
||||
//// [foo3.js]
|
||||
var Foo3 = (function () {
|
||||
module.exports = (function () {
|
||||
function Foo3() {
|
||||
}
|
||||
return Foo3;
|
||||
})();
|
||||
; // Error, not an expression
|
||||
//// [foo4.js]
|
||||
module.exports = true;
|
||||
//// [foo5.js]
|
||||
|
||||
@ -2,18 +2,15 @@ tests/cases/compiler/externModule.ts(1,1): error TS2304: Cannot find name 'decla
|
||||
tests/cases/compiler/externModule.ts(1,9): error TS1005: ';' expected.
|
||||
tests/cases/compiler/externModule.ts(1,9): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/externModule.ts(1,16): error TS1005: ';' expected.
|
||||
tests/cases/compiler/externModule.ts(2,5): error TS1129: Statement expected.
|
||||
tests/cases/compiler/externModule.ts(2,18): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
tests/cases/compiler/externModule.ts(3,10): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/externModule.ts(4,10): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/externModule.ts(18,6): error TS2390: Constructor implementation is missing.
|
||||
tests/cases/compiler/externModule.ts(20,13): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/externModule.ts(26,13): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/externModule.ts(28,13): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/externModule.ts(30,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/externModule.ts (13 errors) ====
|
||||
==== tests/cases/compiler/externModule.ts (10 errors) ====
|
||||
declare module {
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'declare'.
|
||||
@ -24,10 +21,6 @@ tests/cases/compiler/externModule.ts(30,1): error TS1128: Declaration or stateme
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
export class XDate {
|
||||
~~~~~~
|
||||
!!! error TS1129: Statement expected.
|
||||
~~~~~
|
||||
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
public getDay():number;
|
||||
~~~~~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
@ -68,8 +61,6 @@ tests/cases/compiler/externModule.ts(30,1): error TS1128: Declaration or stateme
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
|
||||
var d=new XDate();
|
||||
d.getDay();
|
||||
|
||||
@ -42,13 +42,14 @@ n=XDate.UTC(1964,2,1);
|
||||
//// [externModule.js]
|
||||
declare;
|
||||
module;
|
||||
{ }
|
||||
var XDate = (function () {
|
||||
function XDate() {
|
||||
}
|
||||
return XDate;
|
||||
})();
|
||||
exports.XDate = XDate;
|
||||
{
|
||||
var XDate = (function () {
|
||||
function XDate() {
|
||||
}
|
||||
return XDate;
|
||||
})();
|
||||
exports.XDate = XDate;
|
||||
}
|
||||
var d = new XDate();
|
||||
d.getDay();
|
||||
d = new XDate(1978, 2);
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
tests/cases/conformance/classes/nestedClassDeclaration.ts(5,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/conformance/classes/nestedClassDeclaration.ts(7,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/classes/nestedClassDeclaration.ts(10,5): error TS1129: Statement expected.
|
||||
tests/cases/conformance/classes/nestedClassDeclaration.ts(12,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/classes/nestedClassDeclaration.ts(15,11): error TS1005: ':' expected.
|
||||
tests/cases/conformance/classes/nestedClassDeclaration.ts(15,11): error TS2304: Cannot find name 'C4'.
|
||||
tests/cases/conformance/classes/nestedClassDeclaration.ts(15,14): error TS1005: ',' expected.
|
||||
tests/cases/conformance/classes/nestedClassDeclaration.ts(17,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/nestedClassDeclaration.ts (8 errors) ====
|
||||
==== tests/cases/conformance/classes/nestedClassDeclaration.ts (6 errors) ====
|
||||
// nested classes are not allowed
|
||||
|
||||
class C {
|
||||
@ -23,12 +21,8 @@ tests/cases/conformance/classes/nestedClassDeclaration.ts(17,1): error TS1128: D
|
||||
|
||||
function foo() {
|
||||
class C3 {
|
||||
~~~~~
|
||||
!!! error TS1129: Statement expected.
|
||||
}
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
|
||||
var x = {
|
||||
class C4 {
|
||||
|
||||
@ -30,11 +30,12 @@ var C2 = (function () {
|
||||
}
|
||||
return C2;
|
||||
})();
|
||||
function foo() { }
|
||||
var C3 = (function () {
|
||||
function C3() {
|
||||
}
|
||||
return C3;
|
||||
})();
|
||||
function foo() {
|
||||
var C3 = (function () {
|
||||
function C3() {
|
||||
}
|
||||
return C3;
|
||||
})();
|
||||
}
|
||||
var x = {
|
||||
class: C4 }, _a = void 0;
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parserErrorRecovery_SwitchStatement2.ts(3,13): error TS2304: Cannot find name 'e'.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parserErrorRecovery_SwitchStatement2.ts(5,1): error TS1130: 'case' or 'default' expected.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parserErrorRecovery_SwitchStatement2.ts(6,2): error TS1005: '}' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parserErrorRecovery_SwitchStatement2.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parserErrorRecovery_SwitchStatement2.ts (3 errors) ====
|
||||
class C {
|
||||
constructor() {
|
||||
switch (e) {
|
||||
@ -12,4 +13,6 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parser
|
||||
class D {
|
||||
~~~~~
|
||||
!!! error TS1130: 'case' or 'default' expected.
|
||||
}
|
||||
}
|
||||
|
||||
!!! error TS1005: '}' expected.
|
||||
@ -11,11 +11,11 @@ var C = (function () {
|
||||
function C() {
|
||||
switch (e) {
|
||||
}
|
||||
var D = (function () {
|
||||
function D() {
|
||||
}
|
||||
return D;
|
||||
})();
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
var D = (function () {
|
||||
function D() {
|
||||
}
|
||||
return D;
|
||||
})();
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInvalidIdentifiersInVariableStatements1.ts(1,5): error TS1134: Variable declaration expected.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInvalidIdentifiersInVariableStatements1.ts(3,5): error TS1134: Variable declaration expected.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInvalidIdentifiersInVariableStatements1.ts(3,10): error TS1003: Identifier expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInvalidIdentifiersInVariableStatements1.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInvalidIdentifiersInVariableStatements1.ts (3 errors) ====
|
||||
var export;
|
||||
~~~~~~
|
||||
!!! error TS1134: Variable declaration expected.
|
||||
@ -10,5 +11,7 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/VariableLists/parserInv
|
||||
var class;
|
||||
~~~~~
|
||||
!!! error TS1134: Variable declaration expected.
|
||||
~
|
||||
!!! error TS1003: Identifier expected.
|
||||
var bar;
|
||||
|
||||
@ -9,4 +9,10 @@ var bar;
|
||||
var ;
|
||||
var foo;
|
||||
var ;
|
||||
var = (function () {
|
||||
function () {
|
||||
}
|
||||
return ;
|
||||
})();
|
||||
;
|
||||
var bar;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/withStatementErrors.ts(3,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'.
|
||||
tests/cases/compiler/withStatementErrors.ts(11,5): error TS1129: Statement expected.
|
||||
tests/cases/compiler/withStatementErrors.ts(13,5): error TS1129: Statement expected.
|
||||
tests/cases/compiler/withStatementErrors.ts(17,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
@ -17,10 +17,10 @@ tests/cases/compiler/withStatementErrors.ts(17,1): error TS1128: Declaration or
|
||||
bar(); // no error
|
||||
|
||||
class C {} // error
|
||||
~~~~~
|
||||
!!! error TS1129: Statement expected.
|
||||
|
||||
interface I {} // error
|
||||
~~~~~~~~~
|
||||
!!! error TS1129: Statement expected.
|
||||
|
||||
module M {} // error
|
||||
|
||||
|
||||
@ -23,10 +23,10 @@ with (ooo.eee.oo.ah_ah.ting.tang.walla.walla) {
|
||||
bing = true; // no error
|
||||
bang = true; // no error
|
||||
function bar() { } // no error
|
||||
bar();
|
||||
} // no error
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})(); // error
|
||||
bar(); // no error
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
} // error
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
function foo() {
|
||||
class C { }
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
var v = class C {};
|
||||
@ -0,0 +1,2 @@
|
||||
class D { }
|
||||
var v = class C extends D {};
|
||||
@ -0,0 +1,2 @@
|
||||
// @target: es6
|
||||
var v = class C {};
|
||||
@ -0,0 +1,3 @@
|
||||
// @target: es6
|
||||
class D { }
|
||||
var v = class C extends D {};
|
||||
@ -44,11 +44,13 @@ for (var i = 1; i <= test.markers().length; i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 4:
|
||||
verify.occurrencesAtPositionCount(0);
|
||||
break;
|
||||
case 3:
|
||||
verify.occurrencesAtPositionCount(1); // 'return' is an instance member
|
||||
break;
|
||||
case 4:
|
||||
verify.occurrencesAtPositionCount(4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
verify.errorExistsBetweenMarkers("1", "2");
|
||||
verify.errorExistsBetweenMarkers("3", "4");
|
||||
verify.numberOfErrorsInCurrentFile(2);
|
||||
verify.numberOfErrorsInCurrentFile(3);
|
||||
goTo.eof();
|
||||
verify.completionListContains("foo");
|
||||
verify.completionListContains("bar");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user