feat(tvix/eval): add methods for emitting code with tracked spans
These are not actually used yet; this is in preparation for a multi-commit chain for emitting all the right spans in the right locations. Change-Id: Ie99d6add2696c1cc0acb9ab928917a10237159de Reviewed-on: https://cl.tvl.fyi/c/depot/+/6379 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
c5a8b93eaf
commit
72adcdf965
2 changed files with 111 additions and 80 deletions
|
|
@ -29,12 +29,19 @@ pub struct Chunk {
|
|||
}
|
||||
|
||||
impl Chunk {
|
||||
pub fn push_op(&mut self, data: OpCode) -> CodeIdx {
|
||||
pub fn push_op_old(&mut self, data: OpCode) -> CodeIdx {
|
||||
let idx = self.code.len();
|
||||
self.code.push(data);
|
||||
CodeIdx(idx)
|
||||
}
|
||||
|
||||
pub fn push_op(&mut self, data: OpCode, span: codemap::Span) -> CodeIdx {
|
||||
let idx = self.code.len();
|
||||
self.code.push(data);
|
||||
self.push_span(span);
|
||||
CodeIdx(idx)
|
||||
}
|
||||
|
||||
pub fn push_constant(&mut self, data: Value) -> ConstantIdx {
|
||||
let idx = self.constants.len();
|
||||
self.constants.push(data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue