Skip to content
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

Fixes 6965 #7017

Merged
merged 2 commits into from Dec 13, 2017
Merged

Fixes 6965 #7017

merged 2 commits into from Dec 13, 2017

Conversation

@perinikhil
Copy link
Contributor

perinikhil commented Dec 12, 2017

Q                       A
Fixed Issues? Fixes #6965
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR
Any Dependency Changes?
License MIT
@perinikhil perinikhil force-pushed the perinikhil:issue-6965 branch from a143a07 to c8e056c Dec 12, 2017
const helper = buildApplyDecoratedDescriptor({
NAME: state.applyDecoratedDescriptor,
});
const helper = state.addHelper("buildApplyDecoratedDescriptor");
path.scope.getProgramParent().path.unshiftContainer("body", helper);

This comment has been minimized.

Copy link
@nicolo-ribaudo

nicolo-ribaudo Dec 12, 2017

Member

The problem is that these lines:

const helper = buildApplyDecoratedDescriptor({
  NAME: state.applyDecoratedDescriptor,
});
path.scope.getProgramParent().path.unshiftContainer("body", helper);

added the helper function to the file.

On the other hand, state.addHelper("buildApplyDecoratedDescriptor"); returns the id of the function (not the function itself), and the helper is added automatically.

So you should just remove the ensure* functions (which are the equivalent of state.addHelper), and replace calls to them (like

ensureApplyDecoratedDescriptorHelper(path, state),
) with addHelper(" ... ").

This comment has been minimized.

Copy link
@perinikhil

perinikhil Dec 12, 2017

Author Contributor

I see, yes makes sense!
I will update this PR soon after some more digging and tinkering 😃

… to 'babel-helpers'
@babel-bot

This comment has been minimized.

Copy link
Collaborator

babel-bot commented Dec 13, 2017

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/6174/

@perinikhil perinikhil changed the title WIP: Fixes 6965 Fixes 6965 Dec 13, 2017
@xtuc
xtuc approved these changes Dec 13, 2017
Copy link
Member

xtuc left a comment

Thanks @perinikhil that looks good to me

@perinikhil

This comment has been minimized.

Copy link
Contributor Author

perinikhil commented Dec 13, 2017

Thank you @xtuc and @nicolo-ribaudo for your valuable inputs and patience! Much obliged 😃
I've also raised a docs PR which could be reviewed as well...
And also, i'd like to pick up another issue, any suggestions?

@xtuc

This comment has been minimized.

Copy link
Member

xtuc commented Dec 13, 2017

Copy link
Member

nicolo-ribaudo left a comment

Thank you! 🎉

@nicolo-ribaudo nicolo-ribaudo merged commit 9cc0a26 into babel:master Dec 13, 2017
4 checks passed
4 checks passed
babel/repl REPL preview is available
Details
ci/circleci Your tests passed on CircleCI!
Details
codecov/project 84.24% (target 80%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
helpers.applyDecoratedDescriptor = defineHelper(`
export default function _applyDecoratedDescriptor(target, property, decorators, descriptor, context){
var desc = {};
Object['ke' + 'ys'](descriptor).forEach(function(key){

This comment has been minimized.

Copy link
@TrejGun

TrejGun Dec 15, 2017

what is the problem to use Object.keys(descriptor) ?

This comment has been minimized.

Copy link
@nicolo-ribaudo

nicolo-ribaudo Dec 15, 2017

Member

It is kept because it was in the original helper, I will check

@lock lock bot added the outdated label Oct 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants
You can’t perform that action at this time.