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

Preparation for interpolate/output refactor #899

Closed
wants to merge 39 commits into from

Conversation

mgreter
Copy link
Contributor

@mgreter mgreter commented Feb 21, 2015

This is in preparation for #839

@xzyfer Maybe you could give it a review? It's already a pretty big PR and the rest of the refactoring will be much more new code. This PR should contain most refactoring I needed in the code base. Some code does not do much yet (like String_Quoted type), but it should make it easier this way to review.

I tried to make usefull commits, but I can merge them to one commit if wanted!?

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.31%) to 76.12% when pulling ba0fe1e on mgreter:test-interpolate-merging into 1f40bf4 on sass:master.

@@ -1326,10 +1331,10 @@ namespace Sass {
// "flat" strings.
////////////////////////////////////////////////////////////////////////
class String : public Expression {
ADD_PROPERTY(bool, needs_unquoting);
ADD_PROPERTY(bool, sass_fix_1291);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know about this variable name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The needs_unquoting flag will not be needed with the full refactoring. I my WIP this flag is needed to have the same behavior as ruby sass (sass/sass#1291) which will be deprecated. Which means the sass_fix_1291 can probably be removed once sass has it deprecated. But you're right, currently it doesn't make sense as needs_unquoting is still in the code. Please see comment below about String_Constant vs. String_Quoted. I would favor to ignore it for now.

@xzyfer
Copy link
Contributor

xzyfer commented Feb 21, 2015

Please squash these commits before merging :)

@xzyfer
Copy link
Contributor

xzyfer commented Feb 21, 2015

Can you provide a list of specs that now pass due to this change? You may need to rebase master.

@mgreter
Copy link
Contributor Author

mgreter commented Feb 22, 2015

Thanks for the review! I'm making progress with the fallow up PR:
https://github.com/mgreter/libsass/commits/refactor/output-preparation

@mgreter
Copy link
Contributor Author

mgreter commented Feb 22, 2015

I've nearly finished the merge of my WIP branch. Although it currently only supports nested output and it probably is off by quite a bit. But everything is prepared to implement different output styles inside the Emitter class. Next I hope I can refactor my last part of my working WIP branch, becuase that was actually the most dirty one. But I know it is doable via Emitter class!
https://github.com/mgreter/libsass/commits/refactor/output-preparation

@xzyfer
Copy link
Contributor

xzyfer commented Feb 22, 2015

I think there's room to reduce the number of string types in the near
future. It's getting a bit confusing. Do what you need to do and we'll come
back and evaluate the situation when you're done.

👍
On 22 Feb 2015 14:08, "Marcel Greter" [email protected] wrote:

I finished the merge of my WIP branch. Although it currently only supports
nested output and it probably is off by quite a bit. But everything is
prepared to implement different output styles inside the Emitter class.
Next I hope I can refactor my last part of my working WIP branch, becuase
that was actually the most dirty one. But I know it is doable via Emitter
class!
https://github.com/mgreter/libsass/commits/refactor/output-preparation


Reply to this email directly or view it on GitHub
#899 (comment).

@mgreter
Copy link
Contributor Author

mgreter commented Feb 22, 2015

Just checked which tests pass with the output-preparation branch:

  • libsass-todo-issues/issue_615
  • // libsass-todo-issues/issue_639
  • libsass-todo-issues/issue_694
  • libsass-todo-issues/issue_870
  • libsass-todo-issues/issue_884
  • // libsass-todo-tests/libsass/image-url
  • libsass-todo-tests/libsass/mixin
  • libsass-todo-tests/scss-tests/172_test_parsing_decimals_followed_by_comments_doesnt_take_forever

I guess some also pass on current master! Maybe you have time to move them?

@mgreter
Copy link
Contributor Author

mgreter commented Feb 22, 2015

I have squashed the whole refactoring into two commits (the first one beeing exactly this PR) at:
https://github.com/mgreter/libsass/commits/refactor/output-preparation
Now the work needs to be done in Emitter class. Maybe you want to review it already? To have the full work finally merged I need a correct Emitter implementation first!
I will make sure to add a third commit once it is ready!

@xzyfer
Copy link
Contributor

xzyfer commented Feb 22, 2015

Some of these pass on master, however a few appear to be interpolation related and pass because of this PR 👍

I'll enable the passing tests on master. They're due to my recent normalization PR.

@xzyfer
Copy link
Contributor

xzyfer commented Feb 22, 2015

Enabled the specs that pass on master sass/sass-spec#263.

@mgreter
Copy link
Contributor Author

mgreter commented Feb 22, 2015

Got a first implementation for nested output rendering at: mgreter@3a983e1

That branch passes the following additional tests:

  • libsass-todo-issues/issue_615
  • libsass-todo-issues/issue_639
  • libsass-todo-issues/issue_694
  • libsass-todo-issues/issue_870
  • libsass-todo-tests/scss-tests/172_test_parsing_..._take_forever

It also passes all but 31 spec test exactly to ruby sass output (I only normalize multiple linefeed to one linefeed). Next is to refactor the whitespace/linefeed preserving for selectors and lists.

@mgreter
Copy link
Contributor Author

mgreter commented Feb 22, 2015

Mixed in the line-feed preserving from my WIP branch at: mgreter@1210dfa

With this it additionaly seems to pass one more spec test (only fails 2 nested spec tests):

  • libsass-todo-tests/186_test_newlines_removed_from_selectors_when_compressed

@mgreter
Copy link
Contributor Author

mgreter commented Feb 25, 2015

I have pretty much a finished implementation in another WIP branch:
https://github.com/mgreter/libsass/commits/test/emitter-implementation
Still need to clean up quite a few edges, but it already implements all 4 output modes!
I had to ignore white-space or skip some tests for now:

  • 3 tests in compact mode
  • 7 tests in compressed mode
  • 6 tests in in expanded mode
  • 6 tests in in nested mode

Some of these seem to be bugs in ruby sass.
All other tests only normalize multiple linefeeds to one linefeed.
So I'm positive that I will be able to finish the refactoring pretty soon!

@xzyfer
Copy link
Contributor

xzyfer commented Feb 26, 2015

@mgreter feel free to just do what you need to do, and merge at will. I'd prefer you just merge you changes incrementally (as long as specs are passing).

Frankly there is no much going on here that it can't really be reviewed as is. At this point the best way forward is to merge as you feel comfortable and we can address an incremental work, or refactors as they come up.

@mgreter
Copy link
Contributor Author

mgreter commented Feb 26, 2015

@xzyfer 👍 Btw: you can think if String_Quoted as a replacement for needs_unquote, since I will now unquote strings when parsing. This seems to be the right thing to do and is needed for interpolation. If ok for you, I'll squash this whole PR into one commit and merge it and post other PRs accordingly!

@xzyfer
Copy link
Contributor

xzyfer commented Feb 26, 2015

If ok for you, I'll squash this whole PR into one commit and merge it and post other PRs accordingly!

👍 I'm keen to get this work over the line. Long lasting branches make me uneasy :)

@mgreter
Copy link
Contributor Author

mgreter commented Mar 1, 2015

Closing in favor of #910

@mgreter mgreter closed this Mar 1, 2015
@mgreter mgreter deleted the test-interpolate-merging branch April 6, 2015 17:32
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