Merge remote-tracking branch 'origin/4.14'

Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: I5b8d93f2f08b62626c3f3447728c64d198b601ff
This commit is contained in:
Eike Ziller
2021-01-04 09:09:21 +01:00
30 changed files with 187 additions and 87 deletions

View File

@@ -4019,14 +4019,16 @@ ArrowFunction_In: ArrowParameters T_ARROW ConciseBodyLookahead AssignmentExpress
/.
case $rule_number: {
AST::ReturnStatement *ret = new (pool) AST::ReturnStatement(sym(4).Expression);
ret->returnToken = sym(4).Node->firstSourceLocation();
ret->semicolonToken = sym(4).Node->lastSourceLocation();
const auto zeroLength = [](SourceLocation l){ l.length = 0; return l; };
ret->returnToken = zeroLength(sym(4).Node->firstSourceLocation());
ret->semicolonToken = zeroLength(sym(4).Node->lastSourceLocation());
AST::StatementList *statements = (new (pool) AST::StatementList(ret))->finish();
AST::FunctionExpression *f = new (pool) AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, statements);
AST::FunctionExpression *f = new (pool)
AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, statements);
f->isArrowFunction = true;
f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1);
f->lbraceToken = sym(4).Node->firstSourceLocation();
f->rbraceToken = sym(4).Node->lastSourceLocation();
f->lbraceToken = zeroLength(sym(4).Node->firstSourceLocation());
f->rbraceToken = zeroLength(sym(4).Node->lastSourceLocation());
sym(1).Node = f;
} break;
./
@@ -4039,7 +4041,7 @@ ArrowFunction_In: ArrowParameters T_ARROW ConciseBodyLookahead T_FORCE_BLOCK Fun
AST::FunctionExpression *f = new (pool) AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, sym(6).StatementList);
f->isArrowFunction = true;
f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1);
f->lbraceToken = loc(6);
f->lbraceToken = loc(5);
f->rbraceToken = loc(7);
sym(1).Node = f;
} break;

View File

@@ -3001,15 +3001,16 @@ case 241: {
case 528: {
AST::ReturnStatement *ret = new (pool) AST::ReturnStatement(sym(4).Expression);
ret->returnToken = sym(4).Node->firstSourceLocation();
ret->semicolonToken = sym(4).Node->lastSourceLocation();
const auto zeroLength = [](SourceLocation l){ l.length = 0; return l; };
ret->returnToken = zeroLength(sym(4).Node->firstSourceLocation());
ret->semicolonToken = zeroLength(sym(4).Node->lastSourceLocation());
AST::StatementList *statements = (new (pool) AST::StatementList(ret))->finish();
AST::FunctionExpression *f = new (pool)
AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, statements);
f->isArrowFunction = true;
f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1);
f->lbraceToken = sym(4).Node->firstSourceLocation();
f->rbraceToken = sym(4).Node->lastSourceLocation();
f->lbraceToken = zeroLength(sym(4).Node->firstSourceLocation());
f->rbraceToken = zeroLength(sym(4).Node->lastSourceLocation());
sym(1).Node = f;
} break;
@@ -3022,7 +3023,7 @@ case 241: {
AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, sym(6).StatementList);
f->isArrowFunction = true;
f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1);
f->lbraceToken = loc(6);
f->lbraceToken = loc(5);
f->rbraceToken = loc(7);
sym(1).Node = f;
} break;

View File

@@ -802,6 +802,13 @@ protected:
bool visit(StringLiteralPropertyName *ast) override { out(ast->id.toString()); return true; }
bool visit(NumericLiteralPropertyName *ast) override { out(QString::number(ast->id)); return true; }
bool visit(TemplateLiteral *ast) override
{
out(ast->literalToken);
accept(ast->expression);
return true;
}
bool visit(ArrayMemberExpression *ast) override
{
accept(ast->base);
@@ -1097,7 +1104,8 @@ protected:
{
out(ast->returnToken);
if (ast->expression) {
out(" ");
if (ast->returnToken.isValid())
out(" ");
accept(ast->expression);
}
return false;
@@ -1218,17 +1226,32 @@ protected:
bool visit(FunctionExpression *ast) override
{
out("function ", ast->functionToken);
if (!ast->name.isNull())
out(ast->identifierToken);
if (!ast->isArrowFunction) {
out("function ", ast->functionToken);
if (!ast->name.isNull())
out(ast->identifierToken);
}
out(ast->lparenToken);
if (ast->isArrowFunction && ast->formals && ast->formals->next)
out("(");
accept(ast->formals);
if (ast->isArrowFunction && ast->formals && ast->formals->next)
out(")");
out(ast->rparenToken);
if (ast->isArrowFunction && !ast->formals)
out("()");
out(" ");
if (ast->isArrowFunction)
out("=> ");
out(ast->lbraceToken);
if (ast->body) {
lnAcceptIndented(ast->body);
newLine();
if (ast->body->next || ast->lbraceToken.isValid()) {
lnAcceptIndented(ast->body);
newLine();
} else {
// print a single statement in one line. E.g. x => x * 2
accept(ast->body);
}
}
out(ast->rbraceToken);
return false;