| 132 | } |
| 133 | |
| 134 | struct FunctorCompileOneFile { |
| 135 | FunctorCompileOneFile(CompileSourceFile* compileSource, |
| 136 | CompileSourceFile::Action action) |
| 137 | : m_compileSourceFile(compileSource), m_action(action) {} |
| 138 | |
| 139 | int32_t operator()() const { |
| 140 | #ifdef SURELOG_WITH_PYTHON |
| 141 | if (m_compileSourceFile->getCommandLineParser()->pythonListener() || |
| 142 | m_compileSourceFile->getCommandLineParser() |
| 143 | ->pythonEvalScriptPerFile()) { |
| 144 | PyThreadState* interpState = PythonAPI::initNewInterp(); |
| 145 | m_compileSourceFile->setPythonInterp(interpState); |
| 146 | } |
| 147 | #endif |
| 148 | return m_compileSourceFile->compile(m_action); |
| 149 | } |
| 150 | |
| 151 | private: |
| 152 | CompileSourceFile* m_compileSourceFile; |
| 153 | CompileSourceFile::Action m_action; |
| 154 | }; |
| 155 | |
| 156 | bool Compiler::compileOneFile_(CompileSourceFile* compiler, |
| 157 | CompileSourceFile::Action action) { |