sassc 1.11.4 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +2 -2
  3. data/CODE_OF_CONDUCT.md +10 -0
  4. data/README.md +4 -1
  5. data/ext/libsass/.editorconfig +1 -1
  6. data/ext/libsass/.github/CONTRIBUTING.md +7 -7
  7. data/ext/libsass/.github/ISSUE_TEMPLATE.md +31 -6
  8. data/ext/libsass/.gitignore +3 -0
  9. data/ext/libsass/.travis.yml +37 -18
  10. data/ext/libsass/GNUmakefile.am +23 -37
  11. data/ext/libsass/Makefile +10 -6
  12. data/ext/libsass/Makefile.conf +3 -0
  13. data/ext/libsass/Readme.md +68 -63
  14. data/ext/libsass/appveyor.yml +7 -3
  15. data/ext/libsass/configure.ac +10 -14
  16. data/ext/libsass/docs/api-context-internal.md +29 -21
  17. data/ext/libsass/docs/api-context.md +26 -6
  18. data/ext/libsass/docs/api-doc.md +49 -16
  19. data/ext/libsass/docs/api-function-example.md +1 -1
  20. data/ext/libsass/docs/api-function.md +31 -7
  21. data/ext/libsass/docs/api-importer.md +19 -19
  22. data/ext/libsass/docs/api-value.md +4 -2
  23. data/ext/libsass/docs/build-on-windows.md +4 -4
  24. data/ext/libsass/docs/build-with-mingw.md +3 -3
  25. data/ext/libsass/docs/build.md +9 -9
  26. data/ext/libsass/docs/custom-functions-internal.md +10 -8
  27. data/ext/libsass/docs/implementations.md +20 -8
  28. data/ext/libsass/docs/unicode.md +16 -10
  29. data/ext/libsass/include/sass/base.h +0 -3
  30. data/ext/libsass/include/sass/context.h +20 -2
  31. data/ext/libsass/include/sass/functions.h +31 -0
  32. data/ext/libsass/include/sass/values.h +3 -1
  33. data/ext/libsass/include/sass/version.h +1 -1
  34. data/ext/libsass/include/sass/version.h.in +1 -1
  35. data/ext/libsass/include/sass2scss.h +1 -1
  36. data/ext/libsass/res/resource.rc +6 -6
  37. data/ext/libsass/script/ci-build-libsass +10 -5
  38. data/ext/libsass/script/ci-build-plugin +62 -0
  39. data/ext/libsass/script/ci-install-compiler +1 -1
  40. data/ext/libsass/script/ci-install-deps +4 -7
  41. data/ext/libsass/script/ci-report-coverage +13 -3
  42. data/ext/libsass/script/tap-driver +1 -1
  43. data/ext/libsass/script/tap-runner +1 -1
  44. data/ext/libsass/src/GNUmakefile.am +1 -1
  45. data/ext/libsass/src/ast.cpp +537 -762
  46. data/ext/libsass/src/ast.hpp +377 -419
  47. data/ext/libsass/src/ast_def_macros.hpp +26 -1
  48. data/ext/libsass/src/ast_fwd_decl.cpp +29 -0
  49. data/ext/libsass/src/ast_fwd_decl.hpp +94 -21
  50. data/ext/libsass/src/b64/encode.h +3 -1
  51. data/ext/libsass/src/backtrace.cpp +46 -0
  52. data/ext/libsass/src/backtrace.hpp +7 -54
  53. data/ext/libsass/src/bind.cpp +72 -50
  54. data/ext/libsass/src/bind.hpp +0 -1
  55. data/ext/libsass/src/cencode.c +6 -0
  56. data/ext/libsass/src/check_nesting.cpp +157 -135
  57. data/ext/libsass/src/check_nesting.hpp +11 -10
  58. data/ext/libsass/src/color_maps.cpp +10 -6
  59. data/ext/libsass/src/color_maps.hpp +6 -8
  60. data/ext/libsass/src/constants.cpp +4 -3
  61. data/ext/libsass/src/constants.hpp +4 -3
  62. data/ext/libsass/src/context.cpp +110 -47
  63. data/ext/libsass/src/context.hpp +11 -1
  64. data/ext/libsass/src/cssize.cpp +105 -94
  65. data/ext/libsass/src/cssize.hpp +4 -5
  66. data/ext/libsass/src/debugger.hpp +247 -244
  67. data/ext/libsass/src/emitter.cpp +30 -6
  68. data/ext/libsass/src/emitter.hpp +7 -0
  69. data/ext/libsass/src/environment.cpp +67 -16
  70. data/ext/libsass/src/environment.hpp +28 -7
  71. data/ext/libsass/src/error_handling.cpp +92 -64
  72. data/ext/libsass/src/error_handling.hpp +64 -43
  73. data/ext/libsass/src/eval.cpp +494 -544
  74. data/ext/libsass/src/eval.hpp +17 -23
  75. data/ext/libsass/src/expand.cpp +182 -154
  76. data/ext/libsass/src/expand.hpp +4 -5
  77. data/ext/libsass/src/extend.cpp +299 -291
  78. data/ext/libsass/src/extend.hpp +46 -11
  79. data/ext/libsass/src/file.cpp +103 -36
  80. data/ext/libsass/src/file.hpp +21 -4
  81. data/ext/libsass/src/functions.cpp +561 -312
  82. data/ext/libsass/src/functions.hpp +8 -5
  83. data/ext/libsass/src/inspect.cpp +108 -53
  84. data/ext/libsass/src/inspect.hpp +5 -2
  85. data/ext/libsass/src/lexer.cpp +15 -7
  86. data/ext/libsass/src/lexer.hpp +13 -4
  87. data/ext/libsass/src/listize.cpp +3 -2
  88. data/ext/libsass/src/listize.hpp +0 -1
  89. data/ext/libsass/src/memory/SharedPtr.cpp +16 -18
  90. data/ext/libsass/src/memory/SharedPtr.hpp +47 -43
  91. data/ext/libsass/src/node.cpp +34 -38
  92. data/ext/libsass/src/node.hpp +6 -8
  93. data/ext/libsass/src/operation.hpp +2 -2
  94. data/ext/libsass/src/operators.cpp +240 -0
  95. data/ext/libsass/src/operators.hpp +30 -0
  96. data/ext/libsass/src/output.cpp +22 -20
  97. data/ext/libsass/src/parser.cpp +719 -358
  98. data/ext/libsass/src/parser.hpp +57 -22
  99. data/ext/libsass/src/plugins.cpp +28 -10
  100. data/ext/libsass/src/position.cpp +21 -3
  101. data/ext/libsass/src/position.hpp +2 -1
  102. data/ext/libsass/src/prelexer.cpp +104 -19
  103. data/ext/libsass/src/prelexer.hpp +10 -3
  104. data/ext/libsass/src/remove_placeholders.cpp +9 -10
  105. data/ext/libsass/src/remove_placeholders.hpp +1 -5
  106. data/ext/libsass/src/sass.cpp +62 -4
  107. data/ext/libsass/src/sass.hpp +5 -2
  108. data/ext/libsass/src/sass_context.cpp +96 -58
  109. data/ext/libsass/src/sass_context.hpp +7 -5
  110. data/ext/libsass/src/sass_functions.cpp +63 -1
  111. data/ext/libsass/src/sass_functions.hpp +19 -1
  112. data/ext/libsass/src/sass_util.cpp +3 -3
  113. data/ext/libsass/src/sass_util.hpp +4 -4
  114. data/ext/libsass/src/sass_values.cpp +42 -39
  115. data/ext/libsass/src/sass_values.hpp +2 -1
  116. data/ext/libsass/src/source_map.cpp +16 -18
  117. data/ext/libsass/src/subset_map.cpp +6 -8
  118. data/ext/libsass/src/subset_map.hpp +6 -6
  119. data/ext/libsass/src/to_c.cpp +2 -2
  120. data/ext/libsass/src/to_value.cpp +8 -3
  121. data/ext/libsass/src/to_value.hpp +1 -0
  122. data/ext/libsass/src/units.cpp +349 -45
  123. data/ext/libsass/src/units.hpp +39 -22
  124. data/ext/libsass/src/utf8/checked.h +7 -0
  125. data/ext/libsass/src/utf8/unchecked.h +7 -0
  126. data/ext/libsass/src/utf8_string.cpp +1 -1
  127. data/ext/libsass/src/util.cpp +139 -45
  128. data/ext/libsass/src/util.hpp +4 -7
  129. data/ext/libsass/src/values.cpp +15 -23
  130. data/ext/libsass/win/libsass.sln +13 -2
  131. data/ext/libsass/win/libsass.sln.DotSettings +9 -0
  132. data/ext/libsass/win/libsass.targets +3 -0
  133. data/ext/libsass/win/libsass.vcxproj.filters +9 -0
  134. data/lib/sassc/version.rb +1 -1
  135. data/sassc.gemspec +1 -1
  136. data/test/native_test.rb +1 -1
  137. metadata +11 -4
