diff options
-rw-r--r-- | tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp | 27 | ||||
-rw-r--r-- | tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result | 13 | ||||
-rw-r--r-- | tools/linguist/lupdate/cpp.cpp | 7 |
3 files changed, 46 insertions, 1 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp index 0765bfc..f58f932 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp @@ -275,3 +275,30 @@ void bogosity() // no spaces here. test collateral damage from ignoring equal sign Class::member=QObject::tr("just QObject"); } + + + +namespace Internal { + +class Message : public QObject +{ + Q_OBJECT +public: + Message(QObject *parent = 0); +}; + +} // The temporary closing of the namespace triggers the problem + +namespace Internal { + +static inline QString message1() +{ + return Message::tr("message1"); // Had no namespace +} + +static inline QString message2() +{ + return Message::tr("message2"); // Already had namespace +} + +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result index 208191d..7ac318e 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -120,6 +120,19 @@ backslashed \ stuff.</source> </message> </context> <context> + <name>Internal::Message</name> + <message> + <location filename="main.cpp" line="296"/> + <source>message1</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="301"/> + <source>message2</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>Kåntekst</name> <message utf8="true"> <location filename="finddialog.cpp" line="180"/> diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 609bd3d..bc9bb26 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1686,9 +1686,14 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) HashString ns = HashString(text); yyTok = getToken(); if (yyTok == Tok_LeftBrace) { + yyTok = getToken(); namespaceDepths.push(namespaces.count()); enterNamespace(&namespaces, ns); - yyTok = getToken(); + + functionContext = namespaces; + functionContextUnresolved.clear(); + prospectiveContext.clear(); + pendingContext.clear(); } else if (yyTok == Tok_Equals) { // e.g. namespace Is = OuterSpace::InnerSpace; QList<HashString> fullName; |