mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 02:30:15 -06:00
fix malformed nodes
This commit is contained in:
parent
d9b68e9213
commit
51c76ac351
@ -2752,7 +2752,7 @@ namespace ts {
|
||||
|
||||
function indexInfoToIndexSignatureDeclarationHelper(indexInfo: IndexInfo, kind: IndexKind, context: NodeBuilderContext): IndexSignatureDeclaration {
|
||||
const indexerTypeNode = createKeywordTypeNode(kind === IndexKind.String ? SyntaxKind.StringKeyword : SyntaxKind.NumberKeyword);
|
||||
const name = getNameFromIndexInfo(indexInfo);
|
||||
const name = getNameFromIndexInfo(indexInfo) || "x";
|
||||
|
||||
const indexingParameter = createParameter(
|
||||
/*decorators*/ undefined,
|
||||
@ -2830,8 +2830,8 @@ namespace ts {
|
||||
initializer = parameterDeclaration.initializer;
|
||||
}
|
||||
const parameterNode = createParameter(
|
||||
parameterDeclaration.decorators,
|
||||
parameterDeclaration.modifiers,
|
||||
/*decorators*/ undefined,
|
||||
cloneNodeArray(parameterDeclaration.modifiers),
|
||||
(parameterDeclaration ? isRestParameter(parameterDeclaration) : isTransientSymbol(parameterSymbol) && parameterSymbol.isRestParameter) ?
|
||||
createToken(SyntaxKind.DotDotDotToken) :
|
||||
undefined,
|
||||
|
||||
@ -89,6 +89,10 @@ namespace ts {
|
||||
return nodeIsSynthesized(clone) ? clone : getSynthesizedClone(clone);
|
||||
}
|
||||
|
||||
export function cloneNodeArray<T extends Node>(nodeArray: NodeArray<T>) {
|
||||
return nodeArray && nodeArray.map(getDeepSynthesizedClone);
|
||||
}
|
||||
|
||||
// Literals
|
||||
|
||||
export function createLiteral(value: string): StringLiteral;
|
||||
|
||||
@ -466,7 +466,7 @@ namespace ts {
|
||||
return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name);
|
||||
}
|
||||
|
||||
export function getNameFromIndexInfo(info: IndexInfo) {
|
||||
export function getNameFromIndexInfo(info: IndexInfo): string | undefined {
|
||||
return info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : undefined;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user