mirror of
https://codeberg.org/ProgramSnail/lang.git
synced 2025-12-25 08:18:45 +00:00
part of type checker, type heck result type
This commit is contained in:
parent
48c9e200be
commit
17ff590048
13 changed files with 1022 additions and 321 deletions
|
|
@ -94,7 +94,7 @@ public:
|
|||
: annotation_(annotation), type_(type),
|
||||
before_modifier_(before_modifier),
|
||||
after_modifier_(
|
||||
builtin::builtin_to_modifier(type.get()->to_builtin())) {}
|
||||
builtin::types::get_modifier(type.get()->to_builtin())) {}
|
||||
|
||||
//
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ public:
|
|||
}
|
||||
|
||||
auto type_after_modifier =
|
||||
builtin::builtin_to_modifier(type.get()->to_builtin());
|
||||
builtin::types::get_modifier(type.get()->to_builtin());
|
||||
|
||||
if (after_modifier_ != Modifier::NONE &&
|
||||
after_modifier_ != type_after_modifier) {
|
||||
|
|
@ -397,15 +397,16 @@ private:
|
|||
std::optional<TypeProxy> type_;
|
||||
};
|
||||
|
||||
class Statement {
|
||||
class Statement : public Node {
|
||||
public:
|
||||
Statement(const Statement &) = default;
|
||||
Statement(Statement &&) = default;
|
||||
Statement &operator=(const Statement &) = default;
|
||||
Statement &operator=(Statement &&) = default;
|
||||
// Statement(const Statement &) = default;
|
||||
// Statement(Statement &&) = default;
|
||||
// Statement &operator=(const Statement &) = default;
|
||||
// Statement &operator=(Statement &&) = default;
|
||||
|
||||
template <typename T>
|
||||
explicit Statement(T &&statement) : expression_(std::forward<T>(statement)) {}
|
||||
Statement(Node node, T &&statement)
|
||||
: Node(node), expression_(std::forward<T>(statement)) {}
|
||||
|
||||
template <typename T> std::optional<T *> get() {
|
||||
if (std::holds_alternative<T>(expression_)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue