-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix duplicate key handling for maps #1195
Conversation
7d262a8
to
8b556bc
Compare
👍 |
@@ -1073,8 +1073,15 @@ namespace Sass { | |||
(*map) << make_pair(key, value); | |||
} | |||
|
|||
if (map->has_duplicate_key()) | |||
{ error("Duplicate key \"" + map->get_duplicate_key()->perform(&to_string) + "\" in map " + map->perform(&to_string) + ".", pstate); } | |||
// Check was moved to eval step |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these comments?
Ah, the pstate stuff makes sure the Map object source map is pointing from parenthese to parenthese, since we don't lex it with one call ... Just saw it was off , so I thought I'd fix it while beeing at it ... |
For some more context on the original error message. It was added to address the issue that we weren't throwing duplicate key issues, I expected we'd eventually need it in eval as well. It was added here to match the Ruby behaviour. IIRC Ruby validates duplicate keys when adding keys to a Map AST node. However it only validates static values. The ideal way to handle this would be to have the Map AST either throw the error or have it return an |
Ah right, it's because the close |
Deferred check from parser to evaluation Fixes sass#1187
8b556bc
to
2eef52a
Compare
Fix duplicate key handling for maps
Spec activated sass/sass-spec#656 |
Deferred check from parser to evaluation
Fixes #1187