MCPcopy
hub / github.com/benjamn/recast / printDecorators

Function printDecorators

lib/printer.ts:2564–2595  ·  view source on GitHub ↗
(path: any, printPath: any)

Source from the content-addressed store, hash-verified

2562}
2563
2564function printDecorators(path: any, printPath: any) {
2565 const parts: any[] = [];
2566 const node = path.getValue();
2567
2568 if (
2569 node.decorators &&
2570 node.decorators.length > 0 &&
2571 // If the parent node is an export declaration, it will be
2572 // responsible for printing node.decorators.
2573 !util.getParentExportDeclaration(path)
2574 ) {
2575 path.each(function (decoratorPath: any) {
2576 parts.push(printPath(decoratorPath), "\n");
2577 }, "decorators");
2578 } else if (
2579 util.isExportDeclaration(node) &&
2580 node.declaration &&
2581 node.declaration.decorators
2582 ) {
2583 // Export declarations are responsible for printing any decorators
2584 // that logically apply to node.declaration.
2585 path.each(
2586 function (decoratorPath: any) {
2587 parts.push(printPath(decoratorPath), "\n");
2588 },
2589 "declaration",
2590 "decorators",
2591 );
2592 }
2593
2594 return concat(parts);
2595}
2596
2597function printStatementSequence(path: any, options: any, print: any) {
2598 const filtered: any[] = [];

Callers 1

genericPrintFunction · 0.85

Calls 3

concatFunction · 0.90
getValueMethod · 0.80
eachMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…