The kwargs feature no longer turns on compactdefaultargs for languages that don't support kwargs.
Affects all languages except Python and Ruby. Closes #242
This commit is contained in:
parent
b57a675d00
commit
bfde148887
14 changed files with 72 additions and 21 deletions
|
|
@ -59,6 +59,7 @@ static int compact_default_args = 0;
|
|||
static int template_reduce = 0;
|
||||
static int cparse_externc = 0;
|
||||
int ignore_nested_classes = 0;
|
||||
int kwargs_supported = 0;
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Assist Functions
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
@ -1177,7 +1178,7 @@ static void default_arguments(Node *n) {
|
|||
if (compact_default_args
|
||||
|| is_cfunction(function)
|
||||
|| GetFlag(function,"feature:compactdefaultargs")
|
||||
|| GetFlag(function,"feature:kwargs")) {
|
||||
|| (GetFlag(function,"feature:kwargs") && kwargs_supported)) {
|
||||
ParmList *p = Getattr(function,"parms");
|
||||
if (p)
|
||||
Setattr(p,"compactdefargs", "1"); /* mark parameters for special handling */
|
||||
|
|
|
|||
|
|
@ -3525,6 +3525,14 @@ Language::NestedClassSupport Language::nestedClassesSupport() const {
|
|||
return NCS_Unknown;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Language::kwargsSupport()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
bool Language::kwargsSupport() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Language::is_wrapping_class()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ int SwigRuntime = 0; // 0 = no option, 1 = -runtime, 2 = -noruntime
|
|||
extern "C" {
|
||||
extern String *ModuleName;
|
||||
extern int ignore_nested_classes;
|
||||
extern int kwargs_supported;
|
||||
}
|
||||
|
||||
/* usage string split into multiple parts otherwise string is too big for some compilers */
|
||||
|
|
@ -904,6 +905,8 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
// Inform the parser if the nested classes should be ignored unless explicitly told otherwise via feature:flatnested
|
||||
ignore_nested_classes = l->nestedClassesSupport() == Language::NCS_Unknown ? 1 : 0;
|
||||
|
||||
kwargs_supported = l->kwargsSupport() ? 1 : 0;
|
||||
|
||||
// Create Library search directories
|
||||
|
||||
// Check for SWIG_LIB environment variable
|
||||
|
|
|
|||
|
|
@ -4785,6 +4785,13 @@ public:
|
|||
return NewString("swigpyrun.h");
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
* kwargsSupport()
|
||||
*--------------------------------------------------------------------*/
|
||||
|
||||
bool kwargsSupport() const {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -3426,6 +3426,14 @@ public:
|
|||
String *defaultExternalRuntimeFilename() {
|
||||
return NewString("swigrubyrun.h");
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
* kwargsSupport()
|
||||
*--------------------------------------------------------------------*/
|
||||
|
||||
bool kwargsSupport() const {
|
||||
return true;
|
||||
}
|
||||
}; /* class RUBY */
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -315,6 +315,9 @@ public:
|
|||
*/
|
||||
virtual NestedClassSupport nestedClassesSupport() const;
|
||||
|
||||
/* Returns true if the target language supports key word arguments (kwargs) */
|
||||
virtual bool kwargsSupport() const;
|
||||
|
||||
protected:
|
||||
/* Identifies if a protected members that are generated when the allprotected option is used.
|
||||
This does not include protected virtual methods as they are turned on with the dirprot option. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue