namespace Rust {
namespace Compile {
+tree
+ResolvePathRef::Compile (HIR::QualifiedPathInExpression &expr, Context *ctx)
+{
+ ResolvePathRef resolver (ctx);
+ return resolver.resolve_path_like (expr);
+}
+
+tree
+ResolvePathRef::Compile (HIR::PathInExpression &expr, Context *ctx)
+{
+ ResolvePathRef resolver (ctx);
+ return resolver.resolve_path_like (expr);
+}
+
+ResolvePathRef::ResolvePathRef (Context *ctx) : HIRCompileBase (ctx) {}
+
template <typename T>
tree
ResolvePathRef::resolve_path_like (T &expr)
expr.get_mappings (), expr.get_locus (), true);
}
-void
-ResolvePathRef::visit (HIR::QualifiedPathInExpression &expr)
-{
- resolved = resolve_path_like (expr);
-}
-
-void
-ResolvePathRef::visit (HIR::PathInExpression &expr)
-{
- resolved = resolve_path_like (expr);
-}
-
tree
ResolvePathRef::attempt_constructor_expression_lookup (
TyTy::BaseType *lookup, Context *ctx, const Analysis::NodeMapping &mappings,
#define RUST_COMPILE_RESOLVE_PATH
#include "rust-compile-base.h"
-#include "rust-hir-visitor.h"
namespace Rust {
namespace Compile {
-class ResolvePathRef : public HIRCompileBase, public HIR::HIRPatternVisitor
+class ResolvePathRef : public HIRCompileBase
{
public:
- static tree Compile (HIR::QualifiedPathInExpression &expr, Context *ctx)
- {
- ResolvePathRef resolver (ctx);
- expr.accept_vis (resolver);
- return resolver.resolved;
- }
+ static tree Compile (HIR::QualifiedPathInExpression &expr, Context *ctx);
- static tree Compile (HIR::PathInExpression &expr, Context *ctx)
- {
- ResolvePathRef resolver (ctx);
- expr.accept_vis (resolver);
- return resolver.resolved;
- }
+ static tree Compile (HIR::PathInExpression &expr, Context *ctx);
- void visit (HIR::PathInExpression &expr) override;
- void visit (HIR::QualifiedPathInExpression &expr) override;
-
- // Empty visit for unused Pattern HIR nodes.
- void visit (HIR::IdentifierPattern &) override {}
- void visit (HIR::LiteralPattern &) override {}
- void visit (HIR::RangePattern &) override {}
- void visit (HIR::ReferencePattern &) override {}
- void visit (HIR::SlicePattern &) override {}
- void visit (HIR::AltPattern &) override {}
- void visit (HIR::StructPattern &) override {}
- void visit (HIR::TuplePattern &) override {}
- void visit (HIR::TupleStructPattern &) override {}
- void visit (HIR::WildcardPattern &) override {}
-
- ResolvePathRef (Context *ctx)
- : HIRCompileBase (ctx), resolved (error_mark_node)
- {}
+ ResolvePathRef (Context *ctx);
/**
* Generic visitor for both PathInExpression and QualifiedPathInExpression
const Analysis::NodeMapping &mappings, location_t locus,
bool is_qualified_path);
- tree resolved;
-
private:
tree
attempt_constructor_expression_lookup (TyTy::BaseType *lookup, Context *ctx,