forked from qt-creator/qt-creator
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 <erik.verbruggen@qt.io>
This commit is contained in:
@@ -39,8 +39,8 @@
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include "qmljsengine_p.h"
|
||||
#include "qmljsglobal_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -48,8 +48,6 @@ class QmlError;
|
||||
class QmlEngine;
|
||||
class QML_PARSER_EXPORT QmlDirParser
|
||||
{
|
||||
Q_DISABLE_COPY(QmlDirParser)
|
||||
|
||||
public:
|
||||
QmlDirParser();
|
||||
~QmlDirParser();
|
||||
@@ -76,8 +74,7 @@ public:
|
||||
|
||||
struct Component
|
||||
{
|
||||
Component()
|
||||
: majorVersion(0), minorVersion(0), internal(false), singleton(false) {}
|
||||
Component() {}
|
||||
|
||||
Component(const QString &typeName, const QString &fileName, int majorVersion, int minorVersion)
|
||||
: typeName(typeName), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion),
|
||||
@@ -85,24 +82,23 @@ public:
|
||||
|
||||
QString typeName;
|
||||
QString fileName;
|
||||
int majorVersion;
|
||||
int minorVersion;
|
||||
bool internal;
|
||||
bool singleton;
|
||||
int majorVersion = 0;
|
||||
int minorVersion = 0;
|
||||
bool internal = false;
|
||||
bool singleton = false;
|
||||
};
|
||||
|
||||
struct Script
|
||||
{
|
||||
Script()
|
||||
: majorVersion(0), minorVersion(0) {}
|
||||
Script() {}
|
||||
|
||||
Script(const QString &nameSpace, const QString &fileName, int majorVersion, int minorVersion)
|
||||
: nameSpace(nameSpace), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion) {}
|
||||
|
||||
QString nameSpace;
|
||||
QString fileName;
|
||||
int majorVersion;
|
||||
int minorVersion;
|
||||
int majorVersion = 0;
|
||||
int minorVersion = 0;
|
||||
};
|
||||
|
||||
QHash<QString,Component> components() const;
|
||||
@@ -124,6 +120,8 @@ public:
|
||||
QList<TypeInfo> typeInfos() const;
|
||||
#endif
|
||||
|
||||
QString className() const;
|
||||
|
||||
private:
|
||||
bool maybeAddComponent(const QString &typeName, const QString &fileName, const QString &version, QHash<QString,Component> &hash, int lineNumber = -1, bool multi = true);
|
||||
void reportError(quint16 line, quint16 column, const QString &message);
|
||||
@@ -139,6 +137,7 @@ private:
|
||||
#ifdef QT_CREATOR
|
||||
QList<TypeInfo> _typeInfos;
|
||||
#endif
|
||||
QString _className;
|
||||
};
|
||||
|
||||
typedef QHash<QString,QmlDirParser::Component> QmlDirComponents;
|
||||
|
||||
Reference in New Issue
Block a user