summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/memorystore.cpp
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2019-11-23 09:11:28 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2019-11-23 09:11:28 -0800
commitfed2ac694bd028d119581ea05a3376e791aee97d (patch)
tree726785b677c3109a16a9b0b1b27ade16b2cfea51 /starts/meaning-vm/memorystore.cpp
parentc0fdff872ca2c48939bacfefce020878ef92b44c (diff)
downloadstandingwithresilience-fed2ac694bd028d119581ea05a3376e791aee97d.tar.gz
standingwithresilience-fed2ac694bd028d119581ea05a3376e791aee97d.zip
more syntax sugar, building meaning
Diffstat (limited to 'starts/meaning-vm/memorystore.cpp')
-rw-r--r--starts/meaning-vm/memorystore.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/starts/meaning-vm/memorystore.cpp b/starts/meaning-vm/memorystore.cpp
index c759051..19e40db 100644
--- a/starts/meaning-vm/memorystore.cpp
+++ b/starts/meaning-vm/memorystore.cpp
@@ -16,26 +16,27 @@ ref alloc(concept * moved) {
return r;
}
-bool referenced(ref r) {
+concept* referenced(ref r) {
for (ref r2 : concepts()) {
if (r2 == r) {
continue;
}
for (auto & l : r2->links) {
if (ref(l.first) == r) {
- return true;
+ return r2.ptr;
}
if (ref(l.second) == r) {
- return true;
+ return r2.ptr;
}
}
}
- return false;
+ return 0;
}
void dealloc(ref r) {
- if (referenced(r)) {
- throw std::logic_error("concept is referenced");
+ concept * referenced = ::referenced(r);
+ if (referenced) {
+ throw std::logic_error("concept '" + r.name() + "' is referenced by '" + ref(referenced).name() + '"');
}
for (
auto it = concepts().begin();