ast: Move implementation out of rust-ast#2085
Merged
Merged
Conversation
Move rust-path implementation details out of rust-ast.cc file. This will hopefully decrease compile time and make things clearer. gcc/rust/ChangeLog: * Make-lang.in: Add new file for rust-path implementation. * ast/rust-ast.cc (PathInExpression::as_string): Move function to the new file. (PathPattern::as_string): Likewise. (QualifiedPathInExpression::as_string): Likewise. (ConstGenericParam::as_string): Likewise. (QualifiedPathInType::as_string): Likewise. (TypePath::as_string): Likewise. (PathPattern::convert_to_simple_path): Likewise. (TypePath::as_simple_path): Likewise. (PathExprSegment::as_string): Likewise. (GenericArgs::as_string): Likewise. (GenericArgsBinding::as_string): Likewise. (TypePath::to_trait_bound): Likewise. (TypePathSegmentGeneric::as_string): Likewise. (TypePathFunction::as_string): Likewise. (TypePathSegmentFunction::as_string): Likewise. (ConstGenericParam::accept_vis): Likewise. (PathInExpression::accept_vis): Likewise. (TypePathSegment::accept_vis): Likewise. (TypePathSegmentGeneric::accept_vis): Likewise. (TypePathSegmentFunction::accept_vis): Likewise. (TypePath::accept_vis): Likewise. (QualifiedPathInExpression::accept_vis): Likewise. (QualifiedPathInType::accept_vis): Likewise. (GenericArg::disambiguate_to_const): Likewise. (GenericArg::disambiguate_to_type): Likewise. * ast/rust-path.cc: New file. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Move rust-pattern implementation out of rust-ast.cc in their own file. gcc/rust/ChangeLog: * Make-lang.in: Add two new files to the list of sources. * ast/rust-ast-full.h: Add new ast formatting header. * ast/rust-ast.cc (enum indent_mode): Move formatting function to it's own file. (indent_spaces): Likewise. (get_string_in_delims): Likewise. (enum AttrMode): Likewise. (get_mode_dump_desc): Likewise. (append_attributes): Likewise. (unquote_string): Likewise. (GroupedExpr::as_string): Move pattern implementation to it's own file. (RangePattern::as_string): Likewise. (RangePatternBoundLiteral::as_string): Likewise. (SlicePattern::as_string): Likewise. (AltPattern::as_string): Likewise. (TuplePatternItemsMultiple::as_string): Likewise. (TuplePatternItemsRanged::as_string): Likewise. (TuplePattern::as_string): Likewise. (StructPatternField::as_string): Likewise. (StructPatternFieldIdent::as_string): Likewise. (StructPatternFieldTuplePat::as_string): Likewise. (StructPatternFieldIdentPat::as_string): Likewise. (StructPatternElements::as_string): Likewise. (StructPattern::as_string): Likewise. (LiteralPattern::as_string): Likewise. (ReferencePattern::as_string): Likewise. (IdentifierPattern::as_string): Likewise. (TupleStructItemsNoRange::as_string): Likewise. (TupleStructItemsRange::as_string): Likewise. (TupleStructPattern::as_string): Likewise. (GroupedExpr::accept_vis): Likewise. (LiteralPattern::accept_vis): Likewise. (IdentifierPattern::accept_vis): Likewise. (WildcardPattern::accept_vis): Likewise. (RestPattern::accept_vis): Likewise. (RangePatternBoundLiteral::accept_vis): Likewise. (RangePatternBoundPath::accept_vis): Likewise. (RangePatternBoundQualPath::accept_vis): Likewise. (RangePattern::accept_vis): Likewise. (ReferencePattern::accept_vis): Likewise. (StructPatternFieldTuplePat::accept_vis): Likewise. (StructPatternFieldIdentPat::accept_vis): Likewise. (StructPatternFieldIdent::accept_vis): Likewise. (StructPattern::accept_vis): Likewise. (TupleStructItemsNoRange::accept_vis): Likewise. (TupleStructItemsRange::accept_vis): Likewise. (TupleStructPattern::accept_vis): Likewise. (TuplePatternItemsMultiple::accept_vis): Likewise. (TuplePatternItemsRanged::accept_vis): Likewise. (TuplePattern::accept_vis): Likewise. (GroupedPattern::accept_vis): Likewise. (SlicePattern::accept_vis): Likewise. (AltPattern::accept_vis): Likewise. * ast/rust-ast-formatting.cc: New file. * ast/rust-ast-formatting.h: New file. * ast/rust-pattern.cc: New file. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
philberty
approved these changes
Apr 4, 2023
philberty
left a comment
Member
There was a problem hiding this comment.
LGTM mooaaarrrrr of this every where :D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move implementation details out of
rust-ast.ccfile.Fixes #2084
Fixes #2079