@@ -6,11 +6,10 @@
6
6
 
7
7
  namespace Sass {
8
8
 
9
- typedef Environment<AST_Node_Obj> Env;
10
-
11
9
  class CheckNesting : public Operation_CRTP<Statement_Ptr, CheckNesting> {
12
10
 
13
11
  std::vector<Statement_Ptr> parents;
12
+ Backtraces traces;
14
13
  Statement_Ptr parent;
15
14
  Definition_Ptr current_mixin_definition;
16
15
 
@@ -24,10 +23,11 @@ namespace Sass {
24
23
 
25
24
  Statement_Ptr operator()(Block_Ptr);
26
25
  Statement_Ptr operator()(Definition_Ptr);
26
+ Statement_Ptr operator()(If_Ptr);
27
27
 
28
28
  template <typename U>
29
29
  Statement_Ptr fallback(U x) {
30
- Statement_Ptr n = SASS_MEMORY_CAST_PTR(Statement, x);
30
+ Statement_Ptr n = Cast<Statement>(x);
31
31
  if (this->should_visit(n)) {
32
32
  return fallback_impl(n);
33
33
  }
@@ -35,17 +35,18 @@ namespace Sass {
35
35
  }
36
36
 
37
37
  private:
38
- void invalid_content_parent(Statement_Ptr);
39
- void invalid_charset_parent(Statement_Ptr);
40
- void invalid_extend_parent(Statement_Ptr);
38
+ void invalid_content_parent(Statement_Ptr, AST_Node_Ptr);
39
+ void invalid_charset_parent(Statement_Ptr, AST_Node_Ptr);
40
+ void invalid_extend_parent(Statement_Ptr, AST_Node_Ptr);
41
41
  // void invalid_import_parent(Statement_Ptr);
42
- void invalid_mixin_definition_parent(Statement_Ptr);
43
- void invalid_function_parent(Statement_Ptr);
42
+ void invalid_mixin_definition_parent(Statement_Ptr, AST_Node_Ptr);
43
+ void invalid_function_parent(Statement_Ptr, AST_Node_Ptr);
44
44
 
45
45
  void invalid_function_child(Statement_Ptr);
46
46
  void invalid_prop_child(Statement_Ptr);
47
- void invalid_prop_parent(Statement_Ptr);
48
- void invalid_return_parent(Statement_Ptr);
47
+ void invalid_prop_parent(Statement_Ptr, AST_Node_Ptr);
48
+ void invalid_return_parent(Statement_Ptr, AST_Node_Ptr);
49
+ void invalid_value_child(AST_Node_Ptr);
49
50
 
50
51
  bool is_transparent_parent(Statement_Ptr, Statement_Ptr);
51
52
 
@@ -607,16 +607,20 @@ namespace Sass {
607
607
 
608
608
  Color_Ptr_Const name_to_color(const char* key)
609
609
  {
610
- auto p = names_to_colors.find(key);
611
- if (p != names_to_colors.end()) {
612
- return p->second;
613
- }
614
- return 0;
610
+ return name_to_color(std::string(key));
615
611
  }
616
612
 
617
613
  Color_Ptr_Const name_to_color(const std::string& key)
618
614
  {
619
- return name_to_color(key.c_str());
615
+ // case insensitive lookup. See #2462
616
+ std::string lower{key};
617
+ std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
618
+
619
+ auto p = names_to_colors.find(lower.c_str());
620
+ if (p != names_to_colors.end()) {
621
+ return p->second;
622
+ }
623
+ return 0;
620
624
  }
621
625
 
622
626
  const char* color_to_name(const int key)
@@ -1,3 +1,4 @@
1
+
1
2
  #ifndef SASS_COLOR_MAPS_H
2
3
  #define SASS_COLOR_MAPS_H
3
4
 
@@ -319,14 +320,11 @@ namespace Sass {
319
320
  extern const Color transparent;
320
321
  }
321
322
 
322
- extern const std::map<const int, const char*> colors_to_names;
323
- extern const std::map<const char*, Color_Ptr_Const, map_cmp_str> names_to_colors;
324
-
325
- extern Color_Ptr_Const name_to_color(const char*);
326
- extern Color_Ptr_Const name_to_color(const std::string&);
327
- extern const char* color_to_name(const int);
328
- extern const char* color_to_name(const Color&);
329
- extern const char* color_to_name(const double);
323
+ Color_Ptr_Const name_to_color(const char*);
324
+ Color_Ptr_Const name_to_color(const std::string&);
325
+ const char* color_to_name(const int);
326
+ const char* color_to_name(const Color&);
327
+ const char* color_to_name(const double);
330
328
 
331
329
  }
332
330
 
@@ -79,11 +79,12 @@ namespace Sass {
79
79
  extern const char supports_kwd[] = "@supports";
80
80
  extern const char keyframes_kwd[] = "keyframes";
81
81
  extern const char only_kwd[] = "only";
82
- extern const char rgb_kwd[] = "rgb(";
82
+ extern const char rgb_fn_kwd[] = "rgb(";
83
+ extern const char url_fn_kwd[] = "url(";
83
84
  extern const char url_kwd[] = "url";
84
- // extern const char url_prefix_kwd[] = "url-prefix(";
85
+ // extern const char url_prefix_fn_kwd[] = "url-prefix(";
85
86
  extern const char important_kwd[] = "important";
86
- extern const char pseudo_not_kwd[] = ":not(";
87
+ extern const char pseudo_not_fn_kwd[] = ":not(";
87
88
  extern const char even_kwd[] = "even";
88
89
  extern const char odd_kwd[] = "odd";
89
90
  extern const char progid_kwd[] = "progid";
@@ -79,11 +79,12 @@ namespace Sass {
79
79
  extern const char supports_kwd[];
80
80
  extern const char keyframes_kwd[];
81
81
  extern const char only_kwd[];
82
- extern const char rgb_kwd[];
82
+ extern const char rgb_fn_kwd[];
83
+ extern const char url_fn_kwd[];
83
84
  extern const char url_kwd[];
84
- // extern const char url_prefix_kwd[];
85
+ // extern const char url_prefix_fn_kwd[];
85
86
  extern const char important_kwd[];
86
- extern const char pseudo_not_kwd[];
87
+ extern const char pseudo_not_fn_kwd[];
87
88
  extern const char even_kwd[];
88
89
  extern const char odd_kwd[];
89
90
  extern const char progid_kwd[];
@@ -67,11 +67,15 @@ namespace Sass {
67
67
  plugins(),
68
68
  emitter(c_options),
69
69
 
70
+ ast_gc(),
70
71
  strings(),
71
72
  resources(),
72
73
  sheets(),
73
74
  subset_map(),
74
75
  import_stack(),
76
+ callee_stack(),
77
+ traces(),
78
+ c_compiler(NULL),
75
79
 
76
80
  c_headers (std::vector<Sass_Importer_Entry>()),
77
81
  c_importers (std::vector<Sass_Importer_Entry>()),
@@ -87,10 +91,13 @@ namespace Sass {
87
91
 
88
92
  {
89
93
 
90
- // add cwd to include paths
91
- include_paths.push_back(CWD);
94
+ // Sass 3.4: The current working directory will no longer be placed onto the Sass load path by default.
95
+ // If you need the current working directory to be available, set SASS_PATH=. in your shell's environment.
96
+ // include_paths.push_back(CWD);
92
97
 
93
98
  // collect more paths from different options
99
+ collect_extensions(c_options.extension);
100
+ collect_extensions(c_options.extensions);
94
101
  collect_include_paths(c_options.include_path);
95
102
  collect_include_paths(c_options.include_paths);
96
103
  collect_plugin_paths(c_options.plugin_path);
@@ -129,7 +136,7 @@ namespace Sass {
129
136
 
130
137
  Context::~Context()
131
138
  {
132
- // resources were allocated by strdup or malloc
139
+ // resources were allocated by malloc
133
140
  for (size_t i = 0; i < resources.size(); ++i) {
134
141
  free(resources[i].contents);
135
142
  free(resources[i].srcmap);
@@ -161,6 +168,37 @@ namespace Sass {
161
168
  {
162
169
  }
163
170
 
171
+ void Context::collect_extensions(const char* exts_str)
172
+ {
173
+ if (exts_str) {
174
+ const char* beg = exts_str;
175
+ const char* end = Prelexer::find_first<PATH_SEP>(beg);
176
+
177
+ while (end) {
178
+ std::string ext(beg, end - beg);
179
+ if (!ext.empty()) {
180
+ extensions.push_back(ext);
181
+ }
182
+ beg = end + 1;
183
+ end = Prelexer::find_first<PATH_SEP>(beg);
184
+ }
185
+
186
+ std::string ext(beg);
187
+ if (!ext.empty()) {
188
+ extensions.push_back(ext);
189
+ }
190
+ }
191
+ }
192
+
193
+ void Context::collect_extensions(string_list* paths_array)
194
+ {
195
+ while (paths_array)
196
+ {
197
+ collect_extensions(paths_array->string);
198
+ paths_array = paths_array->next;
199
+ }
200
+ }
201
+
164
202
  void Context::collect_include_paths(const char* paths_str)
165
203
  {
166
204
  if (paths_str) {
@@ -231,25 +269,29 @@ namespace Sass {
231
269
  // looks for alternatives and returns a list from one directory
232
270
  std::vector<Include> Context::find_includes(const Importer& import)
233
271
  {
272
+ // include configured extensions
273
+ std::vector<std::string> exts(File::defaultExtensions);
274
+ if (extensions.size() > 0) {
275
+ exts.insert(exts.end(), extensions.begin(), extensions.end());
276
+ }
234
277
  // make sure we resolve against an absolute path
235
278
  std::string base_path(rel2abs(import.base_path));
236
279
  // first try to resolve the load path relative to the base path
237
- std::vector<Include> vec(resolve_includes(base_path, import.imp_path));
280
+ std::vector<Include> vec(resolve_includes(base_path, import.imp_path, exts));
238
281
  // then search in every include path (but only if nothing found yet)
239
282
  for (size_t i = 0, S = include_paths.size(); vec.size() == 0 && i < S; ++i)
240
283
  {
241
284
  // call resolve_includes and individual base path and append all results
242
- std::vector<Include> resolved(resolve_includes(include_paths[i], import.imp_path));
285
+ std::vector<Include> resolved(resolve_includes(include_paths[i], import.imp_path, exts));
243
286
  if (resolved.size()) vec.insert(vec.end(), resolved.begin(), resolved.end());
244
287
  }
245
288
  // return vector
246
289
  return vec;
247
290
  }
248
291
 
249
-
250
292
  // register include with resolved path and its content
251
293
  // memory of the resources will be freed by us on exit
252
- void Context::register_resource(const Include& inc, const Resource& res, ParserState* prstate)
294
+ void Context::register_resource(const Include& inc, const Resource& res)
253
295
  {
254
296
 
255
297
  // do not parse same resource twice
@@ -297,21 +339,22 @@ namespace Sass {
297
339
  for (size_t i = 0; i < import_stack.size() - 2; ++i) {
298
340
  auto parent = import_stack[i];
299
341
  if (std::strcmp(parent->abs_path, import->abs_path) == 0) {
342
+ std::string cwd(File::get_cwd());
343
+ // make path relative to the current directory
300
344
  std::string stack("An @import loop has been found:");
301
345
  for (size_t n = 1; n < i + 2; ++n) {
302
- stack += "\n " + std::string(import_stack[n]->imp_path) +
303
- " imports " + std::string(import_stack[n+1]->imp_path);
346
+ stack += "\n " + std::string(File::abs2rel(import_stack[n]->abs_path, cwd, cwd)) +
347
+ " imports " + std::string(File::abs2rel(import_stack[n+1]->abs_path, cwd, cwd));
304
348
  }
305
349
  // implement error throw directly until we
306
350
  // decided how to handle full stack traces
307
- ParserState state = prstate ? *prstate : pstate;
308
- throw Exception::InvalidSyntax(state, stack, &import_stack);
351
+ throw Exception::InvalidSyntax(pstate, traces, stack);
309
352
  // error(stack, prstate ? *prstate : pstate, import_stack);
310
353
  }
311
354
  }
312
355
 
313
356
  // create a parser instance from the given c_str buffer
314
- Parser p(Parser::from_c_str(contents, *this, pstate));
357
+ Parser p(Parser::from_c_str(contents, *this, traces, pstate));
315
358
  // do not yet dispose these buffers
316
359
  sass_import_take_source(import);
317
360
  sass_import_take_srcmap(import);
@@ -326,7 +369,15 @@ namespace Sass {
326
369
  ast_pair(inc.abs_path, { res, root });
327
370
  // register resulting resource
328
371
  sheets.insert(ast_pair);
372
+ }
329
373
 
374
+ // register include with resolved path and its content
375
+ // memory of the resources will be freed by us on exit
376
+ void Context::register_resource(const Include& inc, const Resource& res, ParserState& prstate)
377
+ {
378
+ traces.push_back(Backtrace(prstate));
379
+ register_resource(inc, res);
380
+ traces.pop_back();
330
381
  }
331
382
 
332
383
  // Add a new import to the context (called from `import_url`)
@@ -346,19 +397,27 @@ namespace Sass {
346
397
  for (size_t i = 0, L = resolved.size(); i < L; ++i)
347
398
  { msg_stream << " " << resolved[i].imp_path << "\n"; }
348
399
  msg_stream << "Please delete or rename all but one of these files." << "\n";
349
- error(msg_stream.str(), pstate);
400
+ error(msg_stream.str(), pstate, traces);
350
401
  }
351
402
 
352
403
  // process the resolved entry
353
404
  else if (resolved.size() == 1) {
354
405
  bool use_cache = c_importers.size() == 0;
406
+ if (resolved[0].deprecated) {
407
+ // emit deprecation warning when import resolves to a .css file
408
+ deprecated(
409
+ "Including .css files with @import is non-standard behaviour which will be removed in future versions of LibSass.",
410
+ "Use a custom importer to maintain this behaviour. Check your implementations documentation on how to create a custom importer.",
411
+ true, pstate
412
+ );
413
+ }
355
414
  // use cache for the resource loading
356
415
  if (use_cache && sheets.count(resolved[0].abs_path)) return resolved[0];
357
416
  // try to read the content of the resolved file entry
358
417
  // the memory buffer returned must be freed by us!
359
418
  if (char* contents = read_file(resolved[0].abs_path)) {
360
419
  // register the newly resolved file resource
361
- register_resource(resolved[0], { contents, 0 }, &pstate);
420
+ register_resource(resolved[0], { contents, 0 }, pstate);
362
421
  // return resolved entry
363
422
  return resolved[0];
364
423
  }
@@ -391,15 +450,15 @@ namespace Sass {
391
450
  String_Constant_Ptr loc = SASS_MEMORY_NEW(String_Constant, pstate, unquote(load_path));
392
451
  Argument_Obj loc_arg = SASS_MEMORY_NEW(Argument, pstate, loc);
393
452
  Arguments_Obj loc_args = SASS_MEMORY_NEW(Arguments, pstate);
394
- loc_args->append(&loc_arg);
395
- Function_Call_Ptr new_url = SASS_MEMORY_NEW(Function_Call, pstate, "url", &loc_args);
453
+ loc_args->append(loc_arg);
454
+ Function_Call_Ptr new_url = SASS_MEMORY_NEW(Function_Call, pstate, "url", loc_args);
396
455
  imp->urls().push_back(new_url);
397
456
  }
398
457
  else {
399
458
  const Importer importer(imp_path, ctx_path);
400
459
  Include include(load_import(importer, pstate));
401
460
  if (include.abs_path.empty()) {
402
- error("File to import not found or unreadable: " + imp_path + ".\nParent style sheet: " + ctx_path, pstate);
461
+ error("File to import not found or unreadable: " + imp_path + ".", pstate, traces);
403
462
  }
404
463
  imp->incs().push_back(include);
405
464
  }
@@ -415,12 +474,12 @@ namespace Sass {
415
474
  // need one correct import
416
475
  bool has_import = false;
417
476
  // process all custom importers (or custom headers)
418
- for (Sass_Importer_Entry& importer : importers) {
477
+ for (Sass_Importer_Entry& importer_ent : importers) {
419
478
  // int priority = sass_importer_get_priority(importer);
420
- Sass_Importer_Fn fn = sass_importer_get_function(importer);
479
+ Sass_Importer_Fn fn = sass_importer_get_function(importer_ent);
421
480
  // skip importer if it returns NULL
422
481
  if (Sass_Import_List includes =
423
- fn(load_path.c_str(), importer, c_compiler)
482
+ fn(load_path.c_str(), importer_ent, c_compiler)
424
483
  ) {
425
484
  // get c pointer copy to iterate over
426
485
  Sass_Import_List it_includes = includes;
@@ -435,18 +494,18 @@ namespace Sass {
435
494
  // create the importer struct
436
495
  Importer importer(uniq_path, ctx_path);
437
496
  // query data from the current include
438
- Sass_Import_Entry include = *it_includes;
439
- char* source = sass_import_take_source(include);
440
- char* srcmap = sass_import_take_srcmap(include);
441
- size_t line = sass_import_get_error_line(include);
442
- size_t column = sass_import_get_error_column(include);
443
- const char *abs_path = sass_import_get_abs_path(include);
497
+ Sass_Import_Entry include_ent = *it_includes;
498
+ char* source = sass_import_take_source(include_ent);
499
+ char* srcmap = sass_import_take_srcmap(include_ent);
500
+ size_t line = sass_import_get_error_line(include_ent);
501
+ size_t column = sass_import_get_error_column(include_ent);
502
+ const char *abs_path = sass_import_get_abs_path(include_ent);
444
503
  // handle error message passed back from custom importer
445
504
  // it may (or may not) override the line and column info
446
- if (const char* err_message = sass_import_get_error_message(include)) {
447
- if (source || srcmap) register_resource({ importer, uniq_path }, { source, srcmap }, &pstate);
448
- if (line == std::string::npos && column == std::string::npos) error(err_message, pstate);
449
- else error(err_message, ParserState(ctx_path, source, Position(line, column)));
505
+ if (const char* err_message = sass_import_get_error_message(include_ent)) {
506
+ if (source || srcmap) register_resource({ importer, uniq_path }, { source, srcmap }, pstate);
507
+ if (line == std::string::npos && column == std::string::npos) error(err_message, pstate, traces);
508
+ else error(err_message, ParserState(ctx_path, source, Position(line, column)), traces);
450
509
  }
451
510
  // content for import was set
452
511
  else if (source) {
@@ -458,7 +517,7 @@ namespace Sass {
458
517
  // attach information to AST node
459
518
  imp->incs().push_back(include);
460
519
  // register the resource buffers
461
- register_resource(include, { source, srcmap }, &pstate);
520
+ register_resource(include, { source, srcmap }, pstate);
462
521
  }
463
522
  // only a path was retuned
464
523
  // try to load it like normal
@@ -528,11 +587,11 @@ namespace Sass {
528
587
  Import_Obj imp = SASS_MEMORY_NEW(Import, pstate);
529
588
  // dispatch headers which will add custom functions
530
589
  // custom headers are added to the import instance
531
- call_headers(entry_path, ctx_path, pstate, &imp);
590
+ call_headers(entry_path, ctx_path, pstate, imp);
532
591
  // increase head count to skip later
533
592
  head_imports += resources.size() - 1;
534
593
  // add the statement if we have urls
535
- if (!imp->urls().empty()) root->append(&imp);
594
+ if (!imp->urls().empty()) root->append(imp);
536
595
  // process all other resources (add Import_Stub nodes)
537
596
  for (size_t i = 0, S = imp->incs().size(); i < S; ++i) {
538
597
  root->append(SASS_MEMORY_NEW(Import_Stub, pstate, imp->incs()[i]));
@@ -644,30 +703,33 @@ namespace Sass {
644
703
  for (size_t i = 0, S = c_functions.size(); i < S; ++i)
645
704
  { register_c_function(*this, &global, c_functions[i]); }
646
705
  // create initial backtrace entry
647
- Backtrace backtrace(0, ParserState("", 0), "");
648
706
  // create crtp visitor objects
649
- Expand expand(*this, &global, &backtrace);
650
- Cssize cssize(*this, &backtrace);
707
+ Expand expand(*this, &global);
708
+ Cssize cssize(*this);
651
709
  CheckNesting check_nesting;
652
- // check nesting
653
- check_nesting(&root);
710
+ // check nesting in all files
711
+ for (auto sheet : sheets) {
712
+ auto styles = sheet.second;
713
+ check_nesting(styles.root);
714
+ }
654
715
  // expand and eval the tree
655
- root = expand(&root);
716
+ root = expand(root);
656
717
  // check nesting
657
- check_nesting(&root);
718
+ check_nesting(root);
658
719
  // merge and bubble certain rules
659
- root = cssize(&root);
720
+ root = cssize(root);
660
721
  // should we extend something?
661
722
  if (!subset_map.empty()) {
662
723
  // create crtp visitor object
663
- Extend extend(*this, subset_map);
724
+ Extend extend(subset_map);
725
+ extend.setEval(expand.eval);
664
726
  // extend tree nodes
665
- extend(&root);
727
+ extend(root);
666
728
  }
667
729
 
668
730
  // clean up by removing empty placeholders
669
731
  // ToDo: maybe we can do this somewhere else?
670
- Remove_Placeholders remove_placeholders(*this);
732
+ Remove_Placeholders remove_placeholders;
671
733
  root->perform(&remove_placeholders);
672
734
  // return processed tree
673
735
  return root;
@@ -695,10 +757,8 @@ namespace Sass {
695
757
  char* Context::render_srcmap()
696
758
  {
697
759
  if (source_map_file == "") return 0;
698
- char* result = 0;
699
760
  std::string map = emitter.render_srcmap(*this);
700
- result = sass_copy_c_string(map.c_str());
701
- return result;
761
+ return sass_copy_c_string(map.c_str());
702
762
  }
703
763
 
704
764
 
@@ -810,6 +870,7 @@ namespace Sass {
810
870
  register_function(ctx, append_sig, append, env);
811
871
  register_function(ctx, zip_sig, zip, env);
812
872
  register_function(ctx, list_separator_sig, list_separator, env);
873
+ register_function(ctx, is_bracketed_sig, is_bracketed, env);
813
874
  // Map Functions
814
875
  register_function(ctx, map_get_sig, map_get, env);
815
876
  register_function(ctx, map_merge_sig, map_merge, env);
@@ -829,6 +890,8 @@ namespace Sass {
829
890
  register_function(ctx, mixin_exists_sig, mixin_exists, env);
830
891
  register_function(ctx, feature_exists_sig, feature_exists, env);
831
892
  register_function(ctx, call_sig, call, env);
893
+ register_function(ctx, content_exists_sig, content_exists, env);
894
+ register_function(ctx, get_function_sig, get_function, env);
832
895
  // Boolean Functions
833
896
  register_function(ctx, not_sig, sass_not, env);
834
897
  register_function(ctx, if_sig, sass_if, env);