diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-11-08 13:53:23 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-11-08 15:35:14 +0000 |
commit | ad524b0f1cda91c26e6f697831e24d6e78b336a5 (patch) | |
tree | cc9afd2633c2a360b5ce28b956cb2fea575094aa | |
parent | 84a12c6a78fde5f33ad63386a141b9b64d647815 (diff) |
SVConverter: Bail out early if the importScope is erroneous
This simplifies the code quite a bit.
Change-Id: I07a6667276650c4b4d17bd667dd9f8f1c0f753aa
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | src/lib/corelib/language/evaluatorscriptclass.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/lib/corelib/language/evaluatorscriptclass.cpp b/src/lib/corelib/language/evaluatorscriptclass.cpp index 18e088743..d0c508037 100644 --- a/src/lib/corelib/language/evaluatorscriptclass.cpp +++ b/src/lib/corelib/language/evaluatorscriptclass.cpp @@ -277,6 +277,10 @@ private: } const Evaluator::FileContextScopes fileCtxScopes = data->evaluator->fileContextScopes(value->file()); + if (fileCtxScopes.importScope.isError()) { + *result = fileCtxScopes.importScope; + return; + } pushScope(fileCtxScopes.fileScope); pushItemScopes(data->item); if (itemOfProperty->type() != ItemType::ModuleInstance) { @@ -286,14 +290,9 @@ private: if (value->definingItem()) pushItemScopes(value->definingItem()); pushScope(maybeExtraScope.first); - const QScriptValue &theImportScope = fileCtxScopes.importScope; - if (theImportScope.isError()) { - *result = theImportScope; - } else { - pushScope(theImportScope); - *result = engine->evaluate(value->sourceCodeForEvaluation(), value->file()->filePath(), - value->line()); - } + pushScope(fileCtxScopes.importScope); + *result = engine->evaluate(value->sourceCodeForEvaluation(), value->file()->filePath(), + value->line()); popScopes(); } |