#include "rust-type-util.h"
#include "rust-immutable-name-resolution-context.h"
-// used for flag_name_resolution_2_0
-#include "options.h"
-
namespace Rust {
namespace Resolver {
TraitResolver::resolve_path_to_trait (const HIR::TypePath &path,
HIR::Trait **resolved) const
{
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
+
NodeId ref;
- bool ok;
- if (flag_name_resolution_2_0)
+ if (auto ref_opt = nr_ctx.lookup (path.get_mappings ().get_nodeid ()))
{
- auto &nr_ctx
- = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
-
- auto ref_opt = nr_ctx.lookup (path.get_mappings ().get_nodeid ());
-
- if ((ok = ref_opt.has_value ()))
- ref = *ref_opt;
+ ref = *ref_opt;
}
else
- {
- auto path_nodeid = path.get_mappings ().get_nodeid ();
- ok = resolver->lookup_resolved_type (path_nodeid, &ref)
- || resolver->lookup_resolved_name (path_nodeid, &ref)
- || resolver->lookup_resolved_macro (path_nodeid, &ref);
- }
-
- if (!ok)
{
rust_error_at (path.get_locus (), "Failed to resolve path to node-id");
return false;
namespace Resolver {
TypeCheckBase::TypeCheckBase ()
- : mappings (Analysis::Mappings::get ()), resolver (Resolver::get ()),
- context (TypeCheckContext::get ())
+ : mappings (Analysis::Mappings::get ()), context (TypeCheckContext::get ())
{}
void
location_t locus);
Analysis::Mappings &mappings;
- Resolver *resolver;
TypeCheckContext *context;
};
#include "rust-type-util.h"
#include "rust-immutable-name-resolution-context.h"
-// for flag_name_resolution_2_0
-#include "options.h"
-
namespace Rust {
namespace Resolver {
rust_assert (ok);
context->insert_type (mapping, isize);
- tl::optional<CanonicalPath> canonical_path;
-
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx
- = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
-
- canonical_path
- = nr_ctx.to_canonical_path (item.get_mappings ().get_nodeid ());
- }
- else
- {
- canonical_path
- = mappings.lookup_canonical_path (item.get_mappings ().get_nodeid ());
- }
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- rust_assert (canonical_path.has_value ());
+ CanonicalPath canonical_path
+ = nr_ctx.to_canonical_path (item.get_mappings ().get_nodeid ());
- RustIdent ident{*canonical_path, item.get_locus ()};
+ RustIdent ident{canonical_path, item.get_locus ()};
variant = new TyTy::VariantDef (item.get_mappings ().get_hirid (),
item.get_mappings ().get_defid (),
item.get_identifier ().as_string (), ident,
TyTy::TyWithLocation (expected_ty),
TyTy::TyWithLocation (capacity_type), item.get_locus ());
- tl::optional<CanonicalPath> canonical_path;
-
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx
- = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
-
- canonical_path
- = nr_ctx.to_canonical_path (item.get_mappings ().get_nodeid ());
- }
- else
- {
- canonical_path
- = mappings.lookup_canonical_path (item.get_mappings ().get_nodeid ());
- }
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- rust_assert (canonical_path.has_value ());
+ CanonicalPath canonical_path
+ = nr_ctx.to_canonical_path (item.get_mappings ().get_nodeid ());
- RustIdent ident{*canonical_path, item.get_locus ()};
+ RustIdent ident{canonical_path, item.get_locus ()};
variant
= new TyTy::VariantDef (item.get_mappings ().get_hirid (),
item.get_mappings ().get_defid (),
rust_assert (ok);
context->insert_type (mapping, isize);
- tl::optional<CanonicalPath> canonical_path;
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx
- = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
-
- canonical_path
- = nr_ctx.to_canonical_path (item.get_mappings ().get_nodeid ());
- }
- else
- {
- canonical_path
- = mappings.lookup_canonical_path (item.get_mappings ().get_nodeid ());
- }
-
- rust_assert (canonical_path.has_value ());
+ CanonicalPath canonical_path
+ = nr_ctx.to_canonical_path (item.get_mappings ().get_nodeid ());
- RustIdent ident{*canonical_path, item.get_locus ()};
+ RustIdent ident{canonical_path, item.get_locus ()};
variant = new TyTy::VariantDef (item.get_mappings ().get_hirid (),
item.get_mappings ().get_defid (),
item.get_identifier ().as_string (), ident,
rust_assert (ok);
context->insert_type (mapping, isize);
- tl::optional<CanonicalPath> canonical_path;
-
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx
- = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
-
- canonical_path
- = nr_ctx.to_canonical_path (item.get_mappings ().get_nodeid ());
- }
- else
- {
- canonical_path
- = mappings.lookup_canonical_path (item.get_mappings ().get_nodeid ());
- }
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- rust_assert (canonical_path.has_value ());
+ CanonicalPath canonical_path
+ = nr_ctx.to_canonical_path (item.get_mappings ().get_nodeid ());
- RustIdent ident{*canonical_path, item.get_locus ()};
+ RustIdent ident{canonical_path, item.get_locus ()};
variant = new TyTy::VariantDef (item.get_mappings ().get_hirid (),
item.get_mappings ().get_defid (),
item.get_identifier ().as_string (), ident,
#include "rust-immutable-name-resolution-context.h"
#include "rust-compile-base.h"
-// for flag_name_resolution_2_0
-#include "options.h"
-
namespace Rust {
namespace Resolver {
// store the expected fntype
context->insert_type (expr.get_method_name ().get_mappings (), lookup);
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx = const_cast<Resolver2_0::NameResolutionContext &> (
- Resolver2_0::ImmutableNameResolutionContext::get ().resolver ());
+ auto &nr_ctx = const_cast<Resolver2_0::NameResolutionContext &> (
+ Resolver2_0::ImmutableNameResolutionContext::get ().resolver ());
- nr_ctx.map_usage (Resolver2_0::Usage (expr.get_mappings ().get_nodeid ()),
- Resolver2_0::Definition (resolved_node_id));
- }
- // set up the resolved name on the path
- else if (resolver->get_name_scope ().decl_was_declared_here (
- resolved_node_id))
- {
- resolver->insert_resolved_name (expr.get_mappings ().get_nodeid (),
- resolved_node_id);
- }
- else
- {
- resolver->insert_resolved_misc (expr.get_mappings ().get_nodeid (),
- resolved_node_id);
- }
+ nr_ctx.map_usage (Resolver2_0::Usage (expr.get_mappings ().get_nodeid ()),
+ Resolver2_0::Definition (resolved_node_id));
// return the result of the function back
infered = function_ret_tyty;
// Resolve closure captures
std::set<NodeId> captures;
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx = const_cast<Resolver2_0::NameResolutionContext &> (
- Resolver2_0::ImmutableNameResolutionContext::get ().resolver ());
+ auto &nr_ctx = const_cast<Resolver2_0::NameResolutionContext &> (
+ Resolver2_0::ImmutableNameResolutionContext::get ().resolver ());
- if (auto opt_cap = nr_ctx.mappings.lookup_captures (closure_node_id))
- for (auto cap : opt_cap.value ())
- captures.insert (cap);
- }
- else
- {
- captures = resolver->get_captures (closure_node_id);
- }
+ if (auto opt_cap = nr_ctx.mappings.lookup_captures (closure_node_id))
+ for (auto cap : opt_cap.value ())
+ captures.insert (cap);
infered = new TyTy::ClosureType (ref, id, ident, closure_args, result_type,
subst_refs, captures);
context->insert_operator_overload (expr.get_mappings ().get_hirid (), type);
// set up the resolved name on the path
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx = const_cast<Resolver2_0::NameResolutionContext &> (
- Resolver2_0::ImmutableNameResolutionContext::get ().resolver ());
+ auto &nr_ctx = const_cast<Resolver2_0::NameResolutionContext &> (
+ Resolver2_0::ImmutableNameResolutionContext::get ().resolver ());
- nr_ctx.map_usage (Resolver2_0::Usage (expr.get_mappings ().get_nodeid ()),
- Resolver2_0::Definition (resolved_node_id));
- }
- else
- {
- resolver->insert_resolved_name (expr.get_mappings ().get_nodeid (),
- resolved_node_id);
- }
+ nr_ctx.map_usage (Resolver2_0::Usage (expr.get_mappings ().get_nodeid ()),
+ Resolver2_0::Definition (resolved_node_id));
// return the result of the function back
infered = function_ret_tyty;
context->insert_operator_overload (expr.get_mappings ().get_hirid (), fn);
// set up the resolved name on the path
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx = const_cast<Resolver2_0::NameResolutionContext &> (
- Resolver2_0::ImmutableNameResolutionContext::get ().resolver ());
+ auto &nr_ctx = const_cast<Resolver2_0::NameResolutionContext &> (
+ Resolver2_0::ImmutableNameResolutionContext::get ().resolver ());
- auto existing = nr_ctx.lookup (expr.get_mappings ().get_nodeid ());
- if (existing)
- rust_assert (*existing == resolved_node_id);
- else
- nr_ctx.map_usage (Resolver2_0::Usage (
- expr.get_mappings ().get_nodeid ()),
- Resolver2_0::Definition (resolved_node_id));
- }
+ auto existing = nr_ctx.lookup (expr.get_mappings ().get_nodeid ());
+ if (existing)
+ rust_assert (*existing == resolved_node_id);
else
- {
- NodeId existing = UNKNOWN_NODEID;
- bool ok
- = resolver->lookup_resolved_name (expr.get_mappings ().get_nodeid (),
- &existing);
-
- if (ok)
- rust_assert (existing == resolved_node_id);
- else
- resolver->insert_resolved_name (expr.get_mappings ().get_nodeid (),
- resolved_node_id);
- }
+ nr_ctx.map_usage (Resolver2_0::Usage (expr.get_mappings ().get_nodeid ()),
+ Resolver2_0::Definition (resolved_node_id));
// return the result of the function back
*result = function_ret_tyty;
#include "rust-tyty.h"
#include "rust-immutable-name-resolution-context.h"
-// for flag_name_resolution_2_0
-#include "options.h"
-
namespace Rust {
namespace Resolver {
TyTy::FnParam (param.get_param_name ().clone_pattern (), param_tyty));
}
- tl::optional<CanonicalPath> canonical_path;
-
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx
- = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
-
- canonical_path
- = nr_ctx.to_canonical_path (function.get_mappings ().get_nodeid ());
- }
- else
- {
- canonical_path = mappings.lookup_canonical_path (
- function.get_mappings ().get_nodeid ());
- }
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- rust_assert (canonical_path.has_value ());
+ CanonicalPath canonical_path
+ = nr_ctx.to_canonical_path (function.get_mappings ().get_nodeid ());
- RustIdent ident{*canonical_path, function.get_locus ()};
+ RustIdent ident{canonical_path, function.get_locus ()};
auto fnType = new TyTy::FnType (
function.get_mappings ().get_hirid (),
function.get_mappings ().get_defid (),
#include "rust-type-util.h"
#include "rust-tyty-variance-analysis.h"
-// for flag_name_resolution_2_0
-#include "options.h"
-
namespace Rust {
namespace Resolver {
// get the path
- auto path = CanonicalPath::create_empty ();
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- // FIXME: HACK: ARTHUR: Disgusting
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx
- = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
-
- path
- = nr_ctx.to_canonical_path (struct_decl.get_mappings ().get_nodeid ());
- }
- else
- {
- path
- = mappings
- .lookup_canonical_path (struct_decl.get_mappings ().get_nodeid ())
- .value ();
- }
+ CanonicalPath path
+ = nr_ctx.to_canonical_path (struct_decl.get_mappings ().get_nodeid ());
RustIdent ident{path, struct_decl.get_locus ()};
context->insert_type (field.get_mappings (), ty_field->get_field_type ());
}
- auto path = CanonicalPath::create_empty ();
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- // FIXME: HACK: ARTHUR: Disgusting
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx
- = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- path
- = nr_ctx.to_canonical_path (struct_decl.get_mappings ().get_nodeid ());
- }
- else
- {
- path
- = mappings
- .lookup_canonical_path (struct_decl.get_mappings ().get_nodeid ())
- .value ();
- }
+ CanonicalPath path
+ = nr_ctx.to_canonical_path (struct_decl.get_mappings ().get_nodeid ());
RustIdent ident{path, struct_decl.get_locus ()};
}
}
- // get the path
- tl::optional<CanonicalPath> canonical_path;
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx
- = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
-
- canonical_path
- = nr_ctx.to_canonical_path (enum_decl.get_mappings ().get_nodeid ());
- }
- else
- {
- canonical_path = mappings.lookup_canonical_path (
- enum_decl.get_mappings ().get_nodeid ());
- }
-
- rust_assert (canonical_path.has_value ());
+ // get the path
+ CanonicalPath canonical_path
+ = nr_ctx.to_canonical_path (enum_decl.get_mappings ().get_nodeid ());
- RustIdent ident{*canonical_path, enum_decl.get_locus ()};
+ RustIdent ident{canonical_path, enum_decl.get_locus ()};
// multi variant ADT
auto *type
ty_variant->get_field_type ());
}
- // get the path
- tl::optional<CanonicalPath> canonical_path;
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx
- = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
-
- canonical_path
- = nr_ctx.to_canonical_path (union_decl.get_mappings ().get_nodeid ());
- }
- else
- {
- canonical_path = mappings.lookup_canonical_path (
- union_decl.get_mappings ().get_nodeid ());
- }
-
- rust_assert (canonical_path.has_value ());
+ // get the path
+ CanonicalPath canonical_path
+ = nr_ctx.to_canonical_path (union_decl.get_mappings ().get_nodeid ());
- RustIdent ident{*canonical_path, union_decl.get_locus ()};
+ RustIdent ident{canonical_path, union_decl.get_locus ()};
// there is only a single variant
std::vector<TyTy::VariantDef *> variants;
TyTy::FnParam (param.get_param_name ().clone_pattern (), param_tyty));
}
- auto path = CanonicalPath::create_empty ();
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- // FIXME: HACK: ARTHUR: Disgusting
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx
- = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- path = nr_ctx.to_canonical_path (function.get_mappings ().get_nodeid ());
- }
- else
- {
- path = mappings
- .lookup_canonical_path (function.get_mappings ().get_nodeid ())
- .value ();
- }
+ CanonicalPath path
+ = nr_ctx.to_canonical_path (function.get_mappings ().get_nodeid ());
RustIdent ident{path, function.get_locus ()};
bool fully_resolved = expr.get_segments ().size () <= 1;
if (fully_resolved)
{
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx = const_cast<Resolver2_0::NameResolutionContext &> (
- Resolver2_0::ImmutableNameResolutionContext::get ().resolver ());
+ auto &nr_ctx = const_cast<Resolver2_0::NameResolutionContext &> (
+ Resolver2_0::ImmutableNameResolutionContext::get ().resolver ());
- nr_ctx.map_usage (Resolver2_0::Usage (
- expr.get_mappings ().get_nodeid ()),
- Resolver2_0::Definition (root_resolved_node_id));
- }
- else
- {
- resolver->insert_resolved_name (expr.get_mappings ().get_nodeid (),
- root_resolved_node_id);
- }
+ nr_ctx.map_usage (Resolver2_0::Usage (expr.get_mappings ().get_nodeid ()),
+ Resolver2_0::Definition (root_resolved_node_id));
return;
}
bool is_root = *offset == 0;
NodeId ast_node_id = seg.get_mappings ().get_nodeid ();
- // then lookup the reference_node_id
- NodeId ref_node_id = UNKNOWN_NODEID;
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- if (flag_name_resolution_2_0)
+ // lookup the reference_node_id
+ NodeId ref_node_id;
+ if (auto res = nr_ctx.lookup (ast_node_id))
{
- auto &nr_ctx
- = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
-
- // assign the ref_node_id if we've found something
- nr_ctx.lookup (ast_node_id).map ([&ref_node_id] (NodeId resolved) {
- ref_node_id = resolved;
- });
+ ref_node_id = *res;
}
- else if (!resolver->lookup_resolved_name (ast_node_id, &ref_node_id))
- resolver->lookup_resolved_type (ast_node_id, &ref_node_id);
-
- // ref_node_id is the NodeId that the segments refers to.
- if (ref_node_id == UNKNOWN_NODEID)
+ else
{
if (root_tyty != nullptr && *offset > 0)
{
}
rust_assert (resolved_node_id != UNKNOWN_NODEID);
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx = const_cast<Resolver2_0::NameResolutionContext &> (
- Resolver2_0::ImmutableNameResolutionContext::get ().resolver ());
- nr_ctx.map_usage (Resolver2_0::Usage (expr_mappings.get_nodeid ()),
- Resolver2_0::Definition (resolved_node_id));
- }
- // name scope first
- else if (resolver->get_name_scope ().decl_was_declared_here (
- resolved_node_id))
- {
- resolver->insert_resolved_name (expr_mappings.get_nodeid (),
- resolved_node_id);
- }
- // check the type scope
- else if (resolver->get_type_scope ().decl_was_declared_here (
- resolved_node_id))
- {
- resolver->insert_resolved_type (expr_mappings.get_nodeid (),
- resolved_node_id);
- }
- else
- {
- resolver->insert_resolved_misc (expr_mappings.get_nodeid (),
- resolved_node_id);
- }
+ auto &nr_ctx = const_cast<Resolver2_0::NameResolutionContext &> (
+ Resolver2_0::ImmutableNameResolutionContext::get ().resolver ());
+
+ nr_ctx.map_usage (Resolver2_0::Usage (expr_mappings.get_nodeid ()),
+ Resolver2_0::Definition (resolved_node_id));
infered = tyseg;
}
#include "rust-type-util.h"
#include "rust-immutable-name-resolution-context.h"
-// for flag_name_resolution_2_0
-#include "options.h"
-
namespace Rust {
namespace Resolver {
NodeId ref_node_id = UNKNOWN_NODEID;
bool maybe_item = false;
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx
- = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- if (auto id = nr_ctx.lookup (pattern.get_mappings ().get_nodeid ()))
- {
- ref_node_id = *id;
- maybe_item = true;
- }
- }
- else
+ if (auto id = nr_ctx.lookup (pattern.get_mappings ().get_nodeid ()))
{
- maybe_item |= resolver->lookup_resolved_name (
- pattern.get_mappings ().get_nodeid (), &ref_node_id);
- maybe_item |= resolver->lookup_resolved_type (
- pattern.get_mappings ().get_nodeid (), &ref_node_id);
+ ref_node_id = *id;
+ maybe_item = true;
}
bool path_is_const_item = false;
seg->get_lang_item ());
else
{
- // FIXME: HACK: ARTHUR: Remove this
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ()
- .resolver ();
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- // assign the ref_node_id if we've found something
- nr_ctx.lookup (ast_node_id)
- .map (
- [&ref_node_id] (NodeId resolved) { ref_node_id = resolved; });
- }
- else if (!resolver->lookup_resolved_name (ast_node_id, &ref_node_id))
- resolver->lookup_resolved_type (ast_node_id, &ref_node_id);
+ // assign the ref_node_id if we've found something
+ nr_ctx.lookup (ast_node_id).map ([&ref_node_id] (NodeId resolved) {
+ ref_node_id = resolved;
+ });
}
// ref_node_id is the NodeId that the segments refers to.
// then lookup the reference_node_id
NodeId ref_node_id = UNKNOWN_NODEID;
- 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
- {
- NodeId id = UNKNOWN_NODEID;
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- if (resolver->lookup_resolved_type (ast_node_id, &id))
- ref_node_id = id;
+ if (auto id = nr_ctx.lookup (ast_node_id))
+ {
+ ref_node_id = *id;
}
-
- if (ref_node_id == UNKNOWN_NODEID)
+ else
{
// FIXME
rust_error_at (UNDEF_LOCATION,
#include "rust-hir-type-check-struct-field.h"
#include "rust-immutable-name-resolution-context.h"
-// for flag_name_resolution_2_0
-#include "options.h"
-
extern bool saw_errors (void);
namespace Rust {
TyTy::FnParam (param.get_param_name ().clone_pattern (), param_tyty));
}
- auto &mappings = Analysis::Mappings::get ();
-
- tl::optional<CanonicalPath> canonical_path;
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx
- = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
-
- canonical_path
- = nr_ctx.to_canonical_path (fn.get_mappings ().get_nodeid ());
- }
- else
- {
- canonical_path
- = mappings.lookup_canonical_path (fn.get_mappings ().get_nodeid ());
- }
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- rust_assert (canonical_path);
+ CanonicalPath canonical_path
+ = nr_ctx.to_canonical_path (fn.get_mappings ().get_nodeid ());
- RustIdent ident{*canonical_path, fn.get_locus ()};
+ RustIdent ident{canonical_path, fn.get_locus ()};
auto resolved = new TyTy::FnType (
fn.get_mappings ().get_hirid (), fn.get_mappings ().get_defid (),
function.get_function_name ().as_string (), ident,
query_type (HirId reference, TyTy::BaseType **result)
{
auto &mappings = Analysis::Mappings::get ();
- auto &resolver = *Resolver::get ();
TypeCheckContext *context = TypeCheckContext::get ();
if (context->lookup_type (reference, result))
NodeId ref_node_id = UNKNOWN_NODEID;
NodeId ast_node_id = ty.get_mappings ().get_nodeid ();
- if (flag_name_resolution_2_0)
- {
- auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ()
- .resolver ();
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
- // assign the ref_node_id if we've found something
- nr_ctx.lookup (ast_node_id)
- .map (
- [&ref_node_id] (NodeId resolved) { ref_node_id = resolved; });
- }
- else if (!resolver.lookup_resolved_name (ast_node_id, &ref_node_id))
- resolver.lookup_resolved_type (ast_node_id, &ref_node_id);
+ // assign the ref_node_id if we've found something
+ nr_ctx.lookup (ast_node_id).map ([&ref_node_id] (NodeId resolved) {
+ ref_node_id = resolved;
+ });
if (ref_node_id != UNKNOWN_NODEID)
{