MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / enclosing_callable

Function enclosing_callable

atomic-semantic/src/source.rs:145–163  ·  view source on GitHub ↗
(mut node: Node<'_>)

Source from the content-addressed store, hash-verified

143}
144
145fn enclosing_callable(mut node: Node<'_>) -> Option<Node<'_>> {
146 while let Some(parent) = node.parent() {
147 if matches!(
148 parent.kind(),
149 "closure_expression"
150 | "arrow_function"
151 | "lambda_expression"
152 | "lambda"
153 | "lambda_literal"
154 ) {
155 return None;
156 }
157 if callable(parent) {
158 return Some(parent);
159 }
160 node = parent;
161 }
162 None
163}
164
165fn lexical_container(mut node: Node<'_>) -> Node<'_> {
166 while let Some(parent) = node.parent() {

Callers 1

from_treeMethod · 0.85

Calls 2

parentMethod · 0.80
callableFunction · 0.70

Tested by

no test coverage detected