Clean up unused code
This commit is contained in:
parent
1c8e8b35b9
commit
65e513488f
@ -57,18 +57,10 @@ impl Chunk {
|
|||||||
.ok_or(ChunkError::InstructionIndexOfBounds { offset, position })
|
.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) {
|
pub fn push_instruction(&mut self, instruction: Instruction, position: Span) {
|
||||||
self.instructions.push((instruction, position));
|
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> {
|
pub fn take_constants(self) -> Vec<Value> {
|
||||||
self.constants
|
self.constants
|
||||||
}
|
}
|
||||||
|
@ -19,14 +19,11 @@ pub fn parse(source: &str) -> Result<Chunk, DustError> {
|
|||||||
|
|
||||||
while !parser.is_eof() {
|
while !parser.is_eof() {
|
||||||
parser
|
parser
|
||||||
.parse_statement(
|
.parse_statement(Allowed {
|
||||||
Allowed {
|
assignment: true,
|
||||||
assignment: true,
|
explicit_return: false,
|
||||||
explicit_return: false,
|
implicit_return: true,
|
||||||
implicit_return: true,
|
})
|
||||||
},
|
|
||||||
Context::None,
|
|
||||||
)
|
|
||||||
.map_err(|error| DustError::Parse { error, source })?;
|
.map_err(|error| DustError::Parse { error, source })?;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -940,7 +937,7 @@ impl<'src> Parser<'src> {
|
|||||||
|
|
||||||
self.commit_current_statement();
|
self.commit_current_statement();
|
||||||
self.chunk
|
self.chunk
|
||||||
.insert_instruction(jump_end, jump_back, self.current_position);
|
.push_instruction(jump_back, self.current_position);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user