Skip to content

Commit 34f6053

Browse files
committed
Fix call function incorrectly epanding map arguments
1 parent dec2eab commit 34f6053

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

bind.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ namespace Sass {
5656
else {
5757
env->local_frame()[p->name()] = a->value();
5858
}
59+
} else if (a->is_keyword_argument()) {
60+
61+
// expand keyword arguments into their parameters
62+
List* arglist = new (ctx.mem) List(p->pstate(), 0, List::COMMA, true);
63+
env->local_frame()[p->name()] = arglist;
64+
Map* argmap = static_cast<Map*>(a->value());
65+
for (auto key : argmap->keys()) {
66+
string name = unquote(static_cast<String_Constant*>(key)->value());
67+
(*arglist) << new (ctx.mem) Argument(key->pstate(),
68+
argmap->at(key),
69+
name,
70+
false);
71+
}
72+
5973
} else {
6074

6175
// copy all remaining arguments into the rest parameter, preserving names

functions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1474,7 +1474,7 @@ namespace Sass {
14741474
for (size_t i = 0, L = arglist->length(); i < L; ++i) {
14751475
Expression* expr = arglist->value_at_index(i);
14761476
if (arglist->is_arglist()) {
1477-
Argument* arg = static_cast<Argument*>(expr);
1477+
Argument* arg = static_cast<Argument*>((*arglist)[i]);
14781478
*args << new (ctx.mem) Argument(pstate,
14791479
expr,
14801480
"",

0 commit comments

Comments
 (0)