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

[BUGFIX beta] Change preference in positional parameters #12350

Merged
merged 1 commit into from
Sep 15, 2015

Conversation

Serabe
Copy link
Member

@Serabe Serabe commented Sep 15, 2015

This fixes the behaviour when a positional param conflicts conflicts with
a hash param.


for (let i = 0; i < positionalParams.length; i++) {
let param = params[paramsStartIndex + i];
if (!(positionalParams[i] in attrs)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be positionalParams[paramsStartIndex + i].

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the for is iterating through the positionalParams array. The paramsStartIndex accounts for the difference if the first parameter is the name of the component (because of the component helper) or a direct invocation. @mixonic got rid of that in #12285 but it is a WIP

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, thank you for explaining.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this an assertion though?

Basically:

assert(`You cannot specify both a positional param (at position ${i}) and the hash argument \`${positionalParams[i]}\`.`, positonalParams[i] in attrs);

Then the tests get updated to something like:

expectAssertion(function() {
  runAppend(view);
}, /The message from above, I am too lazy to type/);

This fixes the behaviour when a positional param conflicts conflicts with
a hash param.
rwjblue added a commit that referenced this pull request Sep 15, 2015
[BUGFIX beta] Change preference in positional parameters
@rwjblue rwjblue merged commit 299f801 into emberjs:master Sep 15, 2015
@rwjblue
Copy link
Member

rwjblue commented Sep 15, 2015

Thank you!

SaladFork added a commit to SaladFork/ember-paper that referenced this pull request Jan 28, 2016
Ideally we wouldn't need a separate `positionalIcon` property and could
just use `icon`, but this is not permitted (see emberjs/ember.js#12350)
SaladFork added a commit to SaladFork/ember-paper that referenced this pull request Jan 28, 2016
Ideally we wouldn't need a separate `positionalIcon` property and could
just use `icon`, but this is not permitted (see emberjs/ember.js#12350)
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