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

Function generateWhileStatement

python/executor.py:576–603  ·  view source on GitHub ↗
(while_node, traced, lineno)

Source from the content-addressed store, hash-verified

574
575
576def generateWhileStatement(while_node, traced, lineno):
577 condition = generateAstExpression(while_node["childSets"]["condition"][0])
578
579 if traced:
580 key = ast.Name(id=SPLOOT_KEY, ctx=ast.Load())
581 func = ast.Attribute(
582 value=key, attr="logExpressionResultAndStartFrame", ctx=ast.Load()
583 )
584 args = [
585 ast.Constant("PYTHON_WHILE_LOOP_ITERATION"),
586 ast.Constant("condition"),
587 condition,
588 ]
589 condition = ast.Call(func, args=args, keywords=[])
590
591 statements = getStatementsFromBlock(while_node["childSets"]["block"], traced)
592 if not traced:
593 return statements
594
595 statements.insert(0, startChildSetStatement('block'))
596 statements.append(endFrame())
597
598 return [
599 startFrameStatement('PYTHON_WHILE_LOOP', 'frames'),
600 ast.While(condition, statements, [], lineno=lineno),
601 endLoop(),
602 endFrame()
603 ]
604
605def generateFunctionArguments(arg_list):
606 args = []

Callers 1

Calls 6

startChildSetStatementFunction · 0.85
endFrameFunction · 0.85
startFrameStatementFunction · 0.85
endLoopFunction · 0.85
generateAstExpressionFunction · 0.70
getStatementsFromBlockFunction · 0.70

Tested by

no test coverage detected