1
0

Clean up unused code

This commit is contained in:
Jeff 2024-10-19 13:52:23 -04:00
parent 1c8e8b35b9
commit 65e513488f
2 changed files with 6 additions and 17 deletions

View File

@ -57,18 +57,10 @@ impl Chunk {
.ok_or(ChunkError::InstructionIndexOfBounds { offset, position })
}
pub fn remove_instruction(&mut self, index: usize) -> (Instruction, Span) {
self.instructions.remove(index)
}
pub fn push_instruction(&mut self, instruction: Instruction, position: Span) {
self.instructions.push((instruction, position));
}
pub fn insert_instruction(&mut self, index: usize, instruction: Instruction, position: Span) {
self.instructions.insert(index, (instruction, position));
}
pub fn take_constants(self) -> Vec<Value> {
self.constants
}

View File

@ -19,14 +19,11 @@ pub fn parse(source: &str) -> Result<Chunk, DustError> {
while !parser.is_eof() {
parser
.parse_statement(
Allowed {
assignment: true,
explicit_return: false,
implicit_return: true,
},
Context::None,
)
.parse_statement(Allowed {
assignment: true,
explicit_return: false,
implicit_return: true,
})
.map_err(|error| DustError::Parse { error, source })?;
}
@ -940,7 +937,7 @@ impl<'src> Parser<'src> {
self.commit_current_statement();
self.chunk
.insert_instruction(jump_end, jump_back, self.current_position);
.push_instruction(jump_back, self.current_position);
Ok(())
}