diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-04-28 09:16:03 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-28 09:16:03 +0000 |
commit | af48e2a3a1554f727e83281cc96071d9b8b3ef91 (patch) | |
tree | e34b1c2459b7f9bc94a65d86a4aee4e3d287d18f /gcc/rust/resolve/rust-ast-resolve-path.h | |
parent | 9a9bb44058a8406b41bb1ab3110e08a897772bb0 (diff) | |
parent | 10b01c305ff73a9da40fb81b7f90312d1f79f037 (diff) | |
download | gcc-af48e2a3a1554f727e83281cc96071d9b8b3ef91.zip gcc-af48e2a3a1554f727e83281cc96071d9b8b3ef91.tar.gz gcc-af48e2a3a1554f727e83281cc96071d9b8b3ef91.tar.bz2 |
Merge #1186
1186: Refactor `ResolvePath` in its own file r=CohenArthur a=CohenArthur
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
Diffstat (limited to 'gcc/rust/resolve/rust-ast-resolve-path.h')
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-path.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-path.h b/gcc/rust/resolve/rust-ast-resolve-path.h new file mode 100644 index 0000000..7a4413b --- /dev/null +++ b/gcc/rust/resolve/rust-ast-resolve-path.h @@ -0,0 +1,49 @@ +// Copyright (C) 2020-2022 Free Software Foundation, Inc. + +// This file is part of GCC. + +// GCC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 3, or (at your option) any later +// version. + +// GCC is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. + +// You should have received a copy of the GNU General Public License +// along with GCC; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#ifndef RUST_AST_RESOLVE_PATH_H +#define RUST_AST_RESOLVE_PATH_H + +#include "rust-ast-resolve-base.h" + +namespace Rust { +namespace Resolver { + +class ResolvePath : public ResolverBase +{ + using Rust::Resolver::ResolverBase::visit; + +public: + static void go (AST::PathInExpression *expr, NodeId parent); + static void go (AST::QualifiedPathInExpression *expr, NodeId parent); + +private: + ResolvePath (NodeId parent) : ResolverBase (parent) {} + + void resolve_path (AST::PathInExpression *expr); + void resolve_path (AST::QualifiedPathInExpression *expr); + + void resolve_segments (CanonicalPath prefix, size_t offs, + std::vector<AST::PathExprSegment> &segs, + NodeId expr_node_id, Location expr_locus); +}; + +} // namespace Resolver +} // namespace Rust + +#endif // !RUST_AST_RESOLVE_PATH_H |