Skip to content

Commit 25f2d10

Browse files
committed
Merge pull request #1129 from xzyfer/cleanup/function/unquote
Tidy up the unquote function implementation
2 parents 8963264 + 0a66561 commit 25f2d10

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

functions.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -760,18 +760,17 @@ namespace Sass {
760760
Signature unquote_sig = "unquote($string)";
761761
BUILT_IN(sass_unquote)
762762
{
763-
if (dynamic_cast<Null*>(env["$string"])) {
763+
AST_Node* arg = env["$string"];
764+
if (dynamic_cast<Null*>(arg)) {
764765
return new (ctx.mem) Null(pstate);
765766
}
766-
767-
To_String to_string(&ctx);
768-
AST_Node* arg = env["$string"];
769-
if (String_Quoted* string_quoted = dynamic_cast<String_Quoted*>(arg)) {
767+
else if (String_Quoted* string_quoted = dynamic_cast<String_Quoted*>(arg)) {
770768
String_Constant* result = new (ctx.mem) String_Constant(pstate, string_quoted->value());
771769
// remember if the string was quoted (color tokens)
772770
result->sass_fix_1291(string_quoted->quote_mark() != 0);
773771
return result;
774772
}
773+
To_String to_string(&ctx);
775774
return new (ctx.mem) String_Constant(pstate, string(arg->perform(&to_string)));
776775
}
777776

0 commit comments

Comments
 (0)