diff options
| author | Semih Yavuz <semih.yavuz@qt.io> | 2023-12-12 14:33:24 +0300 |
|---|---|---|
| committer | Semih Yavuz <semih.yavuz@qt.io> | 2024-01-10 19:52:18 +0100 |
| commit | 4c059a14b8ce91e005cb67d31cd94223274ad60d (patch) | |
| tree | d84f89b736fd803c6783633d656d086d16e5bfad /src | |
| parent | 3bc2ac3db8b400c1171a8387982af5daee2cdcc6 (diff) | |
qmlformat: Fix property names with escape chars
Formatter was breaking the string literal property names if they
consisted some escape sequences. Remove the complicated logic for
rewriting, instead use the same literal that was scanned and assigned
to propertyName.
Pick-to: 6.5 6.6 6.7
Fixes: QTBUG-113776
Change-Id: I87d8c31d4893001e784536302e33f1f517f21acd
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src')
| -rw-r--r-- | src/qmldom/qqmldomreformatter.cpp | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/qmldom/qqmldomreformatter.cpp b/src/qmldom/qqmldomreformatter.cpp index 533dfab426..4e6c93dec3 100644 --- a/src/qmldom/qqmldomreformatter.cpp +++ b/src/qmldom/qqmldomreformatter.cpp @@ -324,23 +324,7 @@ protected: PatternProperty *assignment = AST::cast<PatternProperty *>(it->property); if (assignment) { preVisit(assignment); - const bool isStringLike = [this](const SourceLocation &loc) { - const auto name = loc2Str(loc); - if (name.first() == name.last()) { - if (name.first() == QStringLiteral("\'") - || name.first() == QStringLiteral("\"")) - return true; - } - return false; - }(assignment->name->propertyNameToken); - - if (isStringLike) - out("\""); - accept(assignment->name); - if (isStringLike) - out("\""); - bool useInitializer = false; const bool bindingIdentifierExist = !assignment->bindingIdentifier.isEmpty(); if (assignment->colonToken.length > 0) { @@ -411,7 +395,7 @@ protected: } bool visit(StringLiteralPropertyName *ast) override { - out(ast->id.toString()); + out(ast->propertyNameToken); return true; } bool visit(NumericLiteralPropertyName *ast) override |
