diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2022-06-17 18:22:55 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2022-06-23 10:40:43 +0200 |
commit | 1364c1363406eda9b462f4e48ed09248ae0cdaf8 (patch) | |
tree | db09d01a6542022ca81186af6c09fc913a968880 /tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp | |
parent | b4c51ba393b19996726b122a4cd5fe6b1fe128d3 (diff) |
lupdate: Apply a simpler fix for static initializers
...in the old C++ parser.
The fix for QTBUG-91521 was overly complicated and slow. Also it
introduced the (minor) issue QTBUG-104426.
Old fix: on encountering an identifier that is not a tr function,
we checked
- Are we on namespace level?
- Is the pending context empty?
- Are we not in a class declaration?
If all are true, we walk up the namespace stack and check whether we're
in a class declaration. Promote the prospecting to the pending context.
New fix: On encountering a first level left parenthesis we promote the
prospective context to pending context. On encountering the matching
right parenthesis we demote the pending context to prospective context.
This has the effect that the prospective context is pending between
matching first-level parentheses like here:
QString MyClass::member(QT_TR_NOOP("some text"));
^^^^^^^^^^^^^^^^^^^^^^^^ ^
pendingContext empty
^^^^^^^^^^^^^^^^^^^^^^^
pendingContext: "MyClass"
The pending context is then picked up by handleTr.
This approach fits better into the overall architecture of the parser.
Task-number: QTBUG-91521
Task-number: QTBUG-104426
Change-Id: Ibc9dfe955f2a56fc13a7bede11344532537e2f5d
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit e4ebb97fe3bb154897394b94473848992f83cf99)
Diffstat (limited to 'tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp')
0 files changed, 0 insertions, 0 deletions