File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -347,6 +347,12 @@ std::vector<std::string> FunctionDoc::GetArgumentTokens(
347
347
str.replace (parenthesis_pos + 1 , 0 , " , " );
348
348
}
349
349
350
+ // Ignore everything after last argument (right before ") ->")
351
+ // Otherwise false argument matches might be found in docstrings
352
+ std::size_t arrow_pos = str.rfind (" ) -> " );
353
+ if (arrow_pos == std::string::npos) return {};
354
+ str = str.substr (0 , arrow_pos);
355
+
350
356
// Get start positions
351
357
std::regex pattern (" (, [A-Za-z_][A-Za-z\\ d_]*:)" );
352
358
std::smatch res;
@@ -366,12 +372,7 @@ std::vector<std::string> FunctionDoc::GetArgumentTokens(
366
372
for (size_t i = 0 ; i + 1 < argument_start_positions.size (); ++i) {
367
373
argument_end_positions.push_back (argument_start_positions[i + 1 ] - 2 );
368
374
}
369
- std::size_t arrow_pos = str.rfind (" ) -> " );
370
- if (arrow_pos == std::string::npos) {
371
- return {};
372
- } else {
373
- argument_end_positions.push_back (arrow_pos);
374
- }
375
+ argument_end_positions.push_back (arrow_pos);
375
376
376
377
std::vector<std::string> argument_tokens;
377
378
for (size_t i = 0 ; i < argument_start_positions.size (); ++i) {
You can’t perform that action at this time.
0 commit comments