File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -762,9 +762,10 @@ class JSGenerator {
762762 // If you don't do this, the loop effectively yields twice per iteration and will run at half-speed.
763763 const isLastInLoop = this . isLastBlockInLoop ( ) ;
764764
765- if ( node . blockType === BlockType . COMMAND ) {
765+ const blockType = node . blockType ;
766+ if ( blockType === BlockType . COMMAND || blockType === BlockType . HAT ) {
766767 this . source += `${ this . generateCompatibilityLayerCall ( node , isLastInLoop ) } ;\n` ;
767- } else if ( node . blockType === BlockType . CONDITIONAL ) {
768+ } else if ( blockType === BlockType . CONDITIONAL ) {
768769 this . source += `switch (Math.round(${ this . generateCompatibilityLayerCall ( node , isLastInLoop ) } )) {\n` ;
769770 for ( let i = 0 ; i < node . substacks . length ; i ++ ) {
770771 this . source += `case ${ i + 1 } : {\n` ;
@@ -773,12 +774,14 @@ class JSGenerator {
773774 this . source += `}\n` ;
774775 }
775776 this . source += `}\n` ;
776- } else if ( node . blockType === BlockType . LOOP ) {
777+ } else if ( blockType === BlockType . LOOP ) {
777778 const stackFrameName = this . localVariables . next ( ) ;
778779 this . source += `const ${ stackFrameName } = persistentStackFrame();\n` ;
779780 this . source += `while (toBoolean(${ this . generateCompatibilityLayerCall ( node , isLastInLoop , stackFrameName ) } )) {\n` ;
780781 this . descendStack ( node . substacks [ 0 ] , new Frame ( true ) ) ;
781782 this . source += '}\n' ;
783+ } else {
784+ throw new Error ( `Unknown block type: ${ blockType } ` ) ;
782785 }
783786
784787 if ( isLastInLoop ) {
You can’t perform that action at this time.
0 commit comments