Skip to content

Commit cf1bcb9

Browse files
committed
Clean up header includes
1. Avoid include cycles. This isn't necessary for amalgamation but makes things more obvious. 2. Rename sass2scss namespace to Sass2Scss (upstream PR mgreter/sass2scss#43). This is necessary for amalgamation.
1 parent fbbadbf commit cf1bcb9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+157
-69
lines changed

include/sass2scss.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#endif
4242

4343
// add namespace for c++
44-
namespace Sass
44+
namespace Sass2Scss
4545
{
4646

4747
// pretty print options
@@ -117,4 +117,4 @@ extern "C" {
117117
} // __cplusplus defined.
118118
#endif
119119

120-
#endif
120+
#endif

src/ast.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
#include "sass.hpp"
44

55
#include "ast.hpp"
6+
#include "ast_selectors.hpp"
7+
#include "ast_values.hpp"
8+
#include "emitter.hpp"
9+
#include "inspect.hpp"
10+
#include "util.hpp"
611

712
namespace Sass {
813

src/ast.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,10 +1052,6 @@ namespace Sass {
10521052

10531053
}
10541054

1055-
#include "ast_values.hpp"
1056-
#include "ast_supports.hpp"
1057-
#include "ast_selectors.hpp"
1058-
10591055
#ifdef __clang__
10601056

10611057
// #pragma clang diagnostic pop

src/ast2c.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
#include "ast2c.hpp"
66
#include "ast.hpp"
7+
#include "ast_selectors.hpp"
8+
#include "ast_supports.hpp"
9+
#include "ast_values.hpp"
710

811
namespace Sass {
912

@@ -77,4 +80,7 @@ namespace Sass {
7780
union Sass_Value* AST2C::operator()(Null* n)
7881
{ return sass_make_null(); }
7982

83+
union Sass_Value* AST2C::fallback(AST_Node* x)
84+
{ return sass_make_error("unknown type for C-API"); }
85+
8086
};

src/ast2c.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ namespace Sass {
2929
union Sass_Value* operator()(Argument*);
3030

3131
// return sass error if type is not supported
32-
union Sass_Value* fallback(AST_Node* x)
33-
{ return sass_make_error("unknown type for C-API"); }
34-
32+
union Sass_Value* fallback(AST_Node* x);
3533
};
3634

3735
}

src/ast_fwd_decl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#include "ast.hpp"
22

3+
#include "ast_selectors.hpp"
4+
#include "ast_supports.hpp"
5+
#include "ast_values.hpp"
6+
37
namespace Sass {
48

59
#define IMPLEMENT_BASE_CAST(T) \

src/ast_sel_cmp.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
// __EXTENSIONS__ fix on Solaris.
33
#include "sass.hpp"
44

5+
#include <unordered_set>
6+
57
#include "ast_selectors.hpp"
8+
#include "ast_values.hpp"
69

710
namespace Sass {
811

src/ast_sel_super.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// __EXTENSIONS__ fix on Solaris.
33
#include "sass.hpp"
44
#include "ast.hpp"
5-
5+
#include "ast_selectors.hpp"
6+
#include "ast_values.hpp"
67
#include "util_string.hpp"
78

89
namespace Sass {
@@ -76,7 +77,7 @@ namespace Sass {
7677
// That items must be a compound selector
7778
if (auto compound = Cast<CompoundSelector>(complex->at(0))) {
7879
// It must contain the lhs simple selector
79-
if (!compound->contains(simple1)) {
80+
if (!compound->contains(simple1)) {
8081
return false;
8182
}
8283
}
@@ -386,8 +387,8 @@ namespace Sass {
386387

387388
// Find the first index where `complex2.sublist(i2, afterSuperselector)`
388389
// is a subselector of [compound1]. We stop before the superselector
389-
// would encompass all of [complex2] because we know [complex1] has
390-
// more than one element, and consuming all of [complex2] wouldn't
390+
// would encompass all of [complex2] because we know [complex1] has
391+
// more than one element, and consuming all of [complex2] wouldn't
391392
// leave anything for the rest of [complex1] to match.
392393
size_t afterSuperselector = i2 + 1;
393394
for (; afterSuperselector < complex2.size(); afterSuperselector++) {

src/ast_sel_unify.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44

55
#include "ast.hpp"
66

7+
#include "ast_selectors.hpp"
8+
#include "util.hpp"
9+
710
namespace Sass {
811

912
// ##########################################################################
10-
// Returns the contents of a [SelectorList] that matches only
13+
// Returns the contents of a [SelectorList] that matches only
1114
// elements that are matched by both [complex1] and [complex2].
1215
// If no such list can be produced, returns `null`.
1316
// ##########################################################################

src/ast_sel_weave.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "sass.hpp"
44

55
#include "ast.hpp"
6+
#include "ast_selectors.hpp"
67
#include "permutate.hpp"
78
#include "dart_helpers.hpp"
89

@@ -190,7 +191,7 @@ namespace Sass {
190191
// EO getChunks
191192

192193
// ##########################################################################
193-
// If the first element of [queue] has a `::root`
194+
// If the first element of [queue] has a `::root`
194195
// selector, removes and returns that element.
195196
// ##########################################################################
196197
CompoundSelectorObj getFirstIfRoot(std::vector<SelectorComponentObj>& queue) {
@@ -298,7 +299,7 @@ namespace Sass {
298299
return true;
299300
}
300301
}
301-
302+
302303
std::vector<SelectorComponentObj> combinators1;
303304
while (!components1.empty() && Cast<SelectorCombinator>(components1.back())) {
304305
SelectorCombinatorObj back = Cast<SelectorCombinator>(components1.back());
@@ -379,7 +380,7 @@ namespace Sass {
379380
else {
380381
CompoundSelectorObj unified = compound1->unifyWith(compound2);
381382
std::vector<std::vector<SelectorComponentObj>> items;
382-
383+
383384
if (!unified.isNull()) {
384385
items.push_back({
385386
unified, nextSiblingCombinator

0 commit comments

Comments
 (0)