|
|
@ -271,8 +271,8 @@ export default class IfBlockWrapper extends Wrapper {
|
|
|
|
? b`
|
|
|
|
? b`
|
|
|
|
${snippet && (
|
|
|
|
${snippet && (
|
|
|
|
dependencies.length > 0
|
|
|
|
dependencies.length > 0
|
|
|
|
? b`if ((${condition} == null) || ${changed(dependencies)}) ${condition} = !!(${snippet})`
|
|
|
|
? b`if (${condition} == null || ${changed(dependencies)}) ${condition} = !!${snippet}`
|
|
|
|
: b`if (${condition} == null) ${condition} = !!(${snippet})`
|
|
|
|
: b`if (${condition} == null) ${condition} = !!${snippet}`
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
if (${condition}) return ${block.name};`
|
|
|
|
if (${condition}) return ${block.name};`
|
|
|
|
: b`return ${block.name};`)}
|
|
|
|
: b`return ${block.name};`)}
|
|
|
@ -388,7 +388,11 @@ export default class IfBlockWrapper extends Wrapper {
|
|
|
|
function ${select_block_type}(#changed, #ctx) {
|
|
|
|
function ${select_block_type}(#changed, #ctx) {
|
|
|
|
${this.branches.map(({ dependencies, condition, snippet }, i) => condition
|
|
|
|
${this.branches.map(({ dependencies, condition, snippet }, i) => condition
|
|
|
|
? b`
|
|
|
|
? b`
|
|
|
|
${snippet && b`if ((${condition} == null) || ${changed(dependencies)}) ${condition} = !!(${snippet})`}
|
|
|
|
${snippet && (
|
|
|
|
|
|
|
|
dependencies.length > 0
|
|
|
|
|
|
|
|
? b`if (${condition} == null || ${changed(dependencies)}) ${condition} = !!${snippet}`
|
|
|
|
|
|
|
|
: b`if (${condition} == null) ${condition} = !!${snippet}`
|
|
|
|
|
|
|
|
)}
|
|
|
|
if (${condition}) return ${i};`
|
|
|
|
if (${condition}) return ${i};`
|
|
|
|
: b`return ${i};`)}
|
|
|
|
: b`return ${i};`)}
|
|
|
|
${!has_else && b`return -1;`}
|
|
|
|
${!has_else && b`return -1;`}
|
|
|
|