// This procedure builds the *scope map* for a given function, which maps any
// given ast::NodeId in the function's AST to the correct DIScope metadata instance.
// This procedure builds the *scope map* for a given function, which maps any
// given ast::NodeId in the function's AST to the correct DIScope metadata instance.
// Push argument identifiers onto the stack so arguments integrate nicely
// with variable shadowing.
for arg in args {
// Push argument identifiers onto the stack so arguments integrate nicely
// with variable shadowing.
for arg in args {
- pat_util::pat_bindings_ident(def_map, &*arg.pat, |_, node_id, _, path1| {
+ pat_util::pat_bindings_ident(def_map, &arg.pat, |_, node_id, _, path1| {
scope_stack.push(ScopeStackEntry { scope_metadata: fn_metadata,
name: Some(path1.node.unhygienic_name) });
scope_map.insert(node_id, fn_metadata);
scope_stack.push(ScopeStackEntry { scope_metadata: fn_metadata,
name: Some(path1.node.unhygienic_name) });
scope_map.insert(node_id, fn_metadata);
- walk_decl(cx, &**decl, scope_stack, scope_map),
+ walk_decl(cx, &decl, scope_stack, scope_map),
hir::StmtExpr(ref exp, _) |
hir::StmtSemi(ref exp, _) =>
hir::StmtExpr(ref exp, _) |
hir::StmtSemi(ref exp, _) =>
- walk_expr(cx, &**exp, scope_stack, scope_map),
+ walk_expr(cx, &exp, scope_stack, scope_map),
- walk_expr(cx, &**exp, scope_stack, scope_map);
+ walk_expr(cx, &exp, scope_stack, scope_map);
codemap::Spanned { node: hir::DeclLocal(ref local), .. } => {
scope_map.insert(local.id, scope_stack.last().unwrap().scope_metadata);
codemap::Spanned { node: hir::DeclLocal(ref local), .. } => {
scope_map.insert(local.id, scope_stack.last().unwrap().scope_metadata);
- walk_pattern(cx, &*local.pat, scope_stack, scope_map);
+ walk_pattern(cx, &local.pat, scope_stack, scope_map);
- walk_expr(cx, &**exp, scope_stack, scope_map);
+ walk_expr(cx, &exp, scope_stack, scope_map);
// ast_util::walk_pat() here because we have to visit *all* nodes in
// order to put them into the scope map. The above functions don't do that.
match pat.node {
// ast_util::walk_pat() here because we have to visit *all* nodes in
// order to put them into the scope map. The above functions don't do that.
match pat.node {
// Check if this is a binding. If so we need to put it on the
// scope stack and maybe introduce an artificial scope
// Check if this is a binding. If so we need to put it on the
// scope stack and maybe introduce an artificial scope
scope_map.insert(pat.id, scope_stack.last().unwrap().scope_metadata);
if let Some(ref sub_pat) = *sub_pat_opt {
scope_map.insert(pat.id, scope_stack.last().unwrap().scope_metadata);
if let Some(ref sub_pat) = *sub_pat_opt {
- walk_pattern(cx, &**sub_pat, scope_stack, scope_map);
+ walk_pattern(cx, &sub_pat, scope_stack, scope_map);
scope_map.insert(pat.id, scope_stack.last().unwrap().scope_metadata);
if let Some(ref sub_pats) = *sub_pats_opt {
for p in sub_pats {
scope_map.insert(pat.id, scope_stack.last().unwrap().scope_metadata);
if let Some(ref sub_pats) = *sub_pats_opt {
for p in sub_pats {
- walk_pattern(cx, &**p, scope_stack, scope_map);
+ walk_pattern(cx, &p, scope_stack, scope_map);
scope_map.insert(pat.id, scope_stack.last().unwrap().scope_metadata);
for &codemap::Spanned {
node: hir::FieldPat { pat: ref sub_pat, .. },
..
} in field_pats {
scope_map.insert(pat.id, scope_stack.last().unwrap().scope_metadata);
for &codemap::Spanned {
node: hir::FieldPat { pat: ref sub_pat, .. },
..
} in field_pats {
- walk_pattern(cx, &**sub_pat, scope_stack, scope_map);
+ walk_pattern(cx, &sub_pat, scope_stack, scope_map);
scope_map.insert(pat.id, scope_stack.last().unwrap().scope_metadata);
for sub_pat in sub_pats {
scope_map.insert(pat.id, scope_stack.last().unwrap().scope_metadata);
for sub_pat in sub_pats {
- walk_pattern(cx, &**sub_pat, scope_stack, scope_map);
+ walk_pattern(cx, &sub_pat, scope_stack, scope_map);
- walk_pattern(cx, &**sub_pat, scope_stack, scope_map);
+ walk_pattern(cx, &sub_pat, scope_stack, scope_map);
- walk_expr(cx, &**exp, scope_stack, scope_map);
+ walk_expr(cx, &exp, scope_stack, scope_map);
- walk_expr(cx, &**exp1, scope_stack, scope_map);
- walk_expr(cx, &**exp2, scope_stack, scope_map);
+ walk_expr(cx, &exp1, scope_stack, scope_map);
+ walk_expr(cx, &exp2, scope_stack, scope_map);
scope_map.insert(pat.id, scope_stack.last().unwrap().scope_metadata);
for sub_pat in front_sub_pats {
scope_map.insert(pat.id, scope_stack.last().unwrap().scope_metadata);
for sub_pat in front_sub_pats {
- walk_pattern(cx, &**sub_pat, scope_stack, scope_map);
+ walk_pattern(cx, &sub_pat, scope_stack, scope_map);
- walk_pattern(cx, &**sub_pat, scope_stack, scope_map);
+ walk_pattern(cx, &sub_pat, scope_stack, scope_map);
- walk_pattern(cx, &**sub_pat, scope_stack, scope_map);
+ walk_pattern(cx, &sub_pat, scope_stack, scope_map);
hir::ExprAddrOf(_, ref sub_exp) |
hir::ExprField(ref sub_exp, _) |
hir::ExprTupField(ref sub_exp, _) =>
hir::ExprAddrOf(_, ref sub_exp) |
hir::ExprField(ref sub_exp, _) |
hir::ExprTupField(ref sub_exp, _) =>
- walk_expr(cx, &**sub_exp, scope_stack, scope_map),
+ walk_expr(cx, &sub_exp, scope_stack, scope_map),
- walk_expr(cx, &**sub_expr, scope_stack, scope_map);
+ walk_expr(cx, &sub_expr, scope_stack, scope_map);
- Some(ref sub_exp) => walk_expr(cx, &**sub_exp, scope_stack, scope_map),
+ Some(ref sub_exp) => walk_expr(cx, &sub_exp, scope_stack, scope_map),
- walk_expr(cx, &**sub_exp, scope_stack, scope_map);
+ walk_expr(cx, &sub_exp, scope_stack, scope_map);
}
hir::ExprAssignOp(_, ref lhs, ref rhs) |
hir::ExprIndex(ref lhs, ref rhs) |
hir::ExprBinary(_, ref lhs, ref rhs) => {
}
hir::ExprAssignOp(_, ref lhs, ref rhs) |
hir::ExprIndex(ref lhs, ref rhs) |
hir::ExprBinary(_, ref lhs, ref rhs) => {
- walk_expr(cx, &**lhs, scope_stack, scope_map);
- walk_expr(cx, &**rhs, scope_stack, scope_map);
+ walk_expr(cx, &lhs, scope_stack, scope_map);
+ walk_expr(cx, &rhs, scope_stack, scope_map);
- start.as_ref().map(|e| walk_expr(cx, &**e, scope_stack, scope_map));
- end.as_ref().map(|e| walk_expr(cx, &**e, scope_stack, scope_map));
+ start.as_ref().map(|e| walk_expr(cx, &e, scope_stack, scope_map));
+ end.as_ref().map(|e| walk_expr(cx, &e, scope_stack, scope_map));
}
hir::ExprVec(ref init_expressions) |
hir::ExprTup(ref init_expressions) => {
for ie in init_expressions {
}
hir::ExprVec(ref init_expressions) |
hir::ExprTup(ref init_expressions) => {
for ie in init_expressions {
- walk_expr(cx, &**ie, scope_stack, scope_map);
+ walk_expr(cx, &ie, scope_stack, scope_map);
}
}
hir::ExprAssign(ref sub_exp1, ref sub_exp2) |
hir::ExprRepeat(ref sub_exp1, ref sub_exp2) => {
}
}
hir::ExprAssign(ref sub_exp1, ref sub_exp2) |
hir::ExprRepeat(ref sub_exp1, ref sub_exp2) => {
- walk_expr(cx, &**sub_exp1, scope_stack, scope_map);
- walk_expr(cx, &**sub_exp2, scope_stack, scope_map);
+ walk_expr(cx, &sub_exp1, scope_stack, scope_map);
+ walk_expr(cx, &sub_exp2, scope_stack, scope_map);
- walk_expr(cx, &**cond_exp, scope_stack, scope_map);
+ walk_expr(cx, &cond_exp, scope_stack, scope_map);
- walk_block(cx, &**then_block, scope_stack, scope_map);
+ walk_block(cx, &then_block, scope_stack, scope_map);
- walk_expr(cx, &**else_exp, scope_stack, scope_map),
+ walk_expr(cx, &else_exp, scope_stack, scope_map),
- walk_expr(cx, &**cond_exp, scope_stack, scope_map);
+ walk_expr(cx, &cond_exp, scope_stack, scope_map);
- walk_block(cx, &**loop_body, scope_stack, scope_map);
+ walk_block(cx, &loop_body, scope_stack, scope_map);
- walk_block(cx, &**block, scope_stack, scope_map);
+ walk_block(cx, &block, scope_stack, scope_map);
scope_map,
|cx, scope_stack, scope_map| {
for &hir::Arg { pat: ref pattern, .. } in &decl.inputs {
scope_map,
|cx, scope_stack, scope_map| {
for &hir::Arg { pat: ref pattern, .. } in &decl.inputs {
- walk_pattern(cx, &**pattern, scope_stack, scope_map);
+ walk_pattern(cx, &pattern, scope_stack, scope_map);
- walk_block(cx, &**block, scope_stack, scope_map);
+ walk_block(cx, &block, scope_stack, scope_map);
- walk_expr(cx, &**fn_exp, scope_stack, scope_map);
+ walk_expr(cx, &fn_exp, scope_stack, scope_map);
- walk_expr(cx, &**arg_exp, scope_stack, scope_map);
+ walk_expr(cx, &arg_exp, scope_stack, scope_map);
- walk_expr(cx, &**arg_exp, scope_stack, scope_map);
+ walk_expr(cx, &arg_exp, scope_stack, scope_map);
- walk_expr(cx, &**discriminant_exp, scope_stack, scope_map);
+ walk_expr(cx, &discriminant_exp, scope_stack, scope_map);
// For each arm we have to first walk the pattern as these might
// introduce new artificial scopes. It should be sufficient to
// For each arm we have to first walk the pattern as these might
// introduce new artificial scopes. It should be sufficient to
scope_map,
|cx, scope_stack, scope_map| {
for pat in &arm_ref.pats {
scope_map,
|cx, scope_stack, scope_map| {
for pat in &arm_ref.pats {
- walk_pattern(cx, &**pat, scope_stack, scope_map);
+ walk_pattern(cx, &pat, scope_stack, scope_map);
- walk_expr(cx, &**guard_exp, scope_stack, scope_map)
+ walk_expr(cx, &guard_exp, scope_stack, scope_map)
- walk_expr(cx, &*arm_ref.body, scope_stack, scope_map);
+ walk_expr(cx, &arm_ref.body, scope_stack, scope_map);
})
}
}
hir::ExprStruct(_, ref fields, ref base_exp) => {
for &hir::Field { expr: ref exp, .. } in fields {
})
}
}
hir::ExprStruct(_, ref fields, ref base_exp) => {
for &hir::Field { expr: ref exp, .. } in fields {
- walk_expr(cx, &**exp, scope_stack, scope_map);
+ walk_expr(cx, &exp, scope_stack, scope_map);
- Some(ref exp) => walk_expr(cx, &**exp, scope_stack, scope_map),
+ Some(ref exp) => walk_expr(cx, &exp, scope_stack, scope_map),
.. }) => {
// inputs, outputs: Vec<(String, P<Expr>)>
for &(_, ref exp) in inputs {
.. }) => {
// inputs, outputs: Vec<(String, P<Expr>)>
for &(_, ref exp) in inputs {
- walk_expr(cx, &**exp, scope_stack, scope_map);
+ walk_expr(cx, &exp, scope_stack, scope_map);
- walk_expr(cx, &*out.expr, scope_stack, scope_map);
+ walk_expr(cx, &out.expr, scope_stack, scope_map);