Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit a2fadba

Browse files
committed
Add eager forward merging
1 parent 96d29f7 commit a2fadba

File tree

4 files changed

+203
-171
lines changed

4 files changed

+203
-171
lines changed

src/ast_css.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include "ast_nodes.hpp"
99
#include "ast_selectors.hpp"
1010
#include "visitor_css.hpp"
11+
#include "ast_statements.hpp"
12+
#include "environment_stack.hpp"
1113
// #include "ast_def_macros.hpp"
1214

1315
namespace Sass {
@@ -554,6 +556,12 @@ namespace Sass {
554556
bool isActive = false;
555557
bool isLoading = false;
556558

559+
560+
EnvKeyMap<VarRef> mergedFwdVars;
561+
EnvKeyMap<VarRef> mergedFwdMixs;
562+
EnvKeyMap<VarRef> mergedFwdFns;
563+
564+
557565
sass::vector<std::pair<VarRefs*, Root*>> forwarded;
558566

559567
Root(const SourceSpan& pstate, size_t reserve = 0)

src/environment_stack.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ namespace Sass {
5959
&& offset == rhs.offset;
6060
}
6161

62+
bool operator!=(const VarRef& rhs) const {
63+
return frame != rhs.frame
64+
|| offset != rhs.offset;
65+
}
66+
6267
bool operator<(const VarRef& rhs) const {
6368
if (frame < rhs.frame) return true;
6469
return offset < rhs.offset;

src/extender.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ namespace Sass {
7373

7474
if (complex->size() > 1) {
7575
throw Exception::RuntimeException(traces,
76-
"complex selectors may not be extended.");
76+
"Can't extend complex selector " +
77+
complex->inspect() + ".");
7778
}
7879

7980
if (const CompoundSelector* compound = complex->first()->isaCompoundSelector()) {

0 commit comments

Comments
 (0)