@@ -3886,7 +3886,7 @@ namespace ts {
3886
3886
if (!links.declaredType) {
3887
3887
const enumType = <EnumType>getDeclaredTypeOfEnum(getParentOfSymbol(symbol));
3888
3888
links.declaredType = enumType.flags & TypeFlags.Union ?
3889
- enumType.memberTypes[getEnumMemberValue(<EnumDeclaration >symbol.valueDeclaration)] :
3889
+ enumType.memberTypes[getEnumMemberValue(<EnumMember >symbol.valueDeclaration)] :
3890
3890
enumType;
3891
3891
}
3892
3892
return links.declaredType;
@@ -6049,7 +6049,7 @@ namespace ts {
6049
6049
return !node.typeParameters && areAllParametersUntyped && !isNullaryArrow;
6050
6050
}
6051
6051
6052
- function isContextSensitiveFunctionOrObjectLiteralMethod(func: Node): func is FunctionExpression | MethodDeclaration {
6052
+ function isContextSensitiveFunctionOrObjectLiteralMethod(func: Node): func is FunctionExpression | ArrowFunction | MethodDeclaration {
6053
6053
return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
6054
6054
}
6055
6055
@@ -10022,7 +10022,7 @@ namespace ts {
10022
10022
}
10023
10023
}
10024
10024
10025
- function isFunctionExpressionOrArrowFunction(node: Node): node is FunctionExpression {
10025
+ function isFunctionExpressionOrArrowFunction(node: Node): node is FunctionExpression | ArrowFunction {
10026
10026
return node.kind === SyntaxKind.FunctionExpression || node.kind === SyntaxKind.ArrowFunction;
10027
10027
}
10028
10028
@@ -10033,7 +10033,7 @@ namespace ts {
10033
10033
: undefined;
10034
10034
}
10035
10035
10036
- function getContextualTypeForFunctionLikeDeclaration(node: FunctionExpression | MethodDeclaration) {
10036
+ function getContextualTypeForFunctionLikeDeclaration(node: FunctionExpression | ArrowFunction | MethodDeclaration) {
10037
10037
return isObjectLiteralMethod(node) ?
10038
10038
getContextualTypeForObjectLiteralMethod(node) :
10039
10039
getApparentTypeOfContextualType(node);
@@ -10044,7 +10044,7 @@ namespace ts {
10044
10044
// If the contextual type is a union type, get the signature from each type possible and if they are
10045
10045
// all identical ignoring their return type, the result is same signature but with return type as
10046
10046
// union type of return types from these signatures
10047
- function getContextualSignature(node: FunctionExpression | MethodDeclaration): Signature {
10047
+ function getContextualSignature(node: FunctionExpression | ArrowFunction | MethodDeclaration): Signature {
10048
10048
Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node));
10049
10049
const type = getContextualTypeForFunctionLikeDeclaration(node);
10050
10050
if (!type) {
@@ -11392,7 +11392,7 @@ namespace ts {
11392
11392
argCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature);
11393
11393
}
11394
11394
else {
11395
- const callExpression = <CallExpression>node;
11395
+ const callExpression = <CallExpression | NewExpression >node;
11396
11396
if (!callExpression.arguments) {
11397
11397
// This only happens when we have something of the form: 'new C'
11398
11398
Debug.assert(callExpression.kind === SyntaxKind.NewExpression);
@@ -11403,7 +11403,7 @@ namespace ts {
11403
11403
argCount = signatureHelpTrailingComma ? args.length + 1 : args.length;
11404
11404
11405
11405
// If we are missing the close paren, the call is incomplete.
11406
- callIsIncomplete = (<CallExpression> callExpression) .arguments.end === callExpression.end;
11406
+ callIsIncomplete = callExpression.arguments.end === callExpression.end;
11407
11407
11408
11408
typeArguments = callExpression.typeArguments;
11409
11409
spreadArgIndex = getSpreadArgumentIndex(args);
@@ -12490,7 +12490,7 @@ namespace ts {
12490
12490
* @param node The call/new expression to be checked.
12491
12491
* @returns On success, the expression's signature's return type. On failure, anyType.
12492
12492
*/
12493
- function checkCallExpression(node: CallExpression): Type {
12493
+ function checkCallExpression(node: CallExpression | NewExpression ): Type {
12494
12494
// Grammar checking; stop grammar-checking if checkGrammarTypeArguments return true
12495
12495
checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments);
12496
12496
@@ -12945,7 +12945,7 @@ namespace ts {
12945
12945
}
12946
12946
}
12947
12947
12948
- if (produceDiagnostics && node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature ) {
12948
+ if (produceDiagnostics && node.kind !== SyntaxKind.MethodDeclaration) {
12949
12949
checkCollisionWithCapturedSuperVariable(node, (<FunctionExpression>node).name);
12950
12950
checkCollisionWithCapturedThisVariable(node, (<FunctionExpression>node).name);
12951
12951
}
@@ -17419,9 +17419,12 @@ namespace ts {
17419
17419
}
17420
17420
}
17421
17421
17422
- checkCollisionWithCapturedThisVariable(node, node.name);
17423
- checkCollisionWithRequireExportsInGeneratedCode(node, node.name);
17424
- checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);
17422
+ if (isIdentifier(node.name)) {
17423
+ checkCollisionWithCapturedThisVariable(node, node.name);
17424
+ checkCollisionWithRequireExportsInGeneratedCode(node, node.name);
17425
+ checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);
17426
+ }
17427
+
17425
17428
checkExportsOnMergedDeclarations(node);
17426
17429
const symbol = getSymbolOfNode(node);
17427
17430
@@ -19040,15 +19043,15 @@ namespace ts {
19040
19043
return undefined;
19041
19044
}
19042
19045
19043
- function isLiteralConstDeclaration(node: VariableDeclaration): boolean {
19046
+ function isLiteralConstDeclaration(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration ): boolean {
19044
19047
if (isConst(node)) {
19045
19048
const type = getTypeOfSymbol(getSymbolOfNode(node));
19046
19049
return !!(type.flags & TypeFlags.StringOrNumberLiteral && type.flags & TypeFlags.FreshLiteral);
19047
19050
}
19048
19051
return false;
19049
19052
}
19050
19053
19051
- function writeLiteralConstValue(node: VariableDeclaration, writer: SymbolWriter) {
19054
+ function writeLiteralConstValue(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration , writer: SymbolWriter) {
19052
19055
const type = getTypeOfSymbol(getSymbolOfNode(node));
19053
19056
writer.writeStringLiteral(literalTypeToString(<LiteralType>type));
19054
19057
}
@@ -19785,7 +19788,7 @@ namespace ts {
19785
19788
checkGrammarForAtLeastOneTypeArgument(node, typeArguments);
19786
19789
}
19787
19790
19788
- function checkGrammarForOmittedArgument(node: CallExpression, args: NodeArray<Expression>): boolean {
19791
+ function checkGrammarForOmittedArgument(node: CallExpression | NewExpression , args: NodeArray<Expression>): boolean {
19789
19792
if (args) {
19790
19793
const sourceFile = getSourceFileOfNode(node);
19791
19794
for (const arg of args) {
@@ -19796,7 +19799,7 @@ namespace ts {
19796
19799
}
19797
19800
}
19798
19801
19799
- function checkGrammarArguments(node: CallExpression, args: NodeArray<Expression>): boolean {
19802
+ function checkGrammarArguments(node: CallExpression | NewExpression , args: NodeArray<Expression>): boolean {
19800
19803
return checkGrammarForOmittedArgument(node, args);
19801
19804
}
19802
19805
@@ -19918,8 +19921,7 @@ namespace ts {
19918
19921
19919
19922
for (const prop of node.properties) {
19920
19923
const name = prop.name;
19921
- if (prop.kind === SyntaxKind.OmittedExpression ||
19922
- name.kind === SyntaxKind.ComputedPropertyName) {
19924
+ if (name.kind === SyntaxKind.ComputedPropertyName) {
19923
19925
// If the name is not a ComputedPropertyName, the grammar checking will skip it
19924
19926
checkGrammarComputedPropertyName(<ComputedPropertyName>name);
19925
19927
}
@@ -19966,7 +19968,7 @@ namespace ts {
19966
19968
currentKind = SetAccessor;
19967
19969
}
19968
19970
else {
19969
- Debug.fail("Unexpected syntax kind:" + prop.kind);
19971
+ Debug.fail("Unexpected syntax kind:" + (<Node> prop) .kind);
19970
19972
}
19971
19973
19972
19974
const effectiveName = getPropertyNameForPropertyNameNode(name);
0 commit comments