Commits

senex committed 9207077

Fixed bug 3567172: Enums without inline definition are skipped such as

enum Stem stem_property

  • Participants
  • Parent commits dad8a82

Comments (0)

Files changed (3)

File CppHeaderParser/CppHeaderParser.py

                 }
     """
     def __init__(self, nameStack):
-        if len(nameStack) < 4 or "{" not in nameStack or "}" not in nameStack:
-            #Not enough stuff for an enum
-            return
         global doxygenCommentCache
         if len(doxygenCommentCache):
             self["doxygen"] = doxygenCommentCache
             doxygenCommentCache = ""
+        if len(nameStack) == 3 and nameStack[0] == "enum":
+            debug_print("Created enum as just name/value")
+            self["name"] = nameStack[1]
+            self["instances"]=[nameStack[2]]
+        if len(nameStack) < 4 or "{" not in nameStack or "}" not in nameStack:
+            #Not enough stuff for an enum
+            debug_print("Bad enum")
+            return
         valueList = []
         self["line_number"] = detect_lineno(nameStack[0])
         #Figure out what values it has
 
     def evaluate_enum_stack(self):
         """Create an Enum out of the name stack"""
+        debug_print( "evaluating enum" )
         newEnum = CppEnum(self.nameStack)
         if len(newEnum.keys()):
             if len(self.curClass):

File CppHeaderParser/test/TestSampleClass.h

 {
 	int i;
 }
+
+
+// Bug 3567172
+class Pear
+{
+	enum Stem stem_property;
+}
 };

File CppHeaderParser/test/test_CppHeaderParser.py

     def test_lineno_Worm_namep(self):
         return self.assertEqual(self.cppHeader.classes["Worm"]["properties"]["private"][0]["line_number"], 29)
 
+# Bug 3567172
+class Pear_TestCase(unittest.TestCase):
+
+    def setUp(self):
+        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
+
+    def test_property(self):
+        self.assertEqual(self.cppHeader.classes["Pear"]["properties"]["private"][0]["name"], "stem_property")
+
 if __name__ == '__main__':
     unittest.main()