Add public API to retrieve internal locals
This commit is contained in:
parent
93d1b3e92a
commit
f4d80a5f09
@ -33,15 +33,21 @@ impl Body {
|
|||||||
Self { blocks, locals, arg_count }
|
Self { blocks, locals, arg_count }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the function's return local.
|
/// Return local that holds this function's return value.
|
||||||
pub fn ret_local(&self) -> &LocalDecl {
|
pub fn ret_local(&self) -> &LocalDecl {
|
||||||
&self.locals[0]
|
&self.locals[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the locals in `self` that correspond to the function's arguments.
|
/// Locals in `self` that correspond to this function's arguments.
|
||||||
pub fn arg_locals(&self) -> &[LocalDecl] {
|
pub fn arg_locals(&self) -> &[LocalDecl] {
|
||||||
&self.locals[1..self.arg_count + 1]
|
&self.locals[1..self.arg_count + 1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Internal locals for this function. These are the locals that are
|
||||||
|
/// neither the return local nor the argument locals.
|
||||||
|
pub fn internal_locals(&self) -> &[LocalDecl] {
|
||||||
|
&self.locals[self.arg_count + 1..]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type LocalDecls = Vec<LocalDecl>;
|
type LocalDecls = Vec<LocalDecl>;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user