diff --git a/dust-lang/src/chunk.rs b/dust-lang/src/chunk.rs index d3d4ec8..45af65e 100644 --- a/dust-lang/src/chunk.rs +++ b/dust-lang/src/chunk.rs @@ -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 { self.constants } diff --git a/dust-lang/src/parser.rs b/dust-lang/src/parser.rs index f5d7bed..95ab2f9 100644 --- a/dust-lang/src/parser.rs +++ b/dust-lang/src/parser.rs @@ -19,14 +19,11 @@ pub fn parse(source: &str) -> Result { 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(()) }