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

Commit 96d29f7

Browse files
committed
Fix forward merge for meta.load-css
1 parent c57fc40 commit 96d29f7

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

src/parser_stylesheet.cpp

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,8 +1574,14 @@ namespace Sass {
15741574
refs->isModule);
15751575

15761576
for (auto fwd : root->forwarded) {
1577+
if (copy == fwd.first) continue;
1578+
bool sameVarFrame(copy->varFrame == fwd.first->varFrame);
1579+
bool sameMixFrame(copy->mixFrame == fwd.first->mixFrame);
1580+
bool sameFnFrame(copy->fnFrame == fwd.first->fnFrame);
15771581
for (auto var : fwd.first->varIdxs) {
1578-
if (copy->varIdxs.count(var.first)) {
1582+
auto it = copy->varIdxs.find(var.first);
1583+
if (it != copy->varIdxs.end()) {
1584+
if (sameVarFrame && it->second == var.second) continue;
15791585
// context.addFinalStackTrace(varcfg.pstate);
15801586
throw Exception::RuntimeException(context,
15811587
"Two forwarded modules both define a "
@@ -1585,7 +1591,9 @@ namespace Sass {
15851591
copy->varIdxs.insert(var);
15861592
}
15871593
for (auto mix : fwd.first->mixIdxs) {
1588-
if (copy->mixIdxs.count(mix.first)) {
1594+
auto it = copy->mixIdxs.find(mix.first);
1595+
if (it != copy->mixIdxs.end()) {
1596+
if (sameMixFrame && it->second == mix.second) continue;
15891597
// context.addFinalStackTrace(varcfg.pstate);
15901598
throw Exception::RuntimeException(context,
15911599
"Two forwarded modules both define a "
@@ -1595,7 +1603,9 @@ namespace Sass {
15951603
copy->mixIdxs.insert(mix);
15961604
}
15971605
for (auto fn : fwd.first->fnIdxs) {
1598-
if (copy->fnIdxs.count(fn.first)) {
1606+
auto it = copy->fnIdxs.find(fn.first);
1607+
if (it != copy->fnIdxs.end()) {
1608+
if (sameFnFrame && it->second == fn.second) continue;
15991609
// context.addFinalStackTrace(varcfg.pstate);
16001610
throw Exception::RuntimeException(context,
16011611
"Two forwarded modules both define a "
@@ -1626,30 +1636,30 @@ namespace Sass {
16261636
bool sameVarFrame(copy->varFrame == fwd.first->varFrame);
16271637
bool sameMixFrame(copy->mixFrame == fwd.first->mixFrame);
16281638
bool sameFnFrame(copy->fnFrame == fwd.first->fnFrame);
1629-
for (auto it : copy->varIdxs) {
1630-
auto var = fwd.first->varIdxs.find(it.first);
1631-
if (var != fwd.first->varIdxs.end()) {
1632-
if (sameVarFrame && it.second == var->second) continue;
1639+
for (auto var : copy->varIdxs) {
1640+
auto it = fwd.first->varIdxs.find(var.first);
1641+
if (it != fwd.first->varIdxs.end()) {
1642+
if (sameVarFrame && var.second == it->second) continue;
16331643
throw Exception::ParserException(context,
1634-
"$" + it.first.norm() + " is available "
1644+
"$" + var.first.norm() + " is available "
16351645
"from multiple global modules.");
16361646
}
16371647
}
1638-
for (auto it : copy->mixIdxs) {
1639-
auto var = fwd.first->mixIdxs.find(it.first);
1640-
if (var != fwd.first->mixIdxs.end()) {
1641-
if (sameMixFrame && it.second == var->second) continue;
1648+
for (auto var : copy->mixIdxs) {
1649+
auto it = fwd.first->mixIdxs.find(var.first);
1650+
if (it != fwd.first->mixIdxs.end()) {
1651+
if (sameMixFrame && var.second == it->second) continue;
16421652
throw Exception::ParserException(context,
1643-
"Mixin \"" + it.first.norm() + "(...)\" is "
1653+
"Mixin \"" + var.first.norm() + "(...)\" is "
16441654
"available from multiple global modules.");
16451655
}
16461656
}
1647-
for (auto it : copy->fnIdxs) {
1648-
auto var = fwd.first->fnIdxs.find(it.first);
1649-
if (var != fwd.first->fnIdxs.end()) {
1650-
if (sameFnFrame && it.second == var->second) continue;
1657+
for (auto var : copy->fnIdxs) {
1658+
auto it = fwd.first->fnIdxs.find(var.first);
1659+
if (it != fwd.first->fnIdxs.end()) {
1660+
if (sameFnFrame && var.second == it->second) continue;
16511661
throw Exception::ParserException(context,
1652-
"Function \"" + it.first.norm() + "(...)\" is "
1662+
"Function \"" + var.first.norm() + "(...)\" is "
16531663
"available from multiple global modules.");
16541664
}
16551665
}

0 commit comments

Comments
 (0)