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 release] Allow recomputation for helpers with arguments #11445

Merged
merged 1 commit into from Jun 15, 2015

Conversation

mixonic
Copy link
Sponsor Member

@mixonic mixonic commented Jun 14, 2015

No unit test for helpers exercised the inline expression visitor (all used the content expression) with recomputation. The inline expression visitor links params before calling the inline hook. Linking params sets morph.linkedParams which disallows calling linkParams later with additional dependencies.

To work around this, here the morph subscribes to the helperStream in invoke-helper itself if there are any params or hash arguments (which means that there the call is an inline one). The helperStream in turn subscribes to the params and hash.

/cc @wycats @mmun @jamesarosen

@mixonic mixonic added this to the 1.13.0 milestone Jun 14, 2015
@mixonic mixonic changed the title [BUGFIX beta] Allow recomputation for helpers with arguments [BUGFIX release] Allow recomputation for helpers with arguments Jun 14, 2015
let addedDependency = false;
let l = params.length;
if (l) {
for (var i = 0; i < l; i++) {

Choose a reason for hiding this comment

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

let l = params.length; if(l) { is an unnecessary optimization in modern engines. It won't hurt anything, but nor will it help. See http://jsperf.com/caching-array-length/4 (This is because JITs know how to do this optimization for you -- the two versions often produce the same set of instructions.)

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Sweet, will drop the paranoia :-)

No unit test for helpers exercised the inline expression visitor (all
used the content expression) with recomputation. The inline expression visitor
links params before calling the inline hook. Linking params sets
morph.linkedParams which disallows calling linkParams later with additional
dependencies.

To work around this, here the morph subscribes to the helperStream
in invoke-helper itself if there are any params or hash arguments (which
means that there the call is an inline one). The helperStream in turn
subscribes to the params and hash.
mixonic added a commit that referenced this pull request Jun 15, 2015
[BUGFIX release] Allow recomputation for helpers with arguments
@mixonic mixonic merged commit 4d13ef9 into emberjs:master Jun 15, 2015
@mixonic mixonic deleted the helper-bug branch June 15, 2015 01:23
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.

None yet

2 participants