sassc 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +5 -0
- data/ext/libsass/VERSION +1 -1
- data/ext/libsass/include/sass/context.h +3 -0
- data/ext/libsass/src/MurmurHash2.hpp +91 -0
- data/ext/libsass/src/ast.cpp +117 -117
- data/ext/libsass/src/ast.hpp +160 -162
- data/ext/libsass/src/ast_def_macros.hpp +10 -10
- data/ext/libsass/src/ast_fwd_decl.cpp +2 -2
- data/ext/libsass/src/ast_fwd_decl.hpp +61 -52
- data/ext/libsass/src/ast_helpers.hpp +5 -5
- data/ext/libsass/src/ast_sel_cmp.cpp +18 -18
- data/ext/libsass/src/ast_sel_super.cpp +52 -52
- data/ext/libsass/src/ast_sel_unify.cpp +16 -16
- data/ext/libsass/src/ast_sel_weave.cpp +62 -62
- data/ext/libsass/src/ast_selectors.cpp +87 -77
- data/ext/libsass/src/ast_selectors.hpp +72 -62
- data/ext/libsass/src/ast_supports.cpp +35 -35
- data/ext/libsass/src/ast_supports.hpp +29 -29
- data/ext/libsass/src/ast_values.cpp +58 -58
- data/ext/libsass/src/ast_values.hpp +75 -75
- data/ext/libsass/src/backtrace.cpp +9 -9
- data/ext/libsass/src/backtrace.hpp +5 -5
- data/ext/libsass/src/base64vlq.cpp +2 -2
- data/ext/libsass/src/base64vlq.hpp +1 -1
- data/ext/libsass/src/bind.cpp +17 -17
- data/ext/libsass/src/bind.hpp +1 -1
- data/ext/libsass/src/c2ast.cpp +3 -3
- data/ext/libsass/src/c2ast.hpp +1 -1
- data/ext/libsass/src/check_nesting.cpp +36 -36
- data/ext/libsass/src/check_nesting.hpp +2 -2
- data/ext/libsass/src/color_maps.cpp +5 -5
- data/ext/libsass/src/color_maps.hpp +1 -1
- data/ext/libsass/src/context.cpp +63 -60
- data/ext/libsass/src/context.hpp +33 -33
- data/ext/libsass/src/cssize.cpp +30 -29
- data/ext/libsass/src/cssize.hpp +13 -13
- data/ext/libsass/src/dart_helpers.hpp +5 -5
- data/ext/libsass/src/debugger.hpp +127 -128
- data/ext/libsass/src/emitter.cpp +12 -12
- data/ext/libsass/src/emitter.hpp +10 -10
- data/ext/libsass/src/environment.cpp +27 -27
- data/ext/libsass/src/environment.hpp +24 -24
- data/ext/libsass/src/error_handling.cpp +42 -42
- data/ext/libsass/src/error_handling.hpp +38 -50
- data/ext/libsass/src/eval.cpp +138 -132
- data/ext/libsass/src/eval.hpp +17 -17
- data/ext/libsass/src/eval_selectors.cpp +3 -3
- data/ext/libsass/src/expand.cpp +70 -64
- data/ext/libsass/src/expand.hpp +12 -12
- data/ext/libsass/src/extender.cpp +55 -53
- data/ext/libsass/src/extender.hpp +14 -14
- data/ext/libsass/src/file.cpp +66 -58
- data/ext/libsass/src/file.hpp +23 -25
- data/ext/libsass/src/fn_colors.cpp +9 -9
- data/ext/libsass/src/fn_lists.cpp +18 -18
- data/ext/libsass/src/fn_maps.cpp +3 -3
- data/ext/libsass/src/fn_miscs.cpp +15 -15
- data/ext/libsass/src/fn_numbers.cpp +7 -7
- data/ext/libsass/src/fn_selectors.cpp +8 -8
- data/ext/libsass/src/fn_strings.cpp +34 -22
- data/ext/libsass/src/fn_utils.cpp +29 -26
- data/ext/libsass/src/fn_utils.hpp +10 -10
- data/ext/libsass/src/inspect.cpp +35 -34
- data/ext/libsass/src/inspect.hpp +21 -21
- data/ext/libsass/src/lexer.cpp +3 -1
- data/ext/libsass/src/listize.cpp +2 -2
- data/ext/libsass/src/mapping.hpp +1 -0
- data/ext/libsass/src/memory.hpp +12 -0
- data/ext/libsass/src/memory/allocator.cpp +48 -0
- data/ext/libsass/src/memory/allocator.hpp +138 -0
- data/ext/libsass/src/memory/config.hpp +20 -0
- data/ext/libsass/src/memory/memory_pool.hpp +186 -0
- data/ext/libsass/src/memory/{SharedPtr.cpp → shared_ptr.cpp} +2 -2
- data/ext/libsass/src/memory/{SharedPtr.hpp → shared_ptr.hpp} +18 -6
- data/ext/libsass/src/operation.hpp +44 -44
- data/ext/libsass/src/operators.cpp +18 -18
- data/ext/libsass/src/operators.hpp +11 -11
- data/ext/libsass/src/ordered_map.hpp +18 -18
- data/ext/libsass/src/output.cpp +16 -16
- data/ext/libsass/src/output.hpp +5 -5
- data/ext/libsass/src/parser.cpp +327 -345
- data/ext/libsass/src/parser.hpp +77 -87
- data/ext/libsass/src/parser_selectors.cpp +6 -6
- data/ext/libsass/src/permutate.hpp +39 -15
- data/ext/libsass/src/plugins.cpp +7 -7
- data/ext/libsass/src/plugins.hpp +8 -8
- data/ext/libsass/src/position.cpp +7 -26
- data/ext/libsass/src/position.hpp +44 -21
- data/ext/libsass/src/remove_placeholders.cpp +4 -4
- data/ext/libsass/src/remove_placeholders.hpp +3 -3
- data/ext/libsass/src/sass.cpp +16 -15
- data/ext/libsass/src/sass.hpp +9 -5
- data/ext/libsass/src/sass_context.cpp +52 -34
- data/ext/libsass/src/sass_values.cpp +8 -10
- data/ext/libsass/src/settings.hpp +19 -0
- data/ext/libsass/src/source.cpp +69 -0
- data/ext/libsass/src/source.hpp +95 -0
- data/ext/libsass/src/source_data.hpp +32 -0
- data/ext/libsass/src/source_map.cpp +22 -18
- data/ext/libsass/src/source_map.hpp +12 -9
- data/ext/libsass/src/units.cpp +19 -19
- data/ext/libsass/src/units.hpp +8 -8
- data/ext/libsass/src/utf8_string.cpp +9 -10
- data/ext/libsass/src/utf8_string.hpp +7 -6
- data/ext/libsass/src/util.cpp +38 -38
- data/ext/libsass/src/util.hpp +18 -18
- data/ext/libsass/src/util_string.cpp +13 -13
- data/ext/libsass/src/util_string.hpp +9 -8
- data/ext/libsass/src/values.cpp +12 -12
- data/lib/sassc/native.rb +3 -5
- data/lib/sassc/version.rb +1 -1
- data/test/native_test.rb +4 -4
- metadata +14 -5
- data/lib/sassc/native/lib_c.rb +0 -21
@@ -20,20 +20,20 @@ namespace Sass {
|
|
20
20
|
|
21
21
|
namespace Exception {
|
22
22
|
|
23
|
-
const
|
24
|
-
const
|
25
|
-
const
|
26
|
-
const
|
23
|
+
const sass::string def_msg = "Invalid sass detected";
|
24
|
+
const sass::string def_op_msg = "Undefined operation";
|
25
|
+
const sass::string def_op_null_msg = "Invalid null operation";
|
26
|
+
const sass::string def_nesting_limit = "Code too deeply nested";
|
27
27
|
|
28
28
|
class Base : public std::runtime_error {
|
29
29
|
protected:
|
30
|
-
|
31
|
-
|
30
|
+
sass::string msg;
|
31
|
+
sass::string prefix;
|
32
32
|
public:
|
33
|
-
|
33
|
+
SourceSpan pstate;
|
34
34
|
Backtraces traces;
|
35
35
|
public:
|
36
|
-
Base(
|
36
|
+
Base(SourceSpan pstate, sass::string msg, Backtraces traces);
|
37
37
|
virtual const char* errtype() const { return prefix.c_str(); }
|
38
38
|
virtual const char* what() const throw() { return msg.c_str(); }
|
39
39
|
virtual ~Base() throw() {};
|
@@ -41,20 +41,8 @@ namespace Sass {
|
|
41
41
|
|
42
42
|
class InvalidSass : public Base {
|
43
43
|
public:
|
44
|
-
InvalidSass(
|
45
|
-
|
46
|
-
other.owned_src = nullptr;
|
47
|
-
}
|
48
|
-
|
49
|
-
// Required because the copy constructor's argument is not const.
|
50
|
-
// Can't use `std::move` here because we build on Visual Studio 2013.
|
51
|
-
InvalidSass(InvalidSass &&other) : Base(other), owned_src(other.owned_src) {
|
52
|
-
other.owned_src = nullptr;
|
53
|
-
}
|
54
|
-
|
55
|
-
InvalidSass(ParserState pstate, Backtraces traces, std::string msg, char* owned_src = nullptr);
|
56
|
-
virtual ~InvalidSass() throw() { sass_free_memory(owned_src); };
|
57
|
-
char *owned_src;
|
44
|
+
InvalidSass(SourceSpan pstate, Backtraces traces, sass::string msg);
|
45
|
+
virtual ~InvalidSass() throw() {};
|
58
46
|
};
|
59
47
|
|
60
48
|
class InvalidParent : public Base {
|
@@ -68,43 +56,43 @@ namespace Sass {
|
|
68
56
|
|
69
57
|
class MissingArgument : public Base {
|
70
58
|
protected:
|
71
|
-
|
72
|
-
|
73
|
-
|
59
|
+
sass::string fn;
|
60
|
+
sass::string arg;
|
61
|
+
sass::string fntype;
|
74
62
|
public:
|
75
|
-
MissingArgument(
|
63
|
+
MissingArgument(SourceSpan pstate, Backtraces traces, sass::string fn, sass::string arg, sass::string fntype);
|
76
64
|
virtual ~MissingArgument() throw() {};
|
77
65
|
};
|
78
66
|
|
79
67
|
class InvalidArgumentType : public Base {
|
80
68
|
protected:
|
81
|
-
|
82
|
-
|
83
|
-
|
69
|
+
sass::string fn;
|
70
|
+
sass::string arg;
|
71
|
+
sass::string type;
|
84
72
|
const Value* value;
|
85
73
|
public:
|
86
|
-
InvalidArgumentType(
|
74
|
+
InvalidArgumentType(SourceSpan pstate, Backtraces traces, sass::string fn, sass::string arg, sass::string type, const Value* value = 0);
|
87
75
|
virtual ~InvalidArgumentType() throw() {};
|
88
76
|
};
|
89
77
|
|
90
78
|
class InvalidVarKwdType : public Base {
|
91
79
|
protected:
|
92
|
-
|
80
|
+
sass::string name;
|
93
81
|
const Argument* arg;
|
94
82
|
public:
|
95
|
-
InvalidVarKwdType(
|
83
|
+
InvalidVarKwdType(SourceSpan pstate, Backtraces traces, sass::string name, const Argument* arg = 0);
|
96
84
|
virtual ~InvalidVarKwdType() throw() {};
|
97
85
|
};
|
98
86
|
|
99
87
|
class InvalidSyntax : public Base {
|
100
88
|
public:
|
101
|
-
InvalidSyntax(
|
89
|
+
InvalidSyntax(SourceSpan pstate, Backtraces traces, sass::string msg);
|
102
90
|
virtual ~InvalidSyntax() throw() {};
|
103
91
|
};
|
104
92
|
|
105
93
|
class NestingLimitError : public Base {
|
106
94
|
public:
|
107
|
-
NestingLimitError(
|
95
|
+
NestingLimitError(SourceSpan pstate, Backtraces traces, sass::string msg = def_nesting_limit);
|
108
96
|
virtual ~NestingLimitError() throw() {};
|
109
97
|
};
|
110
98
|
|
@@ -121,9 +109,9 @@ namespace Sass {
|
|
121
109
|
class TypeMismatch : public Base {
|
122
110
|
protected:
|
123
111
|
const Expression& var;
|
124
|
-
const
|
112
|
+
const sass::string type;
|
125
113
|
public:
|
126
|
-
TypeMismatch(Backtraces traces, const Expression& var, const
|
114
|
+
TypeMismatch(Backtraces traces, const Expression& var, const sass::string type);
|
127
115
|
virtual const char* errtype() const { return "Error"; }
|
128
116
|
virtual ~TypeMismatch() throw() {};
|
129
117
|
};
|
@@ -149,10 +137,10 @@ namespace Sass {
|
|
149
137
|
/* common virtual base class (has no pstate or trace) */
|
150
138
|
class OperationError : public std::runtime_error {
|
151
139
|
protected:
|
152
|
-
|
140
|
+
sass::string msg;
|
153
141
|
public:
|
154
|
-
OperationError(
|
155
|
-
: std::runtime_error(msg), msg(msg)
|
142
|
+
OperationError(sass::string msg = def_op_msg)
|
143
|
+
: std::runtime_error(msg.c_str()), msg(msg)
|
156
144
|
{};
|
157
145
|
public:
|
158
146
|
virtual const char* errtype() const { return "Error"; }
|
@@ -210,13 +198,13 @@ namespace Sass {
|
|
210
198
|
|
211
199
|
class SassValueError : public Base {
|
212
200
|
public:
|
213
|
-
SassValueError(Backtraces traces,
|
201
|
+
SassValueError(Backtraces traces, SourceSpan pstate, OperationError& err);
|
214
202
|
virtual ~SassValueError() throw() {};
|
215
203
|
};
|
216
204
|
|
217
205
|
class TopLevelParent : public Base {
|
218
206
|
public:
|
219
|
-
TopLevelParent(Backtraces traces,
|
207
|
+
TopLevelParent(Backtraces traces, SourceSpan pstate);
|
220
208
|
virtual ~TopLevelParent() throw() {};
|
221
209
|
};
|
222
210
|
|
@@ -234,17 +222,17 @@ namespace Sass {
|
|
234
222
|
|
235
223
|
}
|
236
224
|
|
237
|
-
void warn(
|
238
|
-
void warn(
|
239
|
-
void warning(
|
225
|
+
void warn(sass::string msg, SourceSpan pstate);
|
226
|
+
void warn(sass::string msg, SourceSpan pstate, Backtrace* bt);
|
227
|
+
void warning(sass::string msg, SourceSpan pstate);
|
240
228
|
|
241
|
-
void deprecated_function(
|
242
|
-
void deprecated(
|
243
|
-
void deprecated_bind(
|
244
|
-
// void deprecated(
|
229
|
+
void deprecated_function(sass::string msg, SourceSpan pstate);
|
230
|
+
void deprecated(sass::string msg, sass::string msg2, bool with_column, SourceSpan pstate);
|
231
|
+
void deprecated_bind(sass::string msg, SourceSpan pstate);
|
232
|
+
// void deprecated(sass::string msg, SourceSpan pstate, Backtrace* bt);
|
245
233
|
|
246
|
-
void coreError(
|
247
|
-
void error(
|
234
|
+
void coreError(sass::string msg, SourceSpan pstate);
|
235
|
+
void error(sass::string msg, SourceSpan pstate, Backtraces& traces);
|
248
236
|
|
249
237
|
}
|
250
238
|
|
data/ext/libsass/src/eval.cpp
CHANGED
@@ -30,6 +30,7 @@
|
|
30
30
|
#include "expand.hpp"
|
31
31
|
#include "color_maps.hpp"
|
32
32
|
#include "sass_functions.hpp"
|
33
|
+
#include "error_handling.hpp"
|
33
34
|
#include "util_string.hpp"
|
34
35
|
|
35
36
|
namespace Sass {
|
@@ -52,7 +53,7 @@ namespace Sass {
|
|
52
53
|
return exp.environment();
|
53
54
|
}
|
54
55
|
|
55
|
-
const
|
56
|
+
const sass::string Eval::cwd()
|
56
57
|
{
|
57
58
|
return ctx.cwd();
|
58
59
|
}
|
@@ -72,7 +73,7 @@ namespace Sass {
|
|
72
73
|
return exp.env_stack;
|
73
74
|
}
|
74
75
|
|
75
|
-
|
76
|
+
sass::vector<Sass_Callee>& Eval::callee_stack()
|
76
77
|
{
|
77
78
|
return ctx.callee_stack;
|
78
79
|
}
|
@@ -90,8 +91,14 @@ namespace Sass {
|
|
90
91
|
Expression* Eval::operator()(Assignment* a)
|
91
92
|
{
|
92
93
|
Env* env = environment();
|
93
|
-
|
94
|
+
sass::string var(a->variable());
|
94
95
|
if (a->is_global()) {
|
96
|
+
if (!env->has_global(var)) {
|
97
|
+
deprecated(
|
98
|
+
"!global assignments won't be able to declare new variables in future versions.",
|
99
|
+
"Consider adding `" + var + ": null` at the top level.",
|
100
|
+
true, a->pstate());
|
101
|
+
}
|
95
102
|
if (a->is_default()) {
|
96
103
|
if (env->has_global(var)) {
|
97
104
|
Expression* e = Cast<Expression>(env->get_global(var));
|
@@ -150,10 +157,10 @@ namespace Sass {
|
|
150
157
|
|
151
158
|
Expression* Eval::operator()(If* i)
|
152
159
|
{
|
153
|
-
|
160
|
+
ExpressionObj rv;
|
154
161
|
Env env(environment());
|
155
162
|
env_stack().push_back(&env);
|
156
|
-
|
163
|
+
ExpressionObj cond = i->predicate()->perform(this);
|
157
164
|
if (!cond->is_false()) {
|
158
165
|
rv = i->block()->perform(this);
|
159
166
|
}
|
@@ -167,15 +174,15 @@ namespace Sass {
|
|
167
174
|
|
168
175
|
// For does not create a new env scope
|
169
176
|
// But iteration vars are reset afterwards
|
170
|
-
Expression* Eval::operator()(
|
177
|
+
Expression* Eval::operator()(ForRule* f)
|
171
178
|
{
|
172
|
-
|
173
|
-
|
179
|
+
sass::string variable(f->variable());
|
180
|
+
ExpressionObj low = f->lower_bound()->perform(this);
|
174
181
|
if (low->concrete_type() != Expression::NUMBER) {
|
175
182
|
traces.push_back(Backtrace(low->pstate()));
|
176
183
|
throw Exception::TypeMismatch(traces, *low, "integer");
|
177
184
|
}
|
178
|
-
|
185
|
+
ExpressionObj high = f->upper_bound()->perform(this);
|
179
186
|
if (high->concrete_type() != Expression::NUMBER) {
|
180
187
|
traces.push_back(Backtrace(high->pstate()));
|
181
188
|
throw Exception::TypeMismatch(traces, *high, "integer");
|
@@ -184,7 +191,7 @@ namespace Sass {
|
|
184
191
|
Number_Obj sass_end = Cast<Number>(high);
|
185
192
|
// check if units are valid for sequence
|
186
193
|
if (sass_start->unit() != sass_end->unit()) {
|
187
|
-
|
194
|
+
sass::ostream msg; msg << "Incompatible units: '"
|
188
195
|
<< sass_end->unit() << "' and '"
|
189
196
|
<< sass_start->unit() << "'.";
|
190
197
|
error(msg.str(), low->pstate(), traces);
|
@@ -223,10 +230,10 @@ namespace Sass {
|
|
223
230
|
|
224
231
|
// Eval does not create a new env scope
|
225
232
|
// But iteration vars are reset afterwards
|
226
|
-
Expression* Eval::operator()(
|
233
|
+
Expression* Eval::operator()(EachRule* e)
|
227
234
|
{
|
228
|
-
|
229
|
-
|
235
|
+
sass::vector<sass::string> variables(e->variables());
|
236
|
+
ExpressionObj expr = e->list()->perform(this);
|
230
237
|
Env env(environment(), true);
|
231
238
|
env_stack().push_back(&env);
|
232
239
|
List_Obj list;
|
@@ -235,7 +242,7 @@ namespace Sass {
|
|
235
242
|
map = Cast<Map>(expr);
|
236
243
|
}
|
237
244
|
else if (SelectorList * ls = Cast<SelectorList>(expr)) {
|
238
|
-
|
245
|
+
ExpressionObj rv = Listize::perform(ls);
|
239
246
|
list = Cast<List>(rv);
|
240
247
|
}
|
241
248
|
else if (expr->concrete_type() != Expression::LIST) {
|
@@ -247,11 +254,11 @@ namespace Sass {
|
|
247
254
|
}
|
248
255
|
|
249
256
|
Block_Obj body = e->block();
|
250
|
-
|
257
|
+
ExpressionObj val;
|
251
258
|
|
252
259
|
if (map) {
|
253
|
-
for (
|
254
|
-
|
260
|
+
for (ExpressionObj key : map->keys()) {
|
261
|
+
ExpressionObj value = map->at(key);
|
255
262
|
|
256
263
|
if (variables.size() == 1) {
|
257
264
|
List* variable = SASS_MEMORY_NEW(List, map->pstate(), 2, SASS_SPACE);
|
@@ -281,12 +288,10 @@ namespace Sass {
|
|
281
288
|
Expression* var = scalars;
|
282
289
|
env.set_local(variables[0], var);
|
283
290
|
} else {
|
284
|
-
//
|
291
|
+
// https://github.com/sass/libsass/issues/3078
|
285
292
|
for (size_t j = 0, K = variables.size(); j < K; ++j) {
|
286
|
-
|
287
|
-
? SASS_MEMORY_NEW(Null, expr->pstate())
|
288
|
-
: scalars->at(j);
|
289
|
-
env.set_local(variables[j], res);
|
293
|
+
env.set_local(variables[j], j >= scalars->length()
|
294
|
+
? SASS_MEMORY_NEW(Null, expr->pstate()) : scalars->at(j));
|
290
295
|
}
|
291
296
|
}
|
292
297
|
} else {
|
@@ -307,15 +312,15 @@ namespace Sass {
|
|
307
312
|
return val.detach();
|
308
313
|
}
|
309
314
|
|
310
|
-
Expression* Eval::operator()(
|
315
|
+
Expression* Eval::operator()(WhileRule* w)
|
311
316
|
{
|
312
|
-
|
317
|
+
ExpressionObj pred = w->predicate();
|
313
318
|
Block_Obj body = w->block();
|
314
319
|
Env env(environment(), true);
|
315
320
|
env_stack().push_back(&env);
|
316
|
-
|
321
|
+
ExpressionObj cond = pred->perform(this);
|
317
322
|
while (!cond->is_false()) {
|
318
|
-
|
323
|
+
ExpressionObj val = body->perform(this);
|
319
324
|
if (val) {
|
320
325
|
env_stack().pop_back();
|
321
326
|
return val.detach();
|
@@ -331,11 +336,11 @@ namespace Sass {
|
|
331
336
|
return r->value()->perform(this);
|
332
337
|
}
|
333
338
|
|
334
|
-
Expression* Eval::operator()(
|
339
|
+
Expression* Eval::operator()(WarningRule* w)
|
335
340
|
{
|
336
341
|
Sass_Output_Style outstyle = options().output_style;
|
337
342
|
options().output_style = NESTED;
|
338
|
-
|
343
|
+
ExpressionObj message = w->message()->perform(this);
|
339
344
|
Env* env = environment();
|
340
345
|
|
341
346
|
// try to use generic function
|
@@ -344,9 +349,9 @@ namespace Sass {
|
|
344
349
|
// add call stack entry
|
345
350
|
callee_stack().push_back({
|
346
351
|
"@warn",
|
347
|
-
w->pstate().
|
348
|
-
w->pstate().
|
349
|
-
w->pstate().
|
352
|
+
w->pstate().getPath(),
|
353
|
+
w->pstate().getLine(),
|
354
|
+
w->pstate().getColumn(),
|
350
355
|
SASS_CALLEE_FUNCTION,
|
351
356
|
{ env }
|
352
357
|
});
|
@@ -369,7 +374,7 @@ namespace Sass {
|
|
369
374
|
|
370
375
|
}
|
371
376
|
|
372
|
-
|
377
|
+
sass::string result(unquote(message->to_sass()));
|
373
378
|
std::cerr << "WARNING: " << result << std::endl;
|
374
379
|
traces.push_back(Backtrace(w->pstate()));
|
375
380
|
std::cerr << traces_to_string(traces, " ");
|
@@ -379,11 +384,11 @@ namespace Sass {
|
|
379
384
|
return 0;
|
380
385
|
}
|
381
386
|
|
382
|
-
Expression* Eval::operator()(
|
387
|
+
Expression* Eval::operator()(ErrorRule* e)
|
383
388
|
{
|
384
389
|
Sass_Output_Style outstyle = options().output_style;
|
385
390
|
options().output_style = NESTED;
|
386
|
-
|
391
|
+
ExpressionObj message = e->message()->perform(this);
|
387
392
|
Env* env = environment();
|
388
393
|
|
389
394
|
// try to use generic function
|
@@ -392,9 +397,9 @@ namespace Sass {
|
|
392
397
|
// add call stack entry
|
393
398
|
callee_stack().push_back({
|
394
399
|
"@error",
|
395
|
-
e->pstate().
|
396
|
-
e->pstate().
|
397
|
-
e->pstate().
|
400
|
+
e->pstate().getPath(),
|
401
|
+
e->pstate().getLine(),
|
402
|
+
e->pstate().getColumn(),
|
398
403
|
SASS_CALLEE_FUNCTION,
|
399
404
|
{ env }
|
400
405
|
});
|
@@ -417,17 +422,17 @@ namespace Sass {
|
|
417
422
|
|
418
423
|
}
|
419
424
|
|
420
|
-
|
425
|
+
sass::string result(unquote(message->to_sass()));
|
421
426
|
options().output_style = outstyle;
|
422
427
|
error(result, e->pstate(), traces);
|
423
428
|
return 0;
|
424
429
|
}
|
425
430
|
|
426
|
-
Expression* Eval::operator()(
|
431
|
+
Expression* Eval::operator()(DebugRule* d)
|
427
432
|
{
|
428
433
|
Sass_Output_Style outstyle = options().output_style;
|
429
434
|
options().output_style = NESTED;
|
430
|
-
|
435
|
+
ExpressionObj message = d->value()->perform(this);
|
431
436
|
Env* env = environment();
|
432
437
|
|
433
438
|
// try to use generic function
|
@@ -436,9 +441,9 @@ namespace Sass {
|
|
436
441
|
// add call stack entry
|
437
442
|
callee_stack().push_back({
|
438
443
|
"@debug",
|
439
|
-
d->pstate().
|
440
|
-
d->pstate().
|
441
|
-
d->pstate().
|
444
|
+
d->pstate().getPath(),
|
445
|
+
d->pstate().getLine(),
|
446
|
+
d->pstate().getColumn(),
|
442
447
|
SASS_CALLEE_FUNCTION,
|
443
448
|
{ env }
|
444
449
|
});
|
@@ -461,13 +466,13 @@ namespace Sass {
|
|
461
466
|
|
462
467
|
}
|
463
468
|
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
469
|
+
sass::string result(unquote(message->to_sass()));
|
470
|
+
sass::string abs_path(Sass::File::rel2abs(d->pstate().getPath(), cwd(), cwd()));
|
471
|
+
sass::string rel_path(Sass::File::abs2rel(d->pstate().getPath(), cwd(), cwd()));
|
472
|
+
sass::string output_path(Sass::File::path_for_console(rel_path, abs_path, d->pstate().getPath()));
|
468
473
|
options().output_style = outstyle;
|
469
474
|
|
470
|
-
std::cerr << output_path << ":" << d->pstate().
|
475
|
+
std::cerr << output_path << ":" << d->pstate().getLine() << " DEBUG: " << result;
|
471
476
|
std::cerr << std::endl;
|
472
477
|
return 0;
|
473
478
|
}
|
@@ -482,8 +487,8 @@ namespace Sass {
|
|
482
487
|
l->length() / 2);
|
483
488
|
for (size_t i = 0, L = l->length(); i < L; i += 2)
|
484
489
|
{
|
485
|
-
|
486
|
-
|
490
|
+
ExpressionObj key = (*l)[i+0]->perform(this);
|
491
|
+
ExpressionObj val = (*l)[i+1]->perform(this);
|
487
492
|
// make sure the color key never displays its real name
|
488
493
|
key->is_delayed(true); // verified
|
489
494
|
*lm << std::make_pair(key, val);
|
@@ -549,8 +554,8 @@ namespace Sass {
|
|
549
554
|
Expression* Eval::operator()(Binary_Expression* b_in)
|
550
555
|
{
|
551
556
|
|
552
|
-
|
553
|
-
|
557
|
+
ExpressionObj lhs = b_in->left();
|
558
|
+
ExpressionObj rhs = b_in->right();
|
554
559
|
enum Sass_OP op_type = b_in->optype();
|
555
560
|
|
556
561
|
if (op_type == Sass_OP::AND) {
|
@@ -574,7 +579,7 @@ namespace Sass {
|
|
574
579
|
rhs = operator()(r_v);
|
575
580
|
}
|
576
581
|
|
577
|
-
|
582
|
+
Binary_ExpressionObj b = b_in;
|
578
583
|
|
579
584
|
// Evaluate sub-expressions early on
|
580
585
|
while (Binary_Expression* l_b = Cast<Binary_Expression>(lhs)) {
|
@@ -686,7 +691,7 @@ namespace Sass {
|
|
686
691
|
if (String_Schema* s_l = Cast<String_Schema>(b->left())) {
|
687
692
|
if (!s_l->has_interpolant() && (!s_l->is_right_interpolant())) {
|
688
693
|
ret_schema = SASS_MEMORY_NEW(String_Schema, b->pstate());
|
689
|
-
|
694
|
+
Binary_ExpressionObj bin_ex = SASS_MEMORY_NEW(Binary_Expression, b->pstate(),
|
690
695
|
b->op(), s_l->last(), b->right());
|
691
696
|
bin_ex->is_delayed(b->left()->is_delayed() || b->right()->is_delayed()); // unverified
|
692
697
|
for (size_t i = 0; i < s_l->length() - 1; ++i) {
|
@@ -700,7 +705,7 @@ namespace Sass {
|
|
700
705
|
|
701
706
|
if (!s_r->has_interpolant() && (!s_r->is_left_interpolant() || op_type == Sass_OP::DIV)) {
|
702
707
|
ret_schema = SASS_MEMORY_NEW(String_Schema, b->pstate());
|
703
|
-
|
708
|
+
Binary_ExpressionObj bin_ex = SASS_MEMORY_NEW(Binary_Expression, b->pstate(),
|
704
709
|
b->op(), b->left(), s_r->first());
|
705
710
|
bin_ex->is_delayed(b->left()->is_delayed() || b->right()->is_delayed()); // verified
|
706
711
|
ret_schema->append(bin_ex->perform(this));
|
@@ -742,8 +747,8 @@ namespace Sass {
|
|
742
747
|
// Is one of the operands an interpolant?
|
743
748
|
String_Schema_Obj s1 = Cast<String_Schema>(b->left());
|
744
749
|
String_Schema_Obj s2 = Cast<String_Schema>(b->right());
|
745
|
-
|
746
|
-
|
750
|
+
Binary_ExpressionObj b1 = Cast<Binary_Expression>(b->left());
|
751
|
+
Binary_ExpressionObj b2 = Cast<Binary_Expression>(b->right());
|
747
752
|
|
748
753
|
bool schema_op = false;
|
749
754
|
|
@@ -758,7 +763,7 @@ namespace Sass {
|
|
758
763
|
op_type == Sass_OP::EQ) {
|
759
764
|
// If possible upgrade LHS to a number (for number to string compare)
|
760
765
|
if (String_Constant* str = Cast<String_Constant>(lhs)) {
|
761
|
-
|
766
|
+
sass::string value(str->value());
|
762
767
|
const char* start = value.c_str();
|
763
768
|
if (Prelexer::sequence < Prelexer::dimension, Prelexer::end_of_file >(start) != 0) {
|
764
769
|
lhs = Parser::lexed_dimension(b->pstate(), str->value());
|
@@ -766,7 +771,7 @@ namespace Sass {
|
|
766
771
|
}
|
767
772
|
// If possible upgrade RHS to a number (for string to number compare)
|
768
773
|
if (String_Constant* str = Cast<String_Constant>(rhs)) {
|
769
|
-
|
774
|
+
sass::string value(str->value());
|
770
775
|
const char* start = value.c_str();
|
771
776
|
if (Prelexer::sequence < Prelexer::dimension, Prelexer::number >(start) != 0) {
|
772
777
|
rhs = Parser::lexed_dimension(b->pstate(), str->value());
|
@@ -775,11 +780,11 @@ namespace Sass {
|
|
775
780
|
}
|
776
781
|
|
777
782
|
To_Value to_value(ctx);
|
778
|
-
|
779
|
-
|
783
|
+
ValueObj v_l = Cast<Value>(lhs->perform(&to_value));
|
784
|
+
ValueObj v_r = Cast<Value>(rhs->perform(&to_value));
|
780
785
|
|
781
786
|
if (force_delay) {
|
782
|
-
|
787
|
+
sass::string str("");
|
783
788
|
str += v_l->to_string(options());
|
784
789
|
if (b->op().ws_before) str += " ";
|
785
790
|
str += b->separator();
|
@@ -814,9 +819,9 @@ namespace Sass {
|
|
814
819
|
|
815
820
|
// ToDo: throw error in op functions
|
816
821
|
// ToDo: then catch and re-throw them
|
817
|
-
|
822
|
+
ExpressionObj rv;
|
818
823
|
try {
|
819
|
-
|
824
|
+
SourceSpan pstate(b->pstate());
|
820
825
|
if (l_type == Expression::NUMBER && r_type == Expression::NUMBER) {
|
821
826
|
Number* l_n = Cast<Number>(lhs);
|
822
827
|
Number* r_n = Cast<Number>(rhs);
|
@@ -841,8 +846,8 @@ namespace Sass {
|
|
841
846
|
else {
|
842
847
|
To_Value to_value(ctx);
|
843
848
|
// this will leak if perform does not return a value!
|
844
|
-
|
845
|
-
|
849
|
+
ValueObj v_l = Cast<Value>(lhs->perform(&to_value));
|
850
|
+
ValueObj v_r = Cast<Value>(rhs->perform(&to_value));
|
846
851
|
bool interpolant = b->is_right_interpolant() ||
|
847
852
|
b->is_left_interpolant() ||
|
848
853
|
b->is_interpolant();
|
@@ -895,7 +900,7 @@ namespace Sass {
|
|
895
900
|
|
896
901
|
Expression* Eval::operator()(Unary_Expression* u)
|
897
902
|
{
|
898
|
-
|
903
|
+
ExpressionObj operand = u->operand()->perform(this);
|
899
904
|
if (u->optype() == Unary_Expression::NOT) {
|
900
905
|
Boolean* result = SASS_MEMORY_NEW(Boolean, u->pstate(), (bool)*operand);
|
901
906
|
result->value(!result->value());
|
@@ -909,7 +914,7 @@ namespace Sass {
|
|
909
914
|
return cpy.detach(); // return the copy
|
910
915
|
}
|
911
916
|
else if (u->optype() == Unary_Expression::SLASH) {
|
912
|
-
|
917
|
+
sass::string str = '/' + nr->to_string(options());
|
913
918
|
return SASS_MEMORY_NEW(String_Constant, u->pstate(), str);
|
914
919
|
}
|
915
920
|
// nothing for positive
|
@@ -925,7 +930,7 @@ namespace Sass {
|
|
925
930
|
else if (Color* color = Cast<Color>(operand)) {
|
926
931
|
// Use the color name if this was eval with one
|
927
932
|
if (color->disp().length() > 0) {
|
928
|
-
|
933
|
+
Unary_ExpressionObj cpy = SASS_MEMORY_COPY(u);
|
929
934
|
cpy->operand(SASS_MEMORY_NEW(String_Constant, operand->pstate(), color->disp()));
|
930
935
|
return SASS_MEMORY_NEW(String_Quoted,
|
931
936
|
cpy->pstate(),
|
@@ -933,7 +938,7 @@ namespace Sass {
|
|
933
938
|
}
|
934
939
|
}
|
935
940
|
else {
|
936
|
-
|
941
|
+
Unary_ExpressionObj cpy = SASS_MEMORY_COPY(u);
|
937
942
|
cpy->operand(operand);
|
938
943
|
return SASS_MEMORY_NEW(String_Quoted,
|
939
944
|
cpy->pstate(),
|
@@ -952,21 +957,21 @@ namespace Sass {
|
|
952
957
|
{
|
953
958
|
if (traces.size() > Constants::MaxCallStack) {
|
954
959
|
// XXX: this is never hit via spec tests
|
955
|
-
|
960
|
+
sass::ostream stm;
|
956
961
|
stm << "Stack depth exceeded max of " << Constants::MaxCallStack;
|
957
962
|
error(stm.str(), c->pstate(), traces);
|
958
963
|
}
|
959
964
|
|
960
965
|
if (Cast<String_Schema>(c->sname())) {
|
961
|
-
|
962
|
-
|
963
|
-
|
966
|
+
ExpressionObj evaluated_name = c->sname()->perform(this);
|
967
|
+
ExpressionObj evaluated_args = c->arguments()->perform(this);
|
968
|
+
sass::string str(evaluated_name->to_string());
|
964
969
|
str += evaluated_args->to_string();
|
965
970
|
return SASS_MEMORY_NEW(String_Constant, c->pstate(), str);
|
966
971
|
}
|
967
972
|
|
968
|
-
|
969
|
-
|
973
|
+
sass::string name(Util::normalize_underscores(c->name()));
|
974
|
+
sass::string full_name(name + "[f]");
|
970
975
|
|
971
976
|
// we make a clone here, need to implement that further
|
972
977
|
Arguments_Obj args = c->arguments();
|
@@ -1010,7 +1015,7 @@ namespace Sass {
|
|
1010
1015
|
if (c->func()) def = c->func()->definition();
|
1011
1016
|
|
1012
1017
|
if (def->is_overload_stub()) {
|
1013
|
-
|
1018
|
+
sass::ostream ss;
|
1014
1019
|
size_t L = args->length();
|
1015
1020
|
// account for rest arguments
|
1016
1021
|
if (args->has_rest_argument() && args->length() > 0) {
|
@@ -1021,12 +1026,12 @@ namespace Sass {
|
|
1021
1026
|
}
|
1022
1027
|
ss << full_name << L;
|
1023
1028
|
full_name = ss.str();
|
1024
|
-
|
1025
|
-
if (!env->has(resolved_name)) error("overloaded function `" +
|
1029
|
+
sass::string resolved_name(full_name);
|
1030
|
+
if (!env->has(resolved_name)) error("overloaded function `" + sass::string(c->name()) + "` given wrong number of arguments", c->pstate(), traces);
|
1026
1031
|
def = Cast<Definition>((*env)[resolved_name]);
|
1027
1032
|
}
|
1028
1033
|
|
1029
|
-
|
1034
|
+
ExpressionObj result = c;
|
1030
1035
|
Block_Obj body = def->block();
|
1031
1036
|
Native_Function func = def->native_function();
|
1032
1037
|
Sass_Function_Entry c_function = def->c_function();
|
@@ -1038,14 +1043,14 @@ namespace Sass {
|
|
1038
1043
|
env_stack().push_back(&fn_env);
|
1039
1044
|
|
1040
1045
|
if (func || body) {
|
1041
|
-
bind(
|
1042
|
-
|
1046
|
+
bind(sass::string("Function"), c->name(), params, args, &fn_env, this, traces);
|
1047
|
+
sass::string msg(", in function `" + c->name() + "`");
|
1043
1048
|
traces.push_back(Backtrace(c->pstate(), msg));
|
1044
1049
|
callee_stack().push_back({
|
1045
1050
|
c->name().c_str(),
|
1046
|
-
c->pstate().
|
1047
|
-
c->pstate().
|
1048
|
-
c->pstate().
|
1051
|
+
c->pstate().getPath(),
|
1052
|
+
c->pstate().getLine(),
|
1053
|
+
c->pstate().getColumn(),
|
1049
1054
|
SASS_CALLEE_FUNCTION,
|
1050
1055
|
{ env }
|
1051
1056
|
});
|
@@ -1058,7 +1063,7 @@ namespace Sass {
|
|
1058
1063
|
result = func(fn_env, *env, ctx, def->signature(), c->pstate(), traces, exp.getSelectorStack(), exp.originalStack);
|
1059
1064
|
}
|
1060
1065
|
if (!result) {
|
1061
|
-
error(
|
1066
|
+
error(sass::string("Function ") + c->name() + " finished without @return", c->pstate(), traces);
|
1062
1067
|
}
|
1063
1068
|
callee_stack().pop_back();
|
1064
1069
|
traces.pop_back();
|
@@ -1077,15 +1082,15 @@ namespace Sass {
|
|
1077
1082
|
}
|
1078
1083
|
|
1079
1084
|
// populates env with default values for params
|
1080
|
-
|
1081
|
-
bind(
|
1082
|
-
|
1085
|
+
sass::string ff(c->name());
|
1086
|
+
bind(sass::string("Function"), c->name(), params, args, &fn_env, this, traces);
|
1087
|
+
sass::string msg(", in function `" + c->name() + "`");
|
1083
1088
|
traces.push_back(Backtrace(c->pstate(), msg));
|
1084
1089
|
callee_stack().push_back({
|
1085
1090
|
c->name().c_str(),
|
1086
|
-
c->pstate().
|
1087
|
-
c->pstate().
|
1088
|
-
c->pstate().
|
1091
|
+
c->pstate().getPath(),
|
1092
|
+
c->pstate().getLine(),
|
1093
|
+
c->pstate().getColumn(),
|
1089
1094
|
SASS_CALLEE_C_FUNCTION,
|
1090
1095
|
{ env }
|
1091
1096
|
});
|
@@ -1094,19 +1099,19 @@ namespace Sass {
|
|
1094
1099
|
union Sass_Value* c_args = sass_make_list(params->length(), SASS_COMMA, false);
|
1095
1100
|
for(size_t i = 0; i < params->length(); i++) {
|
1096
1101
|
Parameter_Obj param = params->at(i);
|
1097
|
-
|
1102
|
+
sass::string key = param->name();
|
1098
1103
|
AST_Node_Obj node = fn_env.get_local(key);
|
1099
|
-
|
1104
|
+
ExpressionObj arg = Cast<Expression>(node);
|
1100
1105
|
sass_list_set_value(c_args, i, arg->perform(&ast2c));
|
1101
1106
|
}
|
1102
1107
|
union Sass_Value* c_val = c_func(c_args, c_function, compiler());
|
1103
1108
|
if (sass_value_get_tag(c_val) == SASS_ERROR) {
|
1104
|
-
|
1109
|
+
sass::string message("error in C function " + c->name() + ": " + sass_error_get_message(c_val));
|
1105
1110
|
sass_delete_value(c_val);
|
1106
1111
|
sass_delete_value(c_args);
|
1107
1112
|
error(message, c->pstate(), traces);
|
1108
1113
|
} else if (sass_value_get_tag(c_val) == SASS_WARNING) {
|
1109
|
-
|
1114
|
+
sass::string message("warning in C function " + c->name() + ": " + sass_warning_get_message(c_val));
|
1110
1115
|
sass_delete_value(c_val);
|
1111
1116
|
sass_delete_value(c_args);
|
1112
1117
|
error(message, c->pstate(), traces);
|
@@ -1122,7 +1127,7 @@ namespace Sass {
|
|
1122
1127
|
|
1123
1128
|
// link back to function definition
|
1124
1129
|
// only do this for custom functions
|
1125
|
-
if (result->pstate().
|
1130
|
+
if (result->pstate().getSrcId() == sass::string::npos)
|
1126
1131
|
result->pstate(c->pstate());
|
1127
1132
|
|
1128
1133
|
result = result->perform(this);
|
@@ -1133,9 +1138,9 @@ namespace Sass {
|
|
1133
1138
|
|
1134
1139
|
Expression* Eval::operator()(Variable* v)
|
1135
1140
|
{
|
1136
|
-
|
1141
|
+
ExpressionObj value;
|
1137
1142
|
Env* env = environment();
|
1138
|
-
const
|
1143
|
+
const sass::string& name(v->name());
|
1139
1144
|
EnvResult rv(env->find(name));
|
1140
1145
|
if (rv.found) value = static_cast<Expression*>(rv.it->second.ptr());
|
1141
1146
|
else error("Undefined variable: \"" + v->name() + "\".", v->pstate(), traces);
|
@@ -1169,7 +1174,7 @@ namespace Sass {
|
|
1169
1174
|
return b;
|
1170
1175
|
}
|
1171
1176
|
|
1172
|
-
void Eval::interpolation(Context& ctx,
|
1177
|
+
void Eval::interpolation(Context& ctx, sass::string& res, ExpressionObj ex, bool into_quotes, bool was_itpl) {
|
1173
1178
|
|
1174
1179
|
bool needs_closing_brace = false;
|
1175
1180
|
|
@@ -1214,9 +1219,9 @@ namespace Sass {
|
|
1214
1219
|
List_Obj ll = SASS_MEMORY_NEW(List, l->pstate(), 0, l->separator());
|
1215
1220
|
// this fixes an issue with bourbon sample, not really sure why
|
1216
1221
|
// if (l->size() && Cast<Null>((*l)[0])) { res += ""; }
|
1217
|
-
for(
|
1222
|
+
for(ExpressionObj item : *l) {
|
1218
1223
|
item->is_interpolant(l->is_interpolant());
|
1219
|
-
|
1224
|
+
sass::string rl(""); interpolation(ctx, rl, item, into_quotes, l->is_interpolant());
|
1220
1225
|
bool is_null = Cast<Null>(item) != 0; // rl != ""
|
1221
1226
|
if (!is_null) ll->append(SASS_MEMORY_NEW(String_Quoted, item->pstate(), rl));
|
1222
1227
|
}
|
@@ -1224,7 +1229,7 @@ namespace Sass {
|
|
1224
1229
|
// here. Normally single list items are already unwrapped.
|
1225
1230
|
if (l->size() > 1) {
|
1226
1231
|
// string_to_output would fail "#{'_\a' '_\a'}";
|
1227
|
-
|
1232
|
+
sass::string str(ll->to_string(options()));
|
1228
1233
|
str = read_hex_escapes(str); // read escapes
|
1229
1234
|
newline_to_space(str); // replace directly
|
1230
1235
|
res += str; // append to result string
|
@@ -1245,7 +1250,7 @@ namespace Sass {
|
|
1245
1250
|
if (into_quotes && ex->is_interpolant()) {
|
1246
1251
|
res += evacuate_escapes(ex ? ex->to_string(options()) : "");
|
1247
1252
|
} else {
|
1248
|
-
|
1253
|
+
sass::string str(ex ? ex->to_string(options()) : "");
|
1249
1254
|
if (into_quotes) str = read_hex_escapes(str);
|
1250
1255
|
res += str; // append to result string
|
1251
1256
|
}
|
@@ -1273,12 +1278,12 @@ namespace Sass {
|
|
1273
1278
|
}
|
1274
1279
|
bool was_quoted = false;
|
1275
1280
|
bool was_interpolant = false;
|
1276
|
-
|
1281
|
+
sass::string res("");
|
1277
1282
|
for (size_t i = 0; i < L; ++i) {
|
1278
1283
|
bool is_quoted = Cast<String_Quoted>((*s)[i]) != NULL;
|
1279
1284
|
if (was_quoted && !(*s)[i]->is_interpolant() && !was_interpolant) { res += " "; }
|
1280
1285
|
else if (i > 0 && is_quoted && !(*s)[i]->is_interpolant() && !was_interpolant) { res += " "; }
|
1281
|
-
|
1286
|
+
ExpressionObj ex = (*s)[i]->perform(this);
|
1282
1287
|
interpolation(ctx, res, ex, into_quotes, ex->is_interpolant());
|
1283
1288
|
was_quoted = Cast<String_Quoted>((*s)[i]) != NULL;
|
1284
1289
|
was_interpolant = (*s)[i]->is_interpolant();
|
@@ -1286,7 +1291,8 @@ namespace Sass {
|
|
1286
1291
|
}
|
1287
1292
|
if (!s->is_interpolant()) {
|
1288
1293
|
if (s->length() > 1 && res == "") return SASS_MEMORY_NEW(Null, s->pstate());
|
1289
|
-
|
1294
|
+
String_Constant_Obj str = SASS_MEMORY_NEW(String_Constant, s->pstate(), res, s->css());
|
1295
|
+
return str.detach();
|
1290
1296
|
}
|
1291
1297
|
// string schema seems to have a special unquoting behavior (also handles "nested" quotes)
|
1292
1298
|
String_Quoted_Obj str = SASS_MEMORY_NEW(String_Quoted, s->pstate(), res, 0, false, false, false, s->css());
|
@@ -1313,32 +1319,32 @@ namespace Sass {
|
|
1313
1319
|
return str;
|
1314
1320
|
}
|
1315
1321
|
|
1316
|
-
Expression* Eval::operator()(
|
1322
|
+
Expression* Eval::operator()(SupportsOperation* c)
|
1317
1323
|
{
|
1318
1324
|
Expression* left = c->left()->perform(this);
|
1319
1325
|
Expression* right = c->right()->perform(this);
|
1320
|
-
|
1326
|
+
SupportsOperation* cc = SASS_MEMORY_NEW(SupportsOperation,
|
1321
1327
|
c->pstate(),
|
1322
|
-
Cast<
|
1323
|
-
Cast<
|
1328
|
+
Cast<SupportsCondition>(left),
|
1329
|
+
Cast<SupportsCondition>(right),
|
1324
1330
|
c->operand());
|
1325
1331
|
return cc;
|
1326
1332
|
}
|
1327
1333
|
|
1328
|
-
Expression* Eval::operator()(
|
1334
|
+
Expression* Eval::operator()(SupportsNegation* c)
|
1329
1335
|
{
|
1330
1336
|
Expression* condition = c->condition()->perform(this);
|
1331
|
-
|
1337
|
+
SupportsNegation* cc = SASS_MEMORY_NEW(SupportsNegation,
|
1332
1338
|
c->pstate(),
|
1333
|
-
Cast<
|
1339
|
+
Cast<SupportsCondition>(condition));
|
1334
1340
|
return cc;
|
1335
1341
|
}
|
1336
1342
|
|
1337
|
-
Expression* Eval::operator()(
|
1343
|
+
Expression* Eval::operator()(SupportsDeclaration* c)
|
1338
1344
|
{
|
1339
1345
|
Expression* feature = c->feature()->perform(this);
|
1340
1346
|
Expression* value = c->value()->perform(this);
|
1341
|
-
|
1347
|
+
SupportsDeclaration* cc = SASS_MEMORY_NEW(SupportsDeclaration,
|
1342
1348
|
c->pstate(),
|
1343
1349
|
feature,
|
1344
1350
|
value);
|
@@ -1356,9 +1362,9 @@ namespace Sass {
|
|
1356
1362
|
|
1357
1363
|
Expression* Eval::operator()(At_Root_Query* e)
|
1358
1364
|
{
|
1359
|
-
|
1365
|
+
ExpressionObj feature = e->feature();
|
1360
1366
|
feature = (feature ? feature->perform(this) : 0);
|
1361
|
-
|
1367
|
+
ExpressionObj value = e->value();
|
1362
1368
|
value = (value ? value->perform(this) : 0);
|
1363
1369
|
Expression* ee = SASS_MEMORY_NEW(At_Root_Query,
|
1364
1370
|
e->pstate(),
|
@@ -1385,14 +1391,14 @@ namespace Sass {
|
|
1385
1391
|
|
1386
1392
|
Expression* Eval::operator()(Media_Query_Expression* e)
|
1387
1393
|
{
|
1388
|
-
|
1394
|
+
ExpressionObj feature = e->feature();
|
1389
1395
|
feature = (feature ? feature->perform(this) : 0);
|
1390
1396
|
if (feature && Cast<String_Quoted>(feature)) {
|
1391
1397
|
feature = SASS_MEMORY_NEW(String_Quoted,
|
1392
1398
|
feature->pstate(),
|
1393
1399
|
Cast<String_Quoted>(feature)->value());
|
1394
1400
|
}
|
1395
|
-
|
1401
|
+
ExpressionObj value = e->value();
|
1396
1402
|
value = (value ? value->perform(this) : 0);
|
1397
1403
|
if (value && Cast<String_Quoted>(value)) {
|
1398
1404
|
// XXX: this is never hit via spec tests
|
@@ -1414,7 +1420,7 @@ namespace Sass {
|
|
1414
1420
|
|
1415
1421
|
Expression* Eval::operator()(Argument* a)
|
1416
1422
|
{
|
1417
|
-
|
1423
|
+
ExpressionObj val = a->value()->perform(this);
|
1418
1424
|
bool is_rest_argument = a->is_rest_argument();
|
1419
1425
|
bool is_keyword_argument = a->is_keyword_argument();
|
1420
1426
|
|
@@ -1446,7 +1452,7 @@ namespace Sass {
|
|
1446
1452
|
Arguments_Obj aa = SASS_MEMORY_NEW(Arguments, a->pstate());
|
1447
1453
|
if (a->length() == 0) return aa.detach();
|
1448
1454
|
for (size_t i = 0, L = a->length(); i < L; ++i) {
|
1449
|
-
|
1455
|
+
ExpressionObj rv = (*a)[i]->perform(this);
|
1450
1456
|
Argument* arg = Cast<Argument>(rv);
|
1451
1457
|
if (!(arg->is_rest_argument() || arg->is_keyword_argument())) {
|
1452
1458
|
aa->append(arg);
|
@@ -1454,8 +1460,8 @@ namespace Sass {
|
|
1454
1460
|
}
|
1455
1461
|
|
1456
1462
|
if (a->has_rest_argument()) {
|
1457
|
-
|
1458
|
-
|
1463
|
+
ExpressionObj rest = a->get_rest_argument()->perform(this);
|
1464
|
+
ExpressionObj splat = Cast<Argument>(rest)->value()->perform(this);
|
1459
1465
|
|
1460
1466
|
Sass_Separator separator = SASS_COMMA;
|
1461
1467
|
List* ls = Cast<List>(splat);
|
@@ -1482,9 +1488,9 @@ namespace Sass {
|
|
1482
1488
|
}
|
1483
1489
|
|
1484
1490
|
if (a->has_keyword_argument()) {
|
1485
|
-
|
1491
|
+
ExpressionObj rv = a->get_keyword_argument()->perform(this);
|
1486
1492
|
Argument* rvarg = Cast<Argument>(rv);
|
1487
|
-
|
1493
|
+
ExpressionObj kwarg = rvarg->value()->perform(this);
|
1488
1494
|
|
1489
1495
|
aa->append(SASS_MEMORY_NEW(Argument, kwarg->pstate(), kwarg, "", false, true));
|
1490
1496
|
}
|
@@ -1500,12 +1506,12 @@ namespace Sass {
|
|
1500
1506
|
{
|
1501
1507
|
LOCAL_FLAG(is_in_selector_schema, true);
|
1502
1508
|
// the parser will look for a brace to end the selector
|
1503
|
-
|
1504
|
-
|
1509
|
+
ExpressionObj sel = s->contents()->perform(this);
|
1510
|
+
sass::string result_str(sel->to_string(options()));
|
1505
1511
|
result_str = unquote(Util::rtrim(result_str));
|
1506
|
-
|
1507
|
-
|
1508
|
-
Parser p
|
1512
|
+
ItplFile* source = SASS_MEMORY_NEW(ItplFile,
|
1513
|
+
result_str.c_str(), s->pstate());
|
1514
|
+
Parser p(source, ctx, traces);
|
1509
1515
|
|
1510
1516
|
// If a schema contains a reference to parent it is already
|
1511
1517
|
// connected to it, so don't connect implicitly anymore
|
@@ -1528,7 +1534,7 @@ namespace Sass {
|
|
1528
1534
|
return s;
|
1529
1535
|
}
|
1530
1536
|
|
1531
|
-
|
1537
|
+
PseudoSelector* Eval::operator()(PseudoSelector* pseudo)
|
1532
1538
|
{
|
1533
1539
|
// ToDo: should we eval selector?
|
1534
1540
|
return pseudo;
|