Fix %feature not working for conversion operators

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11123 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2009-02-08 22:30:10 +00:00
commit 30d73c82cd
4 changed files with 27 additions and 2 deletions

View file

@ -1,6 +1,10 @@
Version 1.3.39 (in progress) Version 1.3.39 (in progress)
============================ ============================
2008-02-08: wsfulton
Fix %feature not working for conversion operators, reported by Matt Sprague, for example:
%feature("cs:methodmodifiers") operator bool "protected";
2008-02-07: wsfulton 2008-02-07: wsfulton
[MzScheme] Apply #2081967 configure changes for examples to build with recent PLT versions. [MzScheme] Apply #2081967 configure changes for examples to build with recent PLT versions.
Also fixes Makefile errors building SWIG executable when mzscheme package is installed Also fixes Makefile errors building SWIG executable when mzscheme package is installed

View file

@ -162,3 +162,20 @@ namespace Space {
} }
%} %}
// Test 8 conversion operators
%rename(opbool) operator bool;
%rename(opuint) operator unsigned int;
%exception ConversionOperators::ConversionOperators() "$action /* ConversionOperators::ConversionOperators() */";
%exception ConversionOperators::~ConversionOperators() "$action /* ConversionOperators::~ConversionOperators() */";
%exception ConversionOperators::operator bool "$action /* ConversionOperators::operator bool */";
%exception ConversionOperators::operator unsigned int "$action /* ConversionOperators::unsigned int*/";
%inline %{
class ConversionOperators {
public:
operator bool() { return false; }
operator unsigned int() { return 0; }
};
%}

View file

@ -711,6 +711,10 @@ int yylex(void) {
termtoken = SWIG_TOKEN_SEMI; termtoken = SWIG_TOKEN_SEMI;
termvalue = ";"; termvalue = ";";
break; break;
} else if (nexttok == SWIG_TOKEN_STRING) {
termtoken = SWIG_TOKEN_STRING;
termvalue = Swig_copy_string(Char(Scanner_text(scan)));
break;
} else if (nexttok == SWIG_TOKEN_ID) { } else if (nexttok == SWIG_TOKEN_ID) {
if (needspace) { if (needspace) {
Append(s," "); Append(s," ");

View file

@ -655,7 +655,7 @@ void Swig_features_get(Hash *features, String *prefix, String *name, SwigType *d
} }
#ifdef SWIG_DEBUG #ifdef SWIG_DEBUG
Printf(stdout, "Swig_features_get: %s %s %s\n", prefix, name, decl); Printf(stdout, "Swig_features_get: '%s' '%s' '%s'\n", prefix, name, decl);
#endif #endif
/* Global features */ /* Global features */
@ -732,7 +732,7 @@ void Swig_feature_set(Hash *features, const_String_or_char_ptr name, SwigType *d
Hash *fhash; Hash *fhash;
#ifdef SWIG_DEBUG #ifdef SWIG_DEBUG
Printf(stdout, "Swig_feature_set: %s %s %s %s\n", name, decl, featurename, value); Printf(stdout, "Swig_feature_set: '%s' '%s' '%s' '%s'\n", name, decl, featurename, value);
#endif #endif
n = Getattr(features, name); n = Getattr(features, name);