fixes, function definition search in typecheck

This commit is contained in:
ProgramSnail 2023-05-19 17:09:14 +03:00
parent 0b53b2f218
commit afecbd64f5
6 changed files with 123 additions and 129 deletions

View file

@ -205,15 +205,21 @@ public:
return current_path_;
}
const std::vector<utils::IdType>& GetCurrentPathNamespaces() {
return namespace_stack_;
}
// use only after LinkSymbolsVisitor
std::vector<utils::IdType> GetCurrentPathTypes() {
std::vector<utils::IdType> types;
std::vector<std::optional<utils::IdType>> GetCurrentPathTypes() {
std::vector<std::optional<utils::IdType>> types;
types.reserve(namespace_stack_.size());
for (auto& namespace_id : namespace_stack_) {
definition::Namespace& namespace_info = global_info_.GetNamespaceInfo(namespace_id);
if (namespace_info.any_node.has_value() && namespace_info.any_node.value()->link_type_id_.has_value()) {
types.push_back(namespace_info.any_node.value()->link_type_id_.value());
} else {
types.push_back(std::nullopt);
}
}

View file

@ -522,7 +522,7 @@ struct FunctionCallExpression {
// only one from two is present
std::optional<utils::IdType> function_id_;
std::optional<utils::IdType> typeclass_graph_id_;
std::optional<utils::IdType> graph_id_; // for type or typeclass
bool is_method_of_first_argument_ = false;
};

View file

@ -130,7 +130,8 @@ private:
void AddTypeFunctionsToTypeclassGraph(utils::IdType type_id,
utils::IdType graph_id,
utils::ClassInternalsModifier namespace_modifier);
utils::ClassInternalsModifier namespace_modifier,
const BaseNode& base_node);
private:
info::GlobalInfo::NamespaceVisitor namespace_visitor_;

View file

@ -158,7 +158,7 @@ private:
bool is_method);
std::optional<FunctionDeclaration*>
FindDefinedTypeTypeclassFunctionAndUpdate(
FindDefinedTypeFunctionAndUpdate(
FunctionCallExpression* node,
info::definition::AnyType* defined_type,
bool is_method);