From 520119a6f6ed418b8ae45bfde8239bbb532562cd Mon Sep 17 00:00:00 2001 From: olpc user Date: Mon, 25 Nov 2019 05:02:10 -0800 Subject: cleanup mixin pointer mess for refs --- starts/meaning-vm/level-1/ref.cpp | 2 +- starts/meaning-vm/level-1/ref.hpp | 13 ++++++------- starts/meaning-vm/level-1/sugar.hpp | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) (limited to 'starts/meaning-vm/level-1') 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 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 +struct ref : public level0::baseref { - ref(level0::ref const & other) : ref0(other) { } + using level0::baseref::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 vref name() const; - level0::ref & l0() { return ref0; } + level0::ref & l0() { return *reinterpret_cast(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(); } } } -- cgit v1.2.3