]> git.proxmox.com Git - rustc.git/blame - src/librustc_mir/build/block.rs
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / librustc_mir / build / block.rs
CommitLineData
e9174d1e
SL
1// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
b039eaaf 11use build::{BlockAnd, Builder};
e9174d1e 12use hair::*;
92a42be0 13use rustc::mir::repr::*;
b039eaaf 14use rustc_front::hir;
e9174d1e 15
b039eaaf 16impl<'a,'tcx> Builder<'a,'tcx> {
e9174d1e 17 pub fn ast_block(&mut self,
b039eaaf 18 destination: &Lvalue<'tcx>,
e9174d1e 19 mut block: BasicBlock,
b039eaaf 20 ast_block: &'tcx hir::Block)
e9174d1e
SL
21 -> BlockAnd<()> {
22 let this = self;
23 let Block { extent, span: _, stmts, expr } = this.hir.mirror(ast_block);
24 this.in_scope(extent, block, |this| {
25 unpack!(block = this.stmts(block, stmts));
26 this.into(destination, block, expr)
27 })
28 }
29}