Factor AllocationId out of Address (#916)

This lets us statically distinguish between code that works with arbitrary `Address`es and code that can only work with pointers to separately-allocated storage, and so we no longer need to worry about the latter code crashing at run-time (as `Heap::Deallocate` did) or silently doing the wrong thing (as `Heap::PrintAddress` did) if it's given the wrong kind of `Address`.
This commit is contained in:
Geoff Romer
2021-10-27 16:40:17 -07:00
committed by GitHub
parent 0da907fd2a
commit 0df9e8666c
8 changed files with 85 additions and 66 deletions
@@ -44,7 +44,7 @@ class Interpreter {
SourceLocation source_loc) -> std::optional<Env>;
// Support TypeChecker allocating values on the heap.
auto AllocateValue(Nonnull<const Value*> v) -> Address {
auto AllocateValue(Nonnull<const Value*> v) -> AllocationId {
return heap_.AllocateValue(v);
}