MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / extract_method

Method extract_method

codegraph-kernel/src/tsjs/extractors.rs:147–183  ·  view source on GitHub ↗
(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

145 // --- extractMethod -------------------------------------------------------------
146
147 pub(super) fn extract_method(&mut self, node: Node<'t>) {
148 if !self.inside_class_like() {
149 // Object-literal methods are ephemeral: walk the body only.
150 if let Some(parent) = node.parent() {
151 if matches!(parent.kind(), "object" | "object_expression") {
152 if let Some(body) = body_of(node) {
153 self.visit_function_body(body);
154 }
155 return;
156 }
157 }
158 self.extract_function(node, None);
159 return;
160 }
161
162 let name = self.extract_name(node);
163 let extra = Extra {
164 docstring: crate::docstring::preceding_docstring(node, self.src),
165 signature: self.signature_of(node),
166 visibility: self.visibility_of(node),
167 is_async: Some(self.is_async(node)),
168 is_static: self.is_static(node),
169 ..Extra::default() // methods carry no isExported (mirrors extractMethod)
170 };
171 let Some(row) = self.create_node("method", &name, node, extra) else {
172 return;
173 };
174
175 self.extract_type_annotations(node, row);
176 self.extract_decorators_for(node, row);
177
178 self.stack.push(Scope { row, kind: "method", name });
179 if let Some(body) = body_of(node) {
180 self.visit_function_body(body);
181 }
182 self.stack.pop();
183 }
184
185 // --- extractInterface / extractEnum / members -----------------------------------
186

Callers 1

visit_nodeMethod · 0.45

Calls 13

body_ofFunction · 0.85
preceding_docstringFunction · 0.85
inside_class_likeMethod · 0.45
visit_function_bodyMethod · 0.45
extract_functionMethod · 0.45
extract_nameMethod · 0.45
signature_ofMethod · 0.45
visibility_ofMethod · 0.45
is_asyncMethod · 0.45
is_staticMethod · 0.45
create_nodeMethod · 0.45

Tested by

no test coverage detected