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

Back compatible compiler #420

Merged
merged 2 commits into from
Feb 12, 2014
Merged

Conversation

kate2753
Copy link
Contributor

In Dust 2.2.0 we've introduced backward incompatible change to the compiler (using Context.prototype._get instead of Context.prototype.get and Context.prototype.getPath). _get method was added to Dust 2.2.0 runtime. With that change, templates compiled in 2.2.0 and newer can not be rendered with Dust runtimes prior to 2.2.0.

This pull request makes sure that older Dust runtimes (before 2.2.0) can render templates compiled with Dust 2.2.6 and beyond and 2.3.4 and beyond.

I am switching compiler from _get to get. This way older runtimes will use old implementation of get method. Newer runtimes will use new implementation of get method which calls _get under the hood.

Patching 2.2.x and 2.3.x versions

coreTests = require('./jasmine-test/spec/coreTests'),
coreSetup = require('./core').coreSetup;

//make dust a global
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure how the changes in this file relate to this PR. Were these changes included intentionally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was intentional change for 2.2.x branch. Unit tests with server.js were broken there. So fixing them as part of this commit as well. Now all of the unit tests pass (node test/server.js, node test/jasmine-test/server/specRunner.js and running jasmine client SpecRunner.html in a browser).

I've also added comments in server.js, so merging up to 2.3.x also shows up as few changes there.

@prashn64
Copy link
Contributor

I believe you need to go back to the 2.2.6 branch and generate the dist files.

@kate2753
Copy link
Contributor Author

I was thinking to include both this fix and #419 into 2.2.6. This PR should be pulled in first, then #419. I will generate 2.2.6 dist files in #419. So 2.2.6 will include compiler fix and _get fix to handle undefined context head.

@prashn64
Copy link
Contributor

ok, makes sense to me. code looks good.

@smfoote
Copy link
Contributor

smfoote commented Feb 12, 2014

Looks good to me.

prashn64 added a commit that referenced this pull request Feb 12, 2014
Make the compiler backwards compatible with runtime versions prior to 2.2.x
@prashn64 prashn64 merged commit 1321e74 into linkedin:master Feb 12, 2014
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.

3 participants