if this variable is initialized by a call, return this call.
(&self, visitor: &'a Visitor)
| 239 | |
| 240 | // if this variable is initialized by a call, return this call. |
| 241 | pub fn get_var_init_call<'a>(&self, visitor: &'a Visitor) -> Option<&'a Node> { |
| 242 | if let Some(init) = self.get_var_init(visitor) { |
| 243 | let init = init.ignore_parent().ignore_cast(); |
| 244 | if matches!(&init.kind, Clang::CallExpr(_) | Clang::CXXNewExpr(_)) { |
| 245 | return Some(init); |
| 246 | } |
| 247 | } |
| 248 | let var_name = self.get_name_as_string(); |
| 249 | if let Some(bo_right) = visitor.find_binary_operator(&var_name) { |
| 250 | let init = bo_right.ignore_parent().ignore_cast(); |
| 251 | if matches!(&init.kind, Clang::CallExpr(_)) { |
| 252 | return Some(init); |
| 253 | } |
| 254 | } |
| 255 | None |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | #[derive(Deserialize, Debug, Clone, Default)] |
no test coverage detected