Skip to content

Commit 58ffae1

Browse files
committed
Relax compact error to warning
1 parent 9ad775f commit 58ffae1

File tree

6 files changed

+21
-14
lines changed

6 files changed

+21
-14
lines changed

context.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,6 @@ namespace Sass {
512512
register_function(ctx, index_sig, index, env);
513513
register_function(ctx, join_sig, join, env);
514514
register_function(ctx, append_sig, append, env);
515-
register_function(ctx, compact_sig, compact, env);
516515
register_function(ctx, zip_sig, zip, env);
517516
register_function(ctx, list_separator_sig, list_separator, env);
518517
// Map Functions

error_handling.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,28 @@ namespace Sass {
88
: type(type), pstate(pstate), message(message)
99
{ }
1010

11-
void error(string msg, ParserState pstate)
11+
void warn(string msg, ParserState pstate)
1212
{
13-
throw Sass_Error(Sass_Error::syntax, pstate, msg);
13+
cerr << "Warning: " << msg<< endl;
1414
}
1515

16-
void error(string msg, ParserState pstate, Backtrace* bt)
16+
void warn(string msg, ParserState pstate, Backtrace* bt)
1717
{
18-
1918
Backtrace top(bt, pstate, "");
2019
msg += top.to_string();
20+
warn(msg, pstate);
21+
}
2122

23+
void error(string msg, ParserState pstate)
24+
{
2225
throw Sass_Error(Sass_Error::syntax, pstate, msg);
2326
}
2427

28+
void error(string msg, ParserState pstate, Backtrace* bt)
29+
{
30+
Backtrace top(bt, pstate, "");
31+
msg += "\n" + top.to_string();
32+
error(msg, pstate);
33+
}
34+
2535
}

error_handling.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ namespace Sass {
2121

2222
};
2323

24+
void warn(string msg, ParserState pstate);
25+
void warn(string msg, ParserState pstate, Backtrace* bt);
26+
2427
void error(string msg, ParserState pstate);
2528
void error(string msg, ParserState pstate, Backtrace* bt);
2629

functions.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,13 +1254,6 @@ namespace Sass {
12541254
return zippers;
12551255
}
12561256

1257-
Signature compact_sig = "compact($values...)";
1258-
BUILT_IN(compact)
1259-
{
1260-
error("`compact` has been removed from libsass because it's not part of the Sass spec", pstate);
1261-
return 0; // suppress warning, error will exit anyway
1262-
}
1263-
12641257
Signature list_separator_sig = "list_separator($list)";
12651258
BUILT_IN(list_separator)
12661259
{

functions.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ namespace Sass {
7878
extern Signature join_sig;
7979
extern Signature append_sig;
8080
extern Signature zip_sig;
81-
extern Signature compact_sig;
8281
extern Signature list_separator_sig;
8382
extern Signature type_of_sig;
8483
extern Signature unit_sig;
@@ -153,7 +152,6 @@ namespace Sass {
153152
BUILT_IN(join);
154153
BUILT_IN(append);
155154
BUILT_IN(zip);
156-
BUILT_IN(compact);
157155
BUILT_IN(list_separator);
158156
BUILT_IN(type_of);
159157
BUILT_IN(unit);

parser.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,6 +1619,10 @@ namespace Sass {
16191619
{
16201620
lex< identifier >();
16211621
string name(lexed);
1622+
if (name == "compact") {
1623+
warn("`compact` has been removed from libsass because it's not part of the Sass spec", pstate);
1624+
}
1625+
16221626
ParserState call_pos = pstate;
16231627
Arguments* args = parse_arguments(name == "url");
16241628
return new (ctx.mem) Function_Call(call_pos, name, args);

0 commit comments

Comments
 (0)