diff options
author | Dave <dme2223@gmail.com> | 2022-11-16 17:06:44 -0600 |
---|---|---|
committer | Dave <dme2223@gmail.com> | 2022-11-16 17:06:44 -0600 |
commit | bea720bef773efce55391ef005b7be990b9bfc50 (patch) | |
tree | 351bb86ae538dce6366a7efc5589cb13bcaf46d1 /gcc/rust/parse/rust-parse-impl.h | |
parent | ec62fce8e89a67b2f67d8c42a34e8b12f4765c08 (diff) | |
download | gcc-bea720bef773efce55391ef005b7be990b9bfc50.zip gcc-bea720bef773efce55391ef005b7be990b9bfc50.tar.gz gcc-bea720bef773efce55391ef005b7be990b9bfc50.tar.bz2 |
Remove default location. Add visibility location to create_* functions
Diffstat (limited to 'gcc/rust/parse/rust-parse-impl.h')
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 54f3c5c..5642990 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -2128,12 +2128,13 @@ Parser<ManagedTokenSource>::parse_visibility () return AST::Visibility::create_private (); } + auto vis_loc = lexer.peek_token ()->get_locus (); lexer.skip_token (); // create simple pub visibility if no parentheses if (lexer.peek_token ()->get_id () != LEFT_PAREN) { - return AST::Visibility::create_public (); + return AST::Visibility::create_public (vis_loc); // or whatever } @@ -2149,19 +2150,19 @@ Parser<ManagedTokenSource>::parse_visibility () skip_token (RIGHT_PAREN); - return AST::Visibility::create_crate (path_loc); + return AST::Visibility::create_crate (path_loc, vis_loc); case SELF: lexer.skip_token (); skip_token (RIGHT_PAREN); - return AST::Visibility::create_self (path_loc); + return AST::Visibility::create_self (path_loc, vis_loc); case SUPER: lexer.skip_token (); skip_token (RIGHT_PAREN); - return AST::Visibility::create_super (path_loc); + return AST::Visibility::create_super (path_loc, vis_loc); case IN: { lexer.skip_token (); @@ -2179,7 +2180,7 @@ Parser<ManagedTokenSource>::parse_visibility () skip_token (RIGHT_PAREN); - return AST::Visibility::create_in_path (std::move (path)); + return AST::Visibility::create_in_path (std::move (path), vis_loc); } default: add_error (Error (t->get_locus (), "unexpected token %qs in visibility", |