Skip to content

Refactored to use implicit insert and remove insert_type method from context object #3395 #3488

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

Closed
Closed
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
2 changes: 0 additions & 2 deletions gcc/rust/typecheck/rust-hir-type-check.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ class TypeCheckContext
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);
bool lookup_type (HirId id, TyTy::BaseType **type) const;
void clear_type (TyTy::BaseType *ty);

Expand Down
11 changes: 4 additions & 7 deletions gcc/rust/typecheck/rust-substitution-mapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,15 @@ SubstMapperInternal::Resolve (TyTy::BaseType *base,
= context->lookup_type (mapper.resolved->get_ty_ref (), &unused);
if (!is_ty_available)
{
context->insert_type (
Analysis::NodeMapping (0, 0, mapper.resolved->get_ty_ref (), 0),
mapper.resolved);
context->insert_implicit_type(mapper.resolved->get_ty_ref (),
mapper.resolved);
}
bool is_ref_available
= context->lookup_type (mapper.resolved->get_ref (), &unused);
if (!is_ref_available)
{
context->insert_type (Analysis::NodeMapping (0, 0,
mapper.resolved->get_ref (),
0),
mapper.resolved);
context->insert_implicit_type(mapper.resolved->get_ref (),
mapper.resolved);
}

return mapper.resolved;
Expand Down
11 changes: 0 additions & 11 deletions gcc/rust/typecheck/rust-typecheck-context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,6 @@ TypeCheckContext::get_builtins () const
return builtins;
}

void
TypeCheckContext::insert_type (const Analysis::NodeMapping &mappings,
TyTy::BaseType *type)
{
rust_assert (type != nullptr);
NodeId ref = mappings.get_nodeid ();
HirId id = mappings.get_hirid ();
node_id_refs[ref] = id;
resolved[id] = type;
}

void
TypeCheckContext::insert_implicit_type (HirId id, TyTy::BaseType *type)
{
Expand Down
Loading