Hello,
I have not found a helpful result on this the enum is not recognised in the CodeChunk implementation, it throws an error: can someone explain to me why this happens?
common::OpCode::OP_CONSTANT => println!("{} {} {}", offset, "OP**...**
| ^^^^^^ use of undeclared crate or module common
enum OpCode {
OpConstant,
OpReturn,
Halt
}
pub struct CodeChunk {
code:Vec<OpCode>,
data:Vec<OpCode>,
source_lines:Vec<i32>
}
impl CodeChunk {
pub fn disassemble_instruction(chunk:&CodeChunk, offset:usize){
let instruction = &chunk.code[offset];
match instruction {
common::OpCode::OpConstant => println!("{} {} {}", offset, "OP_CONSTANT", chunk.source_lines[offset])
}
}
}