mirror of https://github.com/swig/swig
Change class names in test code which clash with PHP reserved words
(Interface, Class, and Function - these are case insensitive reserved words in PHP). Fix lists of expected methods in rename_scope_runme.php to match those which we expect with PHP5. With this and the change above, this testcase now passes. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11545 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
54018f66a2
commit
d3809285a4
|
@ -6,10 +6,10 @@ require "rename_scope.php";
|
||||||
|
|
||||||
check::classes(array("rename_scope","Interface_UP","Interface_BP","Natural_UP","Natural_BP","Bucket"));
|
check::classes(array("rename_scope","Interface_UP","Interface_BP","Natural_UP","Natural_BP","Bucket"));
|
||||||
|
|
||||||
check::classmethods("Interface_UP",array("__construct"));
|
check::classmethods("Interface_UP",array("__construct","__set","__isset","__get"));
|
||||||
check::classmethods("Interface_BP",array("__construct"));
|
check::classmethods("Interface_BP",array("__construct","__set","__isset","__get"));
|
||||||
check::classmethods("Natural_UP",array("__construct","rtest"));
|
check::classmethods("Natural_UP",array("__construct","__set","__isset","__get","rtest"));
|
||||||
check::classmethods("Natural_BP",array("__construct","rtest"));
|
check::classmethods("Natural_BP",array("__construct","__set","__isset","__get","rtest"));
|
||||||
check::classparent("Natural_UP","Interface_UP");
|
check::classparent("Natural_UP","Interface_UP");
|
||||||
check::classparent("Natural_BP","Interface_BP");
|
check::classparent("Natural_BP","Interface_BP");
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
enum Polarization { UnaryPolarization, BinaryPolarization };
|
enum Polarization { UnaryPolarization, BinaryPolarization };
|
||||||
|
|
||||||
template <Polarization P>
|
template <Polarization P>
|
||||||
struct Interface
|
struct Interface_
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@
|
||||||
|
|
||||||
namespace oss
|
namespace oss
|
||||||
{
|
{
|
||||||
// Interface
|
// Interface_
|
||||||
%template(Interface_UP) Interface<UnaryPolarization>;
|
%template(Interface_UP) Interface_<UnaryPolarization>;
|
||||||
%template(Interface_BP) Interface<BinaryPolarization>;
|
%template(Interface_BP) Interface_<BinaryPolarization>;
|
||||||
|
|
||||||
}
|
}
|
||||||
%inline
|
%inline
|
||||||
|
@ -27,7 +27,7 @@ namespace oss
|
||||||
namespace interfaces
|
namespace interfaces
|
||||||
{
|
{
|
||||||
template <Polarization P>
|
template <Polarization P>
|
||||||
struct Natural : Interface<P>
|
struct Natural : Interface_<P>
|
||||||
{
|
{
|
||||||
int test(void) { return 1; }
|
int test(void) { return 1; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,14 +12,14 @@
|
||||||
enum Polarization { UnaryPolarization, BinaryPolarization };
|
enum Polarization { UnaryPolarization, BinaryPolarization };
|
||||||
|
|
||||||
template <Polarization P>
|
template <Polarization P>
|
||||||
struct Interface
|
struct Interface_
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace modules
|
namespace modules
|
||||||
{
|
{
|
||||||
|
|
||||||
template <class traits, class base = Interface<traits::pmode> >
|
template <class traits, class base = Interface_<traits::pmode> >
|
||||||
// *** problem here ****
|
// *** problem here ****
|
||||||
struct Module : base
|
struct Module : base
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
namespace oss
|
namespace oss
|
||||||
{
|
{
|
||||||
%template(Interface_UP) Interface<UnaryPolarization>;
|
%template(Interface_UP) Interface_<UnaryPolarization>;
|
||||||
namespace modules
|
namespace modules
|
||||||
{
|
{
|
||||||
%template(Module_etraits) Module<etraits>;
|
%template(Module_etraits) Module<etraits>;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
enum Polarization { UnaryPolarization, BinaryPolarization };
|
enum Polarization { UnaryPolarization, BinaryPolarization };
|
||||||
|
|
||||||
template <Polarization P>
|
template <Polarization P>
|
||||||
struct Interface
|
struct Interface_
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@
|
||||||
|
|
||||||
namespace oss
|
namespace oss
|
||||||
{
|
{
|
||||||
%template(Interface_UP) Interface<UnaryPolarization>;
|
%template(Interface_UP) Interface_<UnaryPolarization>;
|
||||||
%template(Module_UPIUP) Module<UnaryPolarization,Interface<UnaryPolarization> >;
|
%template(Module_UPIUP) Module<UnaryPolarization,Interface_<UnaryPolarization> >;
|
||||||
}
|
}
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
|
@ -31,18 +31,18 @@ namespace oss
|
||||||
namespace hello
|
namespace hello
|
||||||
{
|
{
|
||||||
struct HInterface1 :
|
struct HInterface1 :
|
||||||
Interface<oss::UnaryPolarization> // this works (with fullns qualification)
|
Interface_<oss::UnaryPolarization> // this works (with fullns qualification)
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HInterface2 :
|
struct HInterface2 :
|
||||||
Interface<UnaryPolarization> // this doesn't work
|
Interface_<UnaryPolarization> // this doesn't work
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HModule1 : Module<UnaryPolarization, Interface<UnaryPolarization> > {
|
struct HModule1 : Module<UnaryPolarization, Interface_<UnaryPolarization> > {
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
enum Polarization { UnaryPolarization, BinaryPolarization };
|
enum Polarization { UnaryPolarization, BinaryPolarization };
|
||||||
|
|
||||||
template <Polarization P>
|
template <Polarization P>
|
||||||
struct Interface
|
struct Interface_
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
typedef Traits traits;
|
typedef Traits traits;
|
||||||
static const Polarization P = traits::pmode;
|
static const Polarization P = traits::pmode;
|
||||||
|
|
||||||
void get(Interface<P> arg) { }; // Here P is only replace by traits::pmode
|
void get(Interface_<P> arg) { }; // Here P is only replace by traits::pmode
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,6 @@
|
||||||
|
|
||||||
namespace oss
|
namespace oss
|
||||||
{
|
{
|
||||||
%template(Interface_UP) Interface<UnaryPolarization>;
|
%template(Interface_UP) Interface_<UnaryPolarization>;
|
||||||
%template(Module_UP) Module<etraits>;
|
%template(Module_UP) Module<etraits>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class ArgType, class ResType>
|
template <class ArgType, class ResType>
|
||||||
struct Function
|
struct Function_
|
||||||
{
|
{
|
||||||
char *test() { return (char *) "test"; }
|
char *test() { return (char *) "test"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class AF, class RF>
|
template <class AF, class RF>
|
||||||
struct ArithFunction : Function<AF, RF>
|
struct ArithFunction : Function_<AF, RF>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class AF, class RF>
|
template <class AF, class RF>
|
||||||
class Class : public ArithFunction< typename traits<AF, RF>::arg_type,
|
class Class_ : public ArithFunction< typename traits<AF, RF>::arg_type,
|
||||||
typename traits<AF, RF>::res_type >
|
typename traits<AF, RF>::res_type >
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
typename traits<AF, RF>::base
|
typename traits<AF, RF>::base
|
||||||
make_Class()
|
make_Class()
|
||||||
{
|
{
|
||||||
return Class<AF, RF>();
|
return Class_<AF, RF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,9 +58,9 @@
|
||||||
|
|
||||||
%{
|
%{
|
||||||
namespace hello {
|
namespace hello {
|
||||||
template struct Function <Double, Double>;
|
template struct Function_ <Double, Double>;
|
||||||
template struct ArithFunction <Double, Double>;
|
template struct ArithFunction <Double, Double>;
|
||||||
template class Class <Double, Double>;
|
template class Class_ <Double, Double>;
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -69,9 +69,9 @@
|
||||||
// This complains only when using a namespace
|
// This complains only when using a namespace
|
||||||
//
|
//
|
||||||
%template() traits<Double,Double>;
|
%template() traits<Double,Double>;
|
||||||
%template(Function_DD) Function <Double, Double>;
|
%template(Function_DD) Function_ <Double, Double>;
|
||||||
%template(ArithFunction_DD) ArithFunction <Double, Double>;
|
%template(ArithFunction_DD) ArithFunction <Double, Double>;
|
||||||
%template(Class_DD) Class <Double, Double>;
|
%template(Class_DD) Class_ <Double, Double>;
|
||||||
%template(make_Class_DD) make_Class <Double, Double>;
|
%template(make_Class_DD) make_Class <Double, Double>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
template <Polarization P>
|
template <Polarization P>
|
||||||
struct Interface : Base
|
struct Interface_ : Base
|
||||||
{
|
{
|
||||||
Interface(const Base& b) { };
|
Interface_(const Base& b) { };
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Result>
|
template <class Result>
|
||||||
|
@ -23,6 +23,6 @@
|
||||||
namespace oss
|
namespace oss
|
||||||
{
|
{
|
||||||
// Interface
|
// Interface
|
||||||
%template(Interface_BP) Interface<BinaryPolarization>;
|
%template(Interface_BP) Interface_<BinaryPolarization>;
|
||||||
%template(make_Interface_BP) make<Interface<BinaryPolarization> >;
|
%template(make_Interface_BP) make<Interface_<BinaryPolarization> >;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue