MCPcopy Create free account
hub / github.com/SplootCode/splootcode / generateFunctionStatement

Function generateFunctionStatement

python/executor.py:637–649  ·  view source on GitHub ↗
(func_node, traced, lineno)

Source from the content-addressed store, hash-verified

635 return [assign_node, with_node]
636
637def generateFunctionStatement(func_node, traced, lineno):
638 nameIdentifier = func_node['childSets']['identifier'][0]['properties']['identifier']
639 func_id = func_node['properties']['id']
640 decorators = [generateAstExpression(dec['childSets']['expression'][0]) for dec in func_node['childSets']['decorators']]
641
642 if traced:
643 statements = generateTracedFunctionBlock(func_id, func_node["childSets"]["body"])
644 else:
645 statements = getStatementsFromBlock(func_node["childSets"]["body"], traced)
646
647 funcArgs = generateFunctionArguments(func_node['childSets']['params'])
648
649 return [ast.FunctionDef(nameIdentifier, funcArgs, statements, decorators, lineno=lineno)]
650
651
652def generateReturnStatement(return_node, traced, lineno):

Callers 1

Calls 4

generateAstExpressionFunction · 0.70
getStatementsFromBlockFunction · 0.70

Tested by

no test coverage detected