|
1 | 1 | use QAST;
|
2 | 2 |
|
3 |
| -plan(124); |
| 3 | +plan(125); |
4 | 4 |
|
5 | 5 | # Following a test infrastructure.
|
6 | 6 | sub compile_qast($qast) {
|
@@ -2032,3 +2032,61 @@ is_qast(
|
2032 | 2032 | ),
|
2033 | 2033 | 3,
|
2034 | 2034 | 'while loop nohandler');
|
| 2035 | + |
| 2036 | +{ |
| 2037 | + my sub with_arity($arity, $block) { |
| 2038 | + $block.arity($arity); |
| 2039 | + $block; |
| 2040 | + } |
| 2041 | + |
| 2042 | + is_qast( |
| 2043 | + QAST::Block.new( |
| 2044 | + QAST::Op.new( |
| 2045 | + :op<bind>, |
| 2046 | + QAST::Var.new( :name('$i'), :scope<lexical>, :decl<var>, :returns(int) ), |
| 2047 | + QAST::IVal.new( :value(10) ) |
| 2048 | + ), |
| 2049 | + QAST::Op.new( |
| 2050 | + :op<while>, |
| 2051 | + QAST::Var.new( :name('$i'), :scope<lexical> ), |
| 2052 | + QAST::Stmts.new( |
| 2053 | + QAST::Op.new( |
| 2054 | + :op<bind>, |
| 2055 | + QAST::Var.new( :name('$i'), :scope<lexical> ), |
| 2056 | + QAST::Op.new( |
| 2057 | + :op<sub_i>, |
| 2058 | + QAST::Var.new( :name('$i'), :scope<lexical> ), |
| 2059 | + QAST::IVal.new( :value(1) ) |
| 2060 | + ) |
| 2061 | + ), |
| 2062 | + QAST::Op.new( |
| 2063 | + :op<for>, |
| 2064 | + QAST::IVal.new( :value(1), :named('nohandler') ), |
| 2065 | + QAST::Op.new( |
| 2066 | + :op<list>, |
| 2067 | + QAST::IVal.new( :value(3) ), |
| 2068 | + QAST::IVal.new( :value(7) ), |
| 2069 | + QAST::IVal.new( :value(20) ) |
| 2070 | + ), |
| 2071 | + with_arity(1, QAST::Block.new( |
| 2072 | + :blocktype<immediate>, |
| 2073 | + QAST::Op.new( |
| 2074 | + :op<if>, |
| 2075 | + QAST::Op.new( |
| 2076 | + :op<iseq_i>, |
| 2077 | + QAST::Var.new( :name('$j'), :scope<lexical>, :decl<param> ), |
| 2078 | + QAST::Var.new( :name('$i'), :scope<lexical> ) |
| 2079 | + ), |
| 2080 | + QAST::Op.new( :op<control>, :name<last> ) |
| 2081 | + ), |
| 2082 | + QAST::Op.new(:op<null>) |
| 2083 | + )) |
| 2084 | + ) |
| 2085 | + ) |
| 2086 | + ), |
| 2087 | + QAST::Var.new( :name('$i'), :scope('lexical') ), |
| 2088 | + ), |
| 2089 | + 7, |
| 2090 | + 'for loop nohandler'); |
| 2091 | + |
| 2092 | +} |
0 commit comments