From 5102513a5f342f2744246ddf580e5c2e3ec0c773 Mon Sep 17 00:00:00 2001 From: nullishamy Date: Sat, 28 Oct 2023 14:44:34 +0100 Subject: [PATCH] feat: ldc classes --- sources/interpreter_two/src/bytecode/load_store.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sources/interpreter_two/src/bytecode/load_store.rs b/sources/interpreter_two/src/bytecode/load_store.rs index 150f945b..95e80ae1 100644 --- a/sources/interpreter_two/src/bytecode/load_store.rs +++ b/sources/interpreter_two/src/bytecode/load_store.rs @@ -84,6 +84,11 @@ impl Instruction for Ldc { ctx.operands.push(RuntimeValue::Object(obj)) } + ConstantEntry::Class(data) => { + let class_name = data.name.resolve().string(); + let class = vm.class_loader.load_class(class_name)?; + ctx.operands.push(RuntimeValue::Object(class)); + } v => return Err(anyhow!("cannot load {:#?} with ldc", v)), };