Commits

senex  committed 1995d4d

Fixed bug 3569622: Crashes parsing ::enum

  • Participants
  • Parent commits e270b00

Comments (0)

Files changed (3)

File 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

File 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);

File 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()