Exemplo n.º 1
0
  void Output::operator()(Keyframe_Rule* r)
  {
    Block* b = r->block();
    Selector* v = r->selector();

    if (v) {
      v->perform(this);
    }

    if (!b) {
      append_colon_separator();
      return;
    }

    append_scope_opener();
    for (size_t i = 0, L = b->length(); i < L; ++i) {
      Statement* stm = (*b)[i];
      if (!stm->is_hoistable()) {
        stm->perform(this);
        if (i < L - 1) append_special_linefeed();
      }
    }

    for (size_t i = 0, L = b->length(); i < L; ++i) {
      Statement* stm = (*b)[i];
      if (stm->is_hoistable()) {
        stm->perform(this);
      }
    }

    append_scope_closer();
  }
Exemplo n.º 2
0
  void Inspect::operator()(Declaration* dec)
  {
    if (dec->value()->concrete_type() == Expression::NULL_VAL) return;
    bool was_decl = in_declaration;
    in_declaration = true;
    if (output_style() == NESTED)
      indentation += dec->tabs();
    append_indentation();
    dec->property()->perform(this);
    append_colon_separator();

    if (dec->value()->concrete_type() == Expression::SELECTOR) {
      Listize listize(*ctx);
      dec->value()->perform(&listize)->perform(this);
    } else {
      dec->value()->perform(this);
    }

    if (dec->is_important()) {
      append_optional_space();
      append_string("!important");
    }
    append_delimiter();
    if (output_style() == NESTED)
      indentation -= dec->tabs();
    in_declaration = was_decl;
  }
Exemplo n.º 3
0
 // parameters and arguments
 void Inspect::operator()(Parameter* p)
 {
   append_token(p->name(), p);
   if (p->default_value()) {
     append_colon_separator();
     p->default_value()->perform(this);
   }
   else if (p->is_rest_parameter()) {
     append_string("...");
   }
 }
Exemplo n.º 4
0
 void Inspect::operator()(Assignment* assn)
 {
   append_token(assn->variable(), assn);
   append_colon_separator();
   assn->value()->perform(this);
   if (assn->is_default()) {
     append_optional_space();
     append_string("!default");
   }
   append_delimiter();
 }
Exemplo n.º 5
0
 void Inspect::operator()(At_Root_Expression* ae)
 {
   if (ae->is_interpolated()) {
     ae->feature()->perform(this);
   }
   else {
     append_string("(");
     ae->feature()->perform(this);
     if (ae->value()) {
       append_colon_separator();
       ae->value()->perform(this);
     }
     append_string(")");
   }
 }
Exemplo n.º 6
0
 void Inspect::operator()(Map* map)
 {
   if (map->empty()) return;
   if (map->is_invisible()) return;
   bool items_output = false;
   append_string("(");
   for (auto key : map->keys()) {
     if (items_output) append_comma_separator();
     key->perform(this);
     append_colon_separator();
     map->at(key)->perform(this);
     items_output = true;
   }
   append_string(")");
 }
Exemplo n.º 7
0
 void Inspect::operator()(Argument* a)
 {
   if (!a->name().empty()) {
     append_token(a->name(), a);
     append_colon_separator();
   }
   // Special case: argument nulls can be ignored
   if (a->value()->concrete_type() == Expression::NULL_VAL) {
     return;
   }
   if (a->value()->concrete_type() == Expression::STRING) {
     String_Constant* s = static_cast<String_Constant*>(a->value());
     s->perform(this);
   } else a->value()->perform(this);
   if (a->is_rest_argument()) {
     append_string("...");
   }
 }
Exemplo n.º 8
0
 void Inspect::operator()(Propset* propset)
 {
   propset->property_fragment()->perform(this);
   append_colon_separator();
   propset->block()->perform(this);
 }