From 54906d097f518b95e9301606fa7807a777474bda Mon Sep 17 00:00:00 2001 From: Florrie Date: Fri, 20 Dec 2019 17:53:50 -0400 Subject: support empty C blocks --- src/js/sb3-gen.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/js/sb3-gen.js b/src/js/sb3-gen.js index 615d73a..6a42f0a 100644 --- a/src/js/sb3-gen.js +++ b/src/js/sb3-gen.js @@ -216,17 +216,17 @@ function blockToScratchblocks(block, target) { case 'control_wait': return `wait ${i('DURATION')} seconds`; case 'control_repeat': - return `repeat ${i('TIMES')}` + i('SUBSTACK', true) + 'end'; + return `repeat ${i('TIMES')}` + (i('SUBSTACK', true) || '\n') + 'end'; case 'control_forever': - return 'forever' + i('SUBSTACK', true) + 'end'; + return 'forever' + (i('SUBSTACK', true) || '\n') + 'end'; case 'control_if': - return `if ${i('CONDITION') || '<>'} then` + i('SUBSTACK', true) + 'end'; + return `if ${i('CONDITION') || '<>'} then` + (i('SUBSTACK', true) || '\n') + 'end'; case 'control_if_else': - return `if ${i('CONDITION') || '<>'} then` + i('SUBSTACK', true) + 'else' + i('SUBSTACK2', true) + 'end'; + return `if ${i('CONDITION') || '<>'} then` + (i('SUBSTACK', true) || '\n') + 'else' + (i('SUBSTACK2', true) || '\n') + 'end'; case 'control_wait_until': return `wait until ${i('CONDITION') || '<>'}`; case 'control_repeat_until': - return `repeat until ${i('CONDITION') || '<>'}` + i('SUBSTACK', true) + 'end'; + return `repeat until ${i('CONDITION') || '<>'}` + (i('SUBSTACK', true) || '\n') + 'end'; case 'control_stop': return `stop ${i('STOP_OPTION')}`; case 'control_start_as_clone': -- cgit 1.3.0-6-gf8a5