WithTransform(self),
DecoratorTransform(self),
AnalyseDeclarationsTransform(self),
+ CreateClosureClasses(self),
AutoTestDictTransform(self),
EmbedSignature(self),
+ EarlyReplaceBuiltinCalls(self),
MarkAssignments(self),
TransformBuiltinMethods(self),
IntroduceBufferAuxiliaryVars(self),
# not_none boolean Tagged with 'not None'
# default ExprNode or None
# default_value PyObjectConst constant for default value
+ # annotation ExprNode or None Py3 function arg annotation
# is_self_arg boolean Is the "self" arg of an extension type method
+ # is_type_arg boolean Is the "class" arg of an extension type classmethod
# is_kw_only boolean Is a keyword-only argument
child_attrs = ["base_type", "declarator", "default"]
reqd_kw_flags_cname = "0"
is_wrapper = 0
decorators = None
+ return_type_annotation = None
entry = None
acquire_gil = 0
-
+ self_in_stararg = 0
def __init__(self, pos, **kwds):
FuncDefNode.__init__(self, pos, **kwds)
directive_locals = getattr(cfunc, 'directive_locals', {}))
def analyse_declarations(self, env):
- self.declare_pyfunction(env)
+ self.is_classmethod = self.is_staticmethod = False
+ if self.decorators:
+ for decorator in self.decorators:
+ func = decorator.decorator
+ if func.is_name:
+ self.is_classmethod |= func.name == 'classmethod'
+ self.is_staticmethod |= func.name == 'staticmethod'
+
+ if self.is_classmethod and env.lookup_here('classmethod'):
+ # classmethod() was overridden - not much we can do here ...
+ self.is_classmethod = False
+ if self.is_staticmethod and env.lookup_here('staticmethod'):
+ # staticmethod() was overridden - not much we can do here ...
+ self.is_staticmethod = False
+
+ self.analyse_argument_types(env)
++ if self.name == '<lambda>':
++ self.declare_lambda_function(env)
++ else:
++ self.declare_pyfunction(env)
+ self.analyse_signature(env)
+ self.return_type = self.entry.signature.return_type()
+ self.create_local_scope(env)
+
+ def analyse_argument_types(self, env):
directive_locals = self.directive_locals = env.directives['locals']
for arg in self.args:
if hasattr(arg, 'name'):