librustc: De-`@mut` `ScopeInfo`
This commit is contained in:
parent
8728b09e78
commit
abbee6decd
|
@ -1005,7 +1005,7 @@ pub fn have_cached_lpad(bcx: @Block) -> bool {
|
|||
return res;
|
||||
}
|
||||
|
||||
pub fn in_lpad_scope_cx(bcx: @Block, f: |si: &mut ScopeInfo|) {
|
||||
pub fn in_lpad_scope_cx(bcx: @Block, f: |si: &ScopeInfo|) {
|
||||
let mut bcx = bcx;
|
||||
let mut cur_scope = bcx.scope.get();
|
||||
loop {
|
||||
|
@ -1191,7 +1191,7 @@ pub fn trans_stmt(cx: @Block, s: &ast::Stmt) -> @Block {
|
|||
// next three functions instead.
|
||||
pub fn new_block(cx: @FunctionContext,
|
||||
parent: Option<@Block>,
|
||||
scope: Option<@mut ScopeInfo>,
|
||||
scope: Option<@ScopeInfo>,
|
||||
is_lpad: bool,
|
||||
name: &str,
|
||||
opt_node_info: Option<NodeInfo>)
|
||||
|
@ -1216,9 +1216,10 @@ pub fn new_block(cx: @FunctionContext,
|
|||
}
|
||||
}
|
||||
|
||||
pub fn simple_block_scope(parent: Option<@mut ScopeInfo>,
|
||||
node_info: Option<NodeInfo>) -> @mut ScopeInfo {
|
||||
@mut ScopeInfo {
|
||||
pub fn simple_block_scope(parent: Option<@ScopeInfo>,
|
||||
node_info: Option<NodeInfo>)
|
||||
-> @ScopeInfo {
|
||||
@ScopeInfo {
|
||||
parent: parent,
|
||||
loop_break: None,
|
||||
loop_label: None,
|
||||
|
@ -1248,7 +1249,7 @@ pub fn loop_scope_block(bcx: @Block,
|
|||
loop_label: Option<Name>,
|
||||
n: &str,
|
||||
opt_node_info: Option<NodeInfo>) -> @Block {
|
||||
return new_block(bcx.fcx, Some(bcx), Some(@mut ScopeInfo {
|
||||
return new_block(bcx.fcx, Some(bcx), Some(@ScopeInfo {
|
||||
parent: None,
|
||||
loop_break: Some(loop_break),
|
||||
loop_label: loop_label,
|
||||
|
@ -1329,7 +1330,7 @@ pub fn cleanup_and_leave(bcx: @Block,
|
|||
cur_scope = match cur_scope {
|
||||
Some (inf) if !inf.empty_cleanups() => {
|
||||
let (sub_cx, dest, inf_cleanups) = {
|
||||
let inf = &mut *inf;
|
||||
let inf = &*inf;
|
||||
let mut skip = 0;
|
||||
let mut dest = None;
|
||||
{
|
||||
|
|
|
@ -430,7 +430,7 @@ pub struct cleanup_path {
|
|||
dest: BasicBlockRef
|
||||
}
|
||||
|
||||
pub fn shrink_scope_clean(scope_info: &mut ScopeInfo, size: uint) {
|
||||
pub fn shrink_scope_clean(scope_info: &ScopeInfo, size: uint) {
|
||||
scope_info.landing_pad.set(None);
|
||||
let new_cleanup_paths = {
|
||||
let cleanup_paths = scope_info.cleanup_paths.borrow();
|
||||
|
@ -443,7 +443,7 @@ pub fn shrink_scope_clean(scope_info: &mut ScopeInfo, size: uint) {
|
|||
scope_info.cleanup_paths.set(new_cleanup_paths)
|
||||
}
|
||||
|
||||
pub fn grow_scope_clean(scope_info: &mut ScopeInfo) {
|
||||
pub fn grow_scope_clean(scope_info: &ScopeInfo) {
|
||||
scope_info.landing_pad.set(None);
|
||||
}
|
||||
|
||||
|
@ -623,7 +623,7 @@ pub fn block_cleanups(bcx: &Block) -> ~[cleanup] {
|
|||
}
|
||||
|
||||
pub struct ScopeInfo {
|
||||
parent: Option<@mut ScopeInfo>,
|
||||
parent: Option<@ScopeInfo>,
|
||||
loop_break: Option<@Block>,
|
||||
loop_label: Option<Name>,
|
||||
// A list of functions that must be run at when leaving this
|
||||
|
@ -640,7 +640,7 @@ pub struct ScopeInfo {
|
|||
}
|
||||
|
||||
impl ScopeInfo {
|
||||
pub fn empty_cleanups(&mut self) -> bool {
|
||||
pub fn empty_cleanups(&self) -> bool {
|
||||
let cleanups = self.cleanups.borrow();
|
||||
cleanups.get().is_empty()
|
||||
}
|
||||
|
@ -694,7 +694,7 @@ pub struct Block {
|
|||
unreachable: Cell<bool>,
|
||||
parent: Option<@Block>,
|
||||
// The current scope within this basic block
|
||||
scope: RefCell<Option<@mut ScopeInfo>>,
|
||||
scope: RefCell<Option<@ScopeInfo>>,
|
||||
// Is this block part of a landing pad?
|
||||
is_lpad: bool,
|
||||
// info about the AST node this block originated from, if any
|
||||
|
@ -803,7 +803,7 @@ pub fn val_ty(v: ValueRef) -> Type {
|
|||
|
||||
pub fn in_scope_cx(cx: @Block,
|
||||
scope_id: Option<ast::NodeId>,
|
||||
f: |si: &mut ScopeInfo|) {
|
||||
f: |si: &ScopeInfo|) {
|
||||
let mut cur = cx;
|
||||
let mut cur_scope = cur.scope.get();
|
||||
loop {
|
||||
|
|
Loading…
Reference in New Issue