summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qmldom.cpp10
-rw-r--r--src/declarative/qml/qmldom.h3
-rw-r--r--src/declarative/qml/qmldom_p.h1
-rw-r--r--src/declarative/qml/qmlscriptparser.cpp11
-rw-r--r--src/declarative/qml/qmlscriptparser_p.h4
5 files changed, 29 insertions, 0 deletions
diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp
index 0ebbbfb..e06afb5 100644
--- a/src/declarative/qml/qmldom.cpp
+++ b/src/declarative/qml/qmldom.cpp
@@ -194,6 +194,8 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data, const QUrl
d->imports += QUrl(td->data.imports().at(i).uri);
}
+ d->automaticSemicolonOffsets = td->data.automaticSemicolonOffsets();
+
if (td->data.tree()) {
if (compilerDump()) {
qWarning() << "-AST------------------------------------------------------------------------------";
@@ -251,6 +253,14 @@ QmlDomObject QmlDomDocument::rootObject() const
return rv;
}
+QList<int> QmlDomDocument::automaticSemicolonOffsets() const
+{
+ if (d)
+ return d->automaticSemicolonOffsets;
+ else
+ return QList<int>();
+}
+
QmlDomPropertyPrivate::QmlDomPropertyPrivate()
: property(0)
{
diff --git a/src/declarative/qml/qmldom.h b/src/declarative/qml/qmldom.h
index 86eaecb..442a4fc 100644
--- a/src/declarative/qml/qmldom.h
+++ b/src/declarative/qml/qmldom.h
@@ -78,6 +78,9 @@ public:
QByteArray save() const;
QmlDomObject rootObject() const;
+
+ QList<int> automaticSemicolonOffsets() const;
+
private:
QSharedDataPointer<QmlDomDocumentPrivate> d;
};
diff --git a/src/declarative/qml/qmldom_p.h b/src/declarative/qml/qmldom_p.h
index 74edd47..441269c 100644
--- a/src/declarative/qml/qmldom_p.h
+++ b/src/declarative/qml/qmldom_p.h
@@ -62,6 +62,7 @@ public:
QList<QmlError> errors;
QList<QUrl> imports;
QmlParser::Object *root;
+ QList<int> automaticSemicolonOffsets;
};
class QmlDomObjectPrivate : public QSharedData
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp
index 31a20be..5207292 100644
--- a/src/declarative/qml/qmlscriptparser.cpp
+++ b/src/declarative/qml/qmlscriptparser.cpp
@@ -178,6 +178,8 @@ protected:
virtual bool visit(AST::UiArrayBinding *node);
virtual bool visit(AST::UiSourceElement *node);
+ virtual bool visit(AST::ExpressionStatement *node);
+
void accept(AST::Node *node);
QString asString(AST::UiQualifiedId *node) const;
@@ -638,6 +640,14 @@ bool ProcessAST::visit(AST::UiScriptBinding *node)
return true;
}
+bool ProcessAST::visit(AST::ExpressionStatement *node)
+{
+ if (!node->semicolonToken.isValid())
+ _parser->addAutomaticSemicolonOffset(node->semicolonToken.offset);
+
+ return true;
+}
+
// UiObjectMember: UiQualifiedId T_COLON T_LBRACKET UiObjectMemberList T_RBRACKET ;
bool ProcessAST::visit(AST::UiArrayBinding *node)
{
@@ -825,6 +835,7 @@ void QmlScriptParser::clear()
_nameSpacePaths.clear();
_typeNames.clear();
_errors.clear();
+ _automaticSemicolonOffsets.clear();
if (data) {
delete data;
diff --git a/src/declarative/qml/qmlscriptparser_p.h b/src/declarative/qml/qmlscriptparser_p.h
index 3993194..b057e2b 100644
--- a/src/declarative/qml/qmlscriptparser_p.h
+++ b/src/declarative/qml/qmlscriptparser_p.h
@@ -82,6 +82,9 @@ public:
QList<QmlError> errors() const;
+ QList<int> automaticSemicolonOffsets() const { return _automaticSemicolonOffsets; }
+ void addAutomaticSemicolonOffset(int offset) { _automaticSemicolonOffsets.append(offset); }
+
// ### private:
int findOrCreateTypeId(const QString &name);
void setTree(QmlParser::Object *tree);
@@ -100,6 +103,7 @@ public:
QStringList _typeNames;
QString _scriptFile;
QmlScriptParserJsASTData *data;
+ QList<int> _automaticSemicolonOffsets;
};
QT_END_NAMESPACE