Skip to content

ast: Move implementation out of rust-ast#2085

Merged
CohenArthur merged 2 commits into
Rust-GCC:masterfrom
P-E-P:refactor_rust-ast_path
Apr 4, 2023
Merged

ast: Move implementation out of rust-ast#2085
CohenArthur merged 2 commits into
Rust-GCC:masterfrom
P-E-P:refactor_rust-ast_path

Conversation

@P-E-P

@P-E-P P-E-P commented Apr 3, 2023

Copy link
Copy Markdown
Member

Move implementation details out of rust-ast.cc file.

Fixes #2084
Fixes #2079

P-E-P added 2 commits April 3, 2023 17:25
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>
@P-E-P P-E-P marked this pull request as ready for review April 3, 2023 18:55
@P-E-P P-E-P changed the title ast: Move rust-path implementation out of rust-ast ast: Move implementation out of rust-ast Apr 3, 2023

@CohenArthur CohenArthur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refacto :)

@philberty philberty left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM mooaaarrrrr of this every where :D

@CohenArthur CohenArthur added this pull request to the merge queue Apr 4, 2023
Merged via the queue into Rust-GCC:master with commit f749a7f Apr 4, 2023
@P-E-P P-E-P deleted the refactor_rust-ast_path branch November 21, 2023 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move path node implementation from ast/rust-ast.cc to it's own file. Move patterns node implementation from ast/rust-ast.cc to it's own file

3 participants