/src/libsass/src/extension.cpp
Line | Count | Source |
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 | 0 | { |
16 | 0 | Extension extension(newExtender); |
17 | 0 | extension.specificity = specificity; |
18 | 0 | extension.isOptional = isOptional; |
19 | 0 | extension.target = target; |
20 | 0 | return extension; |
21 | 0 | } |
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 | 0 | { |
29 | |
|
30 | 0 | if (this->mediaContext.isNull()) return; |
31 | | |
32 | 0 | if (mediaQueryContext && ObjPtrEqualityFn(mediaContext->block(), mediaQueryContext->block())) return; |
33 | | |
34 | 0 | if (ObjEqualityFn<CssMediaRuleObj>(mediaQueryContext, mediaContext)) return; |
35 | | |
36 | 0 | throw Exception::ExtendAcrossMedia(traces, *this); |
37 | |
|
38 | 0 | } |
39 | | |
40 | | // ########################################################################## |
41 | | // ########################################################################## |
42 | | |
43 | | } |