Skip to content

Commit

Permalink
Fixup: functions were being generated as if they were methods (had a …
Browse files Browse the repository at this point in the history
…'self' parameter)
  • Loading branch information
lojack5 committed Jan 17, 2025
1 parent 24c4527 commit 837e9f5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions etgtools/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ class FunctionDef(BaseDef, FixWxPrefix):
"""
Information about a standalone function.
"""
_default_method_type = MethodType.FUNCTION

def __init__(self, element=None, **kw):
super(FunctionDef, self).__init__()
self.type = None
Expand Down Expand Up @@ -543,7 +545,7 @@ def makePyArgsString(self):
return_type = returns[0]
else:
return_type = f"Tuple[{', '.join(returns)}]"
kind = MethodType.STATIC_METHOD if getattr(self, 'isStatic', False) else MethodType.METHOD
kind = MethodType.STATIC_METHOD if getattr(self, 'isStatic', False) else type(self)._default_method_type
self.signature = Signature(name, *params, return_type=return_type, method_type=kind)
self.pyArgsString = self.signature.args_string(False)

Expand Down Expand Up @@ -582,6 +584,8 @@ class MethodDef(FunctionDef):
"""
Represents a class method, ctor or dtor declaration.
"""
_default_method_type = MethodType.METHOD

def __init__(self, element=None, className=None, **kw):
super(MethodDef, self).__init__()
self.className = className
Expand Down Expand Up @@ -720,7 +724,6 @@ def convertFromPyObject(self, value: AutoConversionInfo) -> None:
self._convertFromPyObject = value.code
name = self.name or self.pyName
name = removeWxPrefix(name)
print('Registering:', name, value.convertables)
FixWxPrefix.register_autoconversion(name, value.convertables)

def is_top_level(self) -> bool:
Expand Down

0 comments on commit 837e9f5

Please sign in to comment.