Improve director unwrap detection for the return type

Resolve the return type to correctly determine if the type is a pointer or
reference to a director class.

SwigType_refptr_count_return() recently added as a simpler fix is no
longer needed.

The conventional approach of using the "type" rather than "decl" to
analyse the return type is used instead too.

Issue #1823
This commit is contained in:
William S Fulton 2022-10-10 08:27:44 +01:00
commit 2f55379687
10 changed files with 76 additions and 90 deletions

View file

@ -41,12 +41,26 @@ swig_assert_equal('s.getElementPtr', 'e', binding)
swig_assert_equal('s.getElementRef.class', 'MyElement', binding)
swig_assert_equal('s.getElementRef', 'e', binding)
# this shows that the director class was unwrapped:
swig_assert_equal('s.getElementPtrTypedef.class', 'MyElement', binding)
swig_assert_equal('s.getElementPtrTypedef', 'e', binding)
# this shows that the director class was unwrapped:
swig_assert_equal('s.getElementRefTypedef.class', 'MyElement', binding)
swig_assert_equal('s.getElementRefTypedef', 'e', binding)
# this is not unwrapped:
swig_assert_equal('s.getElementPtrPtr.class', 'SWIG::TYPE_p_p_Element', binding)
swig_assert_equal('s.getElementPtrPtr.class', 'SWIG::TYPE_p_p_Element', binding)
# this is not unwrapped:
swig_assert_equal('s.getElementPtrRef.class', 'SWIG::TYPE_p_p_Element', binding)
swig_assert_equal('s.getElementPtrRef.class', 'SWIG::TYPE_p_p_Element', binding)
# this is not unwrapped:
swig_assert_equal('s.getElementPtrRefTypedef.class', 'SWIG::TYPE_p_p_Element', binding)
swig_assert_equal('s.getElementPtrRefTypedef.class', 'SWIG::TYPE_p_p_Element', binding)
############################
# test with a template class