From f49bd300595d34f149152548545a4ad5aa78608b Mon Sep 17 00:00:00 2001
From: Axel Naumann <Axel.Naumann@cern.ch>
Date: Fri, 5 Dec 2008 09:49:26 +0000
Subject: [PATCH] Add the notion of a "recently seen class" when beautifying
 code - helps THtml::Convert() finding identifiers

git-svn-id: http://root.cern.ch/svn/root/trunk@26670 27541ba8-7e3a-0410-8455-c3a389f83636
---
 html/inc/TDocParser.h   |  1 +
 html/src/TDocParser.cxx | 14 ++++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/html/inc/TDocParser.h b/html/inc/TDocParser.h
index 27c35bfe6cd..d1863fc05eb 100644
--- a/html/inc/TDocParser.h
+++ b/html/inc/TDocParser.h
@@ -101,6 +101,7 @@ protected:
    TString        fFirstClassDoc;   // first class-doc found - per file, taken if fLastClassDoc is empty
    TString        fLastClassDoc;    // last class-doc found - becomes class doc at ClassImp or first method
    TClass*        fCurrentClass;    // current class context of sources being parsed
+   TClass*        fRecentClass;     // recently seen class context of sources being parsed, e.g. for Convert()
    TString        fCurrentModule;   // current module context of sources being parsed
    TString        fCurrentMethodTag;// name_idx of the currently parsed method
    Int_t          fDirectiveCount;  // index of directive for current method
diff --git a/html/src/TDocParser.cxx b/html/src/TDocParser.cxx
index 6180d90b8d9..cfff7a730fb 100644
--- a/html/src/TDocParser.cxx
+++ b/html/src/TDocParser.cxx
@@ -131,7 +131,8 @@ std::set<std::string>  TDocParser::fgKeywords;
 //______________________________________________________________________________
 TDocParser::TDocParser(TClassDocOutput& docOutput, TClass* cl):
    fHtml(docOutput.GetHtml()), fDocOutput(&docOutput), fLineNo(0),
-   fCurrentClass(cl), fCurrentModule(0), fDirectiveCount(0), fDocContext(kIgnore), 
+   fCurrentClass(cl), fRecentClass(0), fCurrentModule(0),
+   fDirectiveCount(0), fDocContext(kIgnore), 
    fCheckForMethod(kFALSE), fClassDocState(kClassDoc_Uninitialized), 
    fCommentAtBOL(kFALSE)
 {
@@ -166,7 +167,7 @@ TDocParser::TDocParser(TClassDocOutput& docOutput, TClass* cl):
 //______________________________________________________________________________
 TDocParser::TDocParser(TDocOutput& docOutput):
    fHtml(docOutput.GetHtml()), fDocOutput(&docOutput), fLineNo(0),
-   fCurrentClass(0), fDirectiveCount(0), fDocContext(kIgnore), 
+   fCurrentClass(0), fRecentClass(0), fDirectiveCount(0), fDocContext(kIgnore), 
    fCheckForMethod(kFALSE), fClassDocState(kClassDoc_Uninitialized),
    fCommentAtBOL(kFALSE)
 {
@@ -617,8 +618,12 @@ void TDocParser::DecorateKeywords(TString& line)
       }
       TClass* lookupScope = currentType.back();
 
-      if (scoping == kNada)
-         lookupScope = fCurrentClass;
+      if (scoping == kNada) {
+         if (fCurrentClass)
+            lookupScope = fCurrentClass;
+         else
+            lookupScope = fRecentClass;
+      }
 
       if (scoping == kNada) {
          subType = gROOT->GetType(word);
@@ -724,6 +729,7 @@ void TDocParser::DecorateKeywords(TString& line)
             globalTypeName ? globalTypeName : subClass->GetName());
 
          currentType.back() = subClass;
+         fRecentClass = subClass;
       } else if (datamem || meth) {
             if (datamem) {
                fDocOutput->ReferenceEntity(substr, datamem);
-- 
GitLab