Remove fold code and add Const::internal()

We are not planning to support user generated constant in the
foreseeable future, so we are removing the Fold logic for now in
favor of the Instance::resolve logic.

The Instance::resolve was however incomplete, since we weren't handling
internalizing constants yet. Thus, I added that.

I decided to keep the Const fields private in case we decide to
translate them lazily.
This commit is contained in:
Celina G. Val
2023-10-23 20:32:31 -07:00
parent 151256bd4b
commit 3f60165d27
10 changed files with 144 additions and 404 deletions

View File

@@ -47,12 +47,12 @@ impl Visitable for Const {
visitor.visit_const(self)
}
fn super_visit<V: Visitor>(&self, visitor: &mut V) -> ControlFlow<V::Break> {
match &self.literal {
match &self.kind() {
super::ty::ConstantKind::Allocated(alloc) => alloc.visit(visitor)?,
super::ty::ConstantKind::Unevaluated(uv) => uv.visit(visitor)?,
super::ty::ConstantKind::Param(_) => {}
}
self.ty.visit(visitor)
self.ty().visit(visitor)
}
}