This commit is contained in:
ProgramSnail 2023-05-18 01:02:54 +03:00
parent 3abac1b643
commit b901078956
6 changed files with 291 additions and 155 deletions

View file

@ -356,11 +356,13 @@ public:
std::vector<utils::IdType>
GetAnnotatedTypeTypeclassesVector(interpreter::tokens::AnnotatedType* node);
std::unordered_map<std::string, TypeclassGraph::FunctionInfo*>
GetAnnotatedTypeFunctionsMap(interpreter::tokens::AnnotatedType* node);
std::unordered_map<std::string, TypeclassGraph::FunctionInfo>
GetAnnotatedTypeFunctionsMap(interpreter::tokens::AnnotatedType* node,
const interpreter::tokens::BaseNode& base_node);
std::vector<std::pair<std::string, TypeclassGraph::FunctionInfo*>>
GetAnnotatedTypeFunctionsVector(interpreter::tokens::AnnotatedType* node);
std::vector<std::pair<std::string, TypeclassGraph::FunctionInfo>>
GetAnnotatedTypeFunctionsVector(interpreter::tokens::AnnotatedType* node,
const interpreter::tokens::BaseNode& base_node);
std::unordered_map<std::string, utils::IdType>* ChooseNamespaces(
utils::ClassInternalsModifier modifier,

View file

@ -30,7 +30,8 @@ public:
return &std::get<T>(value);
}
std::optional<utils::IdType> GetFieldValue(const std::string& name);
bool Same(const InternalValue& value) const;
std::optional<utils::IdType> GetFieldValue(const std::string& name) const;
public:
std::variant<double,
long long,
@ -48,7 +49,8 @@ public:
ValueManager* value_manager)
: fields(std::move(fields)), value_manager_(value_manager) {}
std::optional<utils::IdType> GetFieldValue(const std::string& name);
bool Same(const TupleValue& other_value) const;
std::optional<utils::IdType> GetFieldValue(const std::string& name) const;
public:
std::vector<std::pair<std::optional<std::string>, utils::IdType>> fields;
@ -67,7 +69,8 @@ public:
TupleValue value;
size_t current_constructor;
std::optional<utils::IdType> GetFieldValue(const std::string& name);
bool Same(const VariantValue& other_value) const;
std::optional<utils::IdType> GetFieldValue(const std::string& name) const;
};
struct ReferenceToValue {
@ -83,7 +86,9 @@ public:
std::vector<utils::ReferenceModifier> references;
utils::IdType value;
std::optional<utils::IdType> GetFieldValue(const std::string& name);
bool Same(const ReferenceToValue& other_value) const;
std::optional<utils::IdType> GetFieldValue(const std::string& name) const;
private:
ValueManager* value_manager_ = nullptr;
};
@ -100,7 +105,9 @@ public:
std::variant<interpreter::tokens::FunctionDeclaration*,
interpreter::tokens::LambdaFunction*> function;
std::optional<utils::IdType> GetFieldValue(const std::string& name);
bool Same(const FunctionValue& other_value) const;
std::optional<utils::IdType> GetFieldValue(const std::string& name) const;
private:
ValueManager* value_manager_ = nullptr;
};
@ -119,7 +126,9 @@ public:
std::vector<utils::IdType> elements;
bool is_constant_size = false;
std::optional<utils::IdType> GetFieldValue(const std::string& name);
bool Same(const ArrayValue& other_value) const;
std::optional<utils::IdType> GetFieldValue(const std::string& name) const;
private:
ValueManager* value_manager_ = nullptr;
};
@ -131,7 +140,9 @@ public:
OptionalValue(std::optional<utils::IdType> value, ValueManager* value_manager)
: value(value), value_manager_(value_manager) {}
std::optional<utils::IdType> GetFieldValue(const std::string& name);
bool Same(const OptionalValue& other_value) const;
std::optional<utils::IdType> GetFieldValue(const std::string& name) const;
public:
std::optional<utils::IdType> value;
@ -146,7 +157,9 @@ public:
template<typename T>
explicit Value(const T& value) : value(value) {} // move ??
std::optional<utils::IdType> GetFieldValue(const std::string& name);
bool Same(const Value& other_value) const;
std::optional<utils::IdType> GetFieldValue(const std::string& name) const;
public:
std::variant<InternalValue,
TupleValue,
@ -186,7 +199,9 @@ public:
return values_.at(value_id).second;
}
bool EqualValues(utils::IdType first_value, utils::IdType second_value) = delete; // TODO
bool EqualValues(utils::IdType first_value, utils::IdType second_value) {
return GetAnyValue(first_value)->Same(*GetAnyValue(second_value));
}
bool AddValueRequirement(utils::IdType value, utils::IdType requrement) = delete;