diff options
author | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-11-25 05:02:10 -0800 |
---|---|---|
committer | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-11-25 05:02:10 -0800 |
commit | 520119a6f6ed418b8ae45bfde8239bbb532562cd (patch) | |
tree | 6cc381877adb5ddfaf131415c64f87eca5649676 /starts/meaning-vm/level-1 | |
parent | cd03e291664cb102bde61d86a15f0add11809766 (diff) | |
download | standingwithresilience-520119a6f6ed418b8ae45bfde8239bbb532562cd.tar.gz standingwithresilience-520119a6f6ed418b8ae45bfde8239bbb532562cd.zip |
cleanup mixin pointer mess for refs
Diffstat (limited to 'starts/meaning-vm/level-1')
-rw-r--r-- | starts/meaning-vm/level-1/ref.cpp | 2 | ||||
-rw-r--r-- | starts/meaning-vm/level-1/ref.hpp | 13 | ||||
-rw-r--r-- | starts/meaning-vm/level-1/sugar.hpp | 2 |
3 files changed, 8 insertions, 9 deletions
diff --git a/starts/meaning-vm/level-1/ref.cpp b/starts/meaning-vm/level-1/ref.cpp index 045e879..b593f81 100644 --- a/starts/meaning-vm/level-1/ref.cpp +++ b/starts/meaning-vm/level-1/ref.cpp @@ -45,7 +45,7 @@ level0::ref getnamed(std::string const & name) } ref::ref(std::string const & name) -: ref0((level0::concept*)getnamed(name)) +: baseref(getnamed(name).ptr()) { } vref<std::string> ref::name() const diff --git a/starts/meaning-vm/level-1/ref.hpp b/starts/meaning-vm/level-1/ref.hpp index 40eee20..8a7394e 100644 --- a/starts/meaning-vm/level-1/ref.hpp +++ b/starts/meaning-vm/level-1/ref.hpp @@ -1,15 +1,17 @@ #pragma once #include "common.hpp" +#include "../level-0/baseref.hpp" #include "../level-0/ref.hpp" -#include "../level-0/ref-mixin.hpp" namespace intellect { namespace level1 { -struct ref : public level0::refmixin<ref,vref> +struct ref : public level0::baseref<ref,vref,level0::concept> { - ref(level0::ref const & other) : ref0(other) { } + using level0::baseref<ref,vref,level0::concept>::baseref; + ref(level0::concept * p) : baseref(p) { } + ref(level0::ref const & other) : baseref(other.ptr()) { } ref(std::string const & name); ref(const char *name) : ref(std::string(name)) { } ref(bool b) : ref(b ? "true" : "false") { } @@ -20,14 +22,11 @@ struct ref : public level0::refmixin<ref,vref> vref<std::string> name() const; - level0::ref & l0() { return ref0; } + level0::ref & l0() { return *reinterpret_cast<level0::ref*>(this); } ref & l1() { return self; } ref const & l1() const { return self; } std::string dump(ref skipmarkertype, ref skipmarkertarget); -private: - - level0::ref ref0; }; } diff --git a/starts/meaning-vm/level-1/sugar.hpp b/starts/meaning-vm/level-1/sugar.hpp index c2fa4f9..9d439e5 100644 --- a/starts/meaning-vm/level-1/sugar.hpp +++ b/starts/meaning-vm/level-1/sugar.hpp @@ -27,7 +27,7 @@ namespace internal { if (name[name.size() - 1] == ',') { name = name.substr(0, name.size() - 1); } - refptrs[i]->l0() = ref(name).l0(); + refptrs[i]->ptr() = ref(name).ptr(); } } } |