# HG changeset patch # User Paul Boddie # Date 1385685435 -3600 # Node ID bebf059c7be66b86dfc7ea4cfb153d69c820cb8a # Parent a41b7f8b792b8ffa49c1294cc57882db49846013 Removed restrictions on dynamic function identification and generation. diff -r a41b7f8b792b -r bebf059c7be6 micropython/data.py --- a/micropython/data.py Fri Nov 29 01:17:17 2013 +0100 +++ b/micropython/data.py Fri Nov 29 01:37:15 2013 +0100 @@ -1116,15 +1116,13 @@ "An inspected function." def __init__(self, name, parent, argnames, defaults, has_star, has_dstar, - dynamic_def=0, module=None, node=None, original_name=None): + module=None, node=None, original_name=None): """ Initialise the function with the given 'name', 'parent', list of 'argnames', list of 'defaults', the 'has_star' flag (indicating the presence of a * parameter), the 'has_dstar' flag (indicating the - presence of a ** parameter), optional 'dynamic_def' (indicating that the - function must be handled dynamically), optional 'module', and optional - AST 'node'. + presence of a ** parameter), optional 'module', and optional AST 'node'. """ NamespaceDict.__init__(self, module) @@ -1143,7 +1141,6 @@ self.defaults = defaults self.has_star = has_star self.has_dstar = has_dstar - self.dynamic_def = dynamic_def self.astnode = node # Initialise the positional names. @@ -1243,7 +1240,7 @@ if self.dynamic is None: for attr in self.default_attrs: - if not attr.is_strict_constant() and self.dynamic_def: + if not attr.is_strict_constant(): self.dynamic = True self._make_dynamic() break @@ -1405,7 +1402,7 @@ "Make an instantiator function from a method, keeping all arguments." function = Function(self.parent.name, self.parent.parent, self.argnames, self.defaults, - self.has_star, self.has_dstar, self.dynamic_def, self.module) + self.has_star, self.has_dstar, self.module) function.default_attrs = self.default_attrs return function @@ -1633,7 +1630,7 @@ # Function construction. def get_function(name, parent, argnames, defaults, has_star, has_dstar, - dynamic_def=0, module=None, node=None): + module=None, node=None): """ Return a Function instance for the class with the given 'name', 'parent', @@ -1648,7 +1645,7 @@ name = "%s#%d" % (name, assignments + 1) fn = Function(name, parent, argnames, defaults, has_star, has_dstar, - dynamic_def, module, node, original_name) + module, node, original_name) # Add a reference for the function's "shadow" name. diff -r a41b7f8b792b -r bebf059c7be6 micropython/inspect.py --- a/micropython/inspect.py Fri Nov 29 01:17:17 2013 +0100 +++ b/micropython/inspect.py Fri Nov 29 01:37:15 2013 +0100 @@ -783,7 +783,6 @@ node.defaults, (node.flags & 4 != 0), (node.flags & 8 != 0), - self.in_loop or self.in_function, self, node )