1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-21 21:52:10 +02:00

Bug 562125: Fix auto indent of function call with scope qualifiers

A function call may be mistakenly interpreted in looksLikeMethodDecl()
as a method declaration. This was due to simplified processing of
functions with a scope qualifiers in the name.

Now methods with a scope qualifier are handled similarly to methods
without them.

Change-Id: Id3075d3387fdf9c4ae2d0dffa6cdf923fd1ef9d5
Signed-off-by: Andrey Mozzhuhin <amozzhuhin@yandex.ru>
This commit is contained in:
Andrey Mozzhuhin 2020-04-14 23:24:39 +03:00 committed by Andrei Mozzhuhin
parent a145e695c0
commit 45afe49b9c
2 changed files with 21 additions and 2 deletions

View file

@ -1067,4 +1067,19 @@ public class CIndenterTest extends BaseUITestCase {
public void testIndentationAfterArgumentWithQualifier_Bug516393() throws Exception {
assertIndenterResult(); // global scope
}
//x = f()
//+ ::f()
//+ A::f()
//+ ::A::f()
//+ B::C::f();
//x = f()
// + ::f()
// + A::f()
// + ::A::f()
// + B::C::f();
public void testIndentationAfterFunctionCallWithQualifier_Bug562125() throws Exception {
assertIndenterResult();
}
}

View file

@ -2219,8 +2219,9 @@ public final class CIndenter {
if (fToken == Symbols.TokenTILDE) {
return true;
}
if (skipQualifiers()) {
return true;
// optional class or namespace qualifiers
while (skipQualifiers()) {
nextToken();
}
// optional brackets for array valued return types
while (skipBrackets()) {
@ -2238,6 +2239,9 @@ public final class CIndenter {
switch (fToken) {
case Symbols.TokenIDENT:
return true;
case Symbols.TokenEOF:
// EOF can be seen in constructor definition outside the class
// at the beginning of the source file
case Symbols.TokenSEMICOLON:
case Symbols.TokenRBRACE:
fPosition = pos;