Skip to content

Make generic API for binary operators #137

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 3 commits into from
Jul 25, 2019

Conversation

kitasuke
Copy link
Contributor

@kitasuke kitasuke commented Jul 24, 2019

Overview

Added generic API for binary operators so that it can make TokenSyntax for any binary operator

@kitasuke
Copy link
Contributor Author

I'm new to gyb, but can we have python file which has a list of binary operators in SwiftSyntax side so that we can generate gyb files?

@akyrtzi
Copy link
Contributor

akyrtzi commented Jul 24, 2019

What do you see the benefit of naming each one and not just use a generic version:

SyntaxFactory.makeBinaryOperator("+=")

?
We'd need a generic version anyway for custom operators, and seeing the operator written out may actually be a bit more readable. We could also have this do a sanity check that the string really contains an operator.

# Conflicts:
#	Tests/SwiftSyntaxTest/SyntaxFactory.swift
@kitasuke
Copy link
Contributor Author

I thought reserved binary operators can have explicit api, but generic one looks much better.

@kitasuke kitasuke changed the title Add more convenience APIs for common binary operators Make generic API for binary operators Jul 25, 2019
@akyrtzi
Copy link
Contributor

akyrtzi commented Jul 25, 2019

@swift-ci Please test

@swiftlang swiftlang deleted a comment from swift-ci Jul 25, 2019
@akyrtzi akyrtzi merged commit 1c2feb7 into swiftlang:master Jul 25, 2019
adevress pushed a commit to adevress/swift-syntax that referenced this pull request Jan 14, 2024
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