Skip to content

Commit f0b308e

Browse files
committed
Change If class to inherit from Has_Block
1 parent a0238e2 commit f0b308e

File tree

6 files changed

+7
-10
lines changed

6 files changed

+7
-10
lines changed

ast.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,13 +578,12 @@ namespace Sass {
578578
////////////////////////////////////
579579
// The Sass `@if` control directive.
580580
////////////////////////////////////
581-
class If : public Statement {
581+
class If : public Has_Block {
582582
ADD_PROPERTY(Expression*, predicate)
583-
ADD_PROPERTY(Block*, consequent)
584583
ADD_PROPERTY(Block*, alternative)
585584
public:
586585
If(ParserState pstate, Expression* pred, Block* con, Block* alt = 0)
587-
: Statement(pstate), predicate_(pred), consequent_(con), alternative_(alt)
586+
: Has_Block(pstate, con), predicate_(pred), alternative_(alt)
588587
{ }
589588
ATTACH_OPERATIONS()
590589
};

debugger.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ inline void debug_ast(AST_Node* node, string ind = "", Env* env = 0)
283283
cerr << " (" << pstate_source_position(node) << ")";
284284
cerr << " " << block->tabs() << endl;
285285
debug_ast(block->predicate(), ind + " = ");
286-
debug_ast(block->consequent(), ind + " <>");
286+
debug_ast(block->block(), ind + " <>");
287287
debug_ast(block->alternative(), ind + " ><");
288288
} else if (dynamic_cast<Return*>(node)) {
289289
Return* block = dynamic_cast<Return*>(node);

eval.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ namespace Sass {
142142
Env env(exp.environment());
143143
exp.env_stack.push_back(&env);
144144
if (*i->predicate()->perform(this)) {
145-
rv = i->consequent()->perform(this);
145+
rv = i->block()->perform(this);
146146
}
147147
else {
148148
Block* alt = i->alternative();

functions.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,8 +1584,6 @@ namespace Sass {
15841584
if (inspect.empty() && parentheses) inspect = "()";
15851585
ctx.output_style = old_style;
15861586
return new (ctx.mem) String_Quoted(pstate, inspect);
1587-
1588-
15891587
}
15901588
// return v;
15911589
}

inspect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ namespace Sass {
242242
append_token("@if", cond);
243243
append_mandatory_space();
244244
cond->predicate()->perform(this);
245-
cond->consequent()->perform(this);
245+
cond->block()->perform(this);
246246
if (cond->alternative()) {
247247
append_optional_linefeed();
248248
append_indentation();

parser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,7 +1753,7 @@ namespace Sass {
17531753
ParserState if_source_position = pstate;
17541754
Expression* predicate = parse_list();
17551755
predicate->is_delayed(false);
1756-
Block* consequent = parse_block();
1756+
Block* block = parse_block();
17571757
Block* alternative = 0;
17581758

17591759
if (lex< elseif_directive >()) {
@@ -1763,7 +1763,7 @@ namespace Sass {
17631763
else if (lex< kwd_else_directive >()) {
17641764
alternative = parse_block();
17651765
}
1766-
return new (ctx.mem) If(if_source_position, predicate, consequent, alternative);
1766+
return new (ctx.mem) If(if_source_position, predicate, block, alternative);
17671767
}
17681768

17691769
For* Parser::parse_for_directive()

0 commit comments

Comments
 (0)