From b2c9b3ce9083ea2d5dcfd7a24b4953ae8080d2a2 Mon Sep 17 00:00:00 2001 From: Jeong Yunwon Date: Mon, 16 May 2022 04:50:54 +0900 Subject: [PATCH] Remove Constant::map_constant --- bytecode/src/lib.rs | 6 +----- vm/src/builtins/code.rs | 3 --- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/bytecode/src/lib.rs b/bytecode/src/lib.rs index f052719a0..114554b78 100644 --- a/bytecode/src/lib.rs +++ b/bytecode/src/lib.rs @@ -47,10 +47,6 @@ pub trait Constant: Sized { /// Transforms the given Constant to a BorrowedConstant fn borrow_constant(&self) -> BorrowedConstant; - /// Map this Constant to a Bag's constant - fn map_constant(self, bag: &Bag) -> Bag::Constant { - bag.make_constant(self.borrow_constant()) - } /// Maps the name for the given Bag. fn map_name( @@ -765,7 +761,7 @@ impl CodeObject { .constants .into_vec() .into_iter() - .map(|x| x.map_constant(bag)) + .map(|x| bag.make_constant(x.borrow_constant())) .collect(), names: map_names(self.names), varnames: map_names(self.varnames), diff --git a/vm/src/builtins/code.rs b/vm/src/builtins/code.rs index 67476ff34..650ebfb88 100644 --- a/vm/src/builtins/code.rs +++ b/vm/src/builtins/code.rs @@ -66,9 +66,6 @@ impl Constant for PyConstant { fn borrow_constant(&self) -> BorrowedConstant { borrow_obj_constant(&self.0) } - fn map_constant(self, bag: &Bag) -> Bag::Constant { - bag.make_constant(self.borrow_constant()) - } } pub(crate) struct PyObjBag<'a>(pub &'a Context);