diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2021-07-30 14:18:49 +0200 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2021-08-02 09:27:19 +0200 |
commit | 15b7755492e278e1055212be6ad5aef0effb1b7c (patch) | |
tree | c1b18a45bdedc711b610d4152067464a4fea4dd3 /src/qml/compiler | |
parent | 034837826e2ec9ab8fc391c70e0414d026db7330 (diff) |
qv4codegen: Improve source location reporting
Properly report the source location of FieldMemberExpressions and also report them properly when the FieldMemberExpression ends in a CallPropertyLookup.
Change-Id: I2c0eb719e98d19dec97d46cda1530208ad0120cd
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index 2b4168e155..e57b0a27dd 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -2059,6 +2059,9 @@ void Codegen::endVisit(CallExpression *ast) void Codegen::handleCall(Reference &base, Arguments calldata, int slotForFunction, int slotForThisObject, bool optional) { + if (base.sourceLocation.isValid()) + bytecodeGenerator->setLocation(base.sourceLocation); + //### Do we really need all these call instructions? can's we load the callee in a temp? if (base.type == Reference::Member) { if (!disable_lookups && useFastLookups) { @@ -2492,7 +2495,7 @@ bool Codegen::visit(FieldMemberExpression *ast) } setExprResult(Reference::fromMember( - base, ast->name.toString(), ast->firstSourceLocation(), + base, ast->name.toString(), ast->lastSourceLocation(), ast->isOptional ? m_optionalChainLabels.take(ast) : Moth::BytecodeGenerator::Label(), label.has_value() ? label.value() : Moth::BytecodeGenerator::Label())); |