extractLocalObjectOwner: `const api = { load() {…} }` in a function body or an IIFE gets the node a module-scope declaration would, with its members under it. False when the declarator holds no owned literal.
(&mut self, declarator: Node<'t>)
| 1029 | /// or an IIFE gets the node a module-scope declaration would, with its |
| 1030 | /// members under it. False when the declarator holds no owned literal. |
| 1031 | pub(super) fn extract_local_object_owner(&mut self, declarator: Node<'t>) -> bool { |
| 1032 | let Some(name_node) = declarator.child_by_field_name("name") else { return false }; |
| 1033 | if name_node.kind() != "identifier" { |
| 1034 | return false; |
| 1035 | } |
| 1036 | let Some(obj) = self.owned_object_value(declarator.child_by_field_name("value")) else { |
| 1037 | return false; |
| 1038 | }; |
| 1039 | let is_const = declarator.parent().map(|d| self.is_const_decl(d)).unwrap_or(false); |
| 1040 | let kind: &'static str = if is_const { "constant" } else { "variable" }; |
| 1041 | let name = self.text(name_node).to_string(); |
| 1042 | // A local: never the target of another scope's value read. |
| 1043 | let extra = Extra { |
| 1044 | docstring: crate::docstring::preceding_docstring(declarator, self.src), |
| 1045 | signature: Some(util::init_signature(self.text(obj))), |
| 1046 | is_exported: Some(false), |
| 1047 | not_value_target: true, |
| 1048 | ..Extra::default() |
| 1049 | }; |
| 1050 | let Some(row) = self.create_node(kind, &name, declarator, extra) else { return false }; |
| 1051 | self.extract_variable_type_annotation(declarator, row); |
| 1052 | self.extract_owned_object_members(obj, row, kind, &name, false, false, false); |
| 1053 | true |
| 1054 | } |
| 1055 | |
| 1056 | /// extractAssignedObjectOwner: `window.App = {…}` / `App.utils = {…}` / |
| 1057 | /// `dw_page = {…}`. A plain identifier target is qualified like a |
no test coverage detected