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

Function annotateParameters

test/fixtures/snapshot/typescript.js:156716–156738  ·  view source on GitHub ↗
(changes, importAdder, sourceFile, parameterDeclaration, containingFunction, program, host, cancellationToken)

Source from the content-addressed store, hash-verified

156714 }
156715 }
156716 function annotateParameters(changes, importAdder, sourceFile, parameterDeclaration, containingFunction, program, host, cancellationToken) {
156717 if (!ts.isIdentifier(parameterDeclaration.name)) {
156718 return;
156719 }
156720 var parameterInferences = inferTypeForParametersFromUsage(containingFunction, sourceFile, program, cancellationToken);
156721 ts.Debug.assert(containingFunction.parameters.length === parameterInferences.length, "Parameter count and inference count should match");
156722 if (ts.isInJSFile(containingFunction)) {
156723 annotateJSDocParameters(changes, sourceFile, parameterInferences, program, host);
156724 }
156725 else {
156726 var needParens = ts.isArrowFunction(containingFunction) && !ts.findChildOfKind(containingFunction, 20 /* SyntaxKind.OpenParenToken */, sourceFile);
156727 if (needParens)
156728 changes.insertNodeBefore(sourceFile, ts.first(containingFunction.parameters), ts.factory.createToken(20 /* SyntaxKind.OpenParenToken */));
156729 for (var _i = 0, parameterInferences_1 = parameterInferences; _i < parameterInferences_1.length; _i++) {
156730 var _a = parameterInferences_1[_i], declaration = _a.declaration, type = _a.type;
156731 if (declaration && !declaration.type && !declaration.initializer) {
156732 annotate(changes, importAdder, sourceFile, declaration, type, program, host);
156733 }
156734 }
156735 if (needParens)
156736 changes.insertNodeAfter(sourceFile, ts.last(containingFunction.parameters), ts.factory.createToken(21 /* SyntaxKind.CloseParenToken */));
156737 }
156738 }
156739 function annotateThis(changes, sourceFile, containingFunction, program, host, cancellationToken) {
156740 var references = getFunctionReferences(containingFunction, sourceFile, program, cancellationToken);
156741 if (!references || !references.length) {

Callers 1

doChangeFunction · 0.85

Calls 6

annotateJSDocParametersFunction · 0.85
annotateFunction · 0.85
assertMethod · 0.80
firstMethod · 0.45
lastMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…