Skip to content

Commit

Permalink
Rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
ZehMatt committed Sep 5, 2024
1 parent c7d2902 commit 2d1a21c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions zasm/include/zasm/program/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace zasm
NodeFlags _flags{};
Node* _prev{};
Node* _next{};
std::variant<Sentinel*, Instruction*, Label*, EmbeddedLabel*, Data*, Section*, Align*> _data2{};
std::variant<Sentinel*, Instruction*, Label*, EmbeddedLabel*, Data*, Section*, Align*> _data{};

union
{
Expand All @@ -53,7 +53,7 @@ namespace zasm
template<typename T>
constexpr Node(Id nodeId, T* val) noexcept
: _id{ nodeId }
, _data2{ val }
, _data{ val }
{
}

Expand Down Expand Up @@ -97,7 +97,7 @@ namespace zasm
/// <returns>True if the T is the current type</returns>
template<typename T> constexpr bool holds() const noexcept
{
return std::holds_alternative<T*>(_data2);
return std::holds_alternative<T*>(_data);
}

/// <summary>
Expand All @@ -108,13 +108,13 @@ namespace zasm
/// <returns>Returns a reference to the data with the type of T</returns>
template<typename T> constexpr const T& get() const
{
return *std::get<T*>(_data2);
return *std::get<T*>(_data);
}

/// <see cref="get"/>
template<typename T> constexpr T& get()
{
return *std::get<T*>(_data2);
return *std::get<T*>(_data);
}

/// <summary>
Expand All @@ -125,7 +125,7 @@ namespace zasm
/// <returns>Pointer of type T</returns>
template<typename T> constexpr const T* getIf() const noexcept
{
auto r = std::get_if<T*>(&_data2);
auto r = std::get_if<T*>(&_data);
if (r == nullptr)
return nullptr;
return *r;
Expand All @@ -134,7 +134,7 @@ namespace zasm
/// <see cref="getIf"/>
template<typename T> constexpr T* getIf() noexcept
{
auto r = std::get_if<T*>(&_data2);
auto r = std::get_if<T*>(&_data);
if (r == nullptr)
return nullptr;
return *r;
Expand All @@ -149,13 +149,13 @@ namespace zasm
/// <returns>The result of the visitor function</returns>
template<typename TPred> constexpr auto visit(TPred&& func) const
{
return std::visit([&](auto&& obj) { return func(*obj); }, _data2);
return std::visit([&](auto&& obj) { return func(*obj); }, _data);
}

/// <see cref="visit"/>
template<typename TPred> constexpr auto visit(TPred&& func)
{
return std::visit([&](auto&& obj) { return func(*obj); }, _data2);
return std::visit([&](auto&& obj) { return func(*obj); }, _data);
}

/// <summary>
Expand Down

0 comments on commit 2d1a21c

Please sign in to comment.