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

Method extract_method

codegraph-kernel/src/csharp.rs:1022–1053  ·  view source on GitHub ↗

extractMethod (1737) — method_declaration + constructor_declaration. Signature is ALWAYS undefined (no getSignature hook); isAsync is real.

(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

1020 /// extractMethod (1737) — method_declaration + constructor_declaration.
1021 /// Signature is ALWAYS undefined (no getSignature hook); isAsync is real.
1022 fn extract_method(&mut self, node: Node<'t>) {
1023 stack_guard!();
1024 if !self.inside_class_like() {
1025 // Unreachable on non-erroring C# (top-level `void M(){}` parses as
1026 // local_function_statement; erroring files defer) — mirror the TS
1027 // treat-as-function tail for shape.
1028 self.extract_function(node);
1029 return;
1030 }
1031 let name = self.extract_name(node);
1032 let extra = Extra {
1033 docstring: preceding_docstring(node, self.src),
1034 signature: None,
1035 visibility: Some(self.visibility_of(node)),
1036 is_async: Some(self.is_async(node)),
1037 is_static: Some(self.is_static(node)),
1038 return_type: self.return_type_of(node),
1039 };
1040 let Some(row) = self.create_node("method", &name, node, extra) else { return };
1041 // extractTypeAnnotations short-circuits into the csharp path:
1042 // `returns`-field refs FIRST, then per-parameter type refs.
1043 self.extract_csharp_type_refs(node, row);
1044 // decorators: none.
1045 self.stack.push(Scope { row, kind: "method", name });
1046 // The `body` FIELD only (block or arrow_expression_clause). A
1047 // constructor_initializer (`: base(args)`) is NOT the body → its
1048 // argument calls are LOST (quirk, preserve).
1049 if let Some(body) = node.child_by_field_name("body") {
1050 self.visit_function_body(body);
1051 }
1052 self.stack.pop();
1053 }
1054
1055 /// extractFunction — only reachable for a method outside any class
1056 /// (unreachable on non-erroring C#; kept faithful to the generic tail).

Callers 1

visit_nodeMethod · 0.45

Calls 12

preceding_docstringFunction · 0.85
pushMethod · 0.80
inside_class_likeMethod · 0.45
extract_functionMethod · 0.45
extract_nameMethod · 0.45
visibility_ofMethod · 0.45
is_asyncMethod · 0.45
is_staticMethod · 0.45
return_type_ofMethod · 0.45
create_nodeMethod · 0.45
visit_function_bodyMethod · 0.45

Tested by

no test coverage detected