diff --git a/core/compiler/tests/templates.factor b/core/compiler/tests/templates.factor index 74e5ab80a4..4be700f221 100755 --- a/core/compiler/tests/templates.factor +++ b/core/compiler/tests/templates.factor @@ -3,7 +3,7 @@ USING: arrays compiler kernel kernel.private math hashtables.private math.private namespaces sequences sequences.private tools.test namespaces.private slots.private sequences.private byte-arrays alien alien.accessors layouts -words definitions compiler.units ; +words definitions compiler.units io combinators ; IN: temporary ! Oops! @@ -191,3 +191,18 @@ TUPLE: my-tuple ; 2 1 [ 2dup fixnum< [ >r die r> ] when ] compile-call ] unit-test + +! Regression +: a-dummy drop "hi" print ; + +[ ] [ + 1 [ + dup 0 2 3dup pick >= [ >= ] [ 2drop f ] if [ + drop - >fixnum { + [ a-dummy ] + [ a-dummy ] + [ a-dummy ] + } dispatch + ] [ 2drop no-case ] if + ] compile-call +] unit-test diff --git a/core/generator/generator.factor b/core/generator/generator.factor index 8b6742e700..e6a6226afa 100755 --- a/core/generator/generator.factor +++ b/core/generator/generator.factor @@ -158,17 +158,10 @@ M: #if generate-node ] with-generator ] keep ; -: tail-dispatch? ( node -- ? ) - #! Is the dispatch a jump to a tail call to a word? - dup #call? swap node-successor #return? and ; - : dispatch-branches ( node -- ) node-children [ - dup tail-dispatch? [ - node-param - ] [ - compiling-word get dispatch-branch - ] if %dispatch-label + compiling-word get dispatch-branch + %dispatch-label ] each ; : generate-dispatch ( node -- )