MCPcopy Index your code
hub / github.com/nodejs/node / getParameterIdentifierNameAtPosition

Function getParameterIdentifierNameAtPosition

test/fixtures/snapshot/typescript.js:77493–77522  ·  view source on GitHub ↗
(signature, pos)

Source from the content-addressed store, hash-verified

77491 return restParameter.escapedName;
77492 }
77493 function getParameterIdentifierNameAtPosition(signature, pos) {
77494 var _a;
77495 if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 317 /* SyntaxKind.JSDocFunctionType */) {
77496 return undefined;
77497 }
77498 var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
77499 if (pos < paramCount) {
77500 var param = signature.parameters[pos];
77501 return isParameterDeclarationWithIdentifierName(param) ? [param.escapedName, false] : undefined;
77502 }
77503 var restParameter = signature.parameters[paramCount] || unknownSymbol;
77504 if (!isParameterDeclarationWithIdentifierName(restParameter)) {
77505 return undefined;
77506 }
77507 var restType = getTypeOfSymbol(restParameter);
77508 if (isTupleType(restType)) {
77509 var associatedNames = restType.target.labeledElementDeclarations;
77510 var index = pos - paramCount;
77511 var associatedName = associatedNames === null || associatedNames === void 0 ? void 0 : associatedNames[index];
77512 var isRestTupleElement = !!(associatedName === null || associatedName === void 0 ? void 0 : associatedName.dotDotDotToken);
77513 return associatedName ? [
77514 getTupleElementLabel(associatedName),
77515 isRestTupleElement
77516 ] : undefined;
77517 }
77518 if (pos === paramCount) {
77519 return [restParameter.escapedName, true];
77520 }
77521 return undefined;
77522 }
77523 function isParameterDeclarationWithIdentifierName(symbol) {
77524 return symbol.valueDeclaration && ts.isParameter(symbol.valueDeclaration) && ts.isIdentifier(symbol.valueDeclaration.name);
77525 }

Callers

nothing calls this directly

Calls 5

getTypeOfSymbolFunction · 0.85
isTupleTypeFunction · 0.85
getTupleElementLabelFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…