Fix SF #1943608 - substitution in %contract.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10440 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-05-11 20:25:12 +00:00
commit 528ea7a313
3 changed files with 21 additions and 3 deletions

View file

@ -1,6 +1,10 @@
Version 1.3.36 (in progress)
=============================
05/11/2008: wsfulton
Fix SF #1943608 - $self substitution in %contract, patch submitted by
Toon Verstraelen.
05/09/2008: olly
[PHP] Fix char * typemaps to work when applied to signed char * and
unsigned char * (uncovered by testcase apply_strings).

View file

@ -176,7 +176,6 @@ public:
};
class D : public C {
public:
public:
virtual int foo(int a, int b, int c, int d, int e) {
return C::foo(a,b,c,d,e);
@ -187,3 +186,18 @@ public:
};
%}
%extend E {
%contract manipulate_i(int i) {
require:
i <= $self->m_i;
}
}
%inline %{
struct E {
int m_i;
void manipulate_i(int i) {
}
};
%}

View file

@ -220,14 +220,14 @@ String *Contracts::make_expression(String *s, Node *n) {
/* This function substitutes parameter names for argument names in the
contract specification. Note: it is assumed that the wrapper code
uses arg1--argn for arguments. */
uses arg1 for self and arg2..argn for arguments. */
void Contracts::substitute_parms(String *s, ParmList *p, int method) {
int argnum = 1;
char argname[32];
if (method) {
Replaceid(s, "self", "arg0");
Replaceid(s, "$self", "arg1");
argnum++;
}
while (p) {