Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Import class for use during name resolution 2.0 #2901

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h
Original file line number Diff line number Diff line change
@@ -85,6 +85,35 @@ class TopLevel : public DefaultResolver
void visit (AST::UseDeclaration &use) override;
};

/**
* Used to store individual imports
* Required for handling rebindings, glob imports
*/
class Import
{
public:
Import (AST::SimplePath path, bool is_glob, std::string name)
: path (path), is_glob_f (is_glob), name (name)
{}

AST::SimplePath &get_path () { return path; }

const AST::SimplePath &get_path () const { return path; }

bool is_glob () const { return is_glob_f; }

const std::string &get_name () const { return name; }

std::string &get_name () { return name; }

void add_prefix (AST::SimplePath prefix);

private:
AST::SimplePath path;
bool is_glob_f;
std::string name;
};

} // namespace Resolver2_0
} // namespace Rust

Loading
Oops, something went wrong.