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:
Marco Benelli
2018-10-16 15:32:58 +02:00
parent fe8a372773
commit 4646acad0d
46 changed files with 10604 additions and 5872 deletions

View File

@@ -56,13 +56,7 @@ class QML_PARSER_EXPORT MemoryPool : public QSharedData
void operator =(const MemoryPool &other);
public:
MemoryPool()
: _blocks(0),
_allocatedBlocks(0),
_blockCount(-1),
_ptr(0),
_end(0)
{ }
MemoryPool() {}
~MemoryPool()
{
@@ -74,6 +68,7 @@ public:
free(_blocks);
}
qDeleteAll(strings);
}
inline void *allocate(size_t size)
@@ -90,11 +85,16 @@ public:
void reset()
{
_blockCount = -1;
_ptr = _end = 0;
_ptr = _end = nullptr;
}
template <typename Tp> Tp *New() { return new (this->allocate(sizeof(Tp))) Tp(); }
QStringRef newString(const QString &string) {
strings.append(new QString(string));
return QStringRef(strings.last());
}
private:
Q_NEVER_INLINE void *allocate_helper(size_t size)
{
@@ -110,7 +110,7 @@ private:
Q_CHECK_PTR(_blocks);
for (int index = _blockCount; index < _allocatedBlocks; ++index)
_blocks[index] = 0;
_blocks[index] = nullptr;
}
char *&block = _blocks[_blockCount];
@@ -129,11 +129,12 @@ private:
}
private:
char **_blocks;
int _allocatedBlocks;
int _blockCount;
char *_ptr;
char *_end;
char **_blocks = nullptr;
int _allocatedBlocks = 0;
int _blockCount = -1;
char *_ptr = nullptr;
char *_end = nullptr;
QVector<QString*> strings;
enum
{
@@ -144,12 +145,10 @@ private:
class QML_PARSER_EXPORT Managed
{
Managed(const Managed &other);
void operator = (const Managed &other);
Q_DISABLE_COPY(Managed)
public:
Managed() {}
~Managed() {}
Managed() = default;
~Managed() = default;
void *operator new(size_t size, MemoryPool *pool) { return pool->allocate(size); }
void operator delete(void *) {}