Rename 'maybe_node' type to 'MaybeNode'
This commit is contained in:
parent
095d1872c1
commit
7bc9535617
|
@ -58,7 +58,7 @@ public:
|
|||
|
||||
static bool classof(const serene::exprs::Expression *e);
|
||||
|
||||
serene::exprs::maybe_node analyze(SereneContext &);
|
||||
serene::exprs::MaybeNode analyze(SereneContext &);
|
||||
|
||||
~Error() = default;
|
||||
};
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
|
||||
ExprType getType() const;
|
||||
std::string toString() const;
|
||||
maybe_node analyze(SereneContext &);
|
||||
MaybeNode analyze(SereneContext &);
|
||||
|
||||
static bool classof(const Expression *e);
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
///
|
||||
/// \param ctx The semantic analysis context object.
|
||||
/// \param list the list containing the `def` form
|
||||
static maybe_node make(SereneContext &ctx, List *list);
|
||||
static MaybeNode make(SereneContext &ctx, List *list);
|
||||
~Def() = default;
|
||||
};
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ static const char *exprTypes[] = {
|
|||
class Expression;
|
||||
|
||||
using Node = std::shared_ptr<Expression>;
|
||||
using maybe_node = Result<Node>;
|
||||
using MaybeNode = Result<Node>;
|
||||
|
||||
using ast = std::vector<Node>;
|
||||
using maybe_ast = Result<ast>;
|
||||
|
@ -89,7 +89,7 @@ public:
|
|||
/// to a `Def` node that represents defining a new binding.
|
||||
///
|
||||
/// \param ctx is the context object of the semantic analyzer.
|
||||
virtual maybe_node analyze(SereneContext &ctx) = 0;
|
||||
virtual MaybeNode analyze(SereneContext &ctx) = 0;
|
||||
};
|
||||
|
||||
/// Create a new `node` of type `T` and forwards any given parameter
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
|
||||
ExprType getType() const;
|
||||
std::string toString() const;
|
||||
maybe_node analyze(SereneContext &);
|
||||
MaybeNode analyze(SereneContext &);
|
||||
|
||||
static bool classof(const Expression *e);
|
||||
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
///
|
||||
/// \param ctx The semantic analysis context object.
|
||||
/// \param list the list containing the `fn` form
|
||||
static maybe_node make(SereneContext &ctx, List *list);
|
||||
static MaybeNode make(SereneContext &ctx, List *list);
|
||||
|
||||
~Fn() = default;
|
||||
};
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
std::vector<Node>::iterator begin();
|
||||
std::vector<Node>::iterator end();
|
||||
|
||||
maybe_node analyze(SereneContext &);
|
||||
MaybeNode analyze(SereneContext &);
|
||||
|
||||
static bool classof(const Expression *e);
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ struct Number : public Expression {
|
|||
|
||||
ExprType getType() const;
|
||||
std::string toString() const;
|
||||
maybe_node analyze(SereneContext &ctx);
|
||||
MaybeNode analyze(SereneContext &ctx);
|
||||
|
||||
static bool classof(const Expression *e);
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
|
||||
static bool classof(const Expression *e);
|
||||
|
||||
maybe_node analyze(SereneContext &);
|
||||
MaybeNode analyze(SereneContext &);
|
||||
|
||||
~Symbol() = default;
|
||||
};
|
||||
|
|
|
@ -36,7 +36,7 @@ std::string Error::toString() const {
|
|||
return llvm::formatv("<Error E{0}: {1}>", this->variant->id, this->message);
|
||||
}
|
||||
|
||||
serene::exprs::maybe_node Error::analyze(SereneContext &ctx) {
|
||||
serene::exprs::MaybeNode Error::analyze(SereneContext &ctx) {
|
||||
return Result<serene::exprs::Node>::success(nullptr);
|
||||
};
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ std::string Def::toString() const {
|
|||
this->value->toString());
|
||||
}
|
||||
|
||||
maybe_node Def::analyze(SereneContext &ctx) {
|
||||
MaybeNode Def::analyze(SereneContext &ctx) {
|
||||
return Result<Node>::success(nullptr);
|
||||
};
|
||||
|
||||
|
@ -46,7 +46,7 @@ bool Def::classof(const Expression *e) {
|
|||
return e->getType() == ExprType::Def;
|
||||
};
|
||||
|
||||
maybe_node Def::make(SereneContext &ctx, List *list) {
|
||||
MaybeNode Def::make(SereneContext &ctx, List *list) {
|
||||
// TODO: Add support for docstring as the 3rd argument (4th element)
|
||||
|
||||
if (list->count() != 3) {
|
||||
|
@ -68,7 +68,7 @@ maybe_node Def::make(SereneContext &ctx, List *list) {
|
|||
}
|
||||
|
||||
// Analyze the value
|
||||
maybe_node value = list->elements[2]->analyze(ctx);
|
||||
MaybeNode value = list->elements[2]->analyze(ctx);
|
||||
Node analyzedValue;
|
||||
|
||||
if (value) {
|
||||
|
|
|
@ -42,13 +42,13 @@ std::string Fn::toString() const {
|
|||
this->body.empty() ? "<>" : astToString(&this->body));
|
||||
}
|
||||
|
||||
maybe_node Fn::analyze(SereneContext &ctx) {
|
||||
MaybeNode Fn::analyze(SereneContext &ctx) {
|
||||
return Result<Node>::success(nullptr);
|
||||
};
|
||||
|
||||
bool Fn::classof(const Expression *e) { return e->getType() == ExprType::Fn; };
|
||||
|
||||
maybe_node Fn::make(SereneContext &ctx, List *list) {
|
||||
MaybeNode Fn::make(SereneContext &ctx, List *list) {
|
||||
// TODO: Add support for docstring as the 3rd argument (4th element)
|
||||
if (list->count() < 2) {
|
||||
std::string msg =
|
||||
|
|
|
@ -55,7 +55,7 @@ std::string List::toString() const {
|
|||
return llvm::formatv("<List {0}>", s);
|
||||
};
|
||||
|
||||
maybe_node List::analyze(SereneContext &ctx) {
|
||||
MaybeNode List::analyze(SereneContext &ctx) {
|
||||
if (!elements.empty()) {
|
||||
auto *first = elements[0].get();
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ std::string Number::toString() const {
|
|||
return llvm::formatv("<Number {0}>", value);
|
||||
}
|
||||
|
||||
maybe_node Number::analyze(SereneContext &ctx) {
|
||||
MaybeNode Number::analyze(SereneContext &ctx) {
|
||||
return Result<Node>::success(nullptr);
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ std::string Symbol::toString() const {
|
|||
return llvm::formatv("<Symbol {0}>", this->name);
|
||||
}
|
||||
|
||||
maybe_node Symbol::analyze(SereneContext &ctx) {
|
||||
MaybeNode Symbol::analyze(SereneContext &ctx) {
|
||||
return Result<Node>::success(nullptr);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue