However, this doesn't support function pointer arguments, as well as some other stuff, like C++ default values for struct arguments, e.g.:
void foo(Bar bar = { 1, 2, 3 })
An easier and more correct way of handling function declarations/definitions would be to track the parenthesis balance: the declaration/definition is over when the first opening parenthesis is closed:
scope_balance = 1;
for (peek in tokens) {
if (peek->kind == TokenBaseKind_ParentheticalOpen) { ++scope_balance; }
if (peek->kind == TokenBaseKind_ParentheticalClose) { --scope_balance; }
if (scope_balance == 0) { at_paren_close = true; break; }
}
aolo2 commentedDec 25, 2019
•
edited
In
cpp_parse_functioncomma and semicolon are both accepted as the end of the function declaration/definiton, because of this check:This causes the the code index to ignore functions with > 1 arguments, partially breaking
jump_to_definition.The fix is a simple
The text was updated successfully, but these errors were encountered: