AST: Reorder classes

This commit is contained in:
Riyyi
2023-03-28 20:17:03 +02:00
parent 9c1c5114a9
commit de2a207fcb
+18 -18
View File
@@ -161,22 +161,6 @@ private:
// ----------------------------------------- // -----------------------------------------
// Symbols
class Symbol final : public ASTNode {
public:
explicit Symbol(const std::string& symbol);
virtual ~Symbol() = default;
virtual bool isSymbol() const override { return true; }
const std::string& symbol() const { return m_symbol; }
private:
std::string m_symbol;
};
// -----------------------------------------
// true, false, nil // true, false, nil
class Value final : public ASTNode { class Value final : public ASTNode {
public: public:
@@ -199,6 +183,22 @@ private:
// ----------------------------------------- // -----------------------------------------
// Symbols
class Symbol final : public ASTNode {
public:
explicit Symbol(const std::string& symbol);
virtual ~Symbol() = default;
virtual bool isSymbol() const override { return true; }
const std::string& symbol() const { return m_symbol; }
private:
std::string m_symbol;
};
// -----------------------------------------
using Lambda = std::function<ASTNodePtr(std::span<ASTNodePtr>)>; using Lambda = std::function<ASTNodePtr(std::span<ASTNodePtr>)>;
class Function final : public ASTNode { class Function final : public ASTNode {
@@ -247,10 +247,10 @@ template<>
inline bool ASTNode::fastIs<Number>() const { return isNumber(); } inline bool ASTNode::fastIs<Number>() const { return isNumber(); }
template<> template<>
inline bool ASTNode::fastIs<Symbol>() const { return isSymbol(); } inline bool ASTNode::fastIs<Value>() const { return isValue(); }
template<> template<>
inline bool ASTNode::fastIs<Value>() const { return isValue(); } inline bool ASTNode::fastIs<Symbol>() const { return isSymbol(); }
template<> template<>
inline bool ASTNode::fastIs<Function>() const { return isFunction(); } inline bool ASTNode::fastIs<Function>() const { return isFunction(); }