Skip to content

Commit 8fbd1ff

Browse files
committed
Rename Directive to AtRule
1 parent 6cd7d43 commit 8fbd1ff

19 files changed

+44
-44
lines changed

src/ast.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,25 +212,25 @@ namespace Sass {
212212
/////////////////////////////////////////////////////////////////////////
213213
/////////////////////////////////////////////////////////////////////////
214214

215-
Directive::Directive(SourceSpan pstate, sass::string kwd, SelectorListObj sel, Block_Obj b, ExpressionObj val)
215+
AtRule::AtRule(SourceSpan pstate, sass::string kwd, SelectorListObj sel, Block_Obj b, ExpressionObj val)
216216
: ParentStatement(pstate, b), keyword_(kwd), selector_(sel), value_(val) // set value manually if needed
217217
{ statement_type(DIRECTIVE); }
218-
Directive::Directive(const Directive* ptr)
218+
AtRule::AtRule(const AtRule* ptr)
219219
: ParentStatement(ptr),
220220
keyword_(ptr->keyword_),
221221
selector_(ptr->selector_),
222222
value_(ptr->value_) // set value manually if needed
223223
{ statement_type(DIRECTIVE); }
224224

225-
bool Directive::bubbles() { return is_keyframes() || is_media(); }
225+
bool AtRule::bubbles() { return is_keyframes() || is_media(); }
226226

227-
bool Directive::is_media() {
227+
bool AtRule::is_media() {
228228
return keyword_.compare("@-webkit-media") == 0 ||
229229
keyword_.compare("@-moz-media") == 0 ||
230230
keyword_.compare("@-o-media") == 0 ||
231231
keyword_.compare("@media") == 0;
232232
}
233-
bool Directive::is_keyframes() {
233+
bool AtRule::is_keyframes() {
234234
return keyword_.compare("@-webkit-keyframes") == 0 ||
235235
keyword_.compare("@-moz-keyframes") == 0 ||
236236
keyword_.compare("@-o-keyframes") == 0 ||
@@ -826,7 +826,7 @@ namespace Sass {
826826

827827
if (s->statement_type() == Statement::DIRECTIVE)
828828
{
829-
if (Directive_Obj dir = Cast<Directive>(s))
829+
if (AtRuleObj dir = Cast<AtRule>(s))
830830
{
831831
sass::string keyword(dir->keyword());
832832
if (keyword.length() > 0) keyword.erase(0, 1);
@@ -845,7 +845,7 @@ namespace Sass {
845845
{
846846
return expression()->exclude("supports");
847847
}
848-
if (Directive_Obj dir = Cast<Directive>(s))
848+
if (AtRuleObj dir = Cast<AtRule>(s))
849849
{
850850
if (dir->is_keyframes()) return expression()->exclude("keyframes");
851851
}
@@ -917,7 +917,7 @@ namespace Sass {
917917
IMPLEMENT_AST_OPERATORS(CssMediaQuery);
918918
IMPLEMENT_AST_OPERATORS(Import);
919919
IMPLEMENT_AST_OPERATORS(Import_Stub);
920-
IMPLEMENT_AST_OPERATORS(Directive);
920+
IMPLEMENT_AST_OPERATORS(AtRule);
921921
IMPLEMENT_AST_OPERATORS(AtRootRule);
922922
IMPLEMENT_AST_OPERATORS(WhileRule);
923923
IMPLEMENT_AST_OPERATORS(EachRule);

src/ast.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,16 +569,16 @@ namespace Sass {
569569
// At-rules -- arbitrary directives beginning with "@" that may have an
570570
// optional statement block.
571571
///////////////////////////////////////////////////////////////////////
572-
class Directive final : public ParentStatement {
572+
class AtRule final : public ParentStatement {
573573
ADD_CONSTREF(sass::string, keyword)
574574
ADD_PROPERTY(SelectorListObj, selector)
575575
ADD_PROPERTY(ExpressionObj, value)
576576
public:
577-
Directive(SourceSpan pstate, sass::string kwd, SelectorListObj sel = {}, Block_Obj b = {}, ExpressionObj val = {});
577+
AtRule(SourceSpan pstate, sass::string kwd, SelectorListObj sel = {}, Block_Obj b = {}, ExpressionObj val = {});
578578
bool bubbles() override;
579579
bool is_media();
580580
bool is_keyframes();
581-
ATTACH_AST_OPERATIONS(Directive)
581+
ATTACH_AST_OPERATIONS(AtRule)
582582
ATTACH_CRTP_PERFORM_METHODS()
583583
};
584584

src/ast_fwd_decl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace Sass {
3636
class CssMediaQuery;
3737

3838
class SupportsRule;
39-
class Directive;
39+
class AtRule;
4040

4141
class Keyframe_Rule;
4242
class AtRootRule;
@@ -138,7 +138,7 @@ namespace Sass {
138138
IMPL_MEM_OBJ(CssMediaRule);
139139
IMPL_MEM_OBJ(CssMediaQuery);
140140
IMPL_MEM_OBJ(SupportsRule);
141-
IMPL_MEM_OBJ(Directive);
141+
IMPL_MEM_OBJ(AtRule);
142142
IMPL_MEM_OBJ(Keyframe_Rule);
143143
IMPL_MEM_OBJ(AtRootRule);
144144
IMPL_MEM_OBJ(Declaration);

src/check_nesting.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ namespace Sass {
353353

354354
bool CheckNesting::is_charset(Statement* n)
355355
{
356-
Directive* d = Cast<Directive>(n);
356+
AtRule* d = Cast<AtRule>(n);
357357
return d && d->keyword() == "charset";
358358
}
359359

@@ -384,7 +384,7 @@ namespace Sass {
384384

385385
bool CheckNesting::is_directive_node(Statement* n)
386386
{
387-
return Cast<Directive>(n) ||
387+
return Cast<AtRule>(n) ||
388388
Cast<Import>(n) ||
389389
Cast<MediaRule>(n) ||
390390
Cast<CssMediaRule>(n) ||

src/cssize.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ namespace Sass {
8080
return 0;
8181
}
8282

83-
Statement* Cssize::operator()(Directive* r)
83+
Statement* Cssize::operator()(AtRule* r)
8484
{
8585
if (!r->block() || !r->block()->length()) return r;
8686

@@ -90,7 +90,7 @@ namespace Sass {
9090
}
9191

9292
p_stack.push_back(r);
93-
Directive_Obj rr = SASS_MEMORY_NEW(Directive,
93+
AtRuleObj rr = SASS_MEMORY_NEW(AtRule,
9494
r->pstate(),
9595
r->keyword(),
9696
r->selector(),
@@ -107,15 +107,15 @@ namespace Sass {
107107
Bubble_Obj s_obj = Cast<Bubble>(s);
108108
s = s_obj->node();
109109
if (s->statement_type() != Statement::DIRECTIVE) directive_exists = false;
110-
else directive_exists = (Cast<Directive>(s)->keyword() == rr->keyword());
110+
else directive_exists = (Cast<AtRule>(s)->keyword() == rr->keyword());
111111
}
112112

113113
}
114114

115115
Block* result = SASS_MEMORY_NEW(Block, rr->pstate());
116116
if (!(directive_exists || rr->is_keyframes()))
117117
{
118-
Directive* empty_node = Cast<Directive>(rr);
118+
AtRule* empty_node = Cast<AtRule>(rr);
119119
empty_node->block(SASS_MEMORY_NEW(Block, rr->block() ? rr->block()->pstate() : rr->pstate()));
120120
result->append(empty_node);
121121
}
@@ -287,7 +287,7 @@ namespace Sass {
287287
return bubble(m);
288288
}
289289

290-
Statement* Cssize::bubble(Directive* m)
290+
Statement* Cssize::bubble(AtRule* m)
291291
{
292292
Block* bb = SASS_MEMORY_NEW(Block, this->parent()->pstate());
293293
ParentStatementObj new_rule = Cast<ParentStatement>(SASS_MEMORY_COPY(this->parent()));
@@ -297,7 +297,7 @@ namespace Sass {
297297

298298
Block_Obj wrapper_block = SASS_MEMORY_NEW(Block, m->block() ? m->block()->pstate() : m->pstate());
299299
wrapper_block->append(new_rule);
300-
Directive_Obj mm = SASS_MEMORY_NEW(Directive,
300+
AtRuleObj mm = SASS_MEMORY_NEW(AtRule,
301301
m->pstate(),
302302
m->keyword(),
303303
m->selector(),

src/cssize.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace Sass {
2626
Statement* operator()(CssMediaRule*);
2727
Statement* operator()(SupportsRule*);
2828
Statement* operator()(AtRootRule*);
29-
Statement* operator()(Directive*);
29+
Statement* operator()(AtRule*);
3030
Statement* operator()(Keyframe_Rule*);
3131
Statement* operator()(Trace*);
3232
Statement* operator()(Declaration*);
@@ -49,7 +49,7 @@ namespace Sass {
4949

5050
Statement* parent();
5151
sass::vector<std::pair<bool, Block_Obj>> slice_by_bubble(Block*);
52-
Statement* bubble(Directive*);
52+
Statement* bubble(AtRule*);
5353
Statement* bubble(AtRootRule*);
5454
Statement* bubble(CssMediaRule*);
5555
Statement* bubble(SupportsRule*);

src/debugger.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,9 +665,9 @@ inline void debug_ast(AST_Node* node, sass::string ind, Env* env)
665665
std::cerr << " " << ParentStatement->tabs() << std::endl;
666666
if (ParentStatement->name()) debug_ast(ParentStatement->name(), ind + "@");
667667
if (ParentStatement->block()) for(const Statement_Obj& i : ParentStatement->block()->elements()) { debug_ast(i, ind + " ", env); }
668-
} else if (Cast<Directive>(node)) {
669-
Directive* block = Cast<Directive>(node);
670-
std::cerr << ind << "Directive " << block;
668+
} else if (Cast<AtRule>(node)) {
669+
AtRule* block = Cast<AtRule>(node);
670+
std::cerr << ind << "AtRule " << block;
671671
std::cerr << " (" << pstate_source_position(node) << ")";
672672
std::cerr << " [" << block->keyword() << "] " << block->tabs() << std::endl;
673673
debug_ast(block->selector(), ind + "~", env);

src/expand.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ namespace Sass {
299299
return aa.detach();
300300
}
301301

302-
Statement* Expand::operator()(Directive* a)
302+
Statement* Expand::operator()(AtRule* a)
303303
{
304304
LOCAL_FLAG(in_keyframes, a->is_keyframes());
305305
Block* ab = a->block();
@@ -310,7 +310,7 @@ namespace Sass {
310310
if (as) as = eval(as);
311311
popNullSelector();
312312
Block* bb = ab ? operator()(ab) : NULL;
313-
Directive* aa = SASS_MEMORY_NEW(Directive,
313+
AtRule* aa = SASS_MEMORY_NEW(AtRule,
314314
a->pstate(),
315315
a->keyword(),
316316
as,

src/expand.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ namespace Sass {
7070

7171
Statement* operator()(SupportsRule*);
7272
Statement* operator()(AtRootRule*);
73-
Statement* operator()(Directive*);
73+
Statement* operator()(AtRule*);
7474
Statement* operator()(Declaration*);
7575
Statement* operator()(Assignment*);
7676
Statement* operator()(Import*);

src/inspect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ namespace Sass {
142142
if(at_root_block->block()) at_root_block->block()->perform(this);
143143
}
144144

145-
void Inspect::operator()(Directive* at_rule)
145+
void Inspect::operator()(AtRule* at_rule)
146146
{
147147
append_indentation();
148148
append_token(at_rule->keyword(), at_rule);

0 commit comments

Comments
 (0)