Skip to content

[Macros] Add accessor declaration macros, to add accessors to a stored property #1222

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
Jan 12, 2023

Conversation

DougGregor
Copy link
Member

@DougGregor DougGregor commented Jan 11, 2023

This allows something like this:

@wrapProperty("MyWrapperType")
var x: Int

to turn into

var x: Int {
  get {
    _x.wrappedValue
  }
  set {
    _x.wrappedValue = newValue
  }
}

@DougGregor DougGregor requested a review from ahoppen as a code owner January 11, 2023 19:05
… storage

The same use of the macro `@wrapProperty` expands in two ways, adding
accessors and the storage declaration.
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please test macOS

@DougGregor
Copy link
Member Author

swiftlang/swift-driver#1257

@swift-ci please test macOS

@DougGregor
Copy link
Member Author

@swift-ci please test macOS

@DougGregor DougGregor merged commit 7784947 into swiftlang:main Jan 12, 2023
@DougGregor DougGregor deleted the accessor-declaration-macros branch January 12, 2023 04:25
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.

1 participant