MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ eval()

ClangInterpreter::EvalResult Lila::ClangInterpreter::eval ( const std::string &  code)

Evaluates a code snippet.

Parameters
codeC++ code to execute
Returns
EvalResult containing success, output, and error info

Definition at line 161 of file ClangInterpreter.cpp.

162{
163 EvalResult result;
164
165 if (!m_impl->interpreter) {
166 result.error = "Interpreter not initialized";
167 LILA_ERROR(Emitter::INTERPRETER, result.error);
168 return result;
169 }
170
171 LILA_DEBUG(Emitter::INTERPRETER, "Evaluating code...");
172
173 auto eval_result = m_impl->interpreter->ParseAndExecute(code);
174
175 if (!eval_result) {
176 result.success = true;
177 LILA_DEBUG(Emitter::INTERPRETER, "Code evaluation succeeded");
178 } else {
179 result.success = false;
180 result.error = "Execution failed: " + llvm::toString(std::move(eval_result));
181 LILA_ERROR(Emitter::INTERPRETER, result.error);
182 }
183
184 m_impl->eval_counter++;
185 return result;
186}
#define LILA_ERROR(emitter, msg)
#define LILA_DEBUG(emitter, msg)
std::unique_ptr< Impl > m_impl
Internal implementation details.

References Lila::ClangInterpreter::EvalResult::error, LILA_DEBUG, LILA_ERROR, m_impl, and Lila::ClangInterpreter::EvalResult::success.

Referenced by eval_file().

+ Here is the caller graph for this function: