| 122 | } |
| 123 | |
| 124 | bool CompilePackage::collectObjects_(CollectType collectType, Reduce reduce) { |
| 125 | std::vector<VObjectType> stopPoints = { |
| 126 | VObjectType::paClass_declaration, |
| 127 | VObjectType::paFunction_body_declaration, |
| 128 | VObjectType::paTask_body_declaration, |
| 129 | VObjectType::paInterface_class_declaration}; |
| 130 | m_helper.setDesign(m_compileDesign->getCompiler()->getDesign()); |
| 131 | for (uint32_t i = 0; i < m_package->m_fileContents.size(); i++) { |
| 132 | const FileContent* fC = m_package->m_fileContents[i]; |
| 133 | VObject current = fC->Object(m_package->m_nodeIds[i]); |
| 134 | NodeId id = current.m_child; |
| 135 | |
| 136 | if (!id) id = current.m_sibling; |
| 137 | if (!id) return false; |
| 138 | |
| 139 | if (collectType == CollectType::FUNCTION) { |
| 140 | // Package imports |
| 141 | std::vector<FileCNodeId> pack_imports; |
| 142 | // - Local file imports |
| 143 | for (auto import : fC->getObjects(VObjectType::paPackage_import_item)) { |
| 144 | pack_imports.push_back(import); |
| 145 | } |
| 146 | |
| 147 | for (auto pack_import : pack_imports) { |
| 148 | const FileContent* pack_fC = pack_import.fC; |
| 149 | NodeId pack_id = pack_import.nodeId; |
| 150 | m_helper.importPackage(m_package, m_design, pack_fC, pack_id, |
| 151 | m_compileDesign, true); |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | std::stack<NodeId> stack; |
| 156 | stack.push(id); |
| 157 | while (!stack.empty()) { |
| 158 | id = stack.top(); |
| 159 | stack.pop(); |
| 160 | current = fC->Object(id); |
| 161 | VObjectType type = fC->Type(id); |
| 162 | switch (type) { |
| 163 | case VObjectType::paPackage_import_item: { |
| 164 | if (collectType != CollectType::FUNCTION) break; |
| 165 | m_helper.importPackage(m_package, m_design, fC, id, m_compileDesign, |
| 166 | true); |
| 167 | m_helper.compileImportDeclaration(m_package, fC, id, m_compileDesign); |
| 168 | break; |
| 169 | } |
| 170 | case VObjectType::paParameter_declaration: { |
| 171 | if (collectType != CollectType::DEFINITION) break; |
| 172 | NodeId list_of_type_assignments = fC->Child(id); |
| 173 | if (fC->Type(list_of_type_assignments) == |
| 174 | VObjectType::paList_of_type_assignments || |
| 175 | fC->Type(list_of_type_assignments) == VObjectType::paTYPE) { |
| 176 | // Type param |
| 177 | m_helper.compileParameterDeclaration( |
| 178 | m_package, fC, list_of_type_assignments, m_compileDesign, |
| 179 | reduce, false, nullptr, false, false); |
| 180 | |
| 181 | } else { |
nothing calls this directly
no test coverage detected