diff options
author | olpc user <olpc@xo-5d-f7-86.localdomain> | 2020-01-10 14:55:19 -0800 |
---|---|---|
committer | olpc user <olpc@xo-5d-f7-86.localdomain> | 2020-01-10 14:55:19 -0800 |
commit | c8bb547bea279af2bb48c13260f98aa8add07131 (patch) | |
tree | 7f64265d514dc50427d2e5d8a70e09a46927dfbd /starts/meaning-vm/level-2-wip-stmtexprs/funcs.cpp | |
parent | 5601d1f3324c30651ad3f264ac2d6e7f12ea8b34 (diff) | |
download | standingwithresilience-c8bb547bea279af2bb48c13260f98aa8add07131.tar.gz standingwithresilience-c8bb547bea279af2bb48c13260f98aa8add07131.zip |
move intellect-framework-from-internet into folder
Diffstat (limited to 'starts/meaning-vm/level-2-wip-stmtexprs/funcs.cpp')
-rw-r--r-- | starts/meaning-vm/level-2-wip-stmtexprs/funcs.cpp | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/starts/meaning-vm/level-2-wip-stmtexprs/funcs.cpp b/starts/meaning-vm/level-2-wip-stmtexprs/funcs.cpp deleted file mode 100644 index d746f13..0000000 --- a/starts/meaning-vm/level-2-wip-stmtexprs/funcs.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include "funcs.hpp" - -using namespace intellect; -using namespace level2; -using namespace concepts; - -static ref refassigned(ref expr) -{ - ref lhs = ref.get(left-operand); - ref rhs = ref.get(right-operand); - if (lhs.isa(link) && lhs.get(link-target) == unknown) { - // completes the target of a link, for a[b] = c - lhs.unlink(link-target, unknown); - lhs.set(link-target, rhs); - ref.unlink(right-operand, rhs); - ref src = lhs.get(link-source); - if (lhs.get(link-type) != unknown && src != unknown) { - src.set(lhs.get(link-type), rhs); - return src; - } else { - throw std::logic_error("not sure what to do with incomplete link assignment"); - } - } else if (isanonymous(rhs) && !isanonymous(lhs)) { - // assignment of anonymous content to empty named concept - ref.unlink(left-operand, lhs); - return level1::movetoname(rhs, lhs); - } else { - throw std::logic_error("unexpected bare assignment"); - } -} -// maybe later we can have ref class itself do operators completely based on its own -// ref content. - -statementref assignop(ref self, ref other) -{ - return statementref::makebinary( - self, concepts::assign, other, - refassigned, refassigned - ); -} -statementref commaop(ref self, ref other) -{ - if (self.isa(comma-expression)) { - if (other.isa(comma-expression)) { - for (auto & l : other.links()) { self.insert(l.first, l.second); } - dealloc(other); - } else { - self.link(topic, other); - } - return self; - } else if (other.isa(comma-expression)) { - other.link(topic, self); - return other; - } else { - return statementcallref::makebinary( - self, comma, other, - [](ref)->ref { return ref; }, - // um when we pass the comma-expression to - // the [] operator that takes a ref - // the destructor of statementref will deallocate it. - [](ref) { throw std::logic_error("bare comma-expression"); } - // something is wrong here. some approach is wrong. - // would it be better to have ref itself do it all? - ); - } -} -ref subop(ref self, ref other) -{ -} |