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

Method extract_class

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

Source from the content-addressed store, hash-verified

117 // --- extractClass ------------------------------------------------------------
118
119 pub(super) fn extract_class(&mut self, node: Node<'t>) {
120 let resolved_body = body_of(node); // skipBodilessClass unset for TS/JS
121 let name = self.extract_name(node);
122 let extra = Extra {
123 docstring: crate::docstring::preceding_docstring(node, self.src),
124 visibility: self.visibility_of(node),
125 is_exported: Some(self.is_exported(node)),
126 ..Extra::default()
127 };
128 let Some(row) = self.create_node("class", &name, node, extra) else {
129 return;
130 };
131
132 self.extract_inheritance(node, row);
133 self.extract_decorators_for(node, row);
134
135 self.stack.push(Scope { row, kind: "class", name });
136 let body = resolved_body.unwrap_or(node);
137 for i in 0..body.named_child_count() {
138 if let Some(c) = body.named_child(i) {
139 self.visit_node(c);
140 }
141 }
142 self.stack.pop();
143 }
144
145 // --- extractMethod -------------------------------------------------------------
146

Callers 2

visit_nodeMethod · 0.45

Calls 9

body_ofFunction · 0.85
preceding_docstringFunction · 0.85
extract_nameMethod · 0.45
visibility_ofMethod · 0.45
is_exportedMethod · 0.45
create_nodeMethod · 0.45
extract_inheritanceMethod · 0.45
visit_nodeMethod · 0.45

Tested by

no test coverage detected