aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compileddata.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-09-04 10:25:37 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-10-11 14:40:18 +0000
commita4852b1ee77a913f6cc4806e6606c1b720e8f40b (patch)
treeac430430bf167465153485974e31fb4d9f723e75 /src/qml/compiler/qv4compileddata.cpp
parentb6f7fe1f80e6beed62ef47691fae6aa9f4a851b8 (diff)
Fix error reporting when imports or re-exports in modules fail
Collect the location of the import/export statement and include it in the exception thrown. Change-Id: I7966dfd53ed67d2d7087acde2dd8ff67c64cb044 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compileddata.cpp')
-rw-r--r--src/qml/compiler/qv4compileddata.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp
index c82f3d1bc8..244e762faf 100644
--- a/src/qml/compiler/qv4compileddata.cpp
+++ b/src/qml/compiler/qv4compileddata.cpp
@@ -410,7 +410,7 @@ Heap::Module *CompilationUnit::instantiate(ExecutionEngine *engine)
if (!valuePtr) {
QString referenceErrorMessage = QStringLiteral("Unable to resolve import reference ");
referenceErrorMessage += importName->toQString();
- engine->throwReferenceError(referenceErrorMessage, fileName(), /*### line*/1, /*### column*/1);
+ engine->throwReferenceError(referenceErrorMessage, fileName(), entry.location.line, entry.location.column);
return nullptr;
}
imports[i] = valuePtr;
@@ -426,7 +426,7 @@ Heap::Module *CompilationUnit::instantiate(ExecutionEngine *engine)
if (!dependentModuleUnit->resolveExport(importName)) {
QString referenceErrorMessage = QStringLiteral("Unable to resolve re-export reference ");
referenceErrorMessage += importName->toQString();
- engine->throwReferenceError(referenceErrorMessage, fileName(), /*### line*/1, /*### column*/1);
+ engine->throwReferenceError(referenceErrorMessage, fileName(), entry.location.line, entry.location.column);
return nullptr;
}
}
@@ -949,6 +949,13 @@ bool Unit::verifyHeader(QDateTime expectedSourceTimeStamp, QString *errorString)
#endif
}
+Location &Location::operator=(const QQmlJS::AST::SourceLocation &astLocation)
+{
+ line = astLocation.startLine;
+ column = astLocation.startColumn;
+ return *this;
+}
+
}
}