Skip to content

Ensure that existing blockParams and depths are respected on dupe programs#1187

Merged
kpdecker merged 1 commit intohandlebars-lang:masterfrom
charleso:bugfix/1186-existing-program-block-param
Mar 7, 2016
Merged

Ensure that existing blockParams and depths are respected on dupe programs#1187
kpdecker merged 1 commit intohandlebars-lang:masterfrom
charleso:bugfix/1186-existing-program-block-param

Conversation

@charleso
Copy link
Contributor

Fixes #1186

I'm opening this partly just to help identify the problem, my knowledge of the internals of handlebars.js is non-existent and there may well be more desirable ways to fix this problem.

I believe underlying cause is that the previous compiler.useBlockParams is not respected for any subsequent existing programs that are matched. I've just set/stashed/slashed/hacked the value on to child environment, but this is the part that may need to be done differently.

Question - how much performance does matching/re-using the existing programs save? (Just curious)

this.useDepths = this.useDepths || compiler.useDepths;
this.useBlockParams = this.useBlockParams || compiler.useBlockParams;
child.useDepths = this.useDepths || compiler.useDepths;
child.useBlockParams = this.useBlockParams || compiler.useBlockParams;
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't need the || conditions here, it's already been done in the lines above.

@kpdecker
Copy link
Collaborator

kpdecker commented Mar 7, 2016

Thanks. One minor nit and otherwise this looks great.

@charleso charleso force-pushed the bugfix/1186-existing-program-block-param branch from 7462ccd to c7be766 Compare March 7, 2016 20:23
@charleso
Copy link
Contributor Author

charleso commented Mar 7, 2016

@kpdecker Good point. Updated.

kpdecker added a commit that referenced this pull request Mar 7, 2016
…lock-param

Ensure that existing blockParams and depths are respected on dupe programs
@kpdecker kpdecker merged commit 06baeae into handlebars-lang:master Mar 7, 2016
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.

@partial-block interacting strangely with identical helper blocks.

2 participants