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

◆ evaluate()

Status Lila::Lila::evaluate ( const std::string & code,
EvalOrigin origin )
private

Definition at line 141 of file Lila.cpp.

142{
143 const auto result = m_interpreter->eval(code);
144
145 if (const auto observers = m_observers->cell.read()) {
146 const EvalReport report {
147 .origin = origin,
148 .ok = result.success,
149 .code = code,
150 .reason = result.success ? std::string_view {} : std::string_view(result.error),
151 };
152
153 for (const auto& entry : *observers) {
154 try {
155 entry.observer(entry.user, report);
156 } catch (const std::exception& e) {
157 LILA_WARN(Emitter::SYSTEM, std::string("Eval observer threw: ") + e.what());
158 } catch (...) {
159 LILA_WARN(Emitter::SYSTEM, "Eval observer threw");
160 }
161 }
162 }
163
164 if (!result.success) {
165 return refuse(result.error);
166 }
167 return {};
168}
#define LILA_WARN(emitter, msg)
std::unique_ptr< Observers > m_observers
Definition Lila.hpp:148
static Status refuse(std::string reason)
Definition Lila.cpp:62
std::unique_ptr< ClangInterpreter > m_interpreter
Definition Lila.hpp:147
Lila::EvalReport EvalReport
What one evaluation did, as Lila reports it.
Definition Session.hpp:84

References LILA_WARN, m_interpreter, m_observers, and refuse().

Referenced by eval(), handle_message(), and operator=().

Here is the call graph for this function:
Here is the caller graph for this function: