mirror of https://github.com/swig/swig
Use flat static method if it's a "friend"
This allows the friends test case to pass, with or without -builtin.
This commit is contained in:
parent
484e5316f2
commit
63ef91939b
|
@ -2537,7 +2537,7 @@ public:
|
|||
/* ------------------------------------------------------------
|
||||
* dispatchFunction()
|
||||
* ------------------------------------------------------------ */
|
||||
void dispatchFunction(Node *n, String *linkage, int funpack = 0, bool builtin_self = false, bool builtin_ctor = false, bool director_class = false) {
|
||||
void dispatchFunction(Node *n, String *linkage, int funpack = 0, bool builtin_self = false, bool builtin_ctor = false, bool director_class = false, bool use_static_method = false) {
|
||||
/* Last node in overloaded chain */
|
||||
|
||||
bool add_self = builtin_self && (!builtin_ctor || director_class);
|
||||
|
@ -2641,11 +2641,11 @@ public:
|
|||
Printv(f->code, "}\n", NIL);
|
||||
Wrapper_print(f, f_wrappers);
|
||||
Node *p = Getattr(n, "sym:previousSibling");
|
||||
if (!builtin_self && (flat_static_method || !in_class || !builtin))
|
||||
if (!builtin_self && (use_static_method || !builtin))
|
||||
add_method(symname, wname, 0, p);
|
||||
|
||||
/* Create a shadow for this function (if enabled and not in a member function) */
|
||||
if (!builtin && (shadow) && (!(shadow & PYSHADOW_MEMBER)) && (flat_static_method || !in_class)) {
|
||||
if (!builtin && (shadow) && (!(shadow & PYSHADOW_MEMBER)) && (use_static_method)) {
|
||||
emitFunctionShadowHelper(n, in_class ? f_shadow_stubs : f_shadow, symname, 0);
|
||||
}
|
||||
DelWrapper(f);
|
||||
|
@ -3312,18 +3312,19 @@ public:
|
|||
Wrapper_print(f, f_wrappers);
|
||||
}
|
||||
|
||||
bool use_static_method = flat_static_method || !in_class || (Cmp(storage, "friend") == 0);
|
||||
/* Now register the function with the interpreter. */
|
||||
if (!Getattr(n, "sym:overloaded")) {
|
||||
if (!builtin_self && (flat_static_method || !in_class || !builtin))
|
||||
if (!builtin_self && (use_static_method || !builtin))
|
||||
add_method(iname, wname, allow_kwargs, n, funpack, num_required, num_arguments);
|
||||
|
||||
/* Create a shadow for this function (if enabled and not in a member function) */
|
||||
if (!builtin && (shadow) && (!(shadow & PYSHADOW_MEMBER)) && (flat_static_method || !in_class)) {
|
||||
if (!builtin && (shadow) && (!(shadow & PYSHADOW_MEMBER)) && (use_static_method)) {
|
||||
emitFunctionShadowHelper(n, in_class ? f_shadow_stubs : f_shadow, iname, allow_kwargs);
|
||||
}
|
||||
} else {
|
||||
if (!Getattr(n, "sym:nextSibling")) {
|
||||
dispatchFunction(n, linkage, funpack, builtin_self, builtin_ctor, director_class);
|
||||
dispatchFunction(n, linkage, funpack, builtin_self, builtin_ctor, director_class, use_static_method);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue