Added support for Ruby bang methods. Bang methods end in exclamation points and indicate that the object being worked on will be modified in-place as opposed to being copied.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8441 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Charlie Savage 2006-01-15 00:25:48 +00:00
commit 723d385e36
3 changed files with 13 additions and 1 deletions

View file

@ -1,6 +1,12 @@
Version 1.3.28 (unreleased).
===========================
01/14/2006: cfisavage
Added support for Ruby bang! methods via a new %bang feature.
Bang methods end in exclamation points and indicate that the
object being processed will be modified in-place as
opposed to being copied.
01/12/2006: cfisavage
Updated the Ruby module to automatically convert
method names to lower_case_with_underscores using the

View file

@ -3,4 +3,5 @@
#define %markfunc %feature("markfunc")
#define %mixin %feature("mixin")
#define %predicate %feature("predicate", "1")
#define %bang %feature("bang", "1")
#define %trackobjects %feature("trackobjects")

View file

@ -965,7 +965,7 @@ public:
* predicate methods that return true or false (e.g. Array#empty?).
*
* Methods whose names end with exclamation points are, by convention,
* "mutators" that modify the instance in place (e.g. Array#sort!).
* called bang methods that modify the instance in place (e.g. Array#sort!).
*
* Methods whose names end with an equals sign are attribute setters
* (e.g. Thread#critical=).
@ -1038,6 +1038,11 @@ public:
Append(symname, "?");
}
/* Rename bang methods */
if (GetFlag(n, "feature:bang")) {
Append(symname, "!");
}
/* Determine the name of the SWIG wrapper function */
String *wname = Swig_name_wrapper(symname);
if (overname && current != CONSTRUCTOR_ALLOCATE) {