From 4646acad0db369302d08a1b83e1971be31c1df4f Mon Sep 17 00:00:00 2001 From: Marco Benelli Date: Tue, 16 Oct 2018 15:32:58 +0200 Subject: qmljs: update parser Update the qtcreator qmljs parser to the one of Qt 5.12. It supports EcmaScript 7. Task-number: QTCREATORBUG-20341 Change-Id: I0d1cff71402ba17e22cde6b46c65614e162280de Reviewed-by: Erik Verbruggen --- src/libs/qmljs/parser/qmldirparser.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/libs/qmljs/parser/qmldirparser.cpp') diff --git a/src/libs/qmljs/parser/qmldirparser.cpp b/src/libs/qmljs/parser/qmldirparser.cpp index ece7384c98..d56affdbe1 100644 --- a/src/libs/qmljs/parser/qmldirparser.cpp +++ b/src/libs/qmljs/parser/qmldirparser.cpp @@ -93,6 +93,7 @@ bool QmlDirParser::parse(const QString &source) _components.clear(); _scripts.clear(); _designerSupported = false; + _className.clear(); quint16 lineNumber = 0; bool firstLine = true; @@ -182,7 +183,8 @@ bool QmlDirParser::parse(const QString &source) continue; } - // Ignore these. qmlimportscanner uses them. + _className = sections[1]; + } else if (sections[0] == QLatin1String("internal")) { if (sectionCount != 3) { reportError(lineNumber, 0, @@ -256,7 +258,7 @@ bool QmlDirParser::parse(const QString &source) if (parseVersion(sections[1], &major, &minor)) { const QString &fileName = sections[2]; - if (fileName.endsWith(QLatin1String(".js"))) { + if (fileName.endsWith(QLatin1String(".js")) || fileName.endsWith(QLatin1String(".mjs"))) { // A 'js' extension indicates a namespaced script import const Script entry(sections[0], fileName, major, minor); _scripts.append(entry); @@ -363,6 +365,11 @@ bool QmlDirParser::designerSupported() const return _designerSupported; } +QString QmlDirParser::className() const +{ + return _className; +} + QDebug &operator<< (QDebug &debug, const QmlDirParser::Component &component) { const QString output = QStringLiteral("{%1 %2.%3}"). -- cgit v1.2.1