Skip to contentSkip to conversation

parse/ast: Mark anonymous functions as python functions

PATCH New Richard Purdie 1 participant 1 message Feb 2, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 parse/ast: Mark anonymous functions as python functions

Anonymous functions are python functions, set the variable flags as such so we can detect them and avoid expansion where needed.

bitbake/lib/bb/parse/ast.py +2 -2
index cff0d2b..1c5b9d1 100644
@@ -156,8 +156,8 @@ class MethodNode(AstNode):
             anonfuncs = data.getVar('__BBANONFUNCS', False) or []
             anonfuncs.append(funcname)
             data.setVar('__BBANONFUNCS', anonfuncs)
-        else:
-            data.setVarFlag(self.func_name, "func", 1)
+            data.setVarFlag(funcname, "python", 1)
+        data.setVarFlag(funcname, "func", 1)
         data.setVar(funcname, text, parsing=True)
         data.setVarFlag(funcname, 'filename', self.filename)
         data.setVarFlag(funcname, 'lineno', str(self.lineno - len(self.body)))