diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2005-03-07 21:07:13 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2005-03-07 21:07:13 (GMT) |
commit | 5a6400835bc92fb56ef65126785cbe75f092f2d1 (patch) | |
tree | 3f86b13900ced91ef5e802650b33a38767bf6c11 /src/code.l | |
parent | d745dd3737ece0f328e515b1cf10306da0901597 (diff) | |
download | Doxygen-5a6400835bc92fb56ef65126785cbe75f092f2d1.zip Doxygen-5a6400835bc92fb56ef65126785cbe75f092f2d1.tar.gz Doxygen-5a6400835bc92fb56ef65126785cbe75f092f2d1.tar.bz2 |
Release-1.4.1-20050307
Diffstat (limited to 'src/code.l')
-rw-r--r-- | src/code.l | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -133,6 +133,8 @@ static int g_braceCount=0; static void saveObjCContext(); static void restoreObjCContext(); + + //------------------------------------------------------------------- /*! Represents a stack of variable to class mappings as found in the @@ -252,10 +254,15 @@ void VariableContext::addVariable(const QCString &type,const QCString &name) addVariable(typeName,name); } } - else // add a dummy entry so the name is hidden to avoid false links + else { - DBG_CTX((stderr,"** addVariable: dummy context\n")); - scope->append(lname,dummyContext); + if (m_scopes.count()>0) // for local variables add a dummy entry so the name + // is hidden to avoid false links to global variables with the same name + // TODO: make this work for namespaces as well! + { + DBG_CTX((stderr,"** addVariable: dummy context\n")); + scope->append(lname,dummyContext); + } } } @@ -281,9 +288,8 @@ ClassDef *VariableContext::findVariable(const QCString &name) return result; } -const ClassDef *VariableContext::dummyContext = (ClassDef*)0x8; - static VariableContext g_theVarContext; +const ClassDef *VariableContext::dummyContext = (ClassDef*)0x8; //------------------------------------------------------------------- @@ -848,6 +854,7 @@ static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName, } ClassDef *cd=0,*lcd=0; MemberDef *md=0; + bool isLocal=FALSE; //fprintf(stderr,"generateClassOrGlobalLink(className=%s)\n",className.data()); if ((lcd=g_theVarContext.findVariable(className))==0) // not a local variable @@ -859,7 +866,7 @@ static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName, { cd=getResolvedClass(d,g_sourceFileDef,className.left(i),&md); } - //print("is found as a type %s\n",cd?cd->name().data():"<null>"); + //printf("is found as a type %s\n",cd?cd->name().data():"<null>"); if (cd==0 && md==0) // also see if it is variable or enum or enum value { if (getLink(g_classScope,clName,ol,clName)) @@ -874,7 +881,8 @@ static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName, { g_theCallContext.setClass(lcd); } - //fprintf(stderr,"is a local variable!\n"); + isLocal=TRUE; + //fprintf(stderr,"is a local variable cd=%p!\n",cd); } if (cd && cd->isLinkable()) // is it a linkable class { @@ -907,7 +915,7 @@ static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName, else // not a class, maybe a global member { //printf("class %s not linkable! cd=%p md=%p typeOnly=%d\n",clName,cd,md,typeOnly); - if (md!=0 || (cd==0 && !typeOnly)) // not a class, see if it is a global enum/variable/typedef. + if (!isLocal && (md!=0 || (cd==0 && !typeOnly))) // not a class, see if it is a global enum/variable/typedef. { if (md==0) // not found as a typedef { |