Repository navigation
Removes wrapping of properties in favor of always respecting noAccessor - #454
Merged
Merged
Conversation
…sor` Fixes #450. This removes all wrapping of existing accessors. This changes makes property generation simpler and more straightforward. If an accessor should not be generated, for example when there is a user defined accessor, users should set the `noAccessor` flag to true.
added 2 commits
January 17, 2019 11:54
…rototype This means `noAccessor` is only required when extending a user defined accessor with new metadata.
kevinpschaaf
approved these changes
Jan 17, 2019
kevinpschaaf
left a comment
Member
There was a problem hiding this comment.
Approved, with some code comment suggestions.
justinfagnani
approved these changes
Jan 17, 2019
| clazz.createProperty(element.key, options); | ||
| } | ||
| }; | ||
| // createProperty() takes care of defining the property, but we still |
Contributor
There was a problem hiding this comment.
move comment to below the else
| enumerable : true | ||
| }; | ||
| } else { | ||
| if (!options.noAccessor && !this.prototype.hasOwnProperty(name)) { |
Contributor
There was a problem hiding this comment.
I think an early return would read nicer here
| set(value: any) { | ||
| const oldValue = this[name]; | ||
| this[key] = value; | ||
| const desc = { |
Contributor
There was a problem hiding this comment.
you can inline this into the defineProperty call now
Co-Authored-By: sorvell <[email protected]>
Co-Authored-By: sorvell <[email protected]>
kevinpschaaf
added a commit
that referenced
this pull request
Jan 18, 2019
Since we no longer wrap existing accessors, the language and example in #accessors-custom is updated to indicate the user must manually call `requestUpdate`. In addition, since `noAccessor` is _only_ needed now in a pretty esoteric case (extending a superclass and changing metadata for a declared property _that also has a custom accessor_), the code example in that section is simplified.
This was referenced Jan 18, 2019
ghost
pushed a commit
that referenced
this pull request
Feb 5, 2019
…#460) * Update docs to reflect #454 change to remove accessor wrapping Since we no longer wrap existing accessors, the language and example in #accessors-custom is updated to indicate the user must manually call `requestUpdate`. In addition, since `noAccessor` is _only_ needed now in a pretty esoteric case (extending a superclass and changing metadata for a declared property _that also has a custom accessor_), the code example in that section is simplified. * Code samples for accessors with subclassing * Update per feedback
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.
Fixes #450. This removes all wrapping of existing accessors. This changes makes property generation simpler and more straightforward. If an accessor should not be generated, for example when there is a user defined accessor, users should set the
noAccessorflag to true.