fix: Fix bug in IF block generators. (#8780)

This commit is contained in:
michaela-mm
2025-02-24 15:35:33 +01:00
committed by GitHub
parent 7e44e81e42
commit d016801089
5 changed files with 17 additions and 5 deletions

View File

@@ -40,7 +40,11 @@ export function controls_if(block: Block, generator: PythonGenerator) {
} while (block.getInput('IF' + n));
if (block.getInput('ELSE') || generator.STATEMENT_SUFFIX) {
branchCode = generator.statementToCode(block, 'ELSE') || generator.PASS;
if (block.getInput('ELSE')) {
branchCode = generator.statementToCode(block, 'ELSE') || generator.PASS;
} else {
branchCode = generator.PASS;
}
if (generator.STATEMENT_SUFFIX) {
branchCode =
generator.prefixLines(