Skip to content

Commit

Permalink
chore: remove comment
Browse files Browse the repository at this point in the history
  • Loading branch information
omridevk committed Jun 12, 2024
1 parent 8fd8a16 commit 4d4e8d7
Showing 1 changed file with 0 additions and 72 deletions.
72 changes: 0 additions & 72 deletions src/service.mts
Original file line number Diff line number Diff line change
Expand Up @@ -109,75 +109,3 @@ function getMethodsFromService(node: SourceFile): FunctionDescription[] {
});
});
}

// function getMethodsFromService(node: SourceFile, klass: ClassDeclaration) {
// const methods = klass.getMethods();
// if (!methods.length) {
// throw new Error("No methods found");
// }
// return methods.map((method) => {
// const methodBlockNode = method.compilerNode
// .getChildren(node.compilerNode)
// .find((child) => child.kind === ts.SyntaxKind.Block);
//
// if (!methodBlockNode) {
// throw new Error("Method block not found");
// }
// const methodBlock = methodBlockNode as ts.Block;
// const foundReturnStatement = methodBlock.statements.find(
// (s) => s.kind === ts.SyntaxKind.ReturnStatement,
// );
// if (!foundReturnStatement) {
// throw new Error("Return statement not found");
// }
// const returnStatement = foundReturnStatement as ts.ReturnStatement;
// const foundCallExpression = returnStatement.expression;
// if (!foundCallExpression) {
// throw new Error("Call expression not found");
// }
// const callExpression = foundCallExpression as ts.CallExpression;
// const properties = (
// callExpression.arguments[1] as ts.ObjectLiteralExpression
// ).properties as unknown as ts.PropertyAssignment[];
// const httpMethodName = properties
// .find((p) => p.name?.getText(node.compilerNode) === "method")
// ?.initializer?.getText(node.compilerNode);
//
// if (!httpMethodName) {
// throw new Error("httpMethodName not found");
// }
//
// const getAllChildren = (tsNode: ts.Node): Array<ts.Node> => {
// const childItems = tsNode.getChildren(node.compilerNode);
// if (childItems.length) {
// const allChildren = childItems.map(getAllChildren);
// return [tsNode].concat(allChildren.flat());
// }
// return [tsNode];
// };
//
// const children = getAllChildren(method.compilerNode);
// // get all JSDoc comments
// // this should be an array of 1 or 0
// const jsDocs = children
// .filter((c) => c.kind === ts.SyntaxKind.JSDoc)
// .map((c) => c.getText(node.compilerNode));
// // get the first JSDoc comment
// const jsDoc = jsDocs?.[0];
// const isDeprecated = children.some(
// (c) => c.kind === ts.SyntaxKind.JSDocDeprecatedTag,
// );
//
// const className = getClassNameFromClassNode(klass);
//
// return {
// className,
// node,
// method,
// methodBlock,
// httpMethodName,
// jsDoc,
// isDeprecated,
// } satisfies FunctionDescription;
// });
// }

0 comments on commit 4d4e8d7

Please sign in to comment.