1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-14 20:45:22 +02:00

Bug 539535 - Originate an accurate lookup point in CPPASTFieldReference.createEvaluation()

Change-Id: I8030d5b304a61d7235a8ca92cf99de2d9a9aff68
This commit is contained in:
Nathan Ridge 2018-09-28 00:59:08 -04:00
parent cf99170296
commit d3b1d7652d
2 changed files with 54 additions and 33 deletions

View file

@ -292,6 +292,8 @@ public class CPPASTFieldReference extends ASTNode
}
private ICPPEvaluation createEvaluation() {
try {
CPPSemantics.pushLookupPoint(this);
ICPPEvaluation ownerEval = fOwner.getEvaluation();
if (!ownerEval.isTypeDependent()) {
IType ownerType= EvalMemberAccess.getFieldOwnerType(ownerEval.getType(), fIsDeref, null, false);
@ -329,6 +331,9 @@ public class CPPASTFieldReference extends ASTNode
}
}
return new EvalID(ownerEval, qualifier, fName.getSimpleID(), false, true, fIsDeref, args, this);
} finally {
CPPSemantics.popLookupPoint();
}
}
public static int getFieldPosition(ICPPField field) {

View file

@ -740,4 +740,20 @@ public class SemanticHighlightingTest extends TestCase {
ignoredHighlightings.add(SemanticHighlightings.OVERLOADED_OPERATOR);
makeAssertions(ignoredHighlightings);
}
// struct S { //$class
// int waldo; //$field
// };
// struct Iter { //$class
// S operator*(); //$class,methodDeclaration
// };
// int main() { //$functionDeclaration
// Iter it; //$class,localVariableDeclaration
// // TODO: The fact that the opening parenthesis gets its own overloadedOperator
// // semantic highlighting is an (unrelated) bug.
// 1 + (*it).waldo; //$overloadedOperator,overloadedOperator,localVariable,field
// }
public void testOverloadedOperatorStar_539535() throws Exception {
makeAssertions();
}
}