MCPcopy Create free account
hub / github.com/nodejs/node / addDefaultValueAssignmentsIfNeeded

Function addDefaultValueAssignmentsIfNeeded

test/fixtures/snapshot/typescript.js:89436–89451  ·  view source on GitHub ↗
(parameters, context)

Source from the content-addressed store, hash-verified

89434 }
89435 ts.visitParameterList = visitParameterList;
89436 function addDefaultValueAssignmentsIfNeeded(parameters, context) {
89437 var result;
89438 for (var i = 0; i < parameters.length; i++) {
89439 var parameter = parameters[i];
89440 var updated = addDefaultValueAssignmentIfNeeded(parameter, context);
89441 if (result || updated !== parameter) {
89442 if (!result)
89443 result = parameters.slice(0, i);
89444 result[i] = updated;
89445 }
89446 }
89447 if (result) {
89448 return ts.setTextRange(context.factory.createNodeArray(result, parameters.hasTrailingComma), parameters);
89449 }
89450 return parameters;
89451 }
89452 function addDefaultValueAssignmentIfNeeded(parameter, context) {
89453 // A rest parameter cannot have a binding pattern or an initializer,
89454 // so let's just ignore it.

Callers 3

visitParameterListFunction · 0.85
transformConstructorBodyFunction · 0.85
transformFunctionBodyFunction · 0.85

Tested by

no test coverage detected