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

Function getConstantExtractionAtIndex

test/fixtures/snapshot/typescript.js:160574–160583  ·  view source on GitHub ↗
(targetRange, context, requestedChangesIndex)

Source from the content-addressed store, hash-verified

160572 return extractFunctionInScope(target, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], exposedVariableDeclarations, targetRange, context);
160573 }
160574 function getConstantExtractionAtIndex(targetRange, context, requestedChangesIndex) {
160575 var _a = getPossibleExtractionsWorker(targetRange, context), scopes = _a.scopes, _b = _a.readsAndWrites, target = _b.target, usagesPerScope = _b.usagesPerScope, constantErrorsPerScope = _b.constantErrorsPerScope, exposedVariableDeclarations = _b.exposedVariableDeclarations;
160576 ts.Debug.assert(!constantErrorsPerScope[requestedChangesIndex].length, "The extraction went missing? How?");
160577 ts.Debug.assert(exposedVariableDeclarations.length === 0, "Extract constant accepted a range containing a variable declaration?");
160578 context.cancellationToken.throwIfCancellationRequested();
160579 var expression = ts.isExpression(target)
160580 ? target
160581 : target.statements[0].expression;
160582 return extractConstantInScope(expression, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], targetRange.facts, context);
160583 }
160584 /**
160585 * Given a piece of text to extract ('targetRange'), computes a list of possible extractions.
160586 * Each returned ExtractResultForScope corresponds to a possible target scope and is either a set of changes

Callers 1

Calls 3

extractConstantInScopeFunction · 0.85
assertMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…