mirror of
https://github.com/google/blockly.git
synced 2025-12-13 12:50:07 +01:00
fix: Fix bug in IF block generators. (#8780)
This commit is contained in:
@@ -46,7 +46,9 @@ export function controls_if(block: Block, generator: DartGenerator) {
|
||||
} while (block.getInput('IF' + n));
|
||||
|
||||
if (block.getInput('ELSE') || generator.STATEMENT_SUFFIX) {
|
||||
branchCode = generator.statementToCode(block, 'ELSE');
|
||||
branchCode = block.getInput('ELSE')
|
||||
? generator.statementToCode(block, 'ELSE')
|
||||
: '';
|
||||
if (generator.STATEMENT_SUFFIX) {
|
||||
branchCode =
|
||||
generator.prefixLines(
|
||||
|
||||
@@ -44,7 +44,9 @@ export function controls_if(block: Block, generator: JavascriptGenerator) {
|
||||
} while (block.getInput('IF' + n));
|
||||
|
||||
if (block.getInput('ELSE') || generator.STATEMENT_SUFFIX) {
|
||||
let branchCode = generator.statementToCode(block, 'ELSE');
|
||||
let branchCode = block.getInput('ELSE')
|
||||
? generator.statementToCode(block, 'ELSE')
|
||||
: '';
|
||||
if (generator.STATEMENT_SUFFIX) {
|
||||
branchCode =
|
||||
generator.prefixLines(
|
||||
|
||||
@@ -39,7 +39,9 @@ export function controls_if(block: Block, generator: LuaGenerator): string {
|
||||
} while (block.getInput('IF' + n));
|
||||
|
||||
if (block.getInput('ELSE') || generator.STATEMENT_SUFFIX) {
|
||||
let branchCode = generator.statementToCode(block, 'ELSE');
|
||||
let branchCode = block.getInput('ELSE')
|
||||
? generator.statementToCode(block, 'ELSE')
|
||||
: '';
|
||||
if (generator.STATEMENT_SUFFIX) {
|
||||
branchCode =
|
||||
generator.prefixLines(
|
||||
|
||||
@@ -46,7 +46,9 @@ export function controls_if(block: Block, generator: PhpGenerator) {
|
||||
} while (block.getInput('IF' + n));
|
||||
|
||||
if (block.getInput('ELSE') || generator.STATEMENT_SUFFIX) {
|
||||
branchCode = generator.statementToCode(block, 'ELSE');
|
||||
branchCode = block.getInput('ELSE')
|
||||
? generator.statementToCode(block, 'ELSE')
|
||||
: '';
|
||||
if (generator.STATEMENT_SUFFIX) {
|
||||
branchCode =
|
||||
generator.prefixLines(
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user