Skip to content
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
19 changes: 4 additions & 15 deletions gcc/rust/checks/errors/rust-hir-pattern-analysis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,12 @@
#include "rust-tyty.h"
#include "rust-immutable-name-resolution-context.h"

// for flag_name_resolution_2_0
#include "options.h"

namespace Rust {
namespace Analysis {

PatternChecker::PatternChecker ()
: tyctx (*Resolver::TypeCheckContext::get ()),
resolver (*Resolver::Resolver::get ()),
resolver (Resolver2_0::ImmutableNameResolutionContext::get ().resolver ()),
mappings (Analysis::Mappings::get ())
{}

Expand Down Expand Up @@ -238,17 +235,9 @@ PatternChecker::visit (CallExpr &expr)

NodeId ast_node_id = expr.get_fnexpr ().get_mappings ().get_nodeid ();
NodeId ref_node_id;
if (flag_name_resolution_2_0)
{
auto &nr_ctx
= Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();

if (auto id = nr_ctx.lookup (ast_node_id))
ref_node_id = *id;
else
return;
}
else if (!resolver.lookup_resolved_name (ast_node_id, &ref_node_id))
if (auto id = resolver.lookup (ast_node_id))
ref_node_id = *id;
else
return;

if (auto definition_id = mappings.lookup_node_to_hir (ref_node_id))
Expand Down
4 changes: 2 additions & 2 deletions gcc/rust/checks/errors/rust-hir-pattern-analysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "rust-tyty.h"
#include "optional.h"
#include "rust-hir-visitor.h"
#include "rust-name-resolver.h"
#include "rust-immutable-name-resolution-context.h"

namespace Rust {
namespace Analysis {
Expand All @@ -46,7 +46,7 @@ class PatternChecker : public HIR::HIRFullVisitor

private:
Resolver::TypeCheckContext &tyctx;
Resolver::Resolver &resolver;
const Resolver2_0::NameResolutionContext &resolver;
Analysis::Mappings &mappings;

virtual void visit (Lifetime &lifetime) override;
Expand Down
Loading