Commits

senex committed 9207077

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

enum Stem stem_property

Comments (0)

Files changed (3)

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):

CppHeaderParser/test/TestSampleClass.h

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

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()
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.