Merge pull request #1334 from Microsoft/tokens

Tokens
This commit is contained in:
CyrusNajmabadi
2014-12-02 02:28:30 -08:00
36 changed files with 649 additions and 518 deletions
+5 -5
View File
@@ -348,8 +348,8 @@ module ts {
bindChildren(node, symbolKind, isBlockScopeContainer);
}
function bindCatchVariableDeclaration(node: CatchBlock) {
var symbol = createSymbol(SymbolFlags.FunctionScopedVariable, node.variable.text || "__missing");
function bindCatchVariableDeclaration(node: CatchClause) {
var symbol = createSymbol(SymbolFlags.FunctionScopedVariable, node.name.text || "__missing");
addDeclarationToSymbol(symbol, node, SymbolFlags.FunctionScopedVariable);
var saveParent = parent;
var savedBlockScopeContainer = blockScopeContainer;
@@ -444,8 +444,8 @@ module ts {
case SyntaxKind.ArrowFunction:
bindAnonymousDeclaration(<FunctionExpression>node, SymbolFlags.Function, "__function", /*isBlockScopeContainer*/ true);
break;
case SyntaxKind.CatchBlock:
bindCatchVariableDeclaration(<CatchBlock>node);
case SyntaxKind.CatchClause:
bindCatchVariableDeclaration(<CatchClause>node);
break;
case SyntaxKind.ClassDeclaration:
bindDeclaration(<Declaration>node, SymbolFlags.Class, SymbolFlags.ClassExcludes, /*isBlockScopeContainer*/ false);
@@ -478,7 +478,7 @@ module ts {
case SyntaxKind.Block:
case SyntaxKind.TryBlock:
case SyntaxKind.CatchBlock:
case SyntaxKind.CatchClause:
case SyntaxKind.FinallyBlock:
case SyntaxKind.ForStatement:
case SyntaxKind.ForInStatement:
+50 -31
View File
@@ -415,8 +415,8 @@ module ts {
break loop;
}
break;
case SyntaxKind.CatchBlock:
var id = (<CatchBlock>location).variable;
case SyntaxKind.CatchClause:
var id = (<CatchClause>location).name;
if (name === id.text) {
result = location.symbol;
break loop;
@@ -756,7 +756,7 @@ module ts {
//
// x is an optional parameter, but it is a required property.
return propertySymbol.valueDeclaration &&
propertySymbol.valueDeclaration.flags & NodeFlags.QuestionMark &&
hasQuestionToken(propertySymbol.valueDeclaration) &&
propertySymbol.valueDeclaration.kind !== SyntaxKind.Parameter;
}
@@ -1437,11 +1437,11 @@ module ts {
}
function buildParameterDisplay(p: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) {
if (getDeclarationFlagsFromSymbol(p) & NodeFlags.Rest) {
if (hasDotDotDotToken(p.valueDeclaration)) {
writePunctuation(writer, SyntaxKind.DotDotDotToken);
}
appendSymbolNameOnly(p, writer);
if (p.valueDeclaration.flags & NodeFlags.QuestionMark || (<VariableDeclaration>p.valueDeclaration).initializer) {
if (hasQuestionToken(p.valueDeclaration) || (<VariableDeclaration>p.valueDeclaration).initializer) {
writePunctuation(writer, SyntaxKind.QuestionToken);
}
writePunctuation(writer, SyntaxKind.ColonToken);
@@ -1711,7 +1711,7 @@ module ts {
}
// Rest parameters default to type any[], other parameters default to type any
var type = declaration.flags & NodeFlags.Rest ? createArrayType(anyType) : anyType;
var type = hasDotDotDotToken(declaration) ? createArrayType(anyType) : anyType;
checkImplicitAny(type);
return type;
@@ -1733,9 +1733,9 @@ module ts {
var diagnostic = Diagnostics.Member_0_implicitly_has_an_1_type;
break;
case SyntaxKind.Parameter:
var diagnostic = declaration.flags & NodeFlags.Rest ?
Diagnostics.Rest_parameter_0_implicitly_has_an_any_type :
Diagnostics.Parameter_0_implicitly_has_an_1_type;
var diagnostic = hasDotDotDotToken(declaration)
? Diagnostics.Rest_parameter_0_implicitly_has_an_any_type
: Diagnostics.Parameter_0_implicitly_has_an_1_type;
break;
default:
var diagnostic = Diagnostics.Variable_0_implicitly_has_an_1_type;
@@ -1753,7 +1753,7 @@ module ts {
}
// Handle catch clause variables
var declaration = symbol.valueDeclaration;
if (declaration.kind === SyntaxKind.CatchBlock) {
if (declaration.kind === SyntaxKind.CatchClause) {
return links.type = anyType;
}
// Handle variable, parameter or property
@@ -2527,7 +2527,7 @@ module ts {
hasStringLiterals = true;
}
if (minArgumentCount < 0) {
if (param.initializer || param.flags & (NodeFlags.QuestionMark | NodeFlags.Rest)) {
if (param.initializer || param.questionToken || param.dotDotDotToken) {
minArgumentCount = i;
}
}
@@ -4375,7 +4375,7 @@ module ts {
case SyntaxKind.ThrowStatement:
case SyntaxKind.TryStatement:
case SyntaxKind.TryBlock:
case SyntaxKind.CatchBlock:
case SyntaxKind.CatchClause:
case SyntaxKind.FinallyBlock:
return forEachChild(node, isAssignedIn);
}
@@ -6673,7 +6673,7 @@ module ts {
!(parameterDeclaration.parent.kind === SyntaxKind.Constructor && (<ConstructorDeclaration>parameterDeclaration.parent).body)) {
error(parameterDeclaration, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
}
if (parameterDeclaration.flags & NodeFlags.Rest) {
if (parameterDeclaration.dotDotDotToken) {
if (!isArrayType(getTypeOfSymbol(parameterDeclaration.symbol))) {
error(parameterDeclaration, Diagnostics.A_rest_parameter_must_be_of_an_array_type);
}
@@ -7020,20 +7020,23 @@ module ts {
return;
}
function getCanonicalOverload(overloads: Declaration[], implementation: FunctionLikeDeclaration) {
// Consider the canonical set of flags to be the flags of the bodyDeclaration or the first declaration
// Error on all deviations from this canonical set of flags
// The caveat is that if some overloads are defined in lib.d.ts, we don't want to
// report the errors on those. To achieve this, we will say that the implementation is
// the canonical signature only if it is in the same container as the first overload
var implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent;
return implementationSharesContainerWithFirstOverload ? implementation : overloads[0];
}
function checkFlagAgreementBetweenOverloads(overloads: Declaration[], implementation: FunctionLikeDeclaration, flagsToCheck: NodeFlags, someOverloadFlags: NodeFlags, allOverloadFlags: NodeFlags): void {
// Error if some overloads have a flag that is not shared by all overloads. To find the
// deviations, we XOR someOverloadFlags with allOverloadFlags
var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags;
if (someButNotAllOverloadFlags !== 0) {
// Consider the canonical set of flags to be the flags of the bodyDeclaration or the first declaration
// Error on all deviations from this canonical set of flags
// The caveat is that if some overloads are defined in lib.d.ts, we don't want to
// report the errors on those. To achieve this, we will say that the implementation is
// the canonical signature only if it is in the same container as the first overload
var implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent;
var canonicalFlags = implementationSharesContainerWithFirstOverload
? getEffectiveDeclarationFlags(implementation, flagsToCheck)
: getEffectiveDeclarationFlags(overloads[0], flagsToCheck);
var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck);
forEach(overloads, o => {
var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags;
if (deviation & NodeFlags.Export) {
@@ -7045,16 +7048,27 @@ module ts {
else if (deviation & (NodeFlags.Private | NodeFlags.Protected)) {
error(o.name, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
}
else if (deviation & NodeFlags.QuestionMark) {
});
}
}
function checkQuestionTokenAgreementBetweenOverloads(overloads: Declaration[], implementation: FunctionLikeDeclaration, someHaveQuestionToken: boolean, allHaveQuestionToken: boolean): void {
if (someHaveQuestionToken !== allHaveQuestionToken) {
var canonicalHasQuestionToken = hasQuestionToken(getCanonicalOverload(overloads, implementation));
forEach(overloads, o => {
var deviation = hasQuestionToken(o) !== canonicalHasQuestionToken;
if (deviation) {
error(o.name, Diagnostics.Overload_signatures_must_all_be_optional_or_required);
}
});
}
}
var flagsToCheck: NodeFlags = NodeFlags.Export | NodeFlags.Ambient | NodeFlags.Private | NodeFlags.Protected | NodeFlags.QuestionMark;
var flagsToCheck: NodeFlags = NodeFlags.Export | NodeFlags.Ambient | NodeFlags.Private | NodeFlags.Protected;
var someNodeFlags: NodeFlags = 0;
var allNodeFlags = flagsToCheck;
var someHaveQuestionToken = false;
var allHaveQuestionToken = true;
var hasOverloads = false;
var bodyDeclaration: FunctionLikeDeclaration;
var lastSeenNonAmbientDeclaration: FunctionLikeDeclaration;
@@ -7128,6 +7142,8 @@ module ts {
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
someNodeFlags |= currentNodeFlags;
allNodeFlags &= currentNodeFlags;
someHaveQuestionToken = someHaveQuestionToken || hasQuestionToken(node);
allHaveQuestionToken = allHaveQuestionToken && hasQuestionToken(node);
if (node.body && bodyDeclaration) {
if (isConstructor) {
@@ -7176,6 +7192,8 @@ module ts {
if (hasOverloads) {
checkFlagAgreementBetweenOverloads(declarations, bodyDeclaration, flagsToCheck, someNodeFlags, allNodeFlags);
checkQuestionTokenAgreementBetweenOverloads(declarations, bodyDeclaration, someHaveQuestionToken, allHaveQuestionToken);
if (bodyDeclaration) {
var signatures = getSignaturesOfSymbol(symbol);
var bodySignature = getSignatureFromDeclaration(bodyDeclaration);
@@ -7725,13 +7743,14 @@ module ts {
function checkSwitchStatement(node: SwitchStatement) {
var expressionType = checkExpression(node.expression);
forEach(node.clauses, clause => {
if (fullTypeCheck && clause.expression) {
if (fullTypeCheck && clause.kind === SyntaxKind.CaseClause) {
var caseClause = <CaseClause>clause;
// TypeScript 1.0 spec (April 2014):5.9
// In a 'switch' statement, each 'case' expression must be of a type that is assignable to or from the type of the 'switch' expression.
var caseType = checkExpression(clause.expression);
var caseType = checkExpression(caseClause.expression);
if (!isTypeAssignableTo(expressionType, caseType)) {
// check 'expressionType isAssignableTo caseType' failed, try the reversed check and report errors if it fails
checkTypeAssignableTo(caseType, expressionType, clause.expression, /*headMessage*/ undefined);
checkTypeAssignableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined);
}
}
forEach(clause.statements, checkSourceElement);
@@ -7748,7 +7767,7 @@ module ts {
function checkTryStatement(node: TryStatement) {
checkBlock(node.tryBlock);
if (node.catchBlock) checkBlock(node.catchBlock);
if (node.catchClause) checkBlock(node.catchClause.block);
if (node.finallyBlock) checkBlock(node.finallyBlock);
}
@@ -8586,7 +8605,7 @@ module ts {
case SyntaxKind.ThrowStatement:
case SyntaxKind.TryStatement:
case SyntaxKind.TryBlock:
case SyntaxKind.CatchBlock:
case SyntaxKind.CatchClause:
case SyntaxKind.FinallyBlock:
case SyntaxKind.VariableDeclaration:
case SyntaxKind.ClassDeclaration:
@@ -8748,8 +8767,8 @@ module ts {
copySymbol(location.symbol, meaning);
}
break;
case SyntaxKind.CatchBlock:
if ((<CatchBlock>location).variable.text) {
case SyntaxKind.CatchClause:
if ((<CatchClause>location).name.text) {
copySymbol(location.symbol, meaning);
}
break;
+14 -14
View File
@@ -943,7 +943,7 @@ module ts {
if (node.kind !== SyntaxKind.VariableDeclaration || resolver.isDeclarationVisible(node)) {
writeTextOfNode(currentSourceFile, node.name);
// If optional property emit ?
if (node.kind === SyntaxKind.Property && (node.flags & NodeFlags.QuestionMark)) {
if (node.kind === SyntaxKind.Property && hasQuestionToken(node)) {
write("?");
}
if (node.kind === SyntaxKind.Property && node.parent.kind === SyntaxKind.TypeLiteral) {
@@ -1124,7 +1124,7 @@ module ts {
}
else {
writeTextOfNode(currentSourceFile, node.name);
if (node.flags & NodeFlags.QuestionMark) {
if (hasQuestionToken(node)) {
write("?");
}
}
@@ -1252,11 +1252,11 @@ module ts {
function emitParameterDeclaration(node: ParameterDeclaration) {
increaseIndent();
emitJsDocComments(node);
if (node.flags & NodeFlags.Rest) {
if (node.dotDotDotToken) {
write("...");
}
writeTextOfNode(currentSourceFile, node.name);
if (node.initializer || (node.flags & NodeFlags.QuestionMark)) {
if (node.initializer || hasQuestionToken(node)) {
write("?");
}
decreaseIndent();
@@ -2142,8 +2142,8 @@ module ts {
return false;
case SyntaxKind.LabeledStatement:
return (<LabeledStatement>node.parent).label === node;
case SyntaxKind.CatchBlock:
return (<CatchBlock>node.parent).variable === node;
case SyntaxKind.CatchClause:
return (<CatchClause>node.parent).name === node;
}
}
@@ -2624,7 +2624,7 @@ module ts {
function emitCaseOrDefaultClause(node: CaseOrDefaultClause) {
if (node.kind === SyntaxKind.CaseClause) {
write("case ");
emit(node.expression);
emit((<CaseClause>node).expression);
write(":");
}
else {
@@ -2650,7 +2650,7 @@ module ts {
function emitTryStatement(node: TryStatement) {
write("try ");
emit(node.tryBlock);
emit(node.catchBlock);
emit(node.catchClause);
if (node.finallyBlock) {
writeLine();
write("finally ");
@@ -2658,15 +2658,15 @@ module ts {
}
}
function emitCatchBlock(node: CatchBlock) {
function emitCatchClause(node: CatchClause) {
writeLine();
var endPos = emitToken(SyntaxKind.CatchKeyword, node.pos);
write(" ");
emitToken(SyntaxKind.OpenParenToken, endPos);
emit(node.variable);
emitToken(SyntaxKind.CloseParenToken, node.variable.end);
emit(node.name);
emitToken(SyntaxKind.CloseParenToken, node.name.end);
write(" ");
emitBlock(node);
emitBlock(node.block);
}
function emitDebuggerStatement(node: Node) {
@@ -3599,8 +3599,8 @@ module ts {
return emitThrowStatement(<ThrowStatement>node);
case SyntaxKind.TryStatement:
return emitTryStatement(<TryStatement>node);
case SyntaxKind.CatchBlock:
return emitCatchBlock(<CatchBlock>node);
case SyntaxKind.CatchClause:
return emitCatchClause(<CatchClause>node);
case SyntaxKind.DebuggerStatement:
return emitDebuggerStatement(node);
case SyntaxKind.VariableDeclaration:
+434 -336
View File
File diff suppressed because it is too large Load Diff
+21 -8
View File
@@ -208,7 +208,6 @@ module ts {
ThrowStatement,
TryStatement,
TryBlock,
CatchBlock,
FinallyBlock,
DebuggerStatement,
VariableDeclaration,
@@ -222,12 +221,16 @@ module ts {
ModuleBlock,
ImportDeclaration,
ExportAssignment,
// Module references
ExternalModuleReference,
// Clauses
CaseClause,
DefaultClause,
HeritageClause,
CatchClause,
// Property assignments
PropertyAssignment,
ShorthandPropertyAssignment,
@@ -272,8 +275,6 @@ module ts {
export const enum NodeFlags {
Export = 0x00000001, // Declarations
Ambient = 0x00000002, // Declarations
QuestionMark = 0x00000004, // Parameter/Property/Method
Rest = 0x00000008, // Parameter
Public = 0x00000010, // Property/Method
Private = 0x00000020, // Property/Method
Protected = 0x00000040, // Property/Method
@@ -318,7 +319,7 @@ module ts {
hasTrailingComma?: boolean;
}
export interface ModifiersArray extends Array<Node> {
export interface ModifiersArray extends NodeArray<Node> {
flags: number;
}
@@ -369,12 +370,15 @@ module ts {
}
export interface ParameterDeclaration extends Declaration {
dotDotDotToken?: Node;
name: Identifier;
questionToken?: Node;
type?: TypeNode | StringLiteralExpression;
initializer?: Expression;
}
export interface PropertyDeclaration extends Declaration, ClassElement {
questionToken?: Node;
type?: TypeNode;
initializer?: Expression;
}
@@ -384,6 +388,7 @@ module ts {
export interface ShortHandPropertyDeclaration extends Declaration {
name: Identifier;
questionToken?: Node;
}
/**
@@ -398,6 +403,7 @@ module ts {
_functionLikeDeclarationBrand: any;
asteriskToken?: Node;
questionToken?: Node;
body?: Block | Expression;
}
@@ -668,11 +674,17 @@ module ts {
clauses: NodeArray<CaseOrDefaultClause>;
}
export interface CaseOrDefaultClause extends Node {
export interface CaseClause extends Node {
expression?: Expression;
statements: NodeArray<Statement>;
}
export interface DefaultClause extends Node {
statements: NodeArray<Statement>;
}
export type CaseOrDefaultClause = CaseClause | DefaultClause;
export interface LabeledStatement extends Statement {
label: Identifier;
statement: Statement;
@@ -684,13 +696,14 @@ module ts {
export interface TryStatement extends Statement {
tryBlock: Block;
catchBlock?: CatchBlock;
catchClause?: CatchClause;
finallyBlock?: Block;
}
export interface CatchBlock extends Block, Declaration {
variable: Identifier;
export interface CatchClause extends Declaration {
name: Identifier;
type?: TypeNode;
block: Block;
}
export interface ModuleElement extends Node {
+5 -3
View File
@@ -106,11 +106,13 @@ module ts.BreakpointResolver {
case SyntaxKind.Block:
case SyntaxKind.TryBlock:
case SyntaxKind.CatchBlock:
case SyntaxKind.FinallyBlock:
case SyntaxKind.ModuleBlock:
return spanInBlock(<Block>node);
case SyntaxKind.CatchClause:
return spanInBlock((<CatchClause>node).block);
case SyntaxKind.ExpressionStatement:
// span on the expression
return textSpan((<ExpressionStatement>node).expression);
@@ -297,7 +299,7 @@ module ts.BreakpointResolver {
function canHaveSpanInParameterDeclaration(parameter: ParameterDeclaration): boolean {
// Breakpoint is possible on parameter only if it has initializer, is a rest parameter, or has public or private modifier
return !!parameter.initializer || !!(parameter.flags & NodeFlags.Rest) ||
return !!parameter.initializer || parameter.dotDotDotToken !== undefined ||
!!(parameter.flags & NodeFlags.Public) || !!(parameter.flags & NodeFlags.Private);
}
@@ -420,7 +422,7 @@ module ts.BreakpointResolver {
case SyntaxKind.Block:
case SyntaxKind.TryBlock:
case SyntaxKind.CatchBlock:
case SyntaxKind.CatchClause:
case SyntaxKind.FinallyBlock:
return spanInNode((<Block>node.parent).statements[(<Block>node.parent).statements.length - 1]);;
+3 -3
View File
@@ -155,10 +155,11 @@ module ts.formatting {
case SyntaxKind.SourceFile:
case SyntaxKind.Block:
case SyntaxKind.TryBlock:
case SyntaxKind.CatchBlock:
case SyntaxKind.FinallyBlock:
case SyntaxKind.ModuleBlock:
return rangeContainsRange((<Block>parent).statements, node)
return rangeContainsRange((<Block>parent).statements, node);
case SyntaxKind.CatchClause:
return rangeContainsRange((<CatchClause>parent).block.statements, node);
}
return false;
@@ -898,7 +899,6 @@ module ts.formatting {
case SyntaxKind.Block:
case SyntaxKind.FunctionBlock:
case SyntaxKind.TryBlock:
case SyntaxKind.CatchBlock:
case SyntaxKind.FinallyBlock:
case SyntaxKind.ModuleBlock:
return true;
+2 -3
View File
@@ -525,7 +525,6 @@ module ts.formatting {
case SyntaxKind.SwitchStatement:
case SyntaxKind.ObjectLiteralExpression:
case SyntaxKind.TryBlock:
case SyntaxKind.CatchBlock:
case SyntaxKind.FinallyBlock:
case SyntaxKind.FunctionBlock:
case SyntaxKind.ModuleBlock:
@@ -581,7 +580,7 @@ module ts.formatting {
case SyntaxKind.EnumDeclaration:
case SyntaxKind.Block:
case SyntaxKind.TryBlock:
case SyntaxKind.CatchBlock:
case SyntaxKind.CatchClause:
case SyntaxKind.FinallyBlock:
case SyntaxKind.FunctionBlock:
case SyntaxKind.ModuleBlock:
@@ -603,7 +602,7 @@ module ts.formatting {
case SyntaxKind.WithStatement:
// TODO
// case SyntaxKind.ElseClause:
case SyntaxKind.CatchBlock:
case SyntaxKind.CatchClause:
case SyntaxKind.FinallyBlock:
return true;
+2 -2
View File
@@ -79,7 +79,8 @@ module ts {
parent.kind === SyntaxKind.ForStatement ||
parent.kind === SyntaxKind.IfStatement ||
parent.kind === SyntaxKind.WhileStatement ||
parent.kind === SyntaxKind.WithStatement) {
parent.kind === SyntaxKind.WithStatement ||
parent.kind === SyntaxKind.CatchClause) {
addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n));
}
@@ -100,7 +101,6 @@ module ts {
case SyntaxKind.FunctionBlock:
case SyntaxKind.ModuleBlock:
case SyntaxKind.TryBlock:
case SyntaxKind.CatchBlock:
case SyntaxKind.FinallyBlock:
var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
+9 -9
View File
@@ -2576,7 +2576,7 @@ module ts {
isFunction(containingNodeKind);
case SyntaxKind.OpenParenToken:
return containingNodeKind === SyntaxKind.CatchBlock ||
return containingNodeKind === SyntaxKind.CatchClause ||
isFunction(containingNodeKind);
case SyntaxKind.OpenBraceToken:
@@ -3567,8 +3567,8 @@ module ts {
else if (node.kind === SyntaxKind.TryStatement) {
var tryStatement = <TryStatement>node;
if (tryStatement.catchBlock) {
aggregate(tryStatement.catchBlock);
if (tryStatement.catchClause) {
aggregate(tryStatement.catchClause);
}
else {
// Exceptions thrown within a try block lacking a catch clause
@@ -3607,7 +3607,7 @@ module ts {
if (parent.kind === SyntaxKind.TryStatement) {
var tryStatement = <TryStatement>parent;
if (tryStatement.tryBlock === child && tryStatement.catchBlock) {
if (tryStatement.tryBlock === child && tryStatement.catchClause) {
return child;
}
}
@@ -3623,8 +3623,8 @@ module ts {
pushKeywordIf(keywords, tryStatement.getFirstToken(), SyntaxKind.TryKeyword);
if (tryStatement.catchBlock) {
pushKeywordIf(keywords, tryStatement.catchBlock.getFirstToken(), SyntaxKind.CatchKeyword);
if (tryStatement.catchClause) {
pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), SyntaxKind.CatchKeyword);
}
if (tryStatement.finallyBlock) {
@@ -3836,8 +3836,8 @@ module ts {
}
forEach(nodes, node => {
if (node.flags & modifierFlag) {
forEach(node.getChildren(), child => pushKeywordIf(keywords, child, modifier));
if (node.modifiers && node.flags & modifierFlag) {
forEach(node.modifiers, child => pushKeywordIf(keywords, child, modifier));
}
});
@@ -4738,7 +4738,7 @@ module ts {
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
case SyntaxKind.ArrowFunction:
case SyntaxKind.CatchBlock:
case SyntaxKind.CatchClause:
return SemanticMeaning.Value;
case SyntaxKind.TypeParameter:
+1 -1
View File
@@ -524,7 +524,7 @@ module ts.SignatureHelp {
var displayParts = mapToDisplayParts(writer =>
typeInfoResolver.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation));
var isOptional = !!(parameter.valueDeclaration.flags & NodeFlags.QuestionMark);
var isOptional = hasQuestionToken(parameter.valueDeclaration);
return {
name: parameter.name,
+2 -2
View File
@@ -328,7 +328,6 @@ module ts.formatting {
case SyntaxKind.Block:
case SyntaxKind.FunctionBlock:
case SyntaxKind.TryBlock:
case SyntaxKind.CatchBlock:
case SyntaxKind.FinallyBlock:
case SyntaxKind.ModuleBlock:
case SyntaxKind.ObjectLiteralExpression:
@@ -404,12 +403,13 @@ module ts.formatting {
case SyntaxKind.EnumDeclaration:
case SyntaxKind.ObjectLiteralExpression:
case SyntaxKind.Block:
case SyntaxKind.CatchBlock:
case SyntaxKind.FinallyBlock:
case SyntaxKind.FunctionBlock:
case SyntaxKind.ModuleBlock:
case SyntaxKind.SwitchStatement:
return nodeEndsWith(n, SyntaxKind.CloseBraceToken, sourceFile);
case SyntaxKind.CatchClause:
return isCompletedNode((<CatchClause>n).block, sourceFile);
case SyntaxKind.ParenthesizedExpression:
case SyntaxKind.CallSignature:
case SyntaxKind.CallExpression:
@@ -1,14 +1,14 @@
tests/cases/compiler/accessorWithRestParam.ts(3,9): error TS1053: A 'set' accessor cannot have rest parameter.
tests/cases/compiler/accessorWithRestParam.ts(4,16): error TS1053: A 'set' accessor cannot have rest parameter.
tests/cases/compiler/accessorWithRestParam.ts(3,11): error TS1053: A 'set' accessor cannot have rest parameter.
tests/cases/compiler/accessorWithRestParam.ts(4,18): error TS1053: A 'set' accessor cannot have rest parameter.
==== tests/cases/compiler/accessorWithRestParam.ts (2 errors) ====
class C {
set X(...v) { }
~
~~~
!!! error TS1053: A 'set' accessor cannot have rest parameter.
static set X(...v2) { }
~
~~~
!!! error TS1053: A 'set' accessor cannot have rest parameter.
}
@@ -1,5 +1,5 @@
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(1,9): error TS1016: A required parameter cannot follow an optional parameter.
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(2,5): error TS1047: A rest parameter cannot be optional.
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(2,8): error TS1047: A rest parameter cannot be optional.
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(4,5): error TS1048: A rest parameter cannot have an initializer.
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(7,12): error TS1016: A required parameter cannot follow an optional parameter.
@@ -9,7 +9,7 @@ tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(7,12): error TS1016
~~~~
!!! error TS1016: A required parameter cannot follow an optional parameter.
(...arg?) => 102;
~~~
~
!!! error TS1047: A rest parameter cannot be optional.
(...arg) => 103;
(...arg:number [] = []) => 104;
@@ -1,6 +1,6 @@
tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts(2,27): error TS1016: A required parameter cannot follow an optional parameter.
tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts(5,38): error TS1016: A required parameter cannot follow an optional parameter.
tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts(9,28): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts(9,25): error TS1014: A rest parameter must be last in a parameter list.
==== tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts (3 errors) ====
@@ -17,7 +17,7 @@ tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts(9,28): error T
//Function overload signature with rest param followed by non-optional parameter
function fn5(x: string, ...y: any[], z: string);
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
function fn5() { }
@@ -1,5 +1,5 @@
tests/cases/compiler/indexSignatureTypeCheck.ts(14,6): error TS1019: An index signature parameter cannot have a question mark.
tests/cases/compiler/indexSignatureTypeCheck.ts(15,9): error TS1017: An index signature cannot have a rest parameter.
tests/cases/compiler/indexSignatureTypeCheck.ts(14,8): error TS1019: An index signature parameter cannot have a question mark.
tests/cases/compiler/indexSignatureTypeCheck.ts(15,6): error TS1017: An index signature cannot have a rest parameter.
tests/cases/compiler/indexSignatureTypeCheck.ts(16,6): error TS1096: An index signature must have exactly one parameter.
tests/cases/compiler/indexSignatureTypeCheck.ts(17,6): error TS1096: An index signature must have exactly one parameter.
@@ -19,10 +19,10 @@ tests/cases/compiler/indexSignatureTypeCheck.ts(17,6): error TS1096: An index si
interface indexErrors {
[p2?: string];
~~
~
!!! error TS1019: An index signature parameter cannot have a question mark.
[...p3: any[]];
~~
~~~
!!! error TS1017: An index signature cannot have a rest parameter.
[p4: string, p5?: string];
~~
@@ -1,5 +1,5 @@
tests/cases/compiler/indexSignatureTypeCheck2.ts(10,6): error TS1019: An index signature parameter cannot have a question mark.
tests/cases/compiler/indexSignatureTypeCheck2.ts(11,9): error TS1017: An index signature cannot have a rest parameter.
tests/cases/compiler/indexSignatureTypeCheck2.ts(10,8): error TS1019: An index signature parameter cannot have a question mark.
tests/cases/compiler/indexSignatureTypeCheck2.ts(11,6): error TS1017: An index signature cannot have a rest parameter.
tests/cases/compiler/indexSignatureTypeCheck2.ts(12,6): error TS1096: An index signature must have exactly one parameter.
tests/cases/compiler/indexSignatureTypeCheck2.ts(13,6): error TS1096: An index signature must have exactly one parameter.
@@ -15,10 +15,10 @@ tests/cases/compiler/indexSignatureTypeCheck2.ts(13,6): error TS1096: An index s
interface indexErrors {
[p2?: string];
~~
~
!!! error TS1019: An index signature parameter cannot have a question mark.
[...p3: any[]];
~~
~~~
!!! error TS1017: An index signature cannot have a rest parameter.
[p4: string, p5?: string];
~~
@@ -1,18 +1,18 @@
tests/cases/compiler/indexerAsOptional.ts(3,6): error TS1019: An index signature parameter cannot have a question mark.
tests/cases/compiler/indexerAsOptional.ts(8,6): error TS1019: An index signature parameter cannot have a question mark.
tests/cases/compiler/indexerAsOptional.ts(3,9): error TS1019: An index signature parameter cannot have a question mark.
tests/cases/compiler/indexerAsOptional.ts(8,9): error TS1019: An index signature parameter cannot have a question mark.
==== tests/cases/compiler/indexerAsOptional.ts (2 errors) ====
interface indexSig {
//Index signatures can't be optional
[idx?: number]: any; //err
~~~
~
!!! error TS1019: An index signature parameter cannot have a question mark.
}
class indexSig2 {
//Index signatures can't be optional
[idx?: number]: any //err
~~~
~
!!! error TS1019: An index signature parameter cannot have a question mark.
}
@@ -1,16 +1,16 @@
tests/cases/compiler/indexerSignatureWithRestParam.ts(2,9): error TS1017: An index signature cannot have a rest parameter.
tests/cases/compiler/indexerSignatureWithRestParam.ts(6,9): error TS1017: An index signature cannot have a rest parameter.
tests/cases/compiler/indexerSignatureWithRestParam.ts(2,6): error TS1017: An index signature cannot have a rest parameter.
tests/cases/compiler/indexerSignatureWithRestParam.ts(6,6): error TS1017: An index signature cannot have a rest parameter.
==== tests/cases/compiler/indexerSignatureWithRestParam.ts (2 errors) ====
interface I {
[...x]: string;
~
~~~
!!! error TS1017: An index signature cannot have a rest parameter.
}
class C {
[...x]: string
~
~~~
!!! error TS1017: An index signature cannot have a rest parameter.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature1.ts(2,7): error TS1017: An index signature cannot have a rest parameter.
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature1.ts(2,4): error TS1017: An index signature cannot have a rest parameter.
==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature1.ts (1 errors) ====
interface I {
[...a]
~
~~~
!!! error TS1017: An index signature cannot have a rest parameter.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature3.ts(2,4): error TS1019: An index signature parameter cannot have a question mark.
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature3.ts(2,5): error TS1019: An index signature parameter cannot have a question mark.
==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature3.ts (1 errors) ====
interface I {
[a?]
~
~
!!! error TS1019: An index signature parameter cannot have a question mark.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration17.ts(2,8): error TS1051: A 'set' accessor cannot have an optional parameter.
tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration17.ts(2,13): error TS1051: A 'set' accessor cannot have an optional parameter.
==== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration17.ts (1 errors) ====
class C {
set Foo(a?: number) { }
~~~
~
!!! error TS1051: A 'set' accessor cannot have an optional parameter.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration18.ts(2,8): error TS1053: A 'set' accessor cannot have rest parameter.
tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration18.ts(2,12): error TS1053: A 'set' accessor cannot have rest parameter.
==== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration18.ts (1 errors) ====
class C {
set Foo(...a) { }
~~~
~~~
!!! error TS1053: A 'set' accessor cannot have rest parameter.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList1.ts(2,9): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList1.ts(2,6): error TS1014: A rest parameter must be last in a parameter list.
==== tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList1.ts (1 errors) ====
class C {
F(...A, B) { }
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
}
@@ -1,7 +1,7 @@
tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList11.ts(1,5): error TS1047: A rest parameter cannot be optional.
tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList11.ts(1,8): error TS1047: A rest parameter cannot be optional.
==== tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList11.ts (1 errors) ====
(...arg?) => 102;
~~~
~
!!! error TS1047: A rest parameter cannot be optional.
@@ -1,9 +1,9 @@
tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList9.ts(2,11): error TS1047: A rest parameter cannot be optional.
tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList9.ts(2,14): error TS1047: A rest parameter cannot be optional.
==== tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList9.ts (1 errors) ====
class C {
foo(...bar?) { }
~~~
~
!!! error TS1047: A rest parameter cannot be optional.
}
@@ -1,10 +1,10 @@
tests/cases/compiler/restParamAsOptional.ts(1,15): error TS1047: A rest parameter cannot be optional.
tests/cases/compiler/restParamAsOptional.ts(1,16): error TS1047: A rest parameter cannot be optional.
tests/cases/compiler/restParamAsOptional.ts(2,16): error TS1048: A rest parameter cannot have an initializer.
==== tests/cases/compiler/restParamAsOptional.ts (2 errors) ====
function f(...x?) { }
~
~
!!! error TS1047: A rest parameter cannot be optional.
function f2(...x = []) { }
~
@@ -1,7 +1,7 @@
tests/cases/compiler/restParameterNotLast.ts(1,15): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/compiler/restParameterNotLast.ts(1,12): error TS1014: A rest parameter must be last in a parameter list.
==== tests/cases/compiler/restParameterNotLast.ts (1 errors) ====
function f(...x, y) { }
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
@@ -1,6 +1,6 @@
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(5,14): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(13,12): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(23,24): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(5,11): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(13,9): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(23,21): error TS1014: A rest parameter must be last in a parameter list.
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts (3 errors) ====
@@ -9,7 +9,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWith
function foo(...x) { }
var f = function foo(...x) { }
var f2 = (...x, ...y) => { }
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
class C {
@@ -19,7 +19,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWith
interface I {
(...x);
foo(...x, ...y);
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
}
@@ -31,7 +31,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWith
var b = {
foo(...x) { },
a: function foo(...x, ...y) { },
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
b: (...x) => { }
}
@@ -1,6 +1,6 @@
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,14): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(13,12): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(23,24): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,11): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(13,9): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(23,21): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(3,14): error TS2370: A rest parameter must be of an array type.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(4,22): error TS2370: A rest parameter must be of an array type.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,11): error TS2370: A rest parameter must be of an array type.
@@ -27,7 +27,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
var f2 = (...x: Date, ...y: boolean) => { }
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
@@ -45,7 +45,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
foo(...x: number, ...y: number);
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
@@ -67,7 +67,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
a: function foo(...x: number, ...y: Date) { },
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
@@ -1,9 +1,9 @@
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,14): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(17,12): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(27,24): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(36,14): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(44,12): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(54,24): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,11): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(17,9): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(27,21): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(36,11): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(44,9): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(54,21): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(7,14): error TS2370: A rest parameter must be of an array type.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(8,22): error TS2370: A rest parameter must be of an array type.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,11): error TS2370: A rest parameter must be of an array type.
@@ -48,7 +48,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
~~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
var f2 = (...x: MyThing, ...y: MyThing) => { }
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
~~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
@@ -66,7 +66,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
~~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
foo(...x: MyThing, ...y: MyThing);
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
~~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
@@ -88,7 +88,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
~~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
a: function foo(...x: MyThing, ...y: MyThing) { },
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
~~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
@@ -109,7 +109,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
var f4 = (...x: MyThing2<string>, ...y: MyThing2<string>) => { }
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
@@ -127,7 +127,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
foo(...x: MyThing2<string>, ...y: MyThing2<string>);
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
@@ -149,7 +149,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
a: function foo(...x: MyThing2<string>, ...y: MyThing2<string>) { },
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
@@ -1,9 +1,9 @@
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(5,14): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(13,12): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(23,24): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(32,14): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(40,12): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(50,24): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(5,11): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(13,9): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(23,21): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(32,11): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(40,9): error TS1014: A rest parameter must be last in a parameter list.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(50,21): error TS1014: A rest parameter must be last in a parameter list.
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts (6 errors) ====
@@ -12,7 +12,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWit
function foo(...x: number[]) { }
var f = function foo(...x: number[]) { }
var f2 = (...x: number[], ...y: number[]) => { }
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
class C {
@@ -22,7 +22,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWit
interface I {
(...x: number[]);
foo(...x: number[], ...y: number[]);
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
}
@@ -34,7 +34,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWit
var b = {
foo(...x: number[]) { },
a: function foo(...x: number[], ...y: number[]) { },
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
b: (...x: number[]) => { }
}
@@ -45,7 +45,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWit
function foo2(...x: Array<string>) { }
var f3 = function foo(...x: Array<string>) { }
var f4 = (...x: Array<string>, ...y: Array<string>) => { }
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
class C2 {
@@ -55,7 +55,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWit
interface I2 {
(...x: Array<string>);
foo(...x: Array<string>, ...y: Array<string>);
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
}
@@ -67,7 +67,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWit
var b2 = {
foo(...x: Array<string>) { },
a: function foo(...x: Array<string>, ...y: Array<string>) { },
~
~~~
!!! error TS1014: A rest parameter must be last in a parameter list.
b: (...x: Array<string>) => { }
}
@@ -1,2 +1,2 @@
//// [sourceMapValidationStatements.js.map]
{"version":3,"file":"sourceMapValidationStatements.js","sourceRoot":"","sources":["sourceMapValidationStatements.ts"],"names":["f"],"mappings":"AAAA,SAAS,CAAC;IACNA,IAAIA,CAACA,CAACA;IACNA,IAAIA,CAACA,GAAGA,CAACA,CAACA;IACVA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,CAACA,EAAEA,CAACA,GAAGA,EAAEA,EAAEA,CAACA,EAAEA,EAAEA,CAACA;QAC1BA,CAACA,IAAIA,CAACA,CAACA;QACPA,CAACA,IAAIA,CAACA,CAACA;IACXA,CAACA;IACDA,EAAEA,CAACA,CAACA,CAACA,GAAGA,EAAEA,CAACA,CAACA,CAACA;QACTA,CAACA,IAAIA,CAACA,CAACA;IACXA,CAACA;IAACA,IAAIA,CAACA,CAACA;QACJA,CAACA,IAAIA,EAAEA,CAACA;QACRA,CAACA,EAAEA,CAACA;IACRA,CAACA;IACDA,IAAIA,CAACA,GAAGA;QACJA,CAACA;QACDA,CAACA;QACDA,CAACA;KACJA,CAACA;IACFA,IAAIA,GAAGA,GAAGA;QACNA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,OAAOA;KACbA,CAACA;IACFA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,IAAIA,CAACA,CAACA,CAACA,CAACA;QACdA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,CAACA;QACbA,IAAIA,CAACA,GAAGA,EAAEA,CAACA;IACfA,CAACA;IACDA,IAAAA,CAACA;QACGA,GAAGA,CAACA,CAACA,GAAGA,MAAMA,CAACA;IACnBA,CAAEA;IAAAA,KAAKA,CAACA,CAACA,CAACA,CAACA,CAATA,CAACA;QACCA,EAAEA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,EAAEA,CAACA,CAACA,CAACA;YACbA,GAAGA,CAACA,CAACA,GAAGA,EAAEA,CAACA;QACfA,CAACA;QAACA,IAAIA,CAACA,CAACA;YACJA,GAAGA,CAACA,CAACA,GAAGA,KAAKA,CAACA;QAClBA,CAACA;IACLA,CAACA;IACDA,IAAAA,CAACA;QACGA,MAAMA,IAAIA,KAAKA,EAAEA,CAACA;IACtBA,CAAEA;IAAAA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAAVA,CAACA;QACCA,IAAIA,CAACA,GAAGA,EAAEA,CAACA;IACfA,CAACA;YAACA,CAACA;QACCA,CAACA,GAAGA,EAAEA,CAACA;IACXA,CAACA;IACDA,MAAMA,GAAGA,EAAEA,CAACA;QACRA,CAACA,GAAGA,CAACA,CAACA;QACNA,CAACA,GAAGA,EAAEA,CAACA;IACXA,CAACA;IACDA,MAAMA,CAACA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,CAACA;QACZA,KAAKA,CAACA,EAAEA,CAACA;YACLA,CAACA,EAAEA,CAACA;YACJA,KAAKA,CAACA;QAEVA,CAACA;QACDA,KAAKA,CAACA,EAAEA,CAACA;YACLA,CAACA,EAAEA,CAACA;YACJA,KAAKA,CAACA;QAEVA,CAACA;QACDA,SAASA,CAACA;YACNA,CAACA,IAAIA,CAACA,CAACA;YACPA,CAACA,GAAGA,EAAEA,CAACA;YACPA,KAAKA,CAACA;QAEVA,CAACA;IACLA,CAACA;IACDA,OAAOA,CAACA,GAAGA,EAAEA,EAAEA,CAACA;QACZA,CAACA,EAAEA,CAACA;IACRA,CAACA;IACDA,GAAGA,CAACA;QACAA,CAACA,EAAEA,CAACA;IACRA,CAACA,QAAQA,CAACA,GAAGA,CAACA,EAACA;IACfA,CAACA,GAAGA,CAACA,CAACA;IACNA,IAAIA,CAACA,GAAGA,CAACA,CAACA,IAAIA,CAACA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,CAACA;IACjCA,CAACA,CAACA,IAAIA,CAACA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,CAACA;IACzBA,CAACA,KAAKA,CAACA,CAACA;IACRA,CAACA,GAAGA,CAACA,GAAGA,EAAEA,CAACA;IACXA,IAAIA,CAACA,GAAGA,CAACA,CAACA;IACVA,MAAMA,CAACA;AACXA,CAACA;AACD,IAAI,CAAC,GAAG;IACJ,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC,CAAC;AACF,CAAC,EAAE,CAAC"}
{"version":3,"file":"sourceMapValidationStatements.js","sourceRoot":"","sources":["sourceMapValidationStatements.ts"],"names":["f"],"mappings":"AAAA,SAAS,CAAC;IACNA,IAAIA,CAACA,CAACA;IACNA,IAAIA,CAACA,GAAGA,CAACA,CAACA;IACVA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,CAACA,EAAEA,CAACA,GAAGA,EAAEA,EAAEA,CAACA,EAAEA,EAAEA,CAACA;QAC1BA,CAACA,IAAIA,CAACA,CAACA;QACPA,CAACA,IAAIA,CAACA,CAACA;IACXA,CAACA;IACDA,EAAEA,CAACA,CAACA,CAACA,GAAGA,EAAEA,CAACA,CAACA,CAACA;QACTA,CAACA,IAAIA,CAACA,CAACA;IACXA,CAACA;IAACA,IAAIA,CAACA,CAACA;QACJA,CAACA,IAAIA,EAAEA,CAACA;QACRA,CAACA,EAAEA,CAACA;IACRA,CAACA;IACDA,IAAIA,CAACA,GAAGA;QACJA,CAACA;QACDA,CAACA;QACDA,CAACA;KACJA,CAACA;IACFA,IAAIA,GAAGA,GAAGA;QACNA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,OAAOA;KACbA,CAACA;IACFA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,IAAIA,CAACA,CAACA,CAACA,CAACA;QACdA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,CAACA;QACbA,IAAIA,CAACA,GAAGA,EAAEA,CAACA;IACfA,CAACA;IACDA,IAAAA,CAACA;QACGA,GAAGA,CAACA,CAACA,GAAGA,MAAMA,CAACA;IACnBA,CAAEA;IAAAA,KAAKA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;QACTA,EAAEA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,EAAEA,CAACA,CAACA,CAACA;YACbA,GAAGA,CAACA,CAACA,GAAGA,EAAEA,CAACA;QACfA,CAACA;QAACA,IAAIA,CAACA,CAACA;YACJA,GAAGA,CAACA,CAACA,GAAGA,KAAKA,CAACA;QAClBA,CAACA;IACLA,CAACA;IACDA,IAAAA,CAACA;QACGA,MAAMA,IAAIA,KAAKA,EAAEA,CAACA;IACtBA,CAAEA;IAAAA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACVA,IAAIA,CAACA,GAAGA,EAAEA,CAACA;IACfA,CAACA;YAACA,CAACA;QACCA,CAACA,GAAGA,EAAEA,CAACA;IACXA,CAACA;IACDA,MAAMA,GAAGA,EAAEA,CAACA;QACRA,CAACA,GAAGA,CAACA,CAACA;QACNA,CAACA,GAAGA,EAAEA,CAACA;IACXA,CAACA;IACDA,MAAMA,CAACA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,CAACA;QACZA,KAAKA,CAACA,EAAEA,CAACA;YACLA,CAACA,EAAEA,CAACA;YACJA,KAAKA,CAACA;QAEVA,CAACA;QACDA,KAAKA,CAACA,EAAEA,CAACA;YACLA,CAACA,EAAEA,CAACA;YACJA,KAAKA,CAACA;QAEVA,CAACA;QACDA,SAASA,CAACA;YACNA,CAACA,IAAIA,CAACA,CAACA;YACPA,CAACA,GAAGA,EAAEA,CAACA;YACPA,KAAKA,CAACA;QAEVA,CAACA;IACLA,CAACA;IACDA,OAAOA,CAACA,GAAGA,EAAEA,EAAEA,CAACA;QACZA,CAACA,EAAEA,CAACA;IACRA,CAACA;IACDA,GAAGA,CAACA;QACAA,CAACA,EAAEA,CAACA;IACRA,CAACA,QAAQA,CAACA,GAAGA,CAACA,EAACA;IACfA,CAACA,GAAGA,CAACA,CAACA;IACNA,IAAIA,CAACA,GAAGA,CAACA,CAACA,IAAIA,CAACA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,CAACA;IACjCA,CAACA,CAACA,IAAIA,CAACA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,CAACA;IACzBA,CAACA,KAAKA,CAACA,CAACA;IACRA,CAACA,GAAGA,CAACA,GAAGA,EAAEA,CAACA;IACXA,IAAIA,CAACA,GAAGA,CAACA,CAACA;IACVA,MAAMA,CAACA;AACXA,CAACA;AACD,IAAI,CAAC,GAAG;IACJ,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC,CAAC;AACF,CAAC,EAAE,CAAC"}
@@ -557,16 +557,16 @@ sourceFile:sourceMapValidationStatements.ts
4 > (
5 > e
6 > )
7 >
8 > c
7 >
8 > {
1->Emitted(31, 5) Source(29, 7) + SourceIndex(0) name (f)
2 >Emitted(31, 10) Source(29, 12) + SourceIndex(0) name (f)
3 >Emitted(31, 11) Source(29, 13) + SourceIndex(0) name (f)
4 >Emitted(31, 12) Source(29, 14) + SourceIndex(0) name (f)
5 >Emitted(31, 13) Source(29, 15) + SourceIndex(0) name (f)
6 >Emitted(31, 14) Source(29, 16) + SourceIndex(0) name (f)
7 >Emitted(31, 15) Source(29, 7) + SourceIndex(0) name (f)
8 >Emitted(31, 16) Source(29, 8) + SourceIndex(0) name (f)
7 >Emitted(31, 15) Source(29, 17) + SourceIndex(0) name (f)
8 >Emitted(31, 16) Source(29, 18) + SourceIndex(0) name (f)
---
>>> if (obj.z < 10) {
1->^^^^^^^^
@@ -581,7 +581,7 @@ sourceFile:sourceMapValidationStatements.ts
10> ^
11> ^
12> ^
1->atch (e) {
1->
>
2 > if
3 >
@@ -759,16 +759,16 @@ sourceFile:sourceMapValidationStatements.ts
4 > (
5 > e1
6 > )
7 >
8 > c
7 >
8 > {
1->Emitted(42, 5) Source(38, 7) + SourceIndex(0) name (f)
2 >Emitted(42, 10) Source(38, 12) + SourceIndex(0) name (f)
3 >Emitted(42, 11) Source(38, 13) + SourceIndex(0) name (f)
4 >Emitted(42, 12) Source(38, 14) + SourceIndex(0) name (f)
5 >Emitted(42, 14) Source(38, 16) + SourceIndex(0) name (f)
6 >Emitted(42, 15) Source(38, 17) + SourceIndex(0) name (f)
7 >Emitted(42, 16) Source(38, 7) + SourceIndex(0) name (f)
8 >Emitted(42, 17) Source(38, 8) + SourceIndex(0) name (f)
7 >Emitted(42, 16) Source(38, 18) + SourceIndex(0) name (f)
8 >Emitted(42, 17) Source(38, 19) + SourceIndex(0) name (f)
---
>>> var b = e1;
1->^^^^^^^^
@@ -777,7 +777,7 @@ sourceFile:sourceMapValidationStatements.ts
4 > ^^^
5 > ^^
6 > ^
1->atch (e1) {
1->
>
2 > var
3 > b
@@ -1,2 +1,2 @@
//// [sourceMapValidationTryCatchFinally.js.map]
{"version":3,"file":"sourceMapValidationTryCatchFinally.js","sourceRoot":"","sources":["sourceMapValidationTryCatchFinally.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC;AACX,IAAA,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAE;AAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CAAT,CAAC;IACC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;QAAC,CAAC;IACC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACf,CAAC;AACD,IAAA,CAAC;IAEG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,IAAI,KAAK,EAAE,CAAC;AACtB,CACA;AAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CAAT,CAAC;IAEG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;QACD,CAAC;IAEG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACf,CAAC"}
{"version":3,"file":"sourceMapValidationTryCatchFinally.js","sourceRoot":"","sources":["sourceMapValidationTryCatchFinally.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC;AACX,IAAA,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAE;AAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACT,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;QAAC,CAAC;IACC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACf,CAAC;AACD,IAAA,CAAC;IAEG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,IAAI,KAAK,EAAE,CAAC;AACtB,CACA;AAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CACT,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;QACD,CAAC;IAEG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACf,CAAC"}
@@ -91,16 +91,16 @@ sourceFile:sourceMapValidationTryCatchFinally.ts
4 > (
5 > e
6 > )
7 >
8 > c
7 >
8 > {
1->Emitted(5, 1) Source(4, 3) + SourceIndex(0)
2 >Emitted(5, 6) Source(4, 8) + SourceIndex(0)
3 >Emitted(5, 7) Source(4, 9) + SourceIndex(0)
4 >Emitted(5, 8) Source(4, 10) + SourceIndex(0)
5 >Emitted(5, 9) Source(4, 11) + SourceIndex(0)
6 >Emitted(5, 10) Source(4, 12) + SourceIndex(0)
7 >Emitted(5, 11) Source(4, 3) + SourceIndex(0)
8 >Emitted(5, 12) Source(4, 4) + SourceIndex(0)
7 >Emitted(5, 11) Source(4, 13) + SourceIndex(0)
8 >Emitted(5, 12) Source(4, 14) + SourceIndex(0)
---
>>> x = x - 1;
1->^^^^
@@ -110,7 +110,7 @@ sourceFile:sourceMapValidationTryCatchFinally.ts
5 > ^^^
6 > ^
7 > ^
1->atch (e) {
1->
>
2 > x
3 > =
@@ -266,16 +266,17 @@ sourceFile:sourceMapValidationTryCatchFinally.ts
4 > (
5 > e
6 > )
7 >
8 > c
7 >
>
8 > {
1->Emitted(15, 1) Source(14, 1) + SourceIndex(0)
2 >Emitted(15, 6) Source(14, 6) + SourceIndex(0)
3 >Emitted(15, 7) Source(14, 7) + SourceIndex(0)
4 >Emitted(15, 8) Source(14, 8) + SourceIndex(0)
5 >Emitted(15, 9) Source(14, 9) + SourceIndex(0)
6 >Emitted(15, 10) Source(14, 10) + SourceIndex(0)
7 >Emitted(15, 11) Source(14, 1) + SourceIndex(0)
8 >Emitted(15, 12) Source(14, 2) + SourceIndex(0)
7 >Emitted(15, 11) Source(15, 1) + SourceIndex(0)
8 >Emitted(15, 12) Source(15, 2) + SourceIndex(0)
---
>>> x = x - 1;
1->^^^^
@@ -285,8 +286,7 @@ sourceFile:sourceMapValidationTryCatchFinally.ts
5 > ^^^
6 > ^
7 > ^
1->atch (e)
>{
1->
>
2 > x
3 > =