Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usage of Resolver::get_builtin_types #3236

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions gcc/rust/backend/rust-compile-context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,8 @@ Context::Context ()
void
Context::setup_builtins ()
{
auto builtins = resolver->get_builtin_types ();
for (auto it = builtins.begin (); it != builtins.end (); it++)
{
HirId ref;
bool ok = tyctx->lookup_type_by_node_id ((*it)->get_node_id (), &ref);
rust_assert (ok);

TyTy::BaseType *lookup;
ok = tyctx->lookup_type (ref, &lookup);
rust_assert (ok);

TyTyResolveCompile::compile (this, lookup);
}
for (auto &builtin : tyctx->get_builtins ())
TyTyResolveCompile::compile (this, builtin.get ());
}

hashval_t
Expand Down
1 change: 1 addition & 0 deletions gcc/rust/typecheck/rust-hir-type-check.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class TypeCheckContext
bool lookup_builtin (NodeId id, TyTy::BaseType **type);
bool lookup_builtin (std::string name, TyTy::BaseType **type);
void insert_builtin (HirId id, NodeId ref, TyTy::BaseType *type);
const std::vector<std::unique_ptr<TyTy::BaseType>> &get_builtins () const;

void insert_type (const Analysis::NodeMapping &mappings,
TyTy::BaseType *type);
Expand Down
6 changes: 6 additions & 0 deletions gcc/rust/typecheck/rust-typecheck-context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ TypeCheckContext::insert_builtin (HirId id, NodeId ref, TyTy::BaseType *type)
builtins.push_back (std::unique_ptr<TyTy::BaseType> (type));
}

const std::vector<std::unique_ptr<TyTy::BaseType>> &
TypeCheckContext::get_builtins () const
{
return builtins;
}

void
TypeCheckContext::insert_type (const Analysis::NodeMapping &mappings,
TyTy::BaseType *type)
Expand Down
Loading