Commits

senex committed 1995d4d

Fixed bug 3569622: Crashes parsing ::enum

Comments (0)

Files changed (3)

CppHeaderParser/CppHeaderParser.py

                                     elif enum['type'] is str:
                                         var['ctypes_type'] = 'ctypes.c_char_p'
                                         var['raw_type'] = 'char*'
-                                    if 'method' in var: var['enum'] = var['method']['path'] + '::' + enum['name']
-                                    else:    # class property
+                                    try:
+                                        if 'method' in var: var['enum'] = var['method']['path'] + '::' + enum['name']
+                                        else:    # class property
+                                            var['unresolved'] = True
+                                    except:
                                         var['unresolved'] = True
+                                        
                                     var['fundamental'] = True
 
                                 else: var['unresolved'] = True    # TODO klass._public_xxx

CppHeaderParser/test/TestSampleClass.h

 {
     return ((structA*) (Func())->element);
 }
+
+// Bug 3569622
+class Japyx
+{
+public:
+    enum enum1
+    {
+        e1, // 00
+        e2, // 01
+    };
+    UINT32 a;
+};
+
+void japyxFunc(struct s1 *pS, Japyx::enum1 x, MYTYPE myVar);

CppHeaderParser/test/test_CppHeaderParser.py

     def test_termite_function(self):
         self.assertEqual(self.cppHeader.functions[5]["name"], "termite")
 
+
+
+# Bug: 3569622
+class Japyx_TestCase(unittest.TestCase):
+
+    def setUp(self):
+        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
+    
+    def test_japyxFunc(self):
+        self.assertEqual(self.cppHeader.functions[6]["name"], "japyxFunc")
+
 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.