ResolvePath::ResolvePath () : ResolverBase () {}
-void
+NodeId
ResolvePath::go (AST::PathInExpression *expr)
{
ResolvePath resolver;
- resolver.resolve_path (expr);
+ return resolver.resolve_path (expr);
}
-void
+NodeId
ResolvePath::go (AST::QualifiedPathInExpression *expr)
{
ResolvePath resolver;
- resolver.resolve_path (expr);
+ return resolver.resolve_path (expr);
}
-void
+NodeId
ResolvePath::go (AST::SimplePath *expr)
{
ResolvePath resolver;
- resolver.resolve_path (expr);
+ return resolver.resolve_path (expr);
}
-void
+NodeId
ResolvePath::resolve_path (AST::PathInExpression *expr)
{
NodeId resolved_node_id = UNKNOWN_NODEID;
"failed to resolve: %<%s%> in paths can only be used "
"in start position",
segment.as_string ().c_str ());
- return;
+ return UNKNOWN_NODEID;
}
NodeId crate_scope_id = resolver->peek_crate_module_scope ();
{
rust_error_at (segment.get_locus (),
"cannot use %<super%> at the crate scope");
- return;
+ return UNKNOWN_NODEID;
}
module_scope_id = resolver->peek_parent_module_scope ();
rust_error_at (segment.get_locus (),
"Cannot find path %<%s%> in this scope",
segment.as_string ().c_str ());
- return;
+ return UNKNOWN_NODEID;
}
}
}
rust_error_at (segment.get_locus (),
"Cannot find path %<%s%> in this scope",
segment.as_string ().c_str ());
- return;
+ return UNKNOWN_NODEID;
}
}
gcc_unreachable ();
}
}
+ return resolved_node_id;
}
-void
+NodeId
ResolvePath::resolve_path (AST::QualifiedPathInExpression *expr)
{
AST::QualifiedPathType &root_segment = expr->get_qualified_path_type ();
if (segment.has_generic_args ())
ResolveGenericArgs::go (segment.get_generic_args ());
}
+
+ // cannot fully resolve a qualified path as it is dependant on associated
+ // items
+ return UNKNOWN_NODEID;
}
-void
+NodeId
ResolvePath::resolve_path (AST::SimplePath *expr)
{
NodeId crate_scope_id = resolver->peek_crate_module_scope ();
{
rust_error_at (segment.get_locus (),
"cannot use %<super%> at the crate scope");
- return;
+ return UNKNOWN_NODEID;
}
module_scope_id = resolver->peek_parent_module_scope ();
rust_error_at (segment.get_locus (),
"Cannot find path %<%s%> in this scope",
segment.as_string ().c_str ());
- return;
+ return UNKNOWN_NODEID;
}
}
rust_error_at (segment.get_locus (),
"cannot find simple path segment %<%s%> in this scope",
segment.as_string ().c_str ());
- return;
+ return UNKNOWN_NODEID;
}
if (mappings->node_is_module (resolved_node_id))
gcc_unreachable ();
}
}
+ return resolved_node_id;
}
} // namespace Resolver
using Rust::Resolver::ResolverBase::visit;
public:
- static void go (AST::PathInExpression *expr);
- static void go (AST::QualifiedPathInExpression *expr);
- static void go (AST::SimplePath *expr);
+ static NodeId go (AST::PathInExpression *expr);
+ static NodeId go (AST::QualifiedPathInExpression *expr);
+ static NodeId go (AST::SimplePath *expr);
private:
ResolvePath ();
- void resolve_path (AST::PathInExpression *expr);
- void resolve_path (AST::QualifiedPathInExpression *expr);
- void resolve_path (AST::SimplePath *expr);
+ NodeId resolve_path (AST::PathInExpression *expr);
+ NodeId resolve_path (AST::QualifiedPathInExpression *expr);
+ NodeId resolve_path (AST::SimplePath *expr);
void
resolve_simple_path_segments (CanonicalPath prefix, size_t offs,