Skip to content

Commit e507b41

Browse files
committed
Merge pull request #2011 from mgreter/bugfix/extend-regression-2
Fix detection of extending across media queries
2 parents 1ccaa9e + 5aab2fa commit e507b41

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/ast.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,6 +1901,9 @@ namespace Sass {
19011901
virtual unsigned long specificity() {
19021902
return Constants::Specificity_Universal;
19031903
}
1904+
virtual void set_media_block(Media_Block* mb) {
1905+
media_block(mb);
1906+
}
19041907
};
19051908
inline Selector::~Selector() { }
19061909

@@ -2405,6 +2408,11 @@ namespace Sass {
24052408
if (tail()) sum += tail()->specificity();
24062409
return sum;
24072410
}
2411+
virtual void set_media_block(Media_Block* mb) {
2412+
media_block(mb);
2413+
if (tail_) tail_->set_media_block(mb);
2414+
if (head_) head_->set_media_block(mb);
2415+
}
24082416
bool operator<(const Complex_Selector& rhs) const;
24092417
bool operator==(const Complex_Selector& rhs) const;
24102418
inline bool operator!=(const Complex_Selector& rhs) const { return !(*this == rhs); }
@@ -2507,6 +2515,12 @@ namespace Sass {
25072515
}
25082516
return sum;
25092517
}
2518+
virtual void set_media_block(Media_Block* mb) {
2519+
media_block(mb);
2520+
for (Complex_Selector* cs : elements()) {
2521+
cs->set_media_block(mb);
2522+
}
2523+
}
25102524
Selector_List* clone(Context&) const; // does not clone Compound_Selector*s
25112525
Selector_List* cloneFully(Context&) const; // clones Compound_Selector*s
25122526
virtual bool operator==(const Selector& rhs) const;

src/expand.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ namespace Sass {
136136
env = new Env(environment());
137137
env_stack.push_back(env);
138138
}
139+
sel->set_media_block(media_block_stack.back());
139140
Block* blk = r->block()->perform(this)->block();
140141
Ruleset* rr = SASS_MEMORY_NEW(ctx.mem, Ruleset,
141142
r->pstate(),

0 commit comments

Comments
 (0)