| 55 | bool CompileFileContent::compile() { return collectObjects_(); } |
| 56 | |
| 57 | bool CompileFileContent::collectObjects_() { |
| 58 | std::vector<VObjectType> stopPoints = { |
| 59 | VObjectType::paModule_declaration, |
| 60 | VObjectType::paInterface_declaration, |
| 61 | VObjectType::paProgram_declaration, |
| 62 | VObjectType::paClass_declaration, |
| 63 | VObjectType::paPRIMITIVE, |
| 64 | VObjectType::paPackage_declaration, |
| 65 | VObjectType::paFunction_declaration, |
| 66 | VObjectType::paInterface_class_declaration}; |
| 67 | |
| 68 | FileContent* fC = m_fileContent; |
| 69 | if (fC->getSize() == 0) return true; |
| 70 | const VObject& current = fC->Object(NodeId(fC->getSize() - 2)); |
| 71 | NodeId id = current.m_child; |
| 72 | if (!id) id = current.m_sibling; |
| 73 | if (!id) return false; |
| 74 | std::stack<NodeId> stack; |
| 75 | stack.push(id); |
| 76 | while (!stack.empty()) { |
| 77 | id = stack.top(); |
| 78 | stack.pop(); |
| 79 | const VObject& current = fC->Object(id); |
| 80 | VObjectType type = fC->Type(id); |
| 81 | switch (type) { |
| 82 | case VObjectType::paPackage_import_item: { |
| 83 | if (m_declOnly == false) { |
| 84 | m_helper.importPackage(m_fileContent, m_design, fC, id, |
| 85 | m_compileDesign); |
| 86 | m_helper.compileImportDeclaration(m_fileContent, fC, id, |
| 87 | m_compileDesign); |
| 88 | FileCNodeId fnid(fC, id); |
| 89 | m_fileContent->addObject(type, fnid); |
| 90 | } |
| 91 | break; |
| 92 | } |
| 93 | case VObjectType::paFunction_declaration: { |
| 94 | if (m_declOnly == false) { |
| 95 | m_helper.compileFunction(m_fileContent, fC, id, m_compileDesign, |
| 96 | Reduce::No, nullptr, true); |
| 97 | m_helper.compileFunction(m_fileContent, fC, id, m_compileDesign, |
| 98 | Reduce::No, nullptr, true); |
| 99 | } |
| 100 | break; |
| 101 | } |
| 102 | case VObjectType::paData_declaration: { |
| 103 | if (m_declOnly) { |
| 104 | m_helper.compileDataDeclaration(m_fileContent, fC, id, false, |
| 105 | m_compileDesign, Reduce::Yes, |
| 106 | nullptr); |
| 107 | } |
| 108 | break; |
| 109 | } |
| 110 | case VObjectType::paBind_directive: { |
| 111 | if (!m_declOnly) { |
| 112 | m_helper.compileBindStmt(m_fileContent, fC, id, m_compileDesign, |
| 113 | nullptr); |
| 114 | } |
nothing calls this directly
no test coverage detected