@@ -1911,6 +1911,19 @@ QAST::MASTOperations.add_core_moarop_mapping('getcodename', 'getcodename');
1911
1911
QAST ::MASTOperations. add_core_moarop_mapping(' setcodename' , ' setcodename' , 0 );
1912
1912
QAST ::MASTOperations. add_core_moarop_mapping(' forceouterctx' , ' forceouterctx' , 0 );
1913
1913
QAST ::MASTOperations. add_core_moarop_mapping(' setdispatcher' , ' setdispatcher' , 0 );
1914
+ QAST ::MASTOperations. add_core_op(' takedispatcher' , -> $ qastcomp , $ op {
1915
+ unless nqp ::istype($ op [0 ], QAST ::SVal) {
1916
+ nqp ::die(" takedispatcher must have a single QAST::SVal child" );
1917
+ }
1918
+ my @ ops ;
1919
+ my $ disp_reg := $ * REGALLOC . fresh_register($ MVM_reg_obj );
1920
+ push_op(@ ops , ' takedispatcher' , $ disp_reg );
1921
+ if $ * BLOCK . lexical($ op [0 ]. value ) -> $ lex {
1922
+ push_op(@ ops , ' bindlex' , $ lex , $ disp_reg );
1923
+ }
1924
+ $ * REGALLOC . release_register($ disp_reg , $ MVM_reg_obj );
1925
+ MAST::InstructionList. new (@ ops , $ MVM_reg_void , MAST::VOID)
1926
+ });
1914
1927
QAST ::MASTOperations. add_core_op(' setup_blv' , -> $ qastcomp , $ op {
1915
1928
if + @ ($ op ) != 1 || ! nqp ::ishash($ op [0 ]) {
1916
1929
nqp ::die(' setup_blv requires one hash operand' );
0 commit comments