Add support for semicolons in class bodies

This commit is contained in:
Cyrus Najmabadi
2015-03-31 14:29:45 -07:00
parent f7aaf09603
commit b363a459ff
37 changed files with 666 additions and 475 deletions
-1
View File
@@ -126,7 +126,6 @@ module ts {
return (<ExportAssignment>node).isExportEquals ? "export=" : "default";
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.ClassExpression:
return node.flags & NodeFlags.Default ? "default" : undefined;
}
}
+12 -2
View File
@@ -3219,7 +3219,11 @@ module ts {
function emitMemberFunctionsForES5AndLower(node: ClassLikeDeclaration) {
forEach(node.members, member => {
if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) {
if (member.kind === SyntaxKind.SemicolonClassElement) {
writeLine();
write(";");
}
else if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) {
if (!(<MethodDeclaration>member).body) {
return emitOnlyPinnedOrTripleSlashComments(member);
}
@@ -3292,7 +3296,9 @@ module ts {
if ((member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) && !(<MethodDeclaration>member).body) {
emitOnlyPinnedOrTripleSlashComments(member);
}
else if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature || member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) {
else if (member.kind === SyntaxKind.MethodDeclaration ||
member.kind === SyntaxKind.GetAccessor ||
member.kind === SyntaxKind.SetAccessor) {
writeLine();
emitLeadingComments(member);
emitStart(member);
@@ -3311,6 +3317,10 @@ module ts {
emitEnd(member);
emitTrailingComments(member);
}
else if (member.kind === SyntaxKind.SemicolonClassElement) {
writeLine();
write(";");
}
}
}
+12 -1
View File
@@ -1609,7 +1609,11 @@ module ts {
case ParsingContext.TypeMembers:
return isStartOfTypeMember();
case ParsingContext.ClassMembers:
return lookAhead(isClassMemberStart);
// We allow semicolons as class elements (as specified by ES6) as long as we're
// not in error recovery. If we're in error recovery, we don't want an errant
// semicolon to be treated as a class member (since they're almost always used
// for statements.
return lookAhead(isClassMemberStart) || (token === SyntaxKind.SemicolonToken && !inErrorRecovery);
case ParsingContext.EnumMembers:
// Include open bracket computed properties. This technically also lets in indexers,
// which would be a candidate for improved error reporting.
@@ -1996,6 +2000,7 @@ module ts {
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.SemicolonClassElement:
return true;
}
}
@@ -4692,6 +4697,12 @@ module ts {
}
function parseClassElement(): ClassElement {
if (token === SyntaxKind.SemicolonToken) {
let result = <SemicolonClassElement>createNode(SyntaxKind.SemicolonClassElement);
nextToken();
return finishNode(result);
}
let fullStart = getNodePos();
let decorators = parseDecorators();
let modifiers = parseModifiers();
+6
View File
@@ -208,6 +208,7 @@ module ts {
// Misc
TemplateSpan,
HeritageClauseElement,
SemicolonClassElement,
// Element
Block,
VariableStatement,
@@ -538,6 +539,11 @@ module ts {
body?: Block;
}
// For when we encounter a semicolon in a class declaration. ES6 allows these as class elements.
export interface SemicolonClassElement extends ClassElement {
_semicolonClassElementBrand: any;
}
// See the comment on MethodDeclaration for the intuition behind AccessorDeclaration being a
// ClassElement and an ObjectLiteralElement.
export interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
+55 -51
View File
@@ -237,57 +237,58 @@ declare module "typescript" {
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,
SemicolonClassElement = 178,
Block = 179,
VariableStatement = 180,
EmptyStatement = 181,
ExpressionStatement = 182,
IfStatement = 183,
DoStatement = 184,
WhileStatement = 185,
ForStatement = 186,
ForInStatement = 187,
ForOfStatement = 188,
ContinueStatement = 189,
BreakStatement = 190,
ReturnStatement = 191,
WithStatement = 192,
SwitchStatement = 193,
LabeledStatement = 194,
ThrowStatement = 195,
TryStatement = 196,
DebuggerStatement = 197,
VariableDeclaration = 198,
VariableDeclarationList = 199,
FunctionDeclaration = 200,
ClassDeclaration = 201,
InterfaceDeclaration = 202,
TypeAliasDeclaration = 203,
EnumDeclaration = 204,
ModuleDeclaration = 205,
ModuleBlock = 206,
CaseBlock = 207,
ImportEqualsDeclaration = 208,
ImportDeclaration = 209,
ImportClause = 210,
NamespaceImport = 211,
NamedImports = 212,
ImportSpecifier = 213,
ExportAssignment = 214,
ExportDeclaration = 215,
NamedExports = 216,
ExportSpecifier = 217,
MissingDeclaration = 218,
ExternalModuleReference = 219,
CaseClause = 220,
DefaultClause = 221,
HeritageClause = 222,
CatchClause = 223,
PropertyAssignment = 224,
ShorthandPropertyAssignment = 225,
EnumMember = 226,
SourceFile = 227,
SyntaxList = 228,
Count = 229,
FirstAssignment = 53,
LastAssignment = 64,
FirstReservedWord = 66,
@@ -471,6 +472,9 @@ declare module "typescript" {
interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement {
body?: Block;
}
interface SemicolonClassElement extends ClassElement {
_semicolonClassElementBrand: any;
}
interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
_accessorDeclarationBrand: any;
body: Block;
@@ -729,157 +729,160 @@ declare module "typescript" {
HeritageClauseElement = 177,
>HeritageClauseElement : SyntaxKind
Block = 178,
SemicolonClassElement = 178,
>SemicolonClassElement : SyntaxKind
Block = 179,
>Block : SyntaxKind
VariableStatement = 179,
VariableStatement = 180,
>VariableStatement : SyntaxKind
EmptyStatement = 180,
EmptyStatement = 181,
>EmptyStatement : SyntaxKind
ExpressionStatement = 181,
ExpressionStatement = 182,
>ExpressionStatement : SyntaxKind
IfStatement = 182,
IfStatement = 183,
>IfStatement : SyntaxKind
DoStatement = 183,
DoStatement = 184,
>DoStatement : SyntaxKind
WhileStatement = 184,
WhileStatement = 185,
>WhileStatement : SyntaxKind
ForStatement = 185,
ForStatement = 186,
>ForStatement : SyntaxKind
ForInStatement = 186,
ForInStatement = 187,
>ForInStatement : SyntaxKind
ForOfStatement = 187,
ForOfStatement = 188,
>ForOfStatement : SyntaxKind
ContinueStatement = 188,
ContinueStatement = 189,
>ContinueStatement : SyntaxKind
BreakStatement = 189,
BreakStatement = 190,
>BreakStatement : SyntaxKind
ReturnStatement = 190,
ReturnStatement = 191,
>ReturnStatement : SyntaxKind
WithStatement = 191,
WithStatement = 192,
>WithStatement : SyntaxKind
SwitchStatement = 192,
SwitchStatement = 193,
>SwitchStatement : SyntaxKind
LabeledStatement = 193,
LabeledStatement = 194,
>LabeledStatement : SyntaxKind
ThrowStatement = 194,
ThrowStatement = 195,
>ThrowStatement : SyntaxKind
TryStatement = 195,
TryStatement = 196,
>TryStatement : SyntaxKind
DebuggerStatement = 196,
DebuggerStatement = 197,
>DebuggerStatement : SyntaxKind
VariableDeclaration = 197,
VariableDeclaration = 198,
>VariableDeclaration : SyntaxKind
VariableDeclarationList = 198,
VariableDeclarationList = 199,
>VariableDeclarationList : SyntaxKind
FunctionDeclaration = 199,
FunctionDeclaration = 200,
>FunctionDeclaration : SyntaxKind
ClassDeclaration = 200,
ClassDeclaration = 201,
>ClassDeclaration : SyntaxKind
InterfaceDeclaration = 201,
InterfaceDeclaration = 202,
>InterfaceDeclaration : SyntaxKind
TypeAliasDeclaration = 202,
TypeAliasDeclaration = 203,
>TypeAliasDeclaration : SyntaxKind
EnumDeclaration = 203,
EnumDeclaration = 204,
>EnumDeclaration : SyntaxKind
ModuleDeclaration = 204,
ModuleDeclaration = 205,
>ModuleDeclaration : SyntaxKind
ModuleBlock = 205,
ModuleBlock = 206,
>ModuleBlock : SyntaxKind
CaseBlock = 206,
CaseBlock = 207,
>CaseBlock : SyntaxKind
ImportEqualsDeclaration = 207,
ImportEqualsDeclaration = 208,
>ImportEqualsDeclaration : SyntaxKind
ImportDeclaration = 208,
ImportDeclaration = 209,
>ImportDeclaration : SyntaxKind
ImportClause = 209,
ImportClause = 210,
>ImportClause : SyntaxKind
NamespaceImport = 210,
NamespaceImport = 211,
>NamespaceImport : SyntaxKind
NamedImports = 211,
NamedImports = 212,
>NamedImports : SyntaxKind
ImportSpecifier = 212,
ImportSpecifier = 213,
>ImportSpecifier : SyntaxKind
ExportAssignment = 213,
ExportAssignment = 214,
>ExportAssignment : SyntaxKind
ExportDeclaration = 214,
ExportDeclaration = 215,
>ExportDeclaration : SyntaxKind
NamedExports = 215,
NamedExports = 216,
>NamedExports : SyntaxKind
ExportSpecifier = 216,
ExportSpecifier = 217,
>ExportSpecifier : SyntaxKind
MissingDeclaration = 217,
MissingDeclaration = 218,
>MissingDeclaration : SyntaxKind
ExternalModuleReference = 218,
ExternalModuleReference = 219,
>ExternalModuleReference : SyntaxKind
CaseClause = 219,
CaseClause = 220,
>CaseClause : SyntaxKind
DefaultClause = 220,
DefaultClause = 221,
>DefaultClause : SyntaxKind
HeritageClause = 221,
HeritageClause = 222,
>HeritageClause : SyntaxKind
CatchClause = 222,
CatchClause = 223,
>CatchClause : SyntaxKind
PropertyAssignment = 223,
PropertyAssignment = 224,
>PropertyAssignment : SyntaxKind
ShorthandPropertyAssignment = 224,
ShorthandPropertyAssignment = 225,
>ShorthandPropertyAssignment : SyntaxKind
EnumMember = 225,
EnumMember = 226,
>EnumMember : SyntaxKind
SourceFile = 226,
SourceFile = 227,
>SourceFile : SyntaxKind
SyntaxList = 227,
SyntaxList = 228,
>SyntaxList : SyntaxKind
Count = 228,
Count = 229,
>Count : SyntaxKind
FirstAssignment = 53,
@@ -1436,6 +1439,13 @@ declare module "typescript" {
body?: Block;
>body : Block
>Block : Block
}
interface SemicolonClassElement extends ClassElement {
>SemicolonClassElement : SemicolonClassElement
>ClassElement : ClassElement
_semicolonClassElementBrand: any;
>_semicolonClassElementBrand : any
}
interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
>AccessorDeclaration : AccessorDeclaration
+63 -59
View File
@@ -268,57 +268,58 @@ declare module "typescript" {
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,
SemicolonClassElement = 178,
Block = 179,
VariableStatement = 180,
EmptyStatement = 181,
ExpressionStatement = 182,
IfStatement = 183,
DoStatement = 184,
WhileStatement = 185,
ForStatement = 186,
ForInStatement = 187,
ForOfStatement = 188,
ContinueStatement = 189,
BreakStatement = 190,
ReturnStatement = 191,
WithStatement = 192,
SwitchStatement = 193,
LabeledStatement = 194,
ThrowStatement = 195,
TryStatement = 196,
DebuggerStatement = 197,
VariableDeclaration = 198,
VariableDeclarationList = 199,
FunctionDeclaration = 200,
ClassDeclaration = 201,
InterfaceDeclaration = 202,
TypeAliasDeclaration = 203,
EnumDeclaration = 204,
ModuleDeclaration = 205,
ModuleBlock = 206,
CaseBlock = 207,
ImportEqualsDeclaration = 208,
ImportDeclaration = 209,
ImportClause = 210,
NamespaceImport = 211,
NamedImports = 212,
ImportSpecifier = 213,
ExportAssignment = 214,
ExportDeclaration = 215,
NamedExports = 216,
ExportSpecifier = 217,
MissingDeclaration = 218,
ExternalModuleReference = 219,
CaseClause = 220,
DefaultClause = 221,
HeritageClause = 222,
CatchClause = 223,
PropertyAssignment = 224,
ShorthandPropertyAssignment = 225,
EnumMember = 226,
SourceFile = 227,
SyntaxList = 228,
Count = 229,
FirstAssignment = 53,
LastAssignment = 64,
FirstReservedWord = 66,
@@ -502,6 +503,9 @@ declare module "typescript" {
interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement {
body?: Block;
}
interface SemicolonClassElement extends ClassElement {
_semicolonClassElementBrand: any;
}
interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
_accessorDeclarationBrand: any;
body: Block;
@@ -2052,21 +2056,21 @@ function delint(sourceFile) {
delintNode(sourceFile);
function delintNode(node) {
switch (node.kind) {
case 185 /* ForStatement */:
case 186 /* ForInStatement */:
case 184 /* WhileStatement */:
case 183 /* DoStatement */:
if (node.statement.kind !== 178 /* Block */) {
case 186 /* ForStatement */:
case 187 /* ForInStatement */:
case 185 /* WhileStatement */:
case 184 /* DoStatement */:
if (node.statement.kind !== 179 /* Block */) {
report(node, "A looping statement's contents should be wrapped in a block body.");
}
break;
case 182 /* IfStatement */:
case 183 /* IfStatement */:
var ifStatement = node;
if (ifStatement.thenStatement.kind !== 178 /* Block */) {
if (ifStatement.thenStatement.kind !== 179 /* Block */) {
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
}
if (ifStatement.elseStatement &&
ifStatement.elseStatement.kind !== 178 /* Block */ && ifStatement.elseStatement.kind !== 182 /* IfStatement */) {
ifStatement.elseStatement.kind !== 179 /* Block */ && ifStatement.elseStatement.kind !== 183 /* IfStatement */) {
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
}
break;
@@ -875,157 +875,160 @@ declare module "typescript" {
HeritageClauseElement = 177,
>HeritageClauseElement : SyntaxKind
Block = 178,
SemicolonClassElement = 178,
>SemicolonClassElement : SyntaxKind
Block = 179,
>Block : SyntaxKind
VariableStatement = 179,
VariableStatement = 180,
>VariableStatement : SyntaxKind
EmptyStatement = 180,
EmptyStatement = 181,
>EmptyStatement : SyntaxKind
ExpressionStatement = 181,
ExpressionStatement = 182,
>ExpressionStatement : SyntaxKind
IfStatement = 182,
IfStatement = 183,
>IfStatement : SyntaxKind
DoStatement = 183,
DoStatement = 184,
>DoStatement : SyntaxKind
WhileStatement = 184,
WhileStatement = 185,
>WhileStatement : SyntaxKind
ForStatement = 185,
ForStatement = 186,
>ForStatement : SyntaxKind
ForInStatement = 186,
ForInStatement = 187,
>ForInStatement : SyntaxKind
ForOfStatement = 187,
ForOfStatement = 188,
>ForOfStatement : SyntaxKind
ContinueStatement = 188,
ContinueStatement = 189,
>ContinueStatement : SyntaxKind
BreakStatement = 189,
BreakStatement = 190,
>BreakStatement : SyntaxKind
ReturnStatement = 190,
ReturnStatement = 191,
>ReturnStatement : SyntaxKind
WithStatement = 191,
WithStatement = 192,
>WithStatement : SyntaxKind
SwitchStatement = 192,
SwitchStatement = 193,
>SwitchStatement : SyntaxKind
LabeledStatement = 193,
LabeledStatement = 194,
>LabeledStatement : SyntaxKind
ThrowStatement = 194,
ThrowStatement = 195,
>ThrowStatement : SyntaxKind
TryStatement = 195,
TryStatement = 196,
>TryStatement : SyntaxKind
DebuggerStatement = 196,
DebuggerStatement = 197,
>DebuggerStatement : SyntaxKind
VariableDeclaration = 197,
VariableDeclaration = 198,
>VariableDeclaration : SyntaxKind
VariableDeclarationList = 198,
VariableDeclarationList = 199,
>VariableDeclarationList : SyntaxKind
FunctionDeclaration = 199,
FunctionDeclaration = 200,
>FunctionDeclaration : SyntaxKind
ClassDeclaration = 200,
ClassDeclaration = 201,
>ClassDeclaration : SyntaxKind
InterfaceDeclaration = 201,
InterfaceDeclaration = 202,
>InterfaceDeclaration : SyntaxKind
TypeAliasDeclaration = 202,
TypeAliasDeclaration = 203,
>TypeAliasDeclaration : SyntaxKind
EnumDeclaration = 203,
EnumDeclaration = 204,
>EnumDeclaration : SyntaxKind
ModuleDeclaration = 204,
ModuleDeclaration = 205,
>ModuleDeclaration : SyntaxKind
ModuleBlock = 205,
ModuleBlock = 206,
>ModuleBlock : SyntaxKind
CaseBlock = 206,
CaseBlock = 207,
>CaseBlock : SyntaxKind
ImportEqualsDeclaration = 207,
ImportEqualsDeclaration = 208,
>ImportEqualsDeclaration : SyntaxKind
ImportDeclaration = 208,
ImportDeclaration = 209,
>ImportDeclaration : SyntaxKind
ImportClause = 209,
ImportClause = 210,
>ImportClause : SyntaxKind
NamespaceImport = 210,
NamespaceImport = 211,
>NamespaceImport : SyntaxKind
NamedImports = 211,
NamedImports = 212,
>NamedImports : SyntaxKind
ImportSpecifier = 212,
ImportSpecifier = 213,
>ImportSpecifier : SyntaxKind
ExportAssignment = 213,
ExportAssignment = 214,
>ExportAssignment : SyntaxKind
ExportDeclaration = 214,
ExportDeclaration = 215,
>ExportDeclaration : SyntaxKind
NamedExports = 215,
NamedExports = 216,
>NamedExports : SyntaxKind
ExportSpecifier = 216,
ExportSpecifier = 217,
>ExportSpecifier : SyntaxKind
MissingDeclaration = 217,
MissingDeclaration = 218,
>MissingDeclaration : SyntaxKind
ExternalModuleReference = 218,
ExternalModuleReference = 219,
>ExternalModuleReference : SyntaxKind
CaseClause = 219,
CaseClause = 220,
>CaseClause : SyntaxKind
DefaultClause = 220,
DefaultClause = 221,
>DefaultClause : SyntaxKind
HeritageClause = 221,
HeritageClause = 222,
>HeritageClause : SyntaxKind
CatchClause = 222,
CatchClause = 223,
>CatchClause : SyntaxKind
PropertyAssignment = 223,
PropertyAssignment = 224,
>PropertyAssignment : SyntaxKind
ShorthandPropertyAssignment = 224,
ShorthandPropertyAssignment = 225,
>ShorthandPropertyAssignment : SyntaxKind
EnumMember = 225,
EnumMember = 226,
>EnumMember : SyntaxKind
SourceFile = 226,
SourceFile = 227,
>SourceFile : SyntaxKind
SyntaxList = 227,
SyntaxList = 228,
>SyntaxList : SyntaxKind
Count = 228,
Count = 229,
>Count : SyntaxKind
FirstAssignment = 53,
@@ -1582,6 +1585,13 @@ declare module "typescript" {
body?: Block;
>body : Block
>Block : Block
}
interface SemicolonClassElement extends ClassElement {
>SemicolonClassElement : SemicolonClassElement
>ClassElement : ClassElement
_semicolonClassElementBrand: any;
>_semicolonClassElementBrand : any
}
interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
>AccessorDeclaration : AccessorDeclaration
@@ -269,57 +269,58 @@ declare module "typescript" {
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,
SemicolonClassElement = 178,
Block = 179,
VariableStatement = 180,
EmptyStatement = 181,
ExpressionStatement = 182,
IfStatement = 183,
DoStatement = 184,
WhileStatement = 185,
ForStatement = 186,
ForInStatement = 187,
ForOfStatement = 188,
ContinueStatement = 189,
BreakStatement = 190,
ReturnStatement = 191,
WithStatement = 192,
SwitchStatement = 193,
LabeledStatement = 194,
ThrowStatement = 195,
TryStatement = 196,
DebuggerStatement = 197,
VariableDeclaration = 198,
VariableDeclarationList = 199,
FunctionDeclaration = 200,
ClassDeclaration = 201,
InterfaceDeclaration = 202,
TypeAliasDeclaration = 203,
EnumDeclaration = 204,
ModuleDeclaration = 205,
ModuleBlock = 206,
CaseBlock = 207,
ImportEqualsDeclaration = 208,
ImportDeclaration = 209,
ImportClause = 210,
NamespaceImport = 211,
NamedImports = 212,
ImportSpecifier = 213,
ExportAssignment = 214,
ExportDeclaration = 215,
NamedExports = 216,
ExportSpecifier = 217,
MissingDeclaration = 218,
ExternalModuleReference = 219,
CaseClause = 220,
DefaultClause = 221,
HeritageClause = 222,
CatchClause = 223,
PropertyAssignment = 224,
ShorthandPropertyAssignment = 225,
EnumMember = 226,
SourceFile = 227,
SyntaxList = 228,
Count = 229,
FirstAssignment = 53,
LastAssignment = 64,
FirstReservedWord = 66,
@@ -503,6 +504,9 @@ declare module "typescript" {
interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement {
body?: Block;
}
interface SemicolonClassElement extends ClassElement {
_semicolonClassElementBrand: any;
}
interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
_accessorDeclarationBrand: any;
body: Block;
@@ -825,157 +825,160 @@ declare module "typescript" {
HeritageClauseElement = 177,
>HeritageClauseElement : SyntaxKind
Block = 178,
SemicolonClassElement = 178,
>SemicolonClassElement : SyntaxKind
Block = 179,
>Block : SyntaxKind
VariableStatement = 179,
VariableStatement = 180,
>VariableStatement : SyntaxKind
EmptyStatement = 180,
EmptyStatement = 181,
>EmptyStatement : SyntaxKind
ExpressionStatement = 181,
ExpressionStatement = 182,
>ExpressionStatement : SyntaxKind
IfStatement = 182,
IfStatement = 183,
>IfStatement : SyntaxKind
DoStatement = 183,
DoStatement = 184,
>DoStatement : SyntaxKind
WhileStatement = 184,
WhileStatement = 185,
>WhileStatement : SyntaxKind
ForStatement = 185,
ForStatement = 186,
>ForStatement : SyntaxKind
ForInStatement = 186,
ForInStatement = 187,
>ForInStatement : SyntaxKind
ForOfStatement = 187,
ForOfStatement = 188,
>ForOfStatement : SyntaxKind
ContinueStatement = 188,
ContinueStatement = 189,
>ContinueStatement : SyntaxKind
BreakStatement = 189,
BreakStatement = 190,
>BreakStatement : SyntaxKind
ReturnStatement = 190,
ReturnStatement = 191,
>ReturnStatement : SyntaxKind
WithStatement = 191,
WithStatement = 192,
>WithStatement : SyntaxKind
SwitchStatement = 192,
SwitchStatement = 193,
>SwitchStatement : SyntaxKind
LabeledStatement = 193,
LabeledStatement = 194,
>LabeledStatement : SyntaxKind
ThrowStatement = 194,
ThrowStatement = 195,
>ThrowStatement : SyntaxKind
TryStatement = 195,
TryStatement = 196,
>TryStatement : SyntaxKind
DebuggerStatement = 196,
DebuggerStatement = 197,
>DebuggerStatement : SyntaxKind
VariableDeclaration = 197,
VariableDeclaration = 198,
>VariableDeclaration : SyntaxKind
VariableDeclarationList = 198,
VariableDeclarationList = 199,
>VariableDeclarationList : SyntaxKind
FunctionDeclaration = 199,
FunctionDeclaration = 200,
>FunctionDeclaration : SyntaxKind
ClassDeclaration = 200,
ClassDeclaration = 201,
>ClassDeclaration : SyntaxKind
InterfaceDeclaration = 201,
InterfaceDeclaration = 202,
>InterfaceDeclaration : SyntaxKind
TypeAliasDeclaration = 202,
TypeAliasDeclaration = 203,
>TypeAliasDeclaration : SyntaxKind
EnumDeclaration = 203,
EnumDeclaration = 204,
>EnumDeclaration : SyntaxKind
ModuleDeclaration = 204,
ModuleDeclaration = 205,
>ModuleDeclaration : SyntaxKind
ModuleBlock = 205,
ModuleBlock = 206,
>ModuleBlock : SyntaxKind
CaseBlock = 206,
CaseBlock = 207,
>CaseBlock : SyntaxKind
ImportEqualsDeclaration = 207,
ImportEqualsDeclaration = 208,
>ImportEqualsDeclaration : SyntaxKind
ImportDeclaration = 208,
ImportDeclaration = 209,
>ImportDeclaration : SyntaxKind
ImportClause = 209,
ImportClause = 210,
>ImportClause : SyntaxKind
NamespaceImport = 210,
NamespaceImport = 211,
>NamespaceImport : SyntaxKind
NamedImports = 211,
NamedImports = 212,
>NamedImports : SyntaxKind
ImportSpecifier = 212,
ImportSpecifier = 213,
>ImportSpecifier : SyntaxKind
ExportAssignment = 213,
ExportAssignment = 214,
>ExportAssignment : SyntaxKind
ExportDeclaration = 214,
ExportDeclaration = 215,
>ExportDeclaration : SyntaxKind
NamedExports = 215,
NamedExports = 216,
>NamedExports : SyntaxKind
ExportSpecifier = 216,
ExportSpecifier = 217,
>ExportSpecifier : SyntaxKind
MissingDeclaration = 217,
MissingDeclaration = 218,
>MissingDeclaration : SyntaxKind
ExternalModuleReference = 218,
ExternalModuleReference = 219,
>ExternalModuleReference : SyntaxKind
CaseClause = 219,
CaseClause = 220,
>CaseClause : SyntaxKind
DefaultClause = 220,
DefaultClause = 221,
>DefaultClause : SyntaxKind
HeritageClause = 221,
HeritageClause = 222,
>HeritageClause : SyntaxKind
CatchClause = 222,
CatchClause = 223,
>CatchClause : SyntaxKind
PropertyAssignment = 223,
PropertyAssignment = 224,
>PropertyAssignment : SyntaxKind
ShorthandPropertyAssignment = 224,
ShorthandPropertyAssignment = 225,
>ShorthandPropertyAssignment : SyntaxKind
EnumMember = 225,
EnumMember = 226,
>EnumMember : SyntaxKind
SourceFile = 226,
SourceFile = 227,
>SourceFile : SyntaxKind
SyntaxList = 227,
SyntaxList = 228,
>SyntaxList : SyntaxKind
Count = 228,
Count = 229,
>Count : SyntaxKind
FirstAssignment = 53,
@@ -1532,6 +1535,13 @@ declare module "typescript" {
body?: Block;
>body : Block
>Block : Block
}
interface SemicolonClassElement extends ClassElement {
>SemicolonClassElement : SemicolonClassElement
>ClassElement : ClassElement
_semicolonClassElementBrand: any;
>_semicolonClassElementBrand : any
}
interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
>AccessorDeclaration : AccessorDeclaration
+55 -51
View File
@@ -306,57 +306,58 @@ declare module "typescript" {
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,
SemicolonClassElement = 178,
Block = 179,
VariableStatement = 180,
EmptyStatement = 181,
ExpressionStatement = 182,
IfStatement = 183,
DoStatement = 184,
WhileStatement = 185,
ForStatement = 186,
ForInStatement = 187,
ForOfStatement = 188,
ContinueStatement = 189,
BreakStatement = 190,
ReturnStatement = 191,
WithStatement = 192,
SwitchStatement = 193,
LabeledStatement = 194,
ThrowStatement = 195,
TryStatement = 196,
DebuggerStatement = 197,
VariableDeclaration = 198,
VariableDeclarationList = 199,
FunctionDeclaration = 200,
ClassDeclaration = 201,
InterfaceDeclaration = 202,
TypeAliasDeclaration = 203,
EnumDeclaration = 204,
ModuleDeclaration = 205,
ModuleBlock = 206,
CaseBlock = 207,
ImportEqualsDeclaration = 208,
ImportDeclaration = 209,
ImportClause = 210,
NamespaceImport = 211,
NamedImports = 212,
ImportSpecifier = 213,
ExportAssignment = 214,
ExportDeclaration = 215,
NamedExports = 216,
ExportSpecifier = 217,
MissingDeclaration = 218,
ExternalModuleReference = 219,
CaseClause = 220,
DefaultClause = 221,
HeritageClause = 222,
CatchClause = 223,
PropertyAssignment = 224,
ShorthandPropertyAssignment = 225,
EnumMember = 226,
SourceFile = 227,
SyntaxList = 228,
Count = 229,
FirstAssignment = 53,
LastAssignment = 64,
FirstReservedWord = 66,
@@ -540,6 +541,9 @@ declare module "typescript" {
interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement {
body?: Block;
}
interface SemicolonClassElement extends ClassElement {
_semicolonClassElementBrand: any;
}
interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
_accessorDeclarationBrand: any;
body: Block;
@@ -998,157 +998,160 @@ declare module "typescript" {
HeritageClauseElement = 177,
>HeritageClauseElement : SyntaxKind
Block = 178,
SemicolonClassElement = 178,
>SemicolonClassElement : SyntaxKind
Block = 179,
>Block : SyntaxKind
VariableStatement = 179,
VariableStatement = 180,
>VariableStatement : SyntaxKind
EmptyStatement = 180,
EmptyStatement = 181,
>EmptyStatement : SyntaxKind
ExpressionStatement = 181,
ExpressionStatement = 182,
>ExpressionStatement : SyntaxKind
IfStatement = 182,
IfStatement = 183,
>IfStatement : SyntaxKind
DoStatement = 183,
DoStatement = 184,
>DoStatement : SyntaxKind
WhileStatement = 184,
WhileStatement = 185,
>WhileStatement : SyntaxKind
ForStatement = 185,
ForStatement = 186,
>ForStatement : SyntaxKind
ForInStatement = 186,
ForInStatement = 187,
>ForInStatement : SyntaxKind
ForOfStatement = 187,
ForOfStatement = 188,
>ForOfStatement : SyntaxKind
ContinueStatement = 188,
ContinueStatement = 189,
>ContinueStatement : SyntaxKind
BreakStatement = 189,
BreakStatement = 190,
>BreakStatement : SyntaxKind
ReturnStatement = 190,
ReturnStatement = 191,
>ReturnStatement : SyntaxKind
WithStatement = 191,
WithStatement = 192,
>WithStatement : SyntaxKind
SwitchStatement = 192,
SwitchStatement = 193,
>SwitchStatement : SyntaxKind
LabeledStatement = 193,
LabeledStatement = 194,
>LabeledStatement : SyntaxKind
ThrowStatement = 194,
ThrowStatement = 195,
>ThrowStatement : SyntaxKind
TryStatement = 195,
TryStatement = 196,
>TryStatement : SyntaxKind
DebuggerStatement = 196,
DebuggerStatement = 197,
>DebuggerStatement : SyntaxKind
VariableDeclaration = 197,
VariableDeclaration = 198,
>VariableDeclaration : SyntaxKind
VariableDeclarationList = 198,
VariableDeclarationList = 199,
>VariableDeclarationList : SyntaxKind
FunctionDeclaration = 199,
FunctionDeclaration = 200,
>FunctionDeclaration : SyntaxKind
ClassDeclaration = 200,
ClassDeclaration = 201,
>ClassDeclaration : SyntaxKind
InterfaceDeclaration = 201,
InterfaceDeclaration = 202,
>InterfaceDeclaration : SyntaxKind
TypeAliasDeclaration = 202,
TypeAliasDeclaration = 203,
>TypeAliasDeclaration : SyntaxKind
EnumDeclaration = 203,
EnumDeclaration = 204,
>EnumDeclaration : SyntaxKind
ModuleDeclaration = 204,
ModuleDeclaration = 205,
>ModuleDeclaration : SyntaxKind
ModuleBlock = 205,
ModuleBlock = 206,
>ModuleBlock : SyntaxKind
CaseBlock = 206,
CaseBlock = 207,
>CaseBlock : SyntaxKind
ImportEqualsDeclaration = 207,
ImportEqualsDeclaration = 208,
>ImportEqualsDeclaration : SyntaxKind
ImportDeclaration = 208,
ImportDeclaration = 209,
>ImportDeclaration : SyntaxKind
ImportClause = 209,
ImportClause = 210,
>ImportClause : SyntaxKind
NamespaceImport = 210,
NamespaceImport = 211,
>NamespaceImport : SyntaxKind
NamedImports = 211,
NamedImports = 212,
>NamedImports : SyntaxKind
ImportSpecifier = 212,
ImportSpecifier = 213,
>ImportSpecifier : SyntaxKind
ExportAssignment = 213,
ExportAssignment = 214,
>ExportAssignment : SyntaxKind
ExportDeclaration = 214,
ExportDeclaration = 215,
>ExportDeclaration : SyntaxKind
NamedExports = 215,
NamedExports = 216,
>NamedExports : SyntaxKind
ExportSpecifier = 216,
ExportSpecifier = 217,
>ExportSpecifier : SyntaxKind
MissingDeclaration = 217,
MissingDeclaration = 218,
>MissingDeclaration : SyntaxKind
ExternalModuleReference = 218,
ExternalModuleReference = 219,
>ExternalModuleReference : SyntaxKind
CaseClause = 219,
CaseClause = 220,
>CaseClause : SyntaxKind
DefaultClause = 220,
DefaultClause = 221,
>DefaultClause : SyntaxKind
HeritageClause = 221,
HeritageClause = 222,
>HeritageClause : SyntaxKind
CatchClause = 222,
CatchClause = 223,
>CatchClause : SyntaxKind
PropertyAssignment = 223,
PropertyAssignment = 224,
>PropertyAssignment : SyntaxKind
ShorthandPropertyAssignment = 224,
ShorthandPropertyAssignment = 225,
>ShorthandPropertyAssignment : SyntaxKind
EnumMember = 225,
EnumMember = 226,
>EnumMember : SyntaxKind
SourceFile = 226,
SourceFile = 227,
>SourceFile : SyntaxKind
SyntaxList = 227,
SyntaxList = 228,
>SyntaxList : SyntaxKind
Count = 228,
Count = 229,
>Count : SyntaxKind
FirstAssignment = 53,
@@ -1705,6 +1708,13 @@ declare module "typescript" {
body?: Block;
>body : Block
>Block : Block
}
interface SemicolonClassElement extends ClassElement {
>SemicolonClassElement : SemicolonClassElement
>ClassElement : ClassElement
_semicolonClassElementBrand: any;
>_semicolonClassElementBrand : any
}
interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
>AccessorDeclaration : AccessorDeclaration
@@ -0,0 +1,12 @@
//// [classWithSemicolonClassElement1.ts]
class C {
;
}
//// [classWithSemicolonClassElement1.js]
var C = (function () {
function C() {
}
;
return C;
})();
@@ -0,0 +1,6 @@
=== tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement1.ts ===
class C {
>C : C
;
}
@@ -0,0 +1,14 @@
//// [classWithSemicolonClassElement2.ts]
class C {
;
;
}
//// [classWithSemicolonClassElement2.js]
var C = (function () {
function C() {
}
;
;
return C;
})();
@@ -0,0 +1,7 @@
=== tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement2.ts ===
class C {
>C : C
;
;
}
@@ -0,0 +1,9 @@
//// [classWithSemicolonClassElementES61.ts]
class C {
;
}
//// [classWithSemicolonClassElementES61.js]
class C {
;
}
@@ -0,0 +1,6 @@
=== tests/cases/conformance/es6/classDeclaration/classWithSemicolonClassElementES61.ts ===
class C {
>C : C
;
}
@@ -0,0 +1,11 @@
//// [classWithSemicolonClassElementES62.ts]
class C {
;
;
}
//// [classWithSemicolonClassElementES62.js]
class C {
;
;
}
@@ -0,0 +1,7 @@
=== tests/cases/conformance/es6/classDeclaration/classWithSemicolonClassElementES62.ts ===
class C {
>C : C
;
;
}
@@ -1,23 +0,0 @@
tests/cases/compiler/es6ClassTest3.ts(3,22): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/compiler/es6ClassTest3.ts(4,23): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
==== tests/cases/compiler/es6ClassTest3.ts (2 errors) ====
module M {
class Visibility {
public foo() { };
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
private bar() { };
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
private x: number;
public y: number;
public z: number;
constructor() {
this.x = 1;
this.y = 2;
}
}
}
@@ -23,7 +23,9 @@ var M;
this.y = 2;
}
Visibility.prototype.foo = function () { };
;
Visibility.prototype.bar = function () { };
;
return Visibility;
})();
})(M || (M = {}));
@@ -0,0 +1,37 @@
=== tests/cases/compiler/es6ClassTest3.ts ===
module M {
>M : typeof M
class Visibility {
>Visibility : Visibility
public foo() { };
>foo : () => void
private bar() { };
>bar : () => void
private x: number;
>x : number
public y: number;
>y : number
public z: number;
>z : number
constructor() {
this.x = 1;
>this.x = 1 : number
>this.x : number
>this : Visibility
>x : number
this.y = 2;
>this.y = 2 : number
>this.y : number
>this : Visibility
>y : number
}
}
}
@@ -1,15 +1,15 @@
tests/cases/compiler/exportDeclareClass1.ts(2,24): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/compiler/exportDeclareClass1.ts(3,34): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/compiler/exportDeclareClass1.ts(2,21): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/compiler/exportDeclareClass1.ts(3,31): error TS1184: An implementation cannot be declared in ambient contexts.
==== tests/cases/compiler/exportDeclareClass1.ts (2 errors) ====
export declare class eaC {
static tF() { };
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~
!!! error TS1184: An implementation cannot be declared in ambient contexts.
static tsF(param:any) { };
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~
!!! error TS1184: An implementation cannot be declared in ambient contexts.
};
export declare class eaC2 {
@@ -32,11 +32,10 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,86): error T
tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,94): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,96): error TS2300: Duplicate identifier '0'.
tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,97): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,98): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error TS2304: Cannot find name 'SeedCoords'.
==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (36 errors) ====
==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (35 errors) ====
export class Game {
~~~~
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
@@ -107,8 +106,6 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error T
!!! error TS2300: Duplicate identifier '0'.
~
!!! error TS1005: ';' expected.
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
private prevConfig: SeedCoords[][];
~~~~~~~~~~
!!! error TS2304: Cannot find name 'SeedCoords'.
@@ -9,6 +9,7 @@ var Game = (function () {
function Game() {
this.position = new DisplayPosition([]);
}
;
return Game;
})();
exports.Game = Game;
@@ -1,7 +1,10 @@
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonInClass1.ts(9,21): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonInClass1.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonInClass1.ts(15,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonInClass1.ts(18,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonInClass1.ts(24,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonInClass1.ts (1 errors) ====
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonInClass1.ts (4 errors) ====
class a {
//constructor ();
constructor (n: number);
@@ -11,23 +14,29 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonIn
}
public pgF() { };
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
public pv;
public get d() {
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
return 30;
}
public set d() {
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
}
public static get p2() {
~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
return { x: 30, y: 40 };
}
private static d2() {
}
private static get p3() {
~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
return "string";
}
private pv3;
@@ -40,6 +40,7 @@ var a = (function () {
function a(ns) {
}
a.prototype.pgF = function () { };
;
Object.defineProperty(a.prototype, "d", {
get: function () {
return 30;
@@ -1,11 +0,0 @@
tests/cases/compiler/parsingClassRecoversWhenHittingUnexpectedSemicolon.ts(2,19): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
==== tests/cases/compiler/parsingClassRecoversWhenHittingUnexpectedSemicolon.ts (1 errors) ====
class C {
public f() { };
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
private m;
}
@@ -10,5 +10,6 @@ var C = (function () {
function C() {
}
C.prototype.f = function () { };
;
return C;
})();
@@ -0,0 +1,11 @@
=== tests/cases/compiler/parsingClassRecoversWhenHittingUnexpectedSemicolon.ts ===
class C {
>C : C
public f() { };
>f : () => void
private m;
>m : any
}
@@ -1,10 +1,8 @@
tests/cases/compiler/primitiveMembers.ts(5,3): error TS2339: Property 'toBAZ' does not exist on type 'number'.
tests/cases/compiler/primitiveMembers.ts(11,1): error TS2322: Type 'Number' is not assignable to type 'number'.
tests/cases/compiler/primitiveMembers.ts(24,35): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/compiler/primitiveMembers.ts(25,56): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
==== tests/cases/compiler/primitiveMembers.ts (4 errors) ====
==== tests/cases/compiler/primitiveMembers.ts (2 errors) ====
var x = 5;
var r = /yo/;
r.source;
@@ -33,11 +31,7 @@ tests/cases/compiler/primitiveMembers.ts(25,56): error TS1068: Unexpected token.
class baz { public bar(): void { }; }
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
class foo extends baz { public bar(){ return undefined}; }
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
@@ -58,6 +58,7 @@ var baz = (function () {
function baz() {
}
baz.prototype.bar = function () { };
;
return baz;
})();
var foo = (function (_super) {
@@ -66,5 +67,6 @@ var foo = (function (_super) {
_super.apply(this, arguments);
}
foo.prototype.bar = function () { return undefined; };
;
return foo;
})(baz);
@@ -0,0 +1,3 @@
class C {
;
}
@@ -0,0 +1,4 @@
class C {
;
;
}
@@ -0,0 +1,4 @@
//@target: es6
class C {
;
}
@@ -0,0 +1,5 @@
//@target: es6
class C {
;
;
}