aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen_p.h
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2021-07-13 11:58:26 +0200
committerMaximilian Goldstein <max.goldstein@qt.io>2021-07-14 15:10:45 +0200
commit5b1a3d50e618bb0ee9a7a095d65b24f26b633b00 (patch)
tree93f8b0e50d29bff955a59438b396b79910cf337a /src/qml/compiler/qv4codegen_p.h
parent7ca78c28eb1440a1b4b7c1830bea024ba69e32bb (diff)
qv4codegen: Provide more accurate SourceLocations
Previously the source locations in the bytecodegenerator were often imprecise due to them not being updated often enough. This change makes sure that FieldMemberExpressions and IdentifierExpressions report more accurate locations instead. Change-Id: Ib53cda5cc927551c25ed32ed34d4b65d82f5e199 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen_p.h')
-rw-r--r--src/qml/compiler/qv4codegen_p.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h
index f4a7bf4465..58f46f9313 100644
--- a/src/qml/compiler/qv4codegen_p.h
+++ b/src/qml/compiler/qv4codegen_p.h
@@ -279,14 +279,18 @@ public:
r.name = name;
return r;
}
- static Reference fromMember(const Reference &baseRef, const QString &name,
- Moth::BytecodeGenerator::Label jumpLabel = Moth::BytecodeGenerator::Label(),
- Moth::BytecodeGenerator::Label targetLabel = Moth::BytecodeGenerator::Label()) {
+ static Reference
+ fromMember(const Reference &baseRef, const QString &name,
+ QQmlJS::SourceLocation sourceLocation = QQmlJS::SourceLocation(),
+ Moth::BytecodeGenerator::Label jumpLabel = Moth::BytecodeGenerator::Label(),
+ Moth::BytecodeGenerator::Label targetLabel = Moth::BytecodeGenerator::Label())
+ {
Q_ASSERT(baseRef.isValid());
Reference r(baseRef.codegen, Member);
r.propertyBase = baseRef.asRValue();
r.propertyNameIndex = r.codegen->registerString(name);
r.requiresTDZCheck = baseRef.requiresTDZCheck;
+ r.sourceLocation = sourceLocation;
r.optionalChainJumpLabel.reset(new Moth::BytecodeGenerator::Label(jumpLabel));
r.optionalChainTargetLabel.reset(new Moth::BytecodeGenerator::Label(targetLabel));
return r;
@@ -382,6 +386,7 @@ public:
quint32 isVolatile:1;
quint32 global:1;
quint32 qmlGlobal:1;
+ QQmlJS::SourceLocation sourceLocation = QQmlJS::SourceLocation();
QSharedPointer<Moth::BytecodeGenerator::Label> optionalChainJumpLabel;
QSharedPointer<Moth::BytecodeGenerator::Label> optionalChainTargetLabel;