Skip to content

Commit

Permalink
Merge pull request #1055 from mgreter/lower-compact-to-warning
Browse files Browse the repository at this point in the history
Relax compact error to warning
  • Loading branch information
xzyfer committed Apr 30, 2015
2 parents 389bc92 + 58ffae1 commit e716caa
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
1 change: 0 additions & 1 deletion context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,6 @@ namespace Sass {
register_function(ctx, index_sig, index, env);
register_function(ctx, join_sig, join, env);
register_function(ctx, append_sig, append, env);
register_function(ctx, compact_sig, compact, env);
register_function(ctx, zip_sig, zip, env);
register_function(ctx, list_separator_sig, list_separator, env);
// Map Functions
Expand Down
18 changes: 14 additions & 4 deletions error_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,28 @@ namespace Sass {
: type(type), pstate(pstate), message(message)
{ }

void error(string msg, ParserState pstate)
void warn(string msg, ParserState pstate)
{
throw Sass_Error(Sass_Error::syntax, pstate, msg);
cerr << "Warning: " << msg<< endl;
}

void error(string msg, ParserState pstate, Backtrace* bt)
void warn(string msg, ParserState pstate, Backtrace* bt)
{

Backtrace top(bt, pstate, "");
msg += top.to_string();
warn(msg, pstate);
}

void error(string msg, ParserState pstate)
{
throw Sass_Error(Sass_Error::syntax, pstate, msg);
}

void error(string msg, ParserState pstate, Backtrace* bt)
{
Backtrace top(bt, pstate, "");
msg += "\n" + top.to_string();
error(msg, pstate);
}

}
3 changes: 3 additions & 0 deletions error_handling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ namespace Sass {

};

void warn(string msg, ParserState pstate);
void warn(string msg, ParserState pstate, Backtrace* bt);

void error(string msg, ParserState pstate);
void error(string msg, ParserState pstate, Backtrace* bt);

Expand Down
7 changes: 0 additions & 7 deletions functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1251,13 +1251,6 @@ namespace Sass {
return zippers;
}

Signature compact_sig = "compact($values...)";
BUILT_IN(compact)
{
error("`compact` has been removed from libsass because it's not part of the Sass spec", pstate);
return 0; // suppress warning, error will exit anyway
}

Signature list_separator_sig = "list_separator($list)";
BUILT_IN(list_separator)
{
Expand Down
2 changes: 0 additions & 2 deletions functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ namespace Sass {
extern Signature join_sig;
extern Signature append_sig;
extern Signature zip_sig;
extern Signature compact_sig;
extern Signature list_separator_sig;
extern Signature type_of_sig;
extern Signature unit_sig;
Expand Down Expand Up @@ -153,7 +152,6 @@ namespace Sass {
BUILT_IN(join);
BUILT_IN(append);
BUILT_IN(zip);
BUILT_IN(compact);
BUILT_IN(list_separator);
BUILT_IN(type_of);
BUILT_IN(unit);
Expand Down
4 changes: 4 additions & 0 deletions parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,10 @@ namespace Sass {
{
lex< identifier >();
string name(lexed);
if (name == "compact") {
warn("`compact` has been removed from libsass because it's not part of the Sass spec", pstate);
}

ParserState call_pos = pstate;
Arguments* args = parse_arguments(name == "url");
return new (ctx.mem) Function_Call(call_pos, name, args);
Expand Down

0 comments on commit e716caa

Please sign in to comment.