refactor(parser): change value and name handles to results

Refs: #1
This commit is contained in:
2026-06-03 11:08:51 +02:00
parent cf9c53a9e8
commit d1e32baffe
5 changed files with 40 additions and 43 deletions
+6 -4
View File
@@ -51,13 +51,15 @@ protected:
* @brief Var read expression AST node.
*/
class var_read_expression_node final : public expression_node {
public:
using name_type = furlang::result<std::string_view, error>; /**< Name type alias. */
public:
/**
* @brief Construct a new var read expression node object from a name handle.
*
* @param name Handle to the name.
*/
var_read_expression_node(handle<std::string_view>&& name)
var_read_expression_node(name_type&& name)
: m_name(std::move(name)) {}
/**
@@ -65,14 +67,14 @@ public:
*
* @return Name of the variable.
*/
const handle<std::string_view>& get_name() const { return m_name; }
const name_type& get_name() const { return m_name; }
/**
* @brief Returns the variable's name.
*
* @return Name of the variable.
*/
handle<std::string_view>&& move_name() { return std::move(m_name); }
name_type&& move_name() { return std::move(m_name); }
public:
/**
* @brief Returns this node's expression type.
@@ -87,7 +89,7 @@ public:
protected:
bool equal(const node& rhs) const override;
private:
handle<std::string_view> m_name;
name_type m_name;
};
/**