mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
Bug 441701 - Add ICPPASTFunctionCallExpression.getOverload()
Change-Id: I42e2180c28db135d5d7d135cccde44f839720bbd Signed-off-by: Nathan Ridge <zeratul976@hotmail.com> Reviewed-on: https://git.eclipse.org/r/31799 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
parent
4e69217016
commit
82f3bca7d0
3 changed files with 28 additions and 0 deletions
|
@ -97,6 +97,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeleteExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionCallExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification;
|
||||
|
@ -10701,4 +10702,23 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
IVariable waldo = helper.assertNonProblem("waldo");
|
||||
assertEquals(42, waldo.getInitialValue().numericalValue().longValue());
|
||||
}
|
||||
|
||||
// struct S1 { S1(int); };
|
||||
// struct S2 { void operator()(int); };
|
||||
// S2 s2;
|
||||
// int main() {
|
||||
// S1(42);
|
||||
// s2(43);
|
||||
// }
|
||||
public void testICPPASTFunctionCallExpression_getOverload_441701() throws Exception {
|
||||
BindingAssertionHelper helper = getAssertionHelper();
|
||||
|
||||
ICPPASTFunctionCallExpression call1 = helper.assertNode("S1(42)");
|
||||
ICPPFunction constructor = helper.assertNonProblem("S1(int)", "S1");
|
||||
assertEquals(constructor, call1.getOverload());
|
||||
|
||||
ICPPASTFunctionCallExpression call2 = helper.assertNode("s2(43)");
|
||||
ICPPFunction operator = helper.assertNonProblem("operator()");
|
||||
assertEquals(operator, call2.getOverload());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,4 +29,11 @@ public interface ICPPASTFunctionCallExpression
|
|||
*/
|
||||
@Override
|
||||
ICPPASTFunctionCallExpression copy(CopyStyle style);
|
||||
|
||||
/**
|
||||
* Returns the function binding for the overloaded operator() invoked by
|
||||
* the function call, or <code>null</code> if the operator() is not overloaded.
|
||||
* @since 5.8
|
||||
*/
|
||||
public ICPPFunction getOverload();
|
||||
}
|
||||
|
|
|
@ -259,6 +259,7 @@ public class CPPASTFunctionCallExpression extends ASTNode
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPFunction getOverload() {
|
||||
ICPPEvaluation eval = getEvaluation();
|
||||
if (eval instanceof EvalFunctionCall)
|
||||
|
|
Loading…
Add table
Reference in a new issue