diff --git a/error_handling.cpp b/error_handling.cpp index 522994829b..29c2e1f153 100644 --- a/error_handling.cpp +++ b/error_handling.cpp @@ -20,6 +20,15 @@ namespace Sass { warn(msg, pstate); } + void deprecated(string msg, ParserState pstate) + { + string cwd(Sass::File::get_cwd()); + cerr << "DEPRECATION WARNING: " << msg << endl; + cerr << "will be an error in future versions of Sass." << endl; + string rel_path(Sass::File::resolve_relative_path(pstate.path, cwd, cwd)); + cerr << " on line " << pstate.line+1 << " of " << rel_path << endl; + } + void error(string msg, ParserState pstate) { throw Sass_Error(Sass_Error::syntax, pstate, msg); diff --git a/error_handling.hpp b/error_handling.hpp index 6580b79067..1c743ab0e4 100644 --- a/error_handling.hpp +++ b/error_handling.hpp @@ -24,6 +24,9 @@ namespace Sass { void warn(string msg, ParserState pstate); void warn(string msg, ParserState pstate, Backtrace* bt); + void deprecated(string msg, ParserState pstate); + // void deprecated(string msg, ParserState pstate, Backtrace* bt); + void error(string msg, ParserState pstate); void error(string msg, ParserState pstate, Backtrace* bt); diff --git a/functions.cpp b/functions.cpp index 657fdc1a96..60a9582e94 100644 --- a/functions.cpp +++ b/functions.cpp @@ -771,17 +771,21 @@ namespace Sass { if (dynamic_cast(arg)) { return new (ctx.mem) Null(pstate); } - else if (List* list = dynamic_cast(arg)) { - return list; - } else if (String_Quoted* string_quoted = dynamic_cast(arg)) { String_Constant* result = new (ctx.mem) String_Constant(pstate, string_quoted->value()); // remember if the string was quoted (color tokens) result->sass_fix_1291(string_quoted->quote_mark() != 0); return result; } - To_String to_string(&ctx); - return new (ctx.mem) String_Constant(pstate, string(arg->perform(&to_string))); + else if (dynamic_cast(arg)) { + return (Expression*) arg; + } + else { + To_String to_string(&ctx); + string val(arg->perform(&to_string)); + deprecated("Passing " + val + ", a non-string value, to unquote()", pstate); + return (Expression*) arg; + } } Signature quote_sig = "quote($string)";