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

Function generateIfStatement

python/text_generator.py:349–359  ·  view source on GitHub ↗
(if_node)

Source from the content-addressed store, hash-verified

347 return statements
348
349def generateIfStatement(if_node):
350 condition = generateAstExpression(if_node["childSets"]["condition"][0])
351 statements = getStatementsFromBlock(if_node["childSets"]["trueblock"])
352
353 else_statements = []
354 if "elseblocks" in if_node["childSets"] and len(if_node["childSets"]["elseblocks"]) != 0:
355 else_statements = generateElifNestedChain(if_node["childSets"]["elseblocks"])
356
357 return [
358 ast.If(condition, statements, else_statements),
359 ]
360
361
362def generateForStatement(for_node):

Callers 1

generateAstStatementFunction · 0.70

Calls 3

generateAstExpressionFunction · 0.70
getStatementsFromBlockFunction · 0.70
generateElifNestedChainFunction · 0.70

Tested by

no test coverage detected