Sha256: 396e7fb6584c6623d85c5b467aa56678a1ee9623dc2c8cf830b0d7c79a729a93

Contents?: true

Size: 1.91 KB

Versions: 6

Compression:

Stored size: 1.91 KB

Contents

#ifndef SASS_CHECK_NESTING_H
#define SASS_CHECK_NESTING_H

// sass.hpp must go before all system headers to get the
// __EXTENSIONS__ fix on Solaris.
#include "sass.hpp"
#include "ast.hpp"
#include "operation.hpp"
#include <vector>

namespace Sass {

  class CheckNesting : public Operation_CRTP<Statement*, CheckNesting> {

    sass::vector<Statement*>  parents;
    Backtraces                  traces;
    Statement*               parent;
    Definition*              current_mixin_definition;

    Statement* before(Statement*);
    Statement* visit_children(Statement*);

  public:
    CheckNesting();
    ~CheckNesting() { }

    Statement* operator()(Block*);
    Statement* operator()(Definition*);
    Statement* operator()(If*);

    template <typename U>
    Statement* fallback(U x) {
      Statement* s = Cast<Statement>(x);
      if (s && this->should_visit(s)) {
        Block* b1 = Cast<Block>(s);
        ParentStatement* b2 = Cast<ParentStatement>(s);
        if (b1 || b2) return visit_children(s);
      }
      return s;
    }

  private:
    void invalid_content_parent(Statement*, AST_Node*);
    void invalid_charset_parent(Statement*, AST_Node*);
    void invalid_extend_parent(Statement*, AST_Node*);
    // void invalid_import_parent(Statement*);
    void invalid_mixin_definition_parent(Statement*, AST_Node*);
    void invalid_function_parent(Statement*, AST_Node*);

    void invalid_function_child(Statement*);
    void invalid_prop_child(Statement*);
    void invalid_prop_parent(Statement*, AST_Node*);
    void invalid_return_parent(Statement*, AST_Node*);
    void invalid_value_child(AST_Node*);

    bool is_transparent_parent(Statement*, Statement*);

    bool should_visit(Statement*);

    bool is_charset(Statement*);
    bool is_mixin(Statement*);
    bool is_function(Statement*);
    bool is_root_node(Statement*);
    bool is_at_root_node(Statement*);
    bool is_directive_node(Statement*);
  };

}

#endif

Version data entries

6 entries across 5 versions & 4 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/sassc-2.4.0/ext/libsass/src/check_nesting.hpp
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/sassc-2.4.0/ext/libsass/src/check_nesting.hpp
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/sassc-2.4.0/ext/libsass/src/check_nesting.hpp
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/sassc-2.4.0/ext/libsass/src/check_nesting.hpp
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/sassc-2.4.0/ext/libsass/src/check_nesting.hpp
sassc-2.4.0 ext/libsass/src/check_nesting.hpp