hasFunctionAncestor (tree-sitter.ts:295).
(node: Node)
| 1997 | |
| 1998 | /// hasFunctionAncestor (tree-sitter.ts:295). |
| 1999 | fn has_function_ancestor(node: Node) -> bool { |
| 2000 | let mut p = node.parent(); |
| 2001 | while let Some(n) = p { |
| 2002 | if n.kind() == "function_definition" { |
| 2003 | return true; |
| 2004 | } |
| 2005 | p = n.parent(); |
| 2006 | } |
| 2007 | false |
| 2008 | } |
| 2009 | |
| 2010 | fn opt_str(arena: &mut Arena, s: Option<&str>) -> StrRef { |
| 2011 | match s { |