Skip to content

Commit

Permalink
Remove the Propset AST node
Browse files Browse the repository at this point in the history
  • Loading branch information
xzyfer committed May 19, 2016
1 parent b11a557 commit bb56f7b
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 82 deletions.
12 changes: 0 additions & 12 deletions src/ast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,18 +481,6 @@ namespace Sass {
ATTACH_OPERATIONS()
};

/////////////////////////////////////////////////////////
// Nested declaration sets (i.e., namespaced properties).
/////////////////////////////////////////////////////////
class Propset : public Has_Block {
ADD_PROPERTY(String*, property_fragment)
public:
Propset(ParserState pstate, String* pf, Block* b = 0)
: Has_Block(pstate, b), property_fragment_(pf)
{ }
ATTACH_OPERATIONS()
};

/////////////////
// Bubble.
/////////////////
Expand Down
1 change: 0 additions & 1 deletion src/ast_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ namespace Sass {
// statements
Block* new_Block(std::string p, size_t l, size_t s = 0, bool r = false);
Ruleset* new_Ruleset(std::string p, size_t l, Selector* s, Block* b);
Propset* new_Propset(std::string p, size_t l, String* pf, Block* b);
Supports_Query* new_Supports_Query(std::string p, size_t l, Supports_Query* f, Block* b);
Media_Query* new_Media_Query(std::string p, size_t l, List* q, Block* b);
At_Root_Block* new_At_Root_Block(std::string p, size_t l, Selector* sel, Block* b);
Expand Down
1 change: 0 additions & 1 deletion src/ast_fwd_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Sass {
class Statement;
class Block;
class Ruleset;
class Propset;
class Bubble;
class Trace;
class Media_Block;
Expand Down
1 change: 0 additions & 1 deletion src/cssize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ namespace Sass {

Statement* operator()(Block*);
Statement* operator()(Ruleset*);
// Statement* operator()(Propset*);
// Statement* operator()(Bubble*);
Statement* operator()(Media_Block*);
Statement* operator()(Supports_Block*);
Expand Down
7 changes: 0 additions & 7 deletions src/debugger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,6 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
std::cerr << (selector->has_line_feed() ? " [line-feed]": " -");
std::cerr << " <" << prettyprint(selector->pstate().token.ws_before()) << ">" << std::endl;
for(auto i : selector->elements()) { debug_ast(i, ind + " ", env); }
} else if (dynamic_cast<Propset*>(node)) {
Propset* selector = dynamic_cast<Propset*>(node);
std::cerr << ind << "Propset " << selector;
std::cerr << " (" << pstate_source_position(node) << ")";
std::cerr << " <" << dynamic_cast<String_Constant*>(selector->property_fragment())->value() << ">";
std::cerr << " " << selector->tabs() << std::endl;
if (selector->block()) for(auto i : selector->block()->elements()) { debug_ast(i, ind + " ", env); }
} else if (dynamic_cast<Wrapped_Selector*>(node)) {
Wrapped_Selector* selector = dynamic_cast<Wrapped_Selector*>(node);
std::cerr << ind << "Wrapped_Selector " << selector;
Expand Down
47 changes: 0 additions & 47 deletions src/expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,53 +153,6 @@ namespace Sass {
return rr;
}

// this is not properly implemented
// mixes string_schema and statement
Statement* Expand::operator()(Propset* p)
{
String* fragment = dynamic_cast<String*>(p->property_fragment()->perform(&eval));
Propset* prop = SASS_MEMORY_NEW(ctx.mem, Propset,
p->pstate(),
fragment,
p->block()->perform(this)->block());
prop->tabs(p->tabs());
return prop;


property_stack.push_back(p->property_fragment());
Block* expanded_block = p->block()->perform(this)->block();
for (size_t i = 0, L = expanded_block->length(); i < L; ++i) {
Statement* stm = (*expanded_block)[i];
if (Declaration* dec = static_cast<Declaration*>(stm)) {
// dec = SASS_MEMORY_NEW(ctx.mem, Declaration, *dec);
String_Schema* combined_prop = SASS_MEMORY_NEW(ctx.mem, String_Schema, p->pstate());
if (!property_stack.empty()) {
*combined_prop << property_stack.back()->perform(&eval);
*combined_prop << SASS_MEMORY_NEW(ctx.mem, String_Quoted, p->pstate(), "-");
if (dec->property()) {
// we cannot directly add block (from dec->property()) to string schema (combined_prop)
*combined_prop << SASS_MEMORY_NEW(ctx.mem, String_Quoted, dec->pstate(), dec->property()->to_string());
}
}
else {
*combined_prop << dec->property();
}
dec->property(combined_prop);
*block_stack.back() << dec;
}
else if (typeid(*stm) == typeid(Comment)) {
// drop comments in propsets
}
else {
error("contents of namespaced properties must result in style declarations only", stm->pstate(), backtrace());
}
}

property_stack.pop_back();

return 0;
}

Statement* Expand::operator()(Supports_Block* f)
{
Expression* condition = f->condition()->perform(&eval);
Expand Down
1 change: 0 additions & 1 deletion src/expand.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ namespace Sass {

Statement* operator()(Block*);
Statement* operator()(Ruleset*);
Statement* operator()(Propset*);
Statement* operator()(Media_Block*);
Statement* operator()(Supports_Block*);
Statement* operator()(At_Root_Block*);
Expand Down
7 changes: 0 additions & 7 deletions src/inspect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ namespace Sass {
if (rule->block()) rule->block()->perform(this);
}

void Inspect::operator()(Propset* propset)
{
propset->property_fragment()->perform(this);
append_colon_separator();
propset->block()->perform(this);
}

void Inspect::operator()(Bubble* bubble)
{
append_indentation();
Expand Down
1 change: 0 additions & 1 deletion src/inspect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace Sass {
// statements
virtual void operator()(Block*);
virtual void operator()(Ruleset*);
virtual void operator()(Propset*);
virtual void operator()(Bubble*);
virtual void operator()(Supports_Block*);
virtual void operator()(Media_Block*);
Expand Down
2 changes: 0 additions & 2 deletions src/operation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ namespace Sass {
// statements
virtual T operator()(Block* x) = 0;
virtual T operator()(Ruleset* x) = 0;
virtual T operator()(Propset* x) = 0;
virtual T operator()(Bubble* x) = 0;
virtual T operator()(Trace* x) = 0;
virtual T operator()(Supports_Block* x) = 0;
Expand Down Expand Up @@ -95,7 +94,6 @@ namespace Sass {
// statements
T operator()(Block* x) { return static_cast<D*>(this)->fallback(x); }
T operator()(Ruleset* x) { return static_cast<D*>(this)->fallback(x); }
T operator()(Propset* x) { return static_cast<D*>(this)->fallback(x); }
T operator()(Bubble* x) { return static_cast<D*>(this)->fallback(x); }
T operator()(Trace* x) { return static_cast<D*>(this)->fallback(x); }
T operator()(Supports_Block* x) { return static_cast<D*>(this)->fallback(x); }
Expand Down
1 change: 0 additions & 1 deletion src/output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ namespace Sass {

virtual void operator()(Map*);
virtual void operator()(Ruleset*);
// virtual void operator()(Propset*);
virtual void operator()(Supports_Block*);
virtual void operator()(Media_Block*);
virtual void operator()(Directive*);
Expand Down
1 change: 0 additions & 1 deletion src/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ namespace Sass {
Arguments* parse_arguments();
Argument* parse_argument();
Assignment* parse_assignment();
// Propset* parse_propset();
Ruleset* parse_ruleset(Lookahead lookahead, bool is_root = false);
Selector_Schema* parse_selector_schema(const char* end_of_selector);
Selector_List* parse_selector_list(bool at_root = false);
Expand Down

0 comments on commit bb56f7b

Please sign in to comment.