Fix SF#3528035, a regression introduced by the fix for SF#3428833.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13105 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2012-05-23 02:58:24 +00:00
parent b665377ad5
commit 7196e556a5
4 changed files with 20 additions and 2 deletions

View File

@ -6,7 +6,7 @@ Version 2.0.7 (in progress)
===========================
2012-05-18: olly
[PHP] Fix getters for template members. (SF#3428833)
[PHP] Fix getters for template members. (SF#3428833, SF#3528035)
2012-05-14: wsfulton
Fix some language's std::map wrappers to recognise difference_type, size_type, key_type

View File

@ -20,4 +20,15 @@ struct Test {
v.push_back(1.0 / n);
}
};
// Regression test for SF#3528035:
struct S {
int x;
S() : x(4) { }
};
struct T {
S start_t;
unsigned length;
};
%}

View File

@ -20,5 +20,11 @@ $t->f(3);
check::equal($t->x, 6, "Test::x != 6");
check::equal($t->v->size(), 3, "Test::v.size() != 3");
$T = new T();
$T->start_t = new S();
$T->length = 7;
check::equal($T->start_t->x, 4, "S::x != 4");
check::equal($T->length, 7, "T::length != 7");
check::done();
?>

View File

@ -2118,11 +2118,12 @@ done:
// FIXME: tune this threshold...
if (non_class_getters <= 2) {
// Not many non-class getters, so avoid call_user_func.
for (ki = First(shadow_get_vars); non_class_getters && ki.key; --non_class_getters, ki = Next(ki)) {
for (ki = First(shadow_get_vars); non_class_getters && ki.key; ki = Next(ki)) {
DOH *key = ki.key;
SwigType *d = ki.item;
if (is_class(d)) continue;
Printv(s_phpclasses, "\t\tif ($var === '", key, "') return ", shadow_classname, "_", key, "_get($this->", SWIG_PTR, ");\n", NIL);
--non_class_getters;
}
} else {
Printf(s_phpclasses, "\t\t$func = '%s_'.$var.'_get';\n", shadow_classname);