36 lines
716 B
C++

#include "expr.hh"
#include "../tokenizer.hh"
#include <utility>
Expr::Expr(ExprType type, ExprVariant value) : type{type}, value{value} {}
// Copy constructor
Expr::Expr(const Expr &other) : type{other.type}, value{other.value} {}
// Move constructor
Expr::Expr(Expr &&other) noexcept : type{other.type}, value{std::move(other.value)} {}
// Copy assignment
Expr &Expr::operator=(const Expr &other) {
if (this == &other) {
return *this;
}
type = other.type;
value = other.value;
return *this;
}
// Move assignment
Expr &Expr::operator=(Expr &&other) noexcept {
if (this == &other) {
return *this;
}
type = std::move(other.type);
value = std::move(other.value);
return *this;
}