build_visitor fixed, going to test it

This commit is contained in:
ProgramSnail 2023-04-25 21:21:36 +03:00
parent 5bf0c1bf48
commit c34523bd4f
23 changed files with 45468 additions and 45273 deletions

View file

@ -8,7 +8,6 @@
// for clangd
#include "utils.hpp"
#include "types_info.hpp"
namespace interpreter::tokens {
@ -69,6 +68,7 @@ using AnyAnnotatedType = AnnotatedType;
// Flow control -----------------
struct TypeConstructorPatternParameter;
struct TypeConstructorPattern;
struct Match;
@ -167,6 +167,7 @@ struct FunctionCallExpression;
struct TupleExpression;
struct VariantExpression;
struct ReturnExpression;
struct TypeConstructorParameter;
struct TypeConstructor;
struct LambdaFunction;
struct ArrayExpression;
@ -376,9 +377,14 @@ struct AnnotatedAbstractType {
// ----------------- Flow control -----------------
struct TypeConstructorPatternParameter {
std::optional<ExtendedName> name;
PatternToken value;
};
struct TypeConstructorPattern {
TypeIdentifier constructor;
std::vector<std::pair<std::optional<ExtendedName>, PatternToken>> parameters;
std::vector<TypeConstructorPatternParameter> parameters;
};
struct MatchCase {
@ -459,8 +465,8 @@ struct AccessExpression {
// Other Expressions -----------------
struct FunctionCallExpression {
std::variant<std::unique_ptr<SubExpressionToken>,
std::unique_ptr<TypeExpression>> prefix;
std::optional<std::variant<std::unique_ptr<SubExpressionToken>,
std::unique_ptr<TypeExpression>>> prefix;
ExtendedName name;
std::vector<FunctionArgument> arguments;
};
@ -477,10 +483,16 @@ struct ReturnExpression {
Expression expression;
};
struct TypeConstructor {
struct TypeConstructorParameter {
enum AssignmentModifier { Move, Assign };
std::optional<ExtendedName> name;
std::optional<AssignmentModifier> asignment_modifier;
PatternToken value;
};
struct TypeConstructor {
std::unique_ptr<TypeExpression> constructor;
std::vector<std::pair<std::optional<std::pair<ExtendedName, AssignmentModifier>>, SubExpression>> parameters;
std::vector<TypeConstructorParameter> parameters;
};
struct LambdaFunction {