Skip to content

Commit b62d63a

Browse files
committed
Add public API to retrieve internal locals
1 parent 0e726d0 commit b62d63a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

compiler/stable_mir/src/mir/body.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,21 @@ impl Body {
3333
Self { blocks, locals, arg_count }
3434
}
3535

36-
/// Gets the function's return local.
36+
/// Return local that holds this function's return value.
3737
pub fn ret_local(&self) -> &LocalDecl {
3838
&self.locals[0]
3939
}
4040

41-
/// Gets the locals in `self` that correspond to the function's arguments.
41+
/// Locals in `self` that correspond to this function's arguments.
4242
pub fn arg_locals(&self) -> &[LocalDecl] {
4343
&self.locals[1..self.arg_count + 1]
4444
}
45+
46+
/// Internal locals for this function. These are the locals that are
47+
/// neither the return local nor the argument locals.
48+
pub fn internal_locals(&self) -> &[LocalDecl] {
49+
&self.locals[self.arg_count + 1..]
50+
}
4551
}
4652

4753
type LocalDecls = Vec<LocalDecl>;

0 commit comments

Comments
 (0)