diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-02-17 16:14:01 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-02-18 09:08:07 +0100 |
commit | ef06769781a76eaa0de6fb500bebb8473e549f7e (patch) | |
tree | 3665f6165d76dc61daeb881327700f82308e4754 /gcc/rust/parse/rust-parse-impl.h | |
parent | 9e524a7f5a5a7abd7aaf3891ea4eca6f0f84fd36 (diff) | |
download | gcc-ef06769781a76eaa0de6fb500bebb8473e549f7e.zip gcc-ef06769781a76eaa0de6fb500bebb8473e549f7e.tar.gz gcc-ef06769781a76eaa0de6fb500bebb8473e549f7e.tar.bz2 |
path-id: Add location info on path identifier
Diffstat (limited to 'gcc/rust/parse/rust-parse-impl.h')
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 6498f3c..3ff1229 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -706,29 +706,29 @@ Parser<ManagedTokenSource>::parse_path_ident_segment () case IDENTIFIER: lexer.skip_token (); - return AST::PathIdentSegment (t->get_str ()); + return AST::PathIdentSegment (t->get_str (), t->get_locus ()); case SUPER: lexer.skip_token (); - return AST::PathIdentSegment ("super"); + return AST::PathIdentSegment ("super", t->get_locus ()); case SELF: lexer.skip_token (); - return AST::PathIdentSegment ("self"); + return AST::PathIdentSegment ("self", t->get_locus ()); case SELF_ALIAS: lexer.skip_token (); - return AST::PathIdentSegment ("Self"); + return AST::PathIdentSegment ("Self", t->get_locus ()); case CRATE: lexer.skip_token (); - return AST::PathIdentSegment ("crate"); + return AST::PathIdentSegment ("crate", t->get_locus ()); case DOLLAR_SIGN: if (lexer.peek_token (1)->get_id () == CRATE) { lexer.skip_token (1); - return AST::PathIdentSegment ("$crate"); + return AST::PathIdentSegment ("$crate", t->get_locus ()); } gcc_fallthrough (); default: @@ -14613,8 +14613,10 @@ Parser<ManagedTokenSource>::parse_path_in_expression_pratt (const_TokenPtr tok) AST::GenericArgs generic_args = parse_path_generic_args (); - initial_segment = AST::PathExprSegment (initial_str, tok->get_locus (), - std::move (generic_args)); + initial_segment + = AST::PathExprSegment (AST::PathIdentSegment (initial_str, + tok->get_locus ()), + tok->get_locus (), std::move (generic_args)); } if (initial_segment.is_error ()) { |