1 | // sass.hpp must go before all system headers to get the |
---|---|
2 | // __EXTENSIONS__ fix on Solaris. |
3 | #include "sass.hpp" |
4 | |
5 | #include "ast_helpers.hpp" |
6 | #include "extension.hpp" |
7 | #include "ast.hpp" |
8 | |
9 | namespace Sass { |
10 | |
11 | // ########################################################################## |
12 | // Static function to create a copy with a new extender |
13 | // ########################################################################## |
14 | Extension Extension::withExtender(const ComplexSelectorObj& newExtender) const |
15 | { |
16 | Extension extension(newExtender); |
17 | extension.specificity = specificity; |
18 | extension.isOptional = isOptional; |
19 | extension.target = target; |
20 | return extension; |
21 | } |
22 | |
23 | // ########################################################################## |
24 | // Asserts that the [mediaContext] for a selector is |
25 | // compatible with the query context for this extender. |
26 | // ########################################################################## |
27 | void Extension::assertCompatibleMediaContext(CssMediaRuleObj mediaQueryContext, Backtraces& traces) const |
28 | { |
29 | |
30 | if (this->mediaContext.isNull()) return; |
31 | |
32 | if (mediaQueryContext && ObjPtrEqualityFn(lhs: mediaContext->block(), rhs: mediaQueryContext->block())) return; |
33 | |
34 | if (ObjEqualityFn<CssMediaRuleObj>(lhs: mediaQueryContext, rhs: mediaContext)) return; |
35 | |
36 | throw Exception::ExtendAcrossMedia(traces, *this); |
37 | |
38 | } |
39 | |
40 | // ########################################################################## |
41 | // ########################################################################## |
42 | |
43 | } |
44 |