Fixed more %rename errors, and moving

the function 'need_protected' outside parser.y,
ie, if more subtle cases appear, they can be
fixed without changing parser.y.

Now parser.y looks much more like the original 1.32.

 Source/CParse/parser.y: moving and fixing 'need_protected'
 Source/CParse/util.c:  moving and fixing 'need_protected'
 Examples/test-suite/director_protected.i: more %rename cases
 Examples/test-suite/director_using.i: fixing bad module name

The errors in question where related to the mix of
%rename + (typedef|static)  + protected + dirprot_mode:


%rename(s) Foo::p;
%rename(q) Foo::r;

%inline {
class Foo {
public:
  virtual ~Foo() {}

  int p(){ return 1;}
  int r(){ return 1;}

protected:

  typedef int q();
  static int s();
};

since q and s look like functions, the parser was adding them
completly to the symbol table, and clashing latter with the
attemped renames.

The error was only visible when dirprot was enabled, with
the old behavior it was ok.

Marcelo


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5533 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2003-12-11 03:59:18 +00:00
commit 9c372c5c64
4 changed files with 38 additions and 23 deletions

View file

@ -13,6 +13,8 @@
%newobject *::create();
%rename(a) Bar::hello;
%rename(s) Foo::p;
%rename(q) Foo::r;
%inline {
class Foo {
@ -21,7 +23,16 @@ public:
virtual std::string pong() {
return "Foo::pong();" + ping();
}
int p(){ return 1;}
int r(){ return 1;}
protected:
typedef int q();
static int s();
Foo() {}
virtual std::string ping() = 0;

View file

@ -1,5 +1,4 @@
%module(directors="1",dirprot="1") director_nested
//%module director_nested
%module(directors="1",dirprot="1") director_using
%{
#include <string>