Coverage Report

Created: 2026-04-15 06:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libsass/src/ast_supports.hpp
Line
Count
Source
1
#ifndef SASS_AST_SUPPORTS_H
2
#define SASS_AST_SUPPORTS_H
3
4
// sass.hpp must go before all system headers to get the
5
// __EXTENSIONS__ fix on Solaris.
6
#include "sass.hpp"
7
8
#include <set>
9
#include <deque>
10
#include <vector>
11
#include <string>
12
#include <sstream>
13
#include <iostream>
14
#include <typeinfo>
15
#include <algorithm>
16
#include "sass/base.h"
17
#include "ast_fwd_decl.hpp"
18
19
#include "util.hpp"
20
#include "units.hpp"
21
#include "context.hpp"
22
#include "position.hpp"
23
#include "constants.hpp"
24
#include "operation.hpp"
25
#include "position.hpp"
26
#include "inspect.hpp"
27
#include "source_map.hpp"
28
#include "environment.hpp"
29
#include "error_handling.hpp"
30
#include "ast_def_macros.hpp"
31
#include "ast_fwd_decl.hpp"
32
#include "source_map.hpp"
33
#include "fn_utils.hpp"
34
35
#include "sass.h"
36
37
namespace Sass {
38
39
  ////////////////////
40
  // `@supports` rule.
41
  ////////////////////
42
  class SupportsRule : public ParentStatement {
43
    ADD_PROPERTY(SupportsConditionObj, condition)
44
  public:
45
    SupportsRule(SourceSpan pstate, SupportsConditionObj condition, Block_Obj block = {});
46
    bool bubbles() override;
47
    ATTACH_AST_OPERATIONS(SupportsRule)
48
    ATTACH_CRTP_PERFORM_METHODS()
49
  };
50
51
  //////////////////////////////////////////////////////
52
  // The abstract superclass of all Supports conditions.
53
  //////////////////////////////////////////////////////
54
  class SupportsCondition : public Expression {
55
  public:
56
    SupportsCondition(SourceSpan pstate);
57
0
    virtual bool needs_parens(SupportsConditionObj cond) const { return false; }
58
    ATTACH_AST_OPERATIONS(SupportsCondition)
59
    ATTACH_CRTP_PERFORM_METHODS()
60
  };
61
62
  ////////////////////////////////////////////////////////////
63
  // An operator condition (e.g. `CONDITION1 and CONDITION2`).
64
  ////////////////////////////////////////////////////////////
65
  class SupportsOperation : public SupportsCondition {
66
  public:
67
    enum Operand { AND, OR };
68
  private:
69
    ADD_PROPERTY(SupportsConditionObj, left);
70
    ADD_PROPERTY(SupportsConditionObj, right);
71
    ADD_PROPERTY(Operand, operand);
72
  public:
73
    SupportsOperation(SourceSpan pstate, SupportsConditionObj l, SupportsConditionObj r, Operand o);
74
    virtual bool needs_parens(SupportsConditionObj cond) const override;
75
    ATTACH_AST_OPERATIONS(SupportsOperation)
76
    ATTACH_CRTP_PERFORM_METHODS()
77
  };
78
79
  //////////////////////////////////////////
80
  // A negation condition (`not CONDITION`).
81
  //////////////////////////////////////////
82
  class SupportsNegation : public SupportsCondition {
83
  private:
84
    ADD_PROPERTY(SupportsConditionObj, condition);
85
  public:
86
    SupportsNegation(SourceSpan pstate, SupportsConditionObj c);
87
    virtual bool needs_parens(SupportsConditionObj cond) const override;
88
    ATTACH_AST_OPERATIONS(SupportsNegation)
89
    ATTACH_CRTP_PERFORM_METHODS()
90
  };
91
92
  /////////////////////////////////////////////////////
93
  // A declaration condition (e.g. `(feature: value)`).
94
  /////////////////////////////////////////////////////
95
  class SupportsDeclaration : public SupportsCondition {
96
  private:
97
    ADD_PROPERTY(ExpressionObj, feature);
98
    ADD_PROPERTY(ExpressionObj, value);
99
  public:
100
    SupportsDeclaration(SourceSpan pstate, ExpressionObj f, ExpressionObj v);
101
    virtual bool needs_parens(SupportsConditionObj cond) const override;
102
    ATTACH_AST_OPERATIONS(SupportsDeclaration)
103
    ATTACH_CRTP_PERFORM_METHODS()
104
  };
105
106
  ///////////////////////////////////////////////
107
  // An interpolation condition (e.g. `#{$var}`).
108
  ///////////////////////////////////////////////
109
  class Supports_Interpolation : public SupportsCondition {
110
  private:
111
    ADD_PROPERTY(ExpressionObj, value);
112
  public:
113
    Supports_Interpolation(SourceSpan pstate, ExpressionObj v);
114
    virtual bool needs_parens(SupportsConditionObj cond) const override;
115
    ATTACH_AST_OPERATIONS(Supports_Interpolation)
116
    ATTACH_CRTP_PERFORM_METHODS()
117
  };
118
119
}
120
121
#endif