aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qmljs/qmljsscopebuilder.cpp
diff options
context:
space:
mode:
authorChristian Kamm <[email protected]>2010-11-23 14:15:50 +0100
committerChristian Kamm <[email protected]>2010-11-25 15:06:44 +0100
commit34093064feedcf3c918d482d9cd9121b06d804a4 (patch)
treeffe84c7a524554fe4b4bfb4c2a8cd72f3ff5e0dd /src/libs/qmljs/qmljsscopebuilder.cpp
parent93967104f3d7d2579be048d7137a404994981196 (diff)
QmlJS: Make evaluator understand expression statements.
Reviewed-by: Erik Verbruggen
Diffstat (limited to 'src/libs/qmljs/qmljsscopebuilder.cpp')
-rw-r--r--src/libs/qmljs/qmljsscopebuilder.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/libs/qmljs/qmljsscopebuilder.cpp b/src/libs/qmljs/qmljsscopebuilder.cpp
index 477f82db3b2..77b6dcc5cbf 100644
--- a/src/libs/qmljs/qmljsscopebuilder.cpp
+++ b/src/libs/qmljs/qmljsscopebuilder.cpp
@@ -238,16 +238,13 @@ void ScopeBuilder::setQmlScopeObject(Node *node)
if (scriptBinding->qualifiedId && scriptBinding->qualifiedId->name
&& scriptBinding->qualifiedId->name->asString() == QLatin1String("target")
&& ! scriptBinding->qualifiedId->next) {
- // ### make Evaluate understand statements.
- if (ExpressionStatement *expStmt = cast<ExpressionStatement *>(scriptBinding->statement)) {
- Evaluate evaluator(_context);
- const Value *targetValue = evaluator(expStmt->expression);
-
- if (const ObjectValue *target = value_cast<const ObjectValue *>(targetValue)) {
- scopeChain.qmlScopeObjects.prepend(target);
- } else {
- scopeChain.qmlScopeObjects.clear();
- }
+ Evaluate evaluator(_context);
+ const Value *targetValue = evaluator(scriptBinding->statement);
+
+ if (const ObjectValue *target = value_cast<const ObjectValue *>(targetValue)) {
+ scopeChain.qmlScopeObjects.prepend(target);
+ } else {
+ scopeChain.qmlScopeObjects.clear();
}
}
}