aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/language/evaluatorscriptclass.cpp
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2017-10-04 15:12:29 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2017-10-05 10:13:54 +0000
commitb195b8ea48d29b2fa76717821812ebdada820450 (patch)
tree8fec0b8770f2441c80d6908e6e2782367b243285 /src/lib/corelib/language/evaluatorscriptclass.cpp
parent3966a02be1ff953c1b4161ca12e05c27b6abe8bb (diff)
Use range-based for loop in SVConverter::handle(JSSourceValue*)
...and remove a superfluous indirection to clean up the code a bit. Change-Id: Ibb600f129c324519ce7f9513e7e6551b7a4288d4 Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/lib/corelib/language/evaluatorscriptclass.cpp')
-rw-r--r--src/lib/corelib/language/evaluatorscriptclass.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/lib/corelib/language/evaluatorscriptclass.cpp b/src/lib/corelib/language/evaluatorscriptclass.cpp
index fcc920366..4c4a521a5 100644
--- a/src/lib/corelib/language/evaluatorscriptclass.cpp
+++ b/src/lib/corelib/language/evaluatorscriptclass.cpp
@@ -148,9 +148,7 @@ private:
QScriptValue conditionScope;
QScriptValue conditionFileScope;
Item *outerItem = data->item->outerItem();
- for (size_t i = 0; i < value->alternatives().size(); ++i) {
- const JSSourceValue::Alternative *alternative = 0;
- alternative = &value->alternatives().at(i);
+ for (const JSSourceValue::Alternative &alternative : value->alternatives()) {
const Evaluator::FileContextScopes fileCtxScopes
= data->evaluator->fileContextScopes(value->file());
if (!conditionScopeItem) {
@@ -189,8 +187,8 @@ private:
}
scriptContext->pushScope(conditionFileScope);
pushItemScopes(conditionScopeItem);
- if (alternative->value->definingItem())
- pushItemScopes(alternative->value->definingItem());
+ if (alternative.value->definingItem())
+ pushItemScopes(alternative.value->definingItem());
scriptContext->pushScope(conditionScope);
const QScriptValue &theImportScope = fileCtxScopes.importScope;
if (theImportScope.isError()) {
@@ -201,8 +199,8 @@ private:
return;
}
scriptContext->pushScope(theImportScope);
- const QScriptValue cr = engine->evaluate(alternative->condition);
- const QScriptValue overrides = engine->evaluate(alternative->overrideListProperties);
+ const QScriptValue cr = engine->evaluate(alternative.condition);
+ const QScriptValue overrides = engine->evaluate(alternative.overrideListProperties);
scriptContext->popScope();
scriptContext->popScope();
scriptContext->popScope();
@@ -213,7 +211,7 @@ private:
}
if (cr.toBool()) {
// condition is true, let's use the value of this alternative
- if (alternative->value->sourceUsesOuter() && !outerItem) {
+ if (alternative.value->sourceUsesOuter() && !outerItem) {
// Clone value but without alternatives.
JSSourceValuePtr outerValue = JSSourceValue::create();
outerValue->setFile(value->file());
@@ -228,7 +226,7 @@ private:
}
if (overrides.toBool())
value->setIsExclusiveListValue();
- value = alternative->value.get();
+ value = alternative.value.get();
break;
}
}