From ad524b0f1cda91c26e6f697831e24d6e78b336a5 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 8 Nov 2017 13:53:23 +0100 Subject: SVConverter: Bail out early if the importScope is erroneous This simplifies the code quite a bit. Change-Id: I07a6667276650c4b4d17bd667dd9f8f1c0f753aa Reviewed-by: Christian Kandeler --- src/lib/corelib/language/evaluatorscriptclass.cpp | 15 +++++++-------- 1 file 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(); } -- cgit v1.2.3