refactor(tvix/eval): rename Chunk::add_* functions to ::push_*

grfn pointed out in cl/6069 that naming them like this makes it clear
that things are being added to the end of the state.

Change-Id: I6a23215c4fef713869a3c85b0dde1ebbda7637e9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6179
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2022-08-12 17:26:45 +03:00 committed by tazjin
parent 4c9d3fa2a6
commit 0a09356f82
2 changed files with 55 additions and 55 deletions

View file

@ -8,13 +8,13 @@ pub struct Chunk {
}
impl Chunk {
pub fn add_op(&mut self, data: OpCode) -> CodeIdx {
pub fn push_op(&mut self, data: OpCode) -> CodeIdx {
let idx = self.code.len();
self.code.push(data);
CodeIdx(idx)
}
pub fn add_constant(&mut self, data: Value) -> ConstantIdx {
pub fn push_constant(&mut self, data: Value) -> ConstantIdx {
let idx = self.constants.len();
self.constants.push(data);
ConstantIdx(idx)