#include "rust-hir-type-check-expr.h"
#include "rust-hir-type-check-enumitem.h"
#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);
- auto canonical_path
- = mappings.lookup_canonical_path (item.get_mappings ().get_nodeid ());
+ tl::optional<CanonicalPath> canonical_path;
+
+ if (flag_name_resolution_2_0)
+ {
+ auto nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
+
+ canonical_path
+ = nr_ctx.types.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 ());
RustIdent ident{*canonical_path, item.get_locus ()};
variant = new TyTy::VariantDef (item.get_mappings ().get_hirid (),
TyTy::TyWithLocation (expected_ty),
TyTy::TyWithLocation (capacity_type), item.get_locus ());
- auto canonical_path
- = mappings.lookup_canonical_path (item.get_mappings ().get_nodeid ());
+ tl::optional<CanonicalPath> canonical_path;
+
+ if (flag_name_resolution_2_0)
+ {
+ auto nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
+
+ canonical_path
+ = nr_ctx.types.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 ());
RustIdent ident{*canonical_path, item.get_locus ()};
variant = new TyTy::VariantDef (item.get_mappings ().get_hirid (),
rust_assert (ok);
context->insert_type (mapping, isize);
- auto canonical_path
- = mappings.lookup_canonical_path (item.get_mappings ().get_nodeid ());
+ tl::optional<CanonicalPath> canonical_path;
+
+ if (flag_name_resolution_2_0)
+ {
+ auto nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
+
+ canonical_path
+ = nr_ctx.types.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 ());
RustIdent ident{*canonical_path, item.get_locus ()};
variant = new TyTy::VariantDef (item.get_mappings ().get_hirid (),
rust_assert (ok);
context->insert_type (mapping, isize);
- auto canonical_path
- = mappings.lookup_canonical_path (item.get_mappings ().get_nodeid ());
+ tl::optional<CanonicalPath> canonical_path;
+
+ if (flag_name_resolution_2_0)
+ {
+ auto nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
+
+ canonical_path
+ = nr_ctx.types.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 ());
RustIdent ident{*canonical_path, item.get_locus ()};
variant = new TyTy::VariantDef (item.get_mappings ().get_hirid (),
#include "rust-hir-type-check-pattern.h"
#include "rust-type-util.h"
#include "rust-tyty.h"
+#include "rust-immutable-name-resolution-context.h"
+
+// for flag_name_resolution_2_0
+#include "options.h"
namespace Rust {
namespace Resolver {
TypeCheckPattern::Resolve (param.get_param_name ().get (), param_tyty);
}
- auto canonical_path
- = mappings.lookup_canonical_path (function.get_mappings ().get_nodeid ());
+ tl::optional<CanonicalPath> canonical_path;
+
+ if (flag_name_resolution_2_0)
+ {
+ auto nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
+
+ canonical_path = nr_ctx.values.to_canonical_path (
+ function.get_mappings ().get_nodeid ());
+ }
+ else
+ {
+ canonical_path = mappings.lookup_canonical_path (
+ function.get_mappings ().get_nodeid ());
+ }
+
+ rust_assert (canonical_path.has_value ());
RustIdent ident{*canonical_path, function.get_locus ()};
auto fnType = new TyTy::FnType (
#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 canonical_path
- = mappings.lookup_canonical_path (enum_decl.get_mappings ().get_nodeid ());
+ tl::optional<CanonicalPath> canonical_path;
+
+ if (flag_name_resolution_2_0)
+ {
+ auto nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
+
+ canonical_path = nr_ctx.types.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 ());
+
RustIdent ident{*canonical_path, enum_decl.get_locus ()};
// multi variant ADT
}
// get the path
- auto canonical_path
- = mappings.lookup_canonical_path (union_decl.get_mappings ().get_nodeid ());
+ tl::optional<CanonicalPath> canonical_path;
+
+ if (flag_name_resolution_2_0)
+ {
+ auto nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
+
+ canonical_path = nr_ctx.types.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 ());
+
RustIdent ident{*canonical_path, union_decl.get_locus ()};
// there is only a single variant