Skip to content

Commit 541b644

Browse files
committed
Evaluated String_Schemas shouldn't be reevaluated
1 parent fbf1446 commit 541b644

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

eval.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,16 +393,24 @@ namespace Sass {
393393
Expression* Eval::operator()(Map* m)
394394
{
395395
if (m->is_expanded()) return m;
396+
397+
// make sure we're not starting with duplicate keys.
398+
// the duplicate key state will have been set in the parser phase.
399+
if (m->has_duplicate_key()) {
400+
To_String to_string(&ctx);
401+
error("Duplicate key \"" + m->get_duplicate_key()->perform(&to_string) + "\" in map " + m->perform(&to_string) + ".", m->pstate());
402+
}
403+
396404
Map* mm = new (ctx.mem) Map(m->pstate(),
397405
m->length());
398406
for (auto key : m->keys()) {
399-
*mm << std::make_pair(key->perform(this), m->at(key)->perform(this));
407+
*mm << std::make_pair(key->perform(this), m->at(key)->perform(this));;
400408
}
401409

402-
// check for duplicate keys
410+
// check the evaluated keys aren't duplicates.
403411
if (mm->has_duplicate_key()) {
404412
To_String to_string(&ctx);
405-
error("Duplicate key \"" + mm->get_duplicate_key()->perform(&to_string) + "\" in map " + m->perform(&to_string) + ".", m->pstate());
413+
error("Duplicate key \"" + mm->get_duplicate_key()->perform(&to_string) + "\" in map " + mm->perform(&to_string) + ".", mm->pstate());
406414
}
407415

408416
mm->is_expanded(true);
@@ -927,6 +935,7 @@ namespace Sass {
927935
} else if (str->quote_mark()) {
928936
str->quote_mark('*');
929937
}
938+
str->is_delayed(true);
930939
return str;
931940
}
932941

parser.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,12 +1105,6 @@ namespace Sass {
11051105
(*map) << make_pair(key, value);
11061106
}
11071107

1108-
// Check was moved to eval step
1109-
// if (map->has_duplicate_key()) {
1110-
// To_String to_string(&ctx);
1111-
// error("Duplicate key \"" + map->get_duplicate_key()->perform(&to_string) + "\" in map " + map->perform(&to_string) + ".", pstate);
1112-
// }
1113-
11141108
ParserState ps = map->pstate();
11151109
ps.offset = pstate - ps + pstate.offset;
11161110
map->pstate(ps);

0 commit comments

Comments
 (0)