| 75 | } |
| 76 | |
| 77 | std::string Codegen::searchDefaultModule(std::string path, |
| 78 | std::string moduleName) { |
| 79 | for (auto& entry : std::filesystem::directory_iterator(path)) { |
| 80 | if (std::filesystem::path(entry.path()).filename() == moduleName) { |
| 81 | // TODO:ignore extensions? |
| 82 | if (entry.is_regular_file()) { |
| 83 | return entry.path().string(); |
| 84 | } else if (entry.is_directory()) { |
| 85 | // TODO: avoid deeply nested folders |
| 86 | searchDefaultModule(entry.path().string(), moduleName); |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | return ""; |
| 92 | } |
| 93 | |
| 94 | void Codegen::codegenFuncParams(std::vector<ast::parameter> parameters,size_t start) { |
| 95 | if ((parameters.size()-start)>0) { |