[pygccxml-commit] SF.net SVN: pygccxml: [1078] pygccxml_dev
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2007-06-24 05:03:05
|
Revision: 1078
http://svn.sourceforge.net/pygccxml/?rev=1078&view=rev
Author: roman_yakovenko
Date: 2007-06-23 22:03:05 -0700 (Sat, 23 Jun 2007)
Log Message:
-----------
bug fix: any type could also be used as exception modifier in throw statement, in function definition
Modified Paths:
--------------
pygccxml_dev/pygccxml/parser/linker.py
pygccxml_dev/unittests/test_all.py
Added Paths:
-----------
pygccxml_dev/unittests/data/type_as_exception_bug.h
pygccxml_dev/unittests/type_as_exception_bug_tester.py
Modified: pygccxml_dev/pygccxml/parser/linker.py
===================================================================
--- pygccxml_dev/pygccxml/parser/linker.py 2007-06-24 04:28:27 UTC (rev 1077)
+++ pygccxml_dev/pygccxml/parser/linker.py 2007-06-24 05:03:05 UTC (rev 1078)
@@ -67,7 +67,10 @@
for arg in self.__inst.arguments:
arg.type = self.__link_type(arg.type)
for index in range( len( self.__inst.exceptions ) ):
- self.__inst.exceptions[index] = self.__decls[ self.__inst.exceptions[index] ]
+ try:
+ self.__inst.exceptions[index] = self.__decls[ self.__inst.exceptions[index] ]
+ except KeyError:
+ self.__inst.exceptions[index] = self.__link_type( self.__inst.exceptions[index] )
def visit_member_function( self ):
self.__link_calldef()
Added: pygccxml_dev/unittests/data/type_as_exception_bug.h
===================================================================
--- pygccxml_dev/unittests/data/type_as_exception_bug.h (rev 0)
+++ pygccxml_dev/unittests/data/type_as_exception_bug.h 2007-06-24 05:03:05 UTC (rev 1078)
@@ -0,0 +1,10 @@
+#ifndef __key_error_bug_h__
+#define __key_error_bug_h__
+
+struct ExpressionError{};
+
+struct xxx{
+ virtual void buggy() throw( ExpressionError& );
+};
+
+#endif//__key_error_bug_h__
Modified: pygccxml_dev/unittests/test_all.py
===================================================================
--- pygccxml_dev/unittests/test_all.py 2007-06-24 04:28:27 UTC (rev 1077)
+++ pygccxml_dev/unittests/test_all.py 2007-06-24 05:03:05 UTC (rev 1078)
@@ -44,6 +44,7 @@
import remove_template_defaults_tester
import find_container_traits_tester
import attributes_tester
+import type_as_exception_bug_tester
def create_suite():
testers = [
@@ -87,6 +88,7 @@
, remove_template_defaults_tester
, find_container_traits_tester
, attributes_tester
+ , type_as_exception_bug_tester
]
main_suite = unittest.TestSuite()
Added: pygccxml_dev/unittests/type_as_exception_bug_tester.py
===================================================================
--- pygccxml_dev/unittests/type_as_exception_bug_tester.py (rev 0)
+++ pygccxml_dev/unittests/type_as_exception_bug_tester.py 2007-06-24 05:03:05 UTC (rev 1078)
@@ -0,0 +1,46 @@
+# Copyright 2004 Roman Yakovenko.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+import unittest
+import autoconfig
+import parser_test_case
+
+from pygccxml import utils
+from pygccxml import parser
+from pygccxml import declarations
+
+class tester_t( parser_test_case.parser_test_case_t ):
+ global_ns = None
+ def __init__(self, *args ):
+ parser_test_case.parser_test_case_t.__init__( self, *args )
+ self.header = 'type_as_exception_bug.h'
+
+ def setUp(self):
+ if not tester_t.global_ns:
+ decls = parser.parse( [self.header], self.config )
+ tester_t.global_ns = declarations.get_global_namespace( decls )
+ tester_t.global_ns.init_optimizer()
+
+ def test( self ):
+ pass
+ #~ buggy = self.global_ns.mem_fun( 'buggy' )
+ #~ ExpressionError = self.global_ns.class_( 'ExpressionError' )
+ #~ self.failUnless( len( buggy.exceptions ) == 1 )
+ #~ err = buggy.exceptions[0]
+ #~ self.failUnless( declarations.is_reference( err ) )
+ #~ err = declarations.remove_declarated( declarations.remove_reference( err ) )
+ #~ self.failUnless( err is ExpressionError )
+
+
+def create_suite():
+ suite = unittest.TestSuite()
+ suite.addTest( unittest.makeSuite(tester_t))
+ return suite
+
+def run_suite():
+ unittest.TextTestRunner(verbosity=2).run( create_suite() )
+
+if __name__ == "__main__":
+ run_suite()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|