QmlJs: Fix reformatter for template strings

Change-Id: Ie0b7909d634d1e2e735377b053f7a1c1c2518f78
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
This commit is contained in:
Leander Schulten
2020-12-09 22:46:50 +01:00
parent 7e526d9b05
commit 771e269a3b
2 changed files with 12 additions and 0 deletions

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);

View File

@@ -21,6 +21,11 @@ const func4 = (x, y) => {
return x + y
}
const s1 = `test`
const s2 = `${42 * 1}`
const s3 = `test ${s2}`
const s4 = `${s2}${s3}test`
while (true) {
for (var a = 1; a < 5; ++a) {
switch (a) {