diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2017-07-03 11:31:36 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-07-04 09:54:31 +0000 |
commit | 2ff8d515df1bf18b87c7b5ad3ffc05371e0db4e1 (patch) | |
tree | 05ddee7677dd6100cf23e88a3fe52f3ba91d69d9 | |
parent | d0e8197bbfb7d2bd33b957a9965fcc5d9b0982a6 (diff) |
Small clean-up in Transformer class
Privatize some member functions and remove unneeded parameters.
Change-Id: I5fcff6a1f5a55f7bbd2eb9de32a7d03551df8503
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | src/lib/corelib/buildgraph/jscommandexecutor.cpp | 2 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/rulesapplicator.cpp | 4 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/transformer.cpp | 3 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/transformer.h | 14 |
4 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/corelib/buildgraph/jscommandexecutor.cpp b/src/lib/corelib/buildgraph/jscommandexecutor.cpp index afb9d7f98..9865893df 100644 --- a/src/lib/corelib/buildgraph/jscommandexecutor.cpp +++ b/src/lib/corelib/buildgraph/jscommandexecutor.cpp @@ -120,7 +120,7 @@ private: setupScriptEngineForProduct(scriptEngine, transformer->product(), transformer->rule->module, scope, &observer); transformer->setupInputs(scope); - transformer->setupOutputs(scriptEngine, scope); + transformer->setupOutputs(scope); transformer->setupExplicitlyDependsOn(scope); for (QVariantMap::const_iterator it = cmd->properties().constBegin(); diff --git a/src/lib/corelib/buildgraph/rulesapplicator.cpp b/src/lib/corelib/buildgraph/rulesapplicator.cpp index d8fc8264c..51b743527 100644 --- a/src/lib/corelib/buildgraph/rulesapplicator.cpp +++ b/src/lib/corelib/buildgraph/rulesapplicator.cpp @@ -177,7 +177,7 @@ void RulesApplicator::doApply(const ArtifactSet &inputArtifacts, QScriptValue &p m_transformer->alwaysRun = m_rule->alwaysRun; // create the output artifacts from the set of input artifacts - Transformer::setupInputs(prepareScriptContext, inputArtifacts, m_rule->module->name); + m_transformer->setupInputs(prepareScriptContext); m_transformer->setupExplicitlyDependsOn(prepareScriptContext); copyProperty(QLatin1String("inputs"), prepareScriptContext, scope()); copyProperty(QLatin1String("input"), prepareScriptContext, scope()); @@ -253,7 +253,7 @@ void RulesApplicator::doApply(const ArtifactSet &inputArtifacts, QScriptValue &p if (!ruleArtifactArtifactMap.isEmpty()) engine()->setGlobalObject(prepareScriptContext.prototype()); - m_transformer->setupOutputs(engine(), prepareScriptContext); + m_transformer->setupOutputs(prepareScriptContext); m_transformer->createCommands(engine(), m_rule->prepareScript, ScriptEngine::argumentList(m_rule->prepareScript->argumentNames, prepareScriptContext)); if (Q_UNLIKELY(m_transformer->commands.isEmpty())) diff --git a/src/lib/corelib/buildgraph/transformer.cpp b/src/lib/corelib/buildgraph/transformer.cpp index ed9740681..0e5b4a084 100644 --- a/src/lib/corelib/buildgraph/transformer.cpp +++ b/src/lib/corelib/buildgraph/transformer.cpp @@ -184,8 +184,9 @@ void Transformer::setupInputs(QScriptValue targetScriptValue) setupInputs(targetScriptValue, inputs, rule->module->name); } -void Transformer::setupOutputs(ScriptEngine *scriptEngine, QScriptValue targetScriptValue) +void Transformer::setupOutputs(QScriptValue targetScriptValue) { + ScriptEngine * const scriptEngine = static_cast<ScriptEngine *>(targetScriptValue.engine()); const QString &defaultModuleName = rule->module->name; QScriptValue scriptValue = translateInOutputs(scriptEngine, outputs, defaultModuleName); targetScriptValue.setProperty(QLatin1String("outputs"), scriptValue); diff --git a/src/lib/corelib/buildgraph/transformer.h b/src/lib/corelib/buildgraph/transformer.h index 5a278c8fd..e4ffcb83b 100644 --- a/src/lib/corelib/buildgraph/transformer.h +++ b/src/lib/corelib/buildgraph/transformer.h @@ -76,15 +76,9 @@ public: static QScriptValue translateFileConfig(ScriptEngine *scriptEngine, const Artifact *artifact, const QString &defaultModuleName); - static QScriptValue translateInOutputs(ScriptEngine *scriptEngine, - const ArtifactSet &artifacts, - const QString &defaultModuleName); - ResolvedProductPtr product() const; - static void setupInputs(QScriptValue targetScriptValue, const ArtifactSet &inputs, - const QString &defaultModuleName); void setupInputs(QScriptValue targetScriptValue); - void setupOutputs(ScriptEngine *scriptEngine, QScriptValue targetScriptValue); + void setupOutputs(QScriptValue targetScriptValue); void setupExplicitlyDependsOn(QScriptValue targetScriptValue); void createCommands(ScriptEngine *engine, const ScriptFunctionConstPtr &script, const QScriptValueList &args); @@ -92,6 +86,12 @@ public: private: Transformer(); + static void setupInputs(QScriptValue targetScriptValue, const ArtifactSet &inputs, + const QString &defaultModuleName); + static QScriptValue translateInOutputs(ScriptEngine *scriptEngine, + const ArtifactSet &artifacts, + const QString &defaultModuleName); + void load(PersistentPool &pool); void store(PersistentPool &pool) const; }; |