Skip to content

Commit b614ced

Browse files
committed
issue #8851 Python call graph is not completely correct
We saw that in the `pycode.l` the `yyextra->insideBody` wasn't implemented contrary to e.g. `code.l` and `fortrancode.l` Thi omission has been corrected.
1 parent 57d3172 commit b614ced

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/pycode.l

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ struct pycodeYY_state
9494
QCString classScope;
9595
int paramParens = 0;
9696

97+
bool insideBody = false;
9798
bool exampleBlock = FALSE;
9899
QCString exampleName;
99100

@@ -389,7 +390,9 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBU
389390
// about what to accept.
390391

391392
yyextra->curClassBases.push_back(yytext);
393+
yyextra->insideBody = true;
392394
generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
395+
yyextra->insideBody = false;
393396
// codify(yyscanner,yytext);
394397
}
395398

@@ -506,10 +509,14 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBU
506509
endFontClass(yyscanner);
507510
}
508511
({IDENTIFIER}".")*{IDENTIFIER}/"(" {
512+
yyextra->insideBody = true;
509513
generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
514+
yyextra->insideBody = false;
510515
}
511516
({IDENTIFIER}".")+{IDENTIFIER} {
517+
yyextra->insideBody = true;
512518
generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,TRUE);
519+
yyextra->insideBody = false;
513520
}
514521
{IDENTIFIER} { codify(yyscanner,yytext); }
515522

@@ -1023,7 +1030,7 @@ static void startCodeLine(yyscan_t yyscanner)
10231030
{
10241031
yyextra->currentDefinition = d;
10251032
yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
1026-
//yyextra->insideBody = FALSE;
1033+
yyextra->insideBody = false;
10271034
yyextra->endComment = FALSE;
10281035
yyextra->searchingForBody = TRUE;
10291036
yyextra->realScope = d->name();
@@ -1232,7 +1239,7 @@ static bool getLinkInScope(yyscan_t yyscanner,
12321239
//printf("yyextra->currentDefinition=%p yyextra->currentMemberDef=%p\n",
12331240
// yyextra->currentDefinition,yyextra->currentMemberDef);
12341241

1235-
if (yyextra->currentDefinition && yyextra->currentMemberDef && yyextra->collectXRefs)
1242+
if (yyextra->currentDefinition && yyextra->currentMemberDef && yyextra->collectXRefs && yyextra->insideBody)
12361243
{
12371244
std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
12381245
addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(md));
@@ -1343,7 +1350,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
13431350
md->getBodyDef() : md->getOuterScope();
13441351
if (md->getGroupDef()) d = md->getGroupDef();
13451352
if (d && d->isLinkable() && md->isLinkable() &&
1346-
yyextra->currentMemberDef && yyextra->collectXRefs)
1353+
yyextra->currentMemberDef && yyextra->collectXRefs && yyextra->insideBody)
13471354
{
13481355
std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
13491356
addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(md));
@@ -1371,7 +1378,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
13711378
mmd->getBodyDef() : mmd->getOuterScope();
13721379
if (mmd->getGroupDef()) d = mmd->getGroupDef();
13731380
if (d && d->isLinkable() && mmd->isLinkable() &&
1374-
yyextra->currentMemberDef && yyextra->collectXRefs)
1381+
yyextra->currentMemberDef && yyextra->collectXRefs && yyextra->insideBody)
13751382
{
13761383
std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
13771384
addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(mmd));
@@ -1395,7 +1402,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
13951402
mmd->getBodyDef() : mmd->getOuterScope();
13961403
if (mmd->getGroupDef()) d = mmd->getGroupDef();
13971404
if (d && d->isLinkable() && mmd->isLinkable() &&
1398-
yyextra->currentMemberDef && yyextra->collectXRefs)
1405+
yyextra->currentMemberDef && yyextra->collectXRefs && yyextra->insideBody)
13991406
{
14001407
std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
14011408
addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(mmd));

0 commit comments

Comments
 (0)