Parse a single block parameter declaration, and append it to `block`. block-param ::= * Value(v) ":" Type(t) arg-loc? arg-loc ::= "[" value-location "]"
(&mut self, ctx: &mut Context, block: Block)
| 2139 | // arg-loc ::= "[" value-location "]" |
| 2140 | // |
| 2141 | fn parse_block_param(&mut self, ctx: &mut Context, block: Block) -> ParseResult<()> { |
| 2142 | // block-param ::= * Value(v) ":" Type(t) arg-loc? |
| 2143 | let v = self.match_value("block argument must be a value")?; |
| 2144 | let v_location = self.loc; |
| 2145 | self.match_token(Token::Colon, "expected ':' after block argument")?; |
| 2146 | // block-param ::= Value(v) ":" * Type(t) arg-loc? |
| 2147 | while ctx.function.dfg.num_values() <= v.index() { |
| 2148 | ctx.function.dfg.make_invalid_value_for_parser(); |
| 2149 | } |
| 2150 | |
| 2151 | let t = self.match_type("expected block argument type")?; |
| 2152 | // Allocate the block argument. |
| 2153 | ctx.function.dfg.append_block_param_for_parser(block, t, v); |
| 2154 | ctx.map.def_value(v, v_location)?; |
| 2155 | |
| 2156 | Ok(()) |
| 2157 | } |
| 2158 | |
| 2159 | // Parse instruction results and return them. |
| 2160 | // |
no test coverage detected