type structure change, part done

This commit is contained in:
ProgramSnail 2023-08-08 10:30:16 +03:00
parent 78c696b99a
commit 522dd16f79
13 changed files with 386 additions and 218 deletions

View file

@ -335,7 +335,7 @@ public:
TypeDefinition(Node node, SymbolDocs &&docs, bool is_on_heap,
const Identifier &name, std::vector<Identifier> &&typeclasses,
std::vector<Identifier> &&arguments,
std::optional<VariantType> &&type)
std::optional<TypeProxy> &type)
: Node(node), docs_(std::move(docs)), is_on_heap_(is_on_heap),
name_(name), typeclasses_(typeclasses),
arguments_(std::move(arguments)), type_(std::move(type)) {}
@ -366,16 +366,9 @@ public:
//
std::optional<VariantType *> get_type() {
std::optional<TypeProxy> get_type() const {
if (type_.has_value()) {
return &type_.value();
}
return std::nullopt;
}
std::optional<const VariantType *> get_type() const {
if (type_.has_value()) {
return &type_.value();
return type_.value();
}
return std::nullopt;
}
@ -396,7 +389,7 @@ private:
Identifier name_;
std::vector<Identifier> typeclasses_;
std::vector<Identifier> arguments_;
std::optional<VariantType> type_; // TupleType is VariantType with one variant
std::optional<TypeProxy> type_;
};
class Statement {