MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / recompileScriptIfNeeded

Method recompileScriptIfNeeded

app/src/MQTT/Publisher.cpp:450–464  ·  view source on GitHub ↗

* @brief Compiles the script when scriptCode has changed since the last successful compile. */

Source from the content-addressed store, hash-verified

448 * @brief Compiles the script when scriptCode has changed since the last successful compile.
449 */
450void MQTT::PublisherWorker::recompileScriptIfNeeded()
451{
452 if (!m_script)
453 return;
454
455 const bool sameCode = (m_cfg.scriptCode == m_compiledScriptCode);
456 const bool sameLang = (m_cfg.scriptLanguage == m_script->currentLanguage());
457 if (sameCode && sameLang && m_script->isLoaded())
458 return;
459
460 m_compiledScriptCode = m_cfg.scriptCode;
461 QString error;
462 if (!m_script->compile(m_cfg.scriptCode, m_cfg.scriptLanguage, error))
463 Q_EMIT scriptErrorOccurred(error);
464}
465
466/**
467 * @brief Publishes a payload and increments the stats counters.

Callers

nothing calls this directly

Calls 3

currentLanguageMethod · 0.80
isLoadedMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected