Port fidelity changes to github.
This commit is contained in:
parent
80bab05d07
commit
0e9134788a
44 changed files with 379 additions and 17 deletions
|
@ -42,6 +42,10 @@ module TypeScript {
|
||||||
walker.walk(preAst.typeArguments);
|
walker.walk(preAst.typeArguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function walkTupleTypeChildren(preAst: TupleTypeSyntax, walker: AstWalker): void {
|
||||||
|
walker.walk(preAst.types);
|
||||||
|
}
|
||||||
|
|
||||||
function walkTypeOfExpressionChildren(preAst: TypeOfExpressionSyntax, walker: AstWalker): void {
|
function walkTypeOfExpressionChildren(preAst: TypeOfExpressionSyntax, walker: AstWalker): void {
|
||||||
walker.walk(preAst.expression);
|
walker.walk(preAst.expression);
|
||||||
}
|
}
|
||||||
|
@ -561,6 +565,7 @@ module TypeScript {
|
||||||
childrenWalkers[SyntaxKind.TriviaList] = null;
|
childrenWalkers[SyntaxKind.TriviaList] = null;
|
||||||
childrenWalkers[SyntaxKind.TrueKeyword] = null;
|
childrenWalkers[SyntaxKind.TrueKeyword] = null;
|
||||||
childrenWalkers[SyntaxKind.TryStatement] = walkTryStatementChildren;
|
childrenWalkers[SyntaxKind.TryStatement] = walkTryStatementChildren;
|
||||||
|
childrenWalkers[SyntaxKind.TupleType] = walkTupleTypeChildren;
|
||||||
childrenWalkers[SyntaxKind.TypeAnnotation] = walkTypeAnnotationChildren;
|
childrenWalkers[SyntaxKind.TypeAnnotation] = walkTypeAnnotationChildren;
|
||||||
childrenWalkers[SyntaxKind.TypeArgumentList] = walkTypeArgumentListChildren;
|
childrenWalkers[SyntaxKind.TypeArgumentList] = walkTypeArgumentListChildren;
|
||||||
childrenWalkers[SyntaxKind.TypeOfExpression] = walkTypeOfExpressionChildren;
|
childrenWalkers[SyntaxKind.TypeOfExpression] = walkTypeOfExpressionChildren;
|
||||||
|
|
|
@ -42,6 +42,10 @@ module TypeScript {
|
||||||
return this.defaultVisit(node);
|
return this.defaultVisit(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public visitTupleType(node: TupleTypeSyntax): any {
|
||||||
|
return this.defaultVisit(node);
|
||||||
|
}
|
||||||
|
|
||||||
public visitInterfaceDeclaration(node: InterfaceDeclarationSyntax): any {
|
public visitInterfaceDeclaration(node: InterfaceDeclarationSyntax): any {
|
||||||
return this.defaultVisit(node);
|
return this.defaultVisit(node);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1048,6 +1048,7 @@ module TypeScript.Parser {
|
||||||
case SyntaxKind.ExportKeyword:
|
case SyntaxKind.ExportKeyword:
|
||||||
case SyntaxKind.PublicKeyword:
|
case SyntaxKind.PublicKeyword:
|
||||||
case SyntaxKind.PrivateKeyword:
|
case SyntaxKind.PrivateKeyword:
|
||||||
|
case SyntaxKind.ProtectedKeyword:
|
||||||
case SyntaxKind.StaticKeyword:
|
case SyntaxKind.StaticKeyword:
|
||||||
case SyntaxKind.DeclareKeyword:
|
case SyntaxKind.DeclareKeyword:
|
||||||
return true;
|
return true;
|
||||||
|
@ -1434,6 +1435,19 @@ module TypeScript.Parser {
|
||||||
return new syntaxFactory.ObjectTypeSyntax(parseNodeData, openBraceToken, typeMembers, eatToken(SyntaxKind.CloseBraceToken));
|
return new syntaxFactory.ObjectTypeSyntax(parseNodeData, openBraceToken, typeMembers, eatToken(SyntaxKind.CloseBraceToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseTupleType(currentToken: ISyntaxToken): TupleTypeSyntax {
|
||||||
|
var openBracket = consumeToken(currentToken);
|
||||||
|
|
||||||
|
var types = Syntax.emptySeparatedList<ITypeSyntax>();
|
||||||
|
if (openBracket.fullWidth() > 0) {
|
||||||
|
var skippedTokens: ISyntaxToken[] = getArray();
|
||||||
|
types = parseSeparatedSyntaxList<ITypeSyntax>(ListParsingState.TupleType_Types, skippedTokens);
|
||||||
|
openBracket = addSkippedTokensAfterToken(openBracket, skippedTokens);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new syntaxFactory.TupleTypeSyntax(parseNodeData, openBracket, types, eatToken(SyntaxKind.CloseBracketToken));
|
||||||
|
}
|
||||||
|
|
||||||
function isTypeMember(inErrorRecovery: boolean): boolean {
|
function isTypeMember(inErrorRecovery: boolean): boolean {
|
||||||
if (SyntaxUtilities.isTypeMember(currentNode())) {
|
if (SyntaxUtilities.isTypeMember(currentNode())) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1663,6 +1677,7 @@ module TypeScript.Parser {
|
||||||
// ERROR RECOVERY
|
// ERROR RECOVERY
|
||||||
case SyntaxKind.PublicKeyword:
|
case SyntaxKind.PublicKeyword:
|
||||||
case SyntaxKind.PrivateKeyword:
|
case SyntaxKind.PrivateKeyword:
|
||||||
|
case SyntaxKind.ProtectedKeyword:
|
||||||
case SyntaxKind.StaticKeyword:
|
case SyntaxKind.StaticKeyword:
|
||||||
// None of the above are actually keywords. And they might show up in a real
|
// None of the above are actually keywords. And they might show up in a real
|
||||||
// statement (i.e. "public();"). However, if we see 'public <identifier>' then
|
// statement (i.e. "public();"). However, if we see 'public <identifier>' then
|
||||||
|
@ -1731,6 +1746,7 @@ module TypeScript.Parser {
|
||||||
// ERROR RECOVERY
|
// ERROR RECOVERY
|
||||||
case SyntaxKind.PublicKeyword:
|
case SyntaxKind.PublicKeyword:
|
||||||
case SyntaxKind.PrivateKeyword:
|
case SyntaxKind.PrivateKeyword:
|
||||||
|
case SyntaxKind.ProtectedKeyword:
|
||||||
case SyntaxKind.StaticKeyword:
|
case SyntaxKind.StaticKeyword:
|
||||||
// None of the above are actually keywords. And they might show up in a real
|
// None of the above are actually keywords. And they might show up in a real
|
||||||
// statement (i.e. "public();"). However, if we see 'public <identifier>' then
|
// statement (i.e. "public();"). However, if we see 'public <identifier>' then
|
||||||
|
@ -3133,7 +3149,7 @@ module TypeScript.Parser {
|
||||||
token2 = peekToken(2);
|
token2 = peekToken(2);
|
||||||
token2Kind = token2.kind();
|
token2Kind = token2.kind();
|
||||||
|
|
||||||
if (token1Kind === SyntaxKind.PublicKeyword || token1Kind === SyntaxKind.PrivateKeyword) {
|
if (SyntaxFacts.isAccessibilityModifier(token1Kind)) {
|
||||||
if (isIdentifier(token2)) {
|
if (isIdentifier(token2)) {
|
||||||
// "(public id" or "(function id". Definitely an arrow function. Could never
|
// "(public id" or "(function id". Definitely an arrow function. Could never
|
||||||
// be a parenthesized expression. Note: this will be an *illegal* arrow
|
// be a parenthesized expression. Note: this will be an *illegal* arrow
|
||||||
|
@ -3557,11 +3573,12 @@ module TypeScript.Parser {
|
||||||
|
|
||||||
return consumeToken(_currentToken);
|
return consumeToken(_currentToken);
|
||||||
case SyntaxKind.OpenParenToken:
|
case SyntaxKind.OpenParenToken:
|
||||||
case SyntaxKind.LessThanToken: return tryParseFunctionType();
|
case SyntaxKind.LessThanToken: return tryParseFunctionType();
|
||||||
case SyntaxKind.VoidKeyword: return consumeToken(_currentToken);
|
case SyntaxKind.VoidKeyword: return consumeToken(_currentToken);
|
||||||
case SyntaxKind.OpenBraceToken: return parseObjectType();
|
case SyntaxKind.OpenBraceToken: return parseObjectType();
|
||||||
case SyntaxKind.NewKeyword: return parseConstructorType();
|
case SyntaxKind.NewKeyword: return parseConstructorType();
|
||||||
case SyntaxKind.TypeOfKeyword: return parseTypeQuery(_currentToken);
|
case SyntaxKind.TypeOfKeyword: return parseTypeQuery(_currentToken);
|
||||||
|
case SyntaxKind.OpenBracketToken: return parseTupleType(_currentToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tryParseNameOrGenericType();
|
return tryParseNameOrGenericType();
|
||||||
|
@ -3973,6 +3990,7 @@ module TypeScript.Parser {
|
||||||
case ListParsingState.IndexSignature_Parameters: return isExpectedIndexSignature_ParametersTerminator();
|
case ListParsingState.IndexSignature_Parameters: return isExpectedIndexSignature_ParametersTerminator();
|
||||||
case ListParsingState.TypeArgumentList_Types: return isExpectedTypeArgumentList_TypesTerminator();
|
case ListParsingState.TypeArgumentList_Types: return isExpectedTypeArgumentList_TypesTerminator();
|
||||||
case ListParsingState.TypeParameterList_TypeParameters: return isExpectedTypeParameterList_TypeParametersTerminator();
|
case ListParsingState.TypeParameterList_TypeParameters: return isExpectedTypeParameterList_TypeParametersTerminator();
|
||||||
|
case ListParsingState.TupleType_Types: return isExpectedTupleType_TypesTerminator();
|
||||||
default:
|
default:
|
||||||
throw Errors.invalidOperation();
|
throw Errors.invalidOperation();
|
||||||
}
|
}
|
||||||
|
@ -4019,6 +4037,17 @@ module TypeScript.Parser {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isExpectedTupleType_TypesTerminator(): boolean {
|
||||||
|
var token = currentToken();
|
||||||
|
var tokenKind = token.kind();
|
||||||
|
if (tokenKind === SyntaxKind.CloseBracketToken) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: add more cases as necessary for error tolerance.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function isExpectedTypeParameterList_TypeParametersTerminator(): boolean {
|
function isExpectedTypeParameterList_TypeParametersTerminator(): boolean {
|
||||||
var tokenKind = currentToken().kind();
|
var tokenKind = currentToken().kind();
|
||||||
if (tokenKind === SyntaxKind.GreaterThanToken) {
|
if (tokenKind === SyntaxKind.GreaterThanToken) {
|
||||||
|
@ -4187,7 +4216,8 @@ module TypeScript.Parser {
|
||||||
case ListParsingState.IndexSignature_Parameters: return isParameter();
|
case ListParsingState.IndexSignature_Parameters: return isParameter();
|
||||||
case ListParsingState.TypeArgumentList_Types: return isType();
|
case ListParsingState.TypeArgumentList_Types: return isType();
|
||||||
case ListParsingState.TypeParameterList_TypeParameters: return isTypeParameter();
|
case ListParsingState.TypeParameterList_TypeParameters: return isTypeParameter();
|
||||||
default: throw Errors.invalidOperation();
|
case ListParsingState.TupleType_Types: return isType();
|
||||||
|
default: throw Errors.invalidOperation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4230,6 +4260,7 @@ module TypeScript.Parser {
|
||||||
case ListParsingState.IndexSignature_Parameters: return tryParseParameter();
|
case ListParsingState.IndexSignature_Parameters: return tryParseParameter();
|
||||||
case ListParsingState.TypeArgumentList_Types: return tryParseType();
|
case ListParsingState.TypeArgumentList_Types: return tryParseType();
|
||||||
case ListParsingState.TypeParameterList_TypeParameters: return tryParseTypeParameter();
|
case ListParsingState.TypeParameterList_TypeParameters: return tryParseTypeParameter();
|
||||||
|
case ListParsingState.TupleType_Types: return tryParseType();
|
||||||
default: throw Errors.invalidOperation();
|
default: throw Errors.invalidOperation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4254,6 +4285,7 @@ module TypeScript.Parser {
|
||||||
case ListParsingState.IndexSignature_Parameters: return getLocalizedText(DiagnosticCode.parameter, null);
|
case ListParsingState.IndexSignature_Parameters: return getLocalizedText(DiagnosticCode.parameter, null);
|
||||||
case ListParsingState.TypeArgumentList_Types: return getLocalizedText(DiagnosticCode.type, null);
|
case ListParsingState.TypeArgumentList_Types: return getLocalizedText(DiagnosticCode.type, null);
|
||||||
case ListParsingState.TypeParameterList_TypeParameters: return getLocalizedText(DiagnosticCode.type_parameter, null);
|
case ListParsingState.TypeParameterList_TypeParameters: return getLocalizedText(DiagnosticCode.type_parameter, null);
|
||||||
|
case ListParsingState.TupleType_Types: return getLocalizedText(DiagnosticCode.type, null);
|
||||||
case ListParsingState.ArrayLiteralExpression_AssignmentExpressions: return getLocalizedText(DiagnosticCode.expression, null);
|
case ListParsingState.ArrayLiteralExpression_AssignmentExpressions: return getLocalizedText(DiagnosticCode.expression, null);
|
||||||
default: throw Errors.invalidOperation();
|
default: throw Errors.invalidOperation();
|
||||||
}
|
}
|
||||||
|
@ -4376,9 +4408,10 @@ module TypeScript.Parser {
|
||||||
IndexSignature_Parameters = 18,
|
IndexSignature_Parameters = 18,
|
||||||
TypeArgumentList_Types = 19,
|
TypeArgumentList_Types = 19,
|
||||||
TypeParameterList_TypeParameters = 20,
|
TypeParameterList_TypeParameters = 20,
|
||||||
|
TupleType_Types = 21,
|
||||||
|
|
||||||
FirstListParsingState = SourceUnit_ModuleElements,
|
FirstListParsingState = SourceUnit_ModuleElements,
|
||||||
LastListParsingState = TypeParameterList_TypeParameters,
|
LastListParsingState = TupleType_Types,
|
||||||
}
|
}
|
||||||
|
|
||||||
// We keep the parser around as a singleton. This is because calling createParser is actually
|
// We keep the parser around as a singleton. This is because calling createParser is actually
|
||||||
|
|
|
@ -421,6 +421,12 @@ module TypeScript.PrettyPrinter {
|
||||||
this.appendToken(node.greaterThanToken);
|
this.appendToken(node.greaterThanToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public visitTupleType(node: TupleTypeSyntax): void {
|
||||||
|
this.appendToken(node.openBracketToken);
|
||||||
|
this.appendSeparatorSpaceList(node.types);
|
||||||
|
this.appendToken(node.closeBracketToken);
|
||||||
|
}
|
||||||
|
|
||||||
public visitConstructorType(node: ConstructorTypeSyntax): void {
|
public visitConstructorType(node: ConstructorTypeSyntax): void {
|
||||||
this.appendToken(node.newKeyword);
|
this.appendToken(node.newKeyword);
|
||||||
this.ensureSpace();
|
this.ensureSpace();
|
||||||
|
|
|
@ -26,4 +26,15 @@ module TypeScript.SyntaxFacts {
|
||||||
var tokenKind = token.kind();
|
var tokenKind = token.kind();
|
||||||
return tokenKind === SyntaxKind.IdentifierName || SyntaxFacts.isAnyKeyword(tokenKind);
|
return tokenKind === SyntaxKind.IdentifierName || SyntaxFacts.isAnyKeyword(tokenKind);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isAccessibilityModifier(kind: SyntaxKind): boolean {
|
||||||
|
switch (kind) {
|
||||||
|
case SyntaxKind.PublicKeyword:
|
||||||
|
case SyntaxKind.PrivateKeyword:
|
||||||
|
case SyntaxKind.ProtectedKeyword:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -354,6 +354,17 @@ var definitions:ITypeDefinition[] = [
|
||||||
],
|
],
|
||||||
isTypeScriptSpecific: true
|
isTypeScriptSpecific: true
|
||||||
},
|
},
|
||||||
|
<any> {
|
||||||
|
name: 'TupleTypeSyntax',
|
||||||
|
baseType: 'ISyntaxNode',
|
||||||
|
interfaces: ['ITypeSyntax'],
|
||||||
|
children: [
|
||||||
|
<any>{ name: 'openBracketToken', isToken: true, excludeFromAST: true },
|
||||||
|
<any>{ name: 'types', isSeparatedList: true, elementType: 'ITypeSyntax' },
|
||||||
|
<any>{ name: 'closeBracketToken', isToken: true, excludeFromAST: true }
|
||||||
|
],
|
||||||
|
isTypeScriptSpecific: true
|
||||||
|
},
|
||||||
<any>{
|
<any>{
|
||||||
name: 'TypeAnnotationSyntax',
|
name: 'TypeAnnotationSyntax',
|
||||||
baseType: 'ISyntaxNode',
|
baseType: 'ISyntaxNode',
|
||||||
|
|
|
@ -158,6 +158,7 @@ module TypeScript {
|
||||||
ConstructorType,
|
ConstructorType,
|
||||||
GenericType,
|
GenericType,
|
||||||
TypeQuery,
|
TypeQuery,
|
||||||
|
TupleType,
|
||||||
|
|
||||||
// Module elements.
|
// Module elements.
|
||||||
InterfaceDeclaration,
|
InterfaceDeclaration,
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -84,6 +84,7 @@ module TypeScript {
|
||||||
private cacheSyntaxTreeInfo(): void {
|
private cacheSyntaxTreeInfo(): void {
|
||||||
// If we're not keeping around the syntax tree, store the diagnostics and line
|
// If we're not keeping around the syntax tree, store the diagnostics and line
|
||||||
// map so they don't have to be recomputed.
|
// map so they don't have to be recomputed.
|
||||||
|
var sourceUnit = this.sourceUnit();
|
||||||
var firstToken = firstSyntaxTreeToken(this);
|
var firstToken = firstSyntaxTreeToken(this);
|
||||||
var leadingTrivia = firstToken.leadingTrivia(this.text);
|
var leadingTrivia = firstToken.leadingTrivia(this.text);
|
||||||
|
|
||||||
|
@ -238,7 +239,7 @@ module TypeScript {
|
||||||
}
|
}
|
||||||
|
|
||||||
private checkParameterAccessibilityModifier(parameterList: ParameterListSyntax, modifier: ISyntaxToken, modifierIndex: number): boolean {
|
private checkParameterAccessibilityModifier(parameterList: ParameterListSyntax, modifier: ISyntaxToken, modifierIndex: number): boolean {
|
||||||
if (modifier.kind() !== SyntaxKind.PublicKeyword && modifier.kind() !== SyntaxKind.PrivateKeyword) {
|
if (!SyntaxFacts.isAccessibilityModifier(modifier.kind())) {
|
||||||
this.pushDiagnostic(modifier, DiagnosticCode._0_modifier_cannot_appear_on_a_parameter, [modifier.text()]);
|
this.pushDiagnostic(modifier, DiagnosticCode._0_modifier_cannot_appear_on_a_parameter, [modifier.text()]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -320,6 +321,15 @@ module TypeScript {
|
||||||
super.visitTypeArgumentList(node);
|
super.visitTypeArgumentList(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public visitTupleType(node: TupleTypeSyntax): void {
|
||||||
|
if (this.checkForTrailingComma(node.types) ||
|
||||||
|
this.checkForAtLeastOneElement(node, node.types, node.openBracketToken, getLocalizedText(DiagnosticCode.type, null))) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
super.visitTupleType(node);
|
||||||
|
}
|
||||||
|
|
||||||
public visitTypeParameterList(node: TypeParameterListSyntax): void {
|
public visitTypeParameterList(node: TypeParameterListSyntax): void {
|
||||||
if (this.checkForTrailingComma(node.typeParameters) ||
|
if (this.checkForTrailingComma(node.typeParameters) ||
|
||||||
this.checkForAtLeastOneElement(node, node.typeParameters, node.lessThanToken, getLocalizedText(DiagnosticCode.type_parameter, null))) {
|
this.checkForAtLeastOneElement(node, node.typeParameters, node.lessThanToken, getLocalizedText(DiagnosticCode.type_parameter, null))) {
|
||||||
|
@ -514,9 +524,7 @@ module TypeScript {
|
||||||
|
|
||||||
for (var i = 0, n = list.length; i < n; i++) {
|
for (var i = 0, n = list.length; i < n; i++) {
|
||||||
var modifier = list[i];
|
var modifier = list[i];
|
||||||
if (modifier.kind() === SyntaxKind.PublicKeyword ||
|
if (SyntaxFacts.isAccessibilityModifier(modifier.kind())) {
|
||||||
modifier.kind() === SyntaxKind.PrivateKeyword) {
|
|
||||||
|
|
||||||
if (seenAccessibilityModifier) {
|
if (seenAccessibilityModifier) {
|
||||||
this.pushDiagnostic(modifier, DiagnosticCode.Accessibility_modifier_already_seen);
|
this.pushDiagnostic(modifier, DiagnosticCode.Accessibility_modifier_already_seen);
|
||||||
return true;
|
return true;
|
||||||
|
@ -751,8 +759,7 @@ module TypeScript {
|
||||||
|
|
||||||
for (var i = 0, n = modifiers.length; i < n; i++) {
|
for (var i = 0, n = modifiers.length; i < n; i++) {
|
||||||
var modifier = modifiers[i];
|
var modifier = modifiers[i];
|
||||||
if (modifier.kind() === SyntaxKind.PublicKeyword ||
|
if (SyntaxFacts.isAccessibilityModifier(modifier.kind()) ||
|
||||||
modifier.kind() === SyntaxKind.PrivateKeyword ||
|
|
||||||
modifier.kind() === SyntaxKind.StaticKeyword) {
|
modifier.kind() === SyntaxKind.StaticKeyword) {
|
||||||
this.pushDiagnostic(modifier, DiagnosticCode._0_modifier_cannot_appear_on_a_module_element, [modifier.text()]);
|
this.pushDiagnostic(modifier, DiagnosticCode._0_modifier_cannot_appear_on_a_module_element, [modifier.text()]);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -13,6 +13,7 @@ module TypeScript {
|
||||||
case SyntaxKind.ConstructorType: return visitor.visitConstructorType(<ConstructorTypeSyntax>element);
|
case SyntaxKind.ConstructorType: return visitor.visitConstructorType(<ConstructorTypeSyntax>element);
|
||||||
case SyntaxKind.GenericType: return visitor.visitGenericType(<GenericTypeSyntax>element);
|
case SyntaxKind.GenericType: return visitor.visitGenericType(<GenericTypeSyntax>element);
|
||||||
case SyntaxKind.TypeQuery: return visitor.visitTypeQuery(<TypeQuerySyntax>element);
|
case SyntaxKind.TypeQuery: return visitor.visitTypeQuery(<TypeQuerySyntax>element);
|
||||||
|
case SyntaxKind.TupleType: return visitor.visitTupleType(<TupleTypeSyntax>element);
|
||||||
case SyntaxKind.InterfaceDeclaration: return visitor.visitInterfaceDeclaration(<InterfaceDeclarationSyntax>element);
|
case SyntaxKind.InterfaceDeclaration: return visitor.visitInterfaceDeclaration(<InterfaceDeclarationSyntax>element);
|
||||||
case SyntaxKind.FunctionDeclaration: return visitor.visitFunctionDeclaration(<FunctionDeclarationSyntax>element);
|
case SyntaxKind.FunctionDeclaration: return visitor.visitFunctionDeclaration(<FunctionDeclarationSyntax>element);
|
||||||
case SyntaxKind.ModuleDeclaration: return visitor.visitModuleDeclaration(<ModuleDeclarationSyntax>element);
|
case SyntaxKind.ModuleDeclaration: return visitor.visitModuleDeclaration(<ModuleDeclarationSyntax>element);
|
||||||
|
@ -109,6 +110,7 @@ module TypeScript {
|
||||||
visitConstructorType(node: ConstructorTypeSyntax): any;
|
visitConstructorType(node: ConstructorTypeSyntax): any;
|
||||||
visitGenericType(node: GenericTypeSyntax): any;
|
visitGenericType(node: GenericTypeSyntax): any;
|
||||||
visitTypeQuery(node: TypeQuerySyntax): any;
|
visitTypeQuery(node: TypeQuerySyntax): any;
|
||||||
|
visitTupleType(node: TupleTypeSyntax): any;
|
||||||
visitInterfaceDeclaration(node: InterfaceDeclarationSyntax): any;
|
visitInterfaceDeclaration(node: InterfaceDeclarationSyntax): any;
|
||||||
visitFunctionDeclaration(node: FunctionDeclarationSyntax): any;
|
visitFunctionDeclaration(node: FunctionDeclarationSyntax): any;
|
||||||
visitModuleDeclaration(node: ModuleDeclarationSyntax): any;
|
visitModuleDeclaration(node: ModuleDeclarationSyntax): any;
|
||||||
|
|
|
@ -103,6 +103,12 @@ module TypeScript {
|
||||||
this.visitNodeOrToken(node.name);
|
this.visitNodeOrToken(node.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public visitTupleType(node: TupleTypeSyntax): void {
|
||||||
|
this.visitToken(node.openBracketToken);
|
||||||
|
this.visitSeparatedList(node.types);
|
||||||
|
this.visitToken(node.closeBracketToken);
|
||||||
|
}
|
||||||
|
|
||||||
public visitInterfaceDeclaration(node: InterfaceDeclarationSyntax): void {
|
public visitInterfaceDeclaration(node: InterfaceDeclarationSyntax): void {
|
||||||
this.visitList(node.modifiers);
|
this.visitList(node.modifiers);
|
||||||
this.visitToken(node.interfaceKeyword);
|
this.visitToken(node.interfaceKeyword);
|
||||||
|
|
11
tests/baselines/reference/Protected1.errors.txt
Normal file
11
tests/baselines/reference/Protected1.errors.txt
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts(1,11): error TS1005: ';' expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts(1,1): error TS2304: Cannot find name 'protected'.
|
||||||
|
|
||||||
|
|
||||||
|
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts (2 errors) ====
|
||||||
|
protected class C {
|
||||||
|
~~~~~
|
||||||
|
!!! error TS1005: ';' expected.
|
||||||
|
~~~~~~~~~
|
||||||
|
!!! error TS2304: Cannot find name 'protected'.
|
||||||
|
}
|
11
tests/baselines/reference/Protected2.errors.txt
Normal file
11
tests/baselines/reference/Protected2.errors.txt
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts(1,11): error TS1005: ';' expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts(1,1): error TS2304: Cannot find name 'protected'.
|
||||||
|
|
||||||
|
|
||||||
|
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts (2 errors) ====
|
||||||
|
protected module M {
|
||||||
|
~~~~~~
|
||||||
|
!!! error TS1005: ';' expected.
|
||||||
|
~~~~~~~~~
|
||||||
|
!!! error TS2304: Cannot find name 'protected'.
|
||||||
|
}
|
24
tests/baselines/reference/Protected3.errors.txt
Normal file
24
tests/baselines/reference/Protected3.errors.txt
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts(2,3): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts(2,13): error TS1005: ';' expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts(2,27): error TS1005: ';' expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts(3,1): error TS1128: Declaration or statement expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts(2,3): error TS2304: Cannot find name 'protected'.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts(2,13): error TS2304: Cannot find name 'constructor'.
|
||||||
|
|
||||||
|
|
||||||
|
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts (6 errors) ====
|
||||||
|
class C {
|
||||||
|
protected constructor() { }
|
||||||
|
~~~~~~~~~
|
||||||
|
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||||
|
~~~~~~~~~~~
|
||||||
|
!!! error TS1005: ';' expected.
|
||||||
|
~
|
||||||
|
!!! error TS1005: ';' expected.
|
||||||
|
~~~~~~~~~
|
||||||
|
!!! error TS2304: Cannot find name 'protected'.
|
||||||
|
~~~~~~~~~~~
|
||||||
|
!!! error TS2304: Cannot find name 'constructor'.
|
||||||
|
}
|
||||||
|
~
|
||||||
|
!!! error TS1128: Declaration or statement expected.
|
24
tests/baselines/reference/Protected4.errors.txt
Normal file
24
tests/baselines/reference/Protected4.errors.txt
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts(2,3): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts(2,13): error TS1005: ';' expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts(2,24): error TS1005: ';' expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts(3,1): error TS1128: Declaration or statement expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts(2,3): error TS2304: Cannot find name 'protected'.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts(2,20): error TS2304: Cannot find name 'm'.
|
||||||
|
|
||||||
|
|
||||||
|
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts (6 errors) ====
|
||||||
|
class C {
|
||||||
|
protected public m() { }
|
||||||
|
~~~~~~~~~
|
||||||
|
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||||
|
~~~~~~
|
||||||
|
!!! error TS1005: ';' expected.
|
||||||
|
~
|
||||||
|
!!! error TS1005: ';' expected.
|
||||||
|
~~~~~~~~~
|
||||||
|
!!! error TS2304: Cannot find name 'protected'.
|
||||||
|
~
|
||||||
|
!!! error TS2304: Cannot find name 'm'.
|
||||||
|
}
|
||||||
|
~
|
||||||
|
!!! error TS1128: Declaration or statement expected.
|
24
tests/baselines/reference/Protected5.errors.txt
Normal file
24
tests/baselines/reference/Protected5.errors.txt
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts(2,3): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts(2,13): error TS1005: ';' expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts(2,24): error TS1005: ';' expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts(3,1): error TS1128: Declaration or statement expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts(2,3): error TS2304: Cannot find name 'protected'.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts(2,20): error TS2304: Cannot find name 'm'.
|
||||||
|
|
||||||
|
|
||||||
|
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts (6 errors) ====
|
||||||
|
class C {
|
||||||
|
protected static m() { }
|
||||||
|
~~~~~~~~~
|
||||||
|
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||||
|
~~~~~~
|
||||||
|
!!! error TS1005: ';' expected.
|
||||||
|
~
|
||||||
|
!!! error TS1005: ';' expected.
|
||||||
|
~~~~~~~~~
|
||||||
|
!!! error TS2304: Cannot find name 'protected'.
|
||||||
|
~
|
||||||
|
!!! error TS2304: Cannot find name 'm'.
|
||||||
|
}
|
||||||
|
~
|
||||||
|
!!! error TS1128: Declaration or statement expected.
|
27
tests/baselines/reference/Protected6.errors.txt
Normal file
27
tests/baselines/reference/Protected6.errors.txt
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts(2,3): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts(2,10): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts(2,20): error TS1005: ';' expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts(2,24): error TS1005: ';' expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts(3,1): error TS1128: Declaration or statement expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts(2,10): error TS2304: Cannot find name 'protected'.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts(2,20): error TS2304: Cannot find name 'm'.
|
||||||
|
|
||||||
|
|
||||||
|
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts (7 errors) ====
|
||||||
|
class C {
|
||||||
|
static protected m() { }
|
||||||
|
~~~~~~
|
||||||
|
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||||
|
~~~~~~~~~
|
||||||
|
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||||
|
~
|
||||||
|
!!! error TS1005: ';' expected.
|
||||||
|
~
|
||||||
|
!!! error TS1005: ';' expected.
|
||||||
|
~~~~~~~~~
|
||||||
|
!!! error TS2304: Cannot find name 'protected'.
|
||||||
|
~
|
||||||
|
!!! error TS2304: Cannot find name 'm'.
|
||||||
|
}
|
||||||
|
~
|
||||||
|
!!! error TS1128: Declaration or statement expected.
|
24
tests/baselines/reference/Protected7.errors.txt
Normal file
24
tests/baselines/reference/Protected7.errors.txt
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts(2,3): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts(2,13): error TS1005: ';' expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts(2,25): error TS1005: ';' expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts(3,1): error TS1128: Declaration or statement expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts(2,3): error TS2304: Cannot find name 'protected'.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts(2,21): error TS2304: Cannot find name 'm'.
|
||||||
|
|
||||||
|
|
||||||
|
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts (6 errors) ====
|
||||||
|
class C {
|
||||||
|
protected private m() { }
|
||||||
|
~~~~~~~~~
|
||||||
|
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||||
|
~~~~~~~
|
||||||
|
!!! error TS1005: ';' expected.
|
||||||
|
~
|
||||||
|
!!! error TS1005: ';' expected.
|
||||||
|
~~~~~~~~~
|
||||||
|
!!! error TS2304: Cannot find name 'protected'.
|
||||||
|
~
|
||||||
|
!!! error TS2304: Cannot find name 'm'.
|
||||||
|
}
|
||||||
|
~
|
||||||
|
!!! error TS1128: Declaration or statement expected.
|
7
tests/baselines/reference/Protected8.js
Normal file
7
tests/baselines/reference/Protected8.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
//// [Protected8.ts]
|
||||||
|
interface I {
|
||||||
|
protected
|
||||||
|
p
|
||||||
|
}
|
||||||
|
|
||||||
|
//// [Protected8.js]
|
10
tests/baselines/reference/Protected8.types
Normal file
10
tests/baselines/reference/Protected8.types
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
=== tests/cases/conformance/parser/ecmascript5/Protected/Protected8.ts ===
|
||||||
|
interface I {
|
||||||
|
>I : I
|
||||||
|
|
||||||
|
protected
|
||||||
|
>protected : any
|
||||||
|
|
||||||
|
p
|
||||||
|
>p : any
|
||||||
|
}
|
12
tests/baselines/reference/Protected9.errors.txt
Normal file
12
tests/baselines/reference/Protected9.errors.txt
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts(2,26): error TS1005: '=' expected.
|
||||||
|
tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts(2,26): error TS2304: Cannot find name 'p'.
|
||||||
|
|
||||||
|
|
||||||
|
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts (2 errors) ====
|
||||||
|
class C {
|
||||||
|
constructor(protected p) { }
|
||||||
|
~
|
||||||
|
!!! error TS1005: '=' expected.
|
||||||
|
~
|
||||||
|
!!! error TS2304: Cannot find name 'p'.
|
||||||
|
}
|
5
tests/baselines/reference/TupleType1.js
Normal file
5
tests/baselines/reference/TupleType1.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
//// [TupleType1.ts]
|
||||||
|
var v: [number]
|
||||||
|
|
||||||
|
//// [TupleType1.js]
|
||||||
|
var v;
|
4
tests/baselines/reference/TupleType1.types
Normal file
4
tests/baselines/reference/TupleType1.types
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
=== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType1.ts ===
|
||||||
|
var v: [number]
|
||||||
|
>v : [number]
|
||||||
|
|
5
tests/baselines/reference/TupleType2.js
Normal file
5
tests/baselines/reference/TupleType2.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
//// [TupleType2.ts]
|
||||||
|
var v: [number, string]
|
||||||
|
|
||||||
|
//// [TupleType2.js]
|
||||||
|
var v;
|
4
tests/baselines/reference/TupleType2.types
Normal file
4
tests/baselines/reference/TupleType2.types
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
=== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType2.ts ===
|
||||||
|
var v: [number, string]
|
||||||
|
>v : [number, string]
|
||||||
|
|
7
tests/baselines/reference/TupleType3.errors.txt
Normal file
7
tests/baselines/reference/TupleType3.errors.txt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType3.ts(1,8): error TS1122: A tuple type element list cannot be empty.
|
||||||
|
|
||||||
|
|
||||||
|
==== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType3.ts (1 errors) ====
|
||||||
|
var v: []
|
||||||
|
~~
|
||||||
|
!!! error TS1122: A tuple type element list cannot be empty.
|
7
tests/baselines/reference/TupleType4.errors.txt
Normal file
7
tests/baselines/reference/TupleType4.errors.txt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType4.ts(1,9): error TS1005: ']' expected.
|
||||||
|
|
||||||
|
|
||||||
|
==== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType4.ts (1 errors) ====
|
||||||
|
var v: [
|
||||||
|
|
||||||
|
!!! error TS1005: ']' expected.
|
7
tests/baselines/reference/TupleType5.errors.txt
Normal file
7
tests/baselines/reference/TupleType5.errors.txt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType5.ts(1,15): error TS1009: Trailing comma not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
==== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType5.ts (1 errors) ====
|
||||||
|
var v: [number,]
|
||||||
|
~
|
||||||
|
!!! error TS1009: Trailing comma not allowed.
|
|
@ -0,0 +1,2 @@
|
||||||
|
protected class C {
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
protected module M {
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
class C {
|
||||||
|
protected constructor() { }
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
class C {
|
||||||
|
protected public m() { }
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
class C {
|
||||||
|
protected static m() { }
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
class C {
|
||||||
|
static protected m() { }
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
class C {
|
||||||
|
protected private m() { }
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
interface I {
|
||||||
|
protected
|
||||||
|
p
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
class C {
|
||||||
|
constructor(protected p) { }
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
var v: [number]
|
|
@ -0,0 +1 @@
|
||||||
|
var v: [number, string]
|
|
@ -0,0 +1 @@
|
||||||
|
var v: []
|
|
@ -0,0 +1 @@
|
||||||
|
var v: [
|
|
@ -0,0 +1 @@
|
||||||
|
var v: [number,]
|
Loading…
Reference in a new issue