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

@@ -295,8 +295,8 @@ protected:
decl.text += QLatin1Char('(');
for (FormalParameterList *it = ast->formals; it; it = it->next) {
if (!it->name.isEmpty())
decl.text += it->name;
if (!it->element->bindingIdentifier.isEmpty())
decl.text += it->element->bindingIdentifier;
if (it->next)
decl.text += QLatin1String(", ");
@@ -309,14 +309,14 @@ protected:
return false;
}
bool visit(AST::VariableDeclaration *ast) override
bool visit(AST::PatternElement *ast) override
{
if (ast->name.isEmpty())
if (!ast->isVariableDeclaration() || ast->bindingIdentifier.isEmpty())
return false;
Declaration decl;
decl.text.fill(QLatin1Char(' '), _depth);
decl.text += ast->name;
decl.text += ast->bindingIdentifier;
const SourceLocation first = ast->identifierToken;
decl.startLine = first.startLine;
@@ -343,8 +343,8 @@ protected:
decl.text += QLatin1Char('(');
for (FormalParameterList *it = funcExpr->formals; it; it = it->next) {
if (!it->name.isEmpty())
decl.text += it->name;
if (!it->element->bindingIdentifier.isEmpty())
decl.text += it->element->bindingIdentifier;
if (it->next)
decl.text += QLatin1String(", ");