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:
parent
4a397869a2
commit
2f55379687
10 changed files with 76 additions and 90 deletions
|
|
@ -25,6 +25,8 @@ class Element {
|
|||
return &selfptr;
|
||||
}
|
||||
};
|
||||
typedef Element * element_ptr_t;
|
||||
typedef Element & element_ref_t;
|
||||
|
||||
class Storage {
|
||||
public:
|
||||
|
|
@ -45,6 +47,15 @@ class Storage {
|
|||
Element *&getElementPtrRef() {
|
||||
return *getIt();
|
||||
}
|
||||
element_ref_t getElementRefTypedef() {
|
||||
return **getIt();
|
||||
}
|
||||
element_ptr_t getElementPtrTypedef() {
|
||||
return *getIt();
|
||||
}
|
||||
element_ptr_t &getElementPtrRefTypedef() {
|
||||
return *getIt();
|
||||
}
|
||||
};
|
||||
|
||||
template<class T> class StorageTmpl {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue