aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-19 12:54:02 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-02 11:46:09 +0100
commitfe5a3a024ac7e5f0cfa89d58c89ac705940bd5a4 (patch)
treecef9e2778d7bbfbe49466fce0b21bfb47caf60a4 /src/qml
parentcf5c3d686d5bbb942b565ee5df6babb10ce22bc6 (diff)
[new compiler] Fix error location when id property is used in list model elements
Change-Id: Iec648d593d30117c512009dcc6ab0d50b8fc51af Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/qml/qqmlcustomparser.cpp24
-rw-r--r--src/qml/qml/qqmlcustomparser_p.h7
-rw-r--r--src/qml/types/qqmllistmodel.cpp2
3 files changed, 11 insertions, 22 deletions
diff --git a/src/qml/qml/qqmlcustomparser.cpp b/src/qml/qml/qqmlcustomparser.cpp
index e976000c9e..fc14fae275 100644
--- a/src/qml/qml/qqmlcustomparser.cpp
+++ b/src/qml/qml/qqmlcustomparser.cpp
@@ -277,29 +277,15 @@ void QQmlCustomParser::error(const QQmlCustomParserNode& node, const QString& de
}
/*!
- Reports an error in parsing \a binding, with the given \a description.
-
- An error is generated referring to the position of \a node in the source file.
-*/
-void QQmlCustomParser::error(const QV4::CompiledData::Binding *binding, const QString &description)
-{
- QQmlError error;
- error.setLine(binding->location.line);
- error.setColumn(binding->location.column);
- error.setDescription(description);
- exceptions << error;
-}
-
-/*!
- Reports an error in parsing \a object, with the given \a description.
+ Reports an error with the given \a description.
- An error is generated referring to the position of \a object in the source file.
+ An error is generated referring to the \a location in the source file.
*/
-void QQmlCustomParser::error(const QV4::CompiledData::Object *object, const QString &description)
+void QQmlCustomParser::error(const CompiledData::Location &location, const QString &description)
{
QQmlError error;
- error.setLine(object->location.line);
- error.setColumn(object->location.column);
+ error.setLine(location.line);
+ error.setColumn(location.column);
error.setDescription(description);
exceptions << error;
}
diff --git a/src/qml/qml/qqmlcustomparser_p.h b/src/qml/qml/qqmlcustomparser_p.h
index b406717410..d06a8c1551 100644
--- a/src/qml/qml/qqmlcustomparser_p.h
+++ b/src/qml/qml/qqmlcustomparser_p.h
@@ -149,8 +149,11 @@ protected:
void error(const QString& description);
void error(const QQmlCustomParserProperty&, const QString& description);
void error(const QQmlCustomParserNode&, const QString& description);
- void error(const QV4::CompiledData::Binding *binding, const QString& description);
- void error(const QV4::CompiledData::Object *object, const QString& description);
+ void error(const QV4::CompiledData::Binding *binding, const QString& description)
+ { error(binding->location, description); }
+ void error(const QV4::CompiledData::Object *object, const QString& description)
+ { error(object->location, description); }
+ void error(const QV4::CompiledData::Location &location, const QString& description);
int evaluateEnum(const QByteArray&, bool *ok) const;
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 50b7614c3b..eed76ee09e 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -2407,7 +2407,7 @@ bool QQmlListModelParser::compileProperty(const QV4::CompiledData::QmlUnit *qmlU
}
if (!qmlUnit->header.stringAt(target->idIndex).isEmpty()) {
- error(binding, QQmlListModel::tr("ListElement: cannot use reserved \"id\" property"));
+ error(target->locationOfIdProperty, QQmlListModel::tr("ListElement: cannot use reserved \"id\" property"));
return false;
}