Commit f361b86f by Aaron Leung

Cleaning up the new selector expander & emitter. All tests pass again.

parent 467c22e3
...@@ -108,7 +108,7 @@ namespace Sass { ...@@ -108,7 +108,7 @@ namespace Sass {
root.echo(output); root.echo(output);
break; break;
case nested: case nested:
root.emit_nested_css(output, 0); root.emit_nested_css(output, 0, true);
break; break;
case expanded: case expanded:
root.emit_expanded_css(output, ""); root.emit_expanded_css(output, "");
......
...@@ -199,7 +199,7 @@ namespace Sass { ...@@ -199,7 +199,7 @@ namespace Sass {
bool operator>=(Node rhs) const; bool operator>=(Node rhs) const;
string to_string() const; string to_string() const;
void emit_nested_css(stringstream& buf, size_t depth); void emit_nested_css(stringstream& buf, size_t depth, bool at_toplevel = false);
void emit_propset(stringstream& buf, size_t depth, const string& prefix); void emit_propset(stringstream& buf, size_t depth, const string& prefix);
void echo(stringstream& buf, size_t depth = 0); void echo(stringstream& buf, size_t depth = 0);
void emit_expanded_css(stringstream& buf, const string& prefix); void emit_expanded_css(stringstream& buf, const string& prefix);
......
...@@ -295,14 +295,14 @@ namespace Sass { ...@@ -295,14 +295,14 @@ namespace Sass {
} }
} }
void Node::emit_nested_css(stringstream& buf, size_t depth) void Node::emit_nested_css(stringstream& buf, size_t depth, bool at_toplevel)
{ {
switch (type()) switch (type())
{ {
case root: case root:
if (has_expansions()) flatten(); if (has_expansions()) flatten();
for (size_t i = 0, S = size(); i < S; ++i) { for (size_t i = 0, S = size(); i < S; ++i) {
at(i).emit_nested_css(buf, depth); at(i).emit_nested_css(buf, depth, true);
} }
break; break;
...@@ -332,7 +332,7 @@ namespace Sass { ...@@ -332,7 +332,7 @@ namespace Sass {
} }
} }
if (block.has_statements()) --depth; // see previous comment if (block.has_statements()) --depth; // see previous comment
if (depth == 0) buf << endl; if ((depth == 0) && at_toplevel) buf << endl;
} break; } break;
case propset: { case propset: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment