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
1 changed files with 7 additions and 6 deletions
|
|
@ -2537,7 +2537,7 @@ public:
|
||||||
/* ------------------------------------------------------------
|
/* ------------------------------------------------------------
|
||||||
* dispatchFunction()
|
* 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 */
|
/* Last node in overloaded chain */
|
||||||
|
|
||||||
bool add_self = builtin_self && (!builtin_ctor || director_class);
|
bool add_self = builtin_self && (!builtin_ctor || director_class);
|
||||||
|
|
@ -2641,11 +2641,11 @@ public:
|
||||||
Printv(f->code, "}\n", NIL);
|
Printv(f->code, "}\n", NIL);
|
||||||
Wrapper_print(f, f_wrappers);
|
Wrapper_print(f, f_wrappers);
|
||||||
Node *p = Getattr(n, "sym:previousSibling");
|
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);
|
add_method(symname, wname, 0, p);
|
||||||
|
|
||||||
/* Create a shadow for this function (if enabled and not in a member function) */
|
/* 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);
|
emitFunctionShadowHelper(n, in_class ? f_shadow_stubs : f_shadow, symname, 0);
|
||||||
}
|
}
|
||||||
DelWrapper(f);
|
DelWrapper(f);
|
||||||
|
|
@ -3312,18 +3312,19 @@ public:
|
||||||
Wrapper_print(f, f_wrappers);
|
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. */
|
/* Now register the function with the interpreter. */
|
||||||
if (!Getattr(n, "sym:overloaded")) {
|
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);
|
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) */
|
/* 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);
|
emitFunctionShadowHelper(n, in_class ? f_shadow_stubs : f_shadow, iname, allow_kwargs);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!Getattr(n, "sym:nextSibling")) {
|
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…
Add table
Add a link
Reference in a new issue