Commits

senex committed 3b88516

Fixed bug 3577484: Class template specialization plus inheritance mis-parsed

Comments (0)

Files changed (3)

CppHeaderParser/CppHeaderParser.py

                     self["name"] = "".join(nameStack[1:i + 1])
                     break;
                 i += 1
-                
+        elif ":" in nameStack:
+            self['name'] = nameStack[ nameStack.index(':') - 1 ]
+
         inheritList = []
 
-        if ":" in nameStack:
-            self['name'] = nameStack[ nameStack.index(':') - 1 ]
-
         if nameStack.count(':') == 1:
             nameStack = nameStack[nameStack.index(":") + 1:]
             while len(nameStack):

CppHeaderParser/test/TestSampleClass.h

     'S' << 8 | \
     'H'),
 };
+
+// Bug 3577484
+template <> class FruitFly<int>: public Fly { };

CppHeaderParser/test/test_CppHeaderParser.py

         self.assertEqual(self.cppHeader.enums[0]["values"], [
             {'name': 'NAME', 'value': "( 'J' << 24 | 'A' << 16 | 'S' << 8 | 'H' )"}])
 
+
+# Bug: 3577484
+class Fly_TestCase(unittest.TestCase):
+
+    def setUp(self):
+        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
+    
+    def test_exists(self):
+        self.assertEqual(self.cppHeader.classes.has_key("FruitFly<int>"), True)
+
 if __name__ == '__main__':
     unittest.main()