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:
parent
a145e695c0
commit
45afe49b9c
2 changed files with 21 additions and 2 deletions
|
@ -1067,4 +1067,19 @@ public class CIndenterTest extends BaseUITestCase {
|
||||||
public void testIndentationAfterArgumentWithQualifier_Bug516393() throws Exception {
|
public void testIndentationAfterArgumentWithQualifier_Bug516393() throws Exception {
|
||||||
assertIndenterResult(); // global scope
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2219,8 +2219,9 @@ public final class CIndenter {
|
||||||
if (fToken == Symbols.TokenTILDE) {
|
if (fToken == Symbols.TokenTILDE) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (skipQualifiers()) {
|
// optional class or namespace qualifiers
|
||||||
return true;
|
while (skipQualifiers()) {
|
||||||
|
nextToken();
|
||||||
}
|
}
|
||||||
// optional brackets for array valued return types
|
// optional brackets for array valued return types
|
||||||
while (skipBrackets()) {
|
while (skipBrackets()) {
|
||||||
|
@ -2238,6 +2239,9 @@ public final class CIndenter {
|
||||||
switch (fToken) {
|
switch (fToken) {
|
||||||
case Symbols.TokenIDENT:
|
case Symbols.TokenIDENT:
|
||||||
return true;
|
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.TokenSEMICOLON:
|
||||||
case Symbols.TokenRBRACE:
|
case Symbols.TokenRBRACE:
|
||||||
fPosition = pos;
|
fPosition = pos;
|
||||||
|
|
Loading…
Add table
Reference in a new issue