mirror of
https://codeberg.org/ProgramSnail/lang.git
synced 2025-12-10 00:48:45 +00:00
type structure change, part done
This commit is contained in:
parent
78c696b99a
commit
522dd16f79
13 changed files with 386 additions and 218 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue