Exemple #1
0
 union Sass_Value* To_C::operator()(Arguments* a)
 {
   union Sass_Value* v = sass_make_list(a->length(), SASS_COMMA);
   for (size_t i = 0, L = a->length(); i < L; ++i) {
     sass_list_set_value(v, i, (*a)[i]->perform(this));
   }
   return v;
 }
Exemple #2
0
 union Sass_Value* To_C::operator()(List* l)
 {
   union Sass_Value* v = sass_make_list(l->length(), l->separator());
   for (size_t i = 0, L = l->length(); i < L; ++i) {
     sass_list_set_value(v, i, (*l)[i]->perform(this));
   }
   return v;
 }
Exemple #3
0
  Sass_Value* List::construct(const std::vector<v8::Local<v8::Value>> raw_val, Sass_Value **out) {
    size_t length = 0;
    bool comma = true;

    if (raw_val.size() >= 1) {
      if (!raw_val[0]->IsNumber()) {
        return fail("First argument should be an integer.", out);
      }

      length = Nan::To<uint32_t>(raw_val[0]).FromJust();

      if (raw_val.size() >= 2) {
        if (!raw_val[1]->IsBoolean()) {
          return fail("Second argument should be a boolean.", out);
        }

        comma = Nan::To<bool>(raw_val[1]).FromJust();
      }
    }

    return *out = sass_make_list(length, comma ? SASS_COMMA : SASS_SPACE);
  }