Skip to content

Commit

Permalink
Fix output with unhoistables and make comments hoistable
Browse files Browse the repository at this point in the history
Fixes sass#2158
  • Loading branch information
mgreter committed Sep 2, 2016
1 parent 014a61b commit 41ce53d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/ast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ namespace Sass {
{ statement_type(COMMENT); }
virtual bool is_invisible() const
{ return /* is_important() == */ false; }
bool is_hoistable() { return true; }
ATTACH_OPERATIONS()
};

Expand Down
9 changes: 3 additions & 6 deletions src/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,19 +240,16 @@ namespace Sass {
append_token("@supports", f);
append_mandatory_space();
c->perform(this);
append_scope_opener();

if (b->has_non_hoistable()) {
// JMA - hoisted, output the non-hoistable in a nested block, followed by the hoistable
append_scope_opener();

// JMA - hoisted, output the non-hoistable in a nested block, followed by the hoistable
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
if (!stm->is_hoistable()) {
stm->perform(this);
}
}

append_scope_closer();

for (size_t i = 0, L = b->length(); i < L; ++i) {
Expand All @@ -263,18 +260,18 @@ namespace Sass {
}
}
else {
append_scope_opener();
// JMA - not hoisted, just output in order
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
stm->perform(this);
if (i < L - 1) append_special_linefeed();
}
append_scope_closer();
}

if (output_style() == NESTED) indentation -= f->tabs();

append_scope_closer();

}

void Output::operator()(Media_Block* m)
Expand Down

0 comments on commit 41ce53d

Please # to comment.