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

Function inlineExportModifiers

test/fixtures/snapshot/typescript.js:54242–54272  ·  view source on GitHub ↗
(statements)

Source from the content-addressed store, hash-verified

54240 return statements;
54241 }
54242 function inlineExportModifiers(statements) {
54243 // Pass 3: Move all `export {}`'s to `export` modifiers where possible
54244 var index = ts.findIndex(statements, function (d) { return ts.isExportDeclaration(d) && !d.moduleSpecifier && !d.assertClause && !!d.exportClause && ts.isNamedExports(d.exportClause); });
54245 if (index >= 0) {
54246 var exportDecl = statements[index];
54247 var replacements = ts.mapDefined(exportDecl.exportClause.elements, function (e) {
54248 if (!e.propertyName) {
54249 // export {name} - look thru `statements` for `name`, and if all results can take an `export` modifier, do so and filter it
54250 var indices = ts.indicesOf(statements);
54251 var associatedIndices = ts.filter(indices, function (i) { return ts.nodeHasName(statements[i], e.name); });
54252 if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return canHaveExportModifier(statements[i]); })) {
54253 for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) {
54254 var index_1 = associatedIndices_1[_i];
54255 statements[index_1] = addExportModifier(statements[index_1]);
54256 }
54257 return undefined;
54258 }
54259 }
54260 return e;
54261 });
54262 if (!ts.length(replacements)) {
54263 // all clauses removed, remove the export declaration
54264 ts.orderedRemoveItemAt(statements, index);
54265 }
54266 else {
54267 // some items filtered, others not - update the export declaration
54268 statements[index] = ts.factory.updateExportDeclaration(exportDecl, exportDecl.decorators, exportDecl.modifiers, exportDecl.isTypeOnly, ts.factory.updateNamedExports(exportDecl.exportClause, replacements), exportDecl.moduleSpecifier, exportDecl.assertClause);
54269 }
54270 }
54271 return statements;
54272 }
54273 function mergeRedundantStatements(statements) {
54274 statements = flattenExportAssignedNamespace(statements);
54275 statements = mergeExportDeclarations(statements);

Callers 1

mergeRedundantStatementsFunction · 0.85

Calls 5

canHaveExportModifierFunction · 0.85
addExportModifierFunction · 0.85
everyMethod · 0.80
filterMethod · 0.65
lengthMethod · 0.45

Tested by

no test coverage detected