Skip to content

Split SyntaxNodes.swift.gyb into multiple files #165

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

Merged
merged 1 commit into from
Nov 5, 2019

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Oct 29, 2019

At the moment SyntaxNodes.swift.gyb is a giant files that does all sorts of things and the generated file is even larger. This PR aims to split it up into manageable parts so that even the generated files can be viewed in Xcode.

The specific moves I did were:

  • Move non-generated Syntax-related stuff to Syntax.swift
  • Extract the repeated implementation of withLeadingTrivia and friends to SyntaxProtocol so we only need to specify it once
  • Move SyntaxEnum to a new file SyntaxEnum.swift.gyb
  • Move traits to new file SyntaxTraits.swift.gyb
  • Remove a single convenience function that still existed from when SwiftSyntax was initially created and was never used (or intended to be used)
  • Remove extensions to SyntaxNode and the syntax parser version verification to Misc.swift.gyb
  • Generate multiple files from SyntaxNodes.swift.gyb; one for every base kind like SyntaxExprNodes.swift etc.
  • Move UnknownSyntax and TokenSyntax to SyntaxOtherNodes.swift

This change also improves debug compile times by 2x. The release compile time seems to stay roughly the same.

Note: I am planning to squash the various commits before merging, I just want to keep them around for now if I need to make any more changes.

@ahoppen ahoppen changed the title WIP: Split SyntaxNodes.swift.gyb into multiple files Split SyntaxNodes.swift.gyb into multiple files Oct 29, 2019
@ahoppen ahoppen force-pushed the split-syntaxnodes-gyb branch 2 times, most recently from 605819f to bfa0ddc Compare October 31, 2019 23:33
@ahoppen
Copy link
Member Author

ahoppen commented Nov 4, 2019

@swift-ci Please test

This way the generated files get a more managable size and
can be viewed more easily.
@ahoppen ahoppen force-pushed the split-syntaxnodes-gyb branch from bfa0ddc to 65a49c4 Compare November 5, 2019 04:14
@ahoppen
Copy link
Member Author

ahoppen commented Nov 5, 2019

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Nov 5, 2019

Let’s use this PR to verify that SwiftSyntax PR testing is testing the stress tester as well using the updated preset.

@swift-ci Please test

@ahoppen ahoppen merged commit 5d091cd into swiftlang:master Nov 5, 2019
@ahoppen ahoppen deleted the split-syntaxnodes-gyb branch November 5, 2019 23:20
adevress pushed a commit to adevress/swift-syntax that referenced this pull request Jan 14, 2024
Force breaking in repeat body when while condition is too long.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants