| 92 | } |
| 93 | |
| 94 | bool CompileProgram::collectObjects_(CollectType collectType) { |
| 95 | const FileContent* fC = m_program->m_fileContents[0]; |
| 96 | NodeId nodeId = m_program->m_nodeIds[0]; |
| 97 | std::vector<VObjectType> stopPoints = { |
| 98 | VObjectType::paClass_declaration, |
| 99 | }; |
| 100 | |
| 101 | NodeId programId = m_program->m_nodeIds[0]; |
| 102 | do { |
| 103 | VObject current = fC->Object(programId); |
| 104 | programId = current.m_child; |
| 105 | } while (programId && |
| 106 | (fC->Type(programId) != VObjectType::paAttribute_instance)); |
| 107 | if (programId) { |
| 108 | if (UHDM::VectorOfattribute* attributes = m_helper.compileAttributes( |
| 109 | m_program, fC, programId, m_compileDesign, nullptr)) { |
| 110 | m_program->Attributes(attributes); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | if (fC->getSize() == 0) return true; |
| 115 | VObject current = fC->Object(nodeId); |
| 116 | NodeId id = current.m_child; |
| 117 | if (!id) id = current.m_sibling; |
| 118 | if (!id) return false; |
| 119 | |
| 120 | if (collectType == CollectType::FUNCTION) { |
| 121 | // Package imports |
| 122 | std::vector<FileCNodeId> pack_imports; |
| 123 | // - Local file imports |
| 124 | for (auto import : fC->getObjects(VObjectType::paPackage_import_item)) { |
| 125 | pack_imports.push_back(import); |
| 126 | } |
| 127 | |
| 128 | for (auto pack_import : pack_imports) { |
| 129 | const FileContent* pack_fC = pack_import.fC; |
| 130 | NodeId pack_id = pack_import.nodeId; |
| 131 | m_helper.importPackage(m_program, m_design, pack_fC, pack_id, |
| 132 | m_compileDesign); |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | NodeId ParameterPortListId; |
| 137 | std::stack<NodeId> stack; |
| 138 | stack.push(id); |
| 139 | VObjectType port_direction = VObjectType::slNoType; |
| 140 | while (!stack.empty()) { |
| 141 | id = stack.top(); |
| 142 | if (ParameterPortListId && (id == ParameterPortListId)) { |
| 143 | ParameterPortListId = InvalidNodeId; |
| 144 | } |
| 145 | stack.pop(); |
| 146 | current = fC->Object(id); |
| 147 | VObjectType type = fC->Type(id); |
| 148 | switch (type) { |
| 149 | case VObjectType::paPackage_import_item: { |
| 150 | if (collectType != CollectType::FUNCTION) break; |
| 151 | m_helper.importPackage(m_program, m_design, fC, id, m_compileDesign); |
nothing calls this directly
no test coverage detected