Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit d0e6ea2

Browse files
author
Aaron Leung
committed
Printing out the backtrace for warnings, too.
1 parent 48917b7 commit d0e6ea2

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

backtrace.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@ namespace Sass {
2020
caller(c)
2121
{ }
2222

23-
string to_string()
23+
string to_string(bool warning = false)
2424
{
2525
stringstream ss;
2626
Backtrace* this_point = this;
2727

28-
ss << endl << "Backtrace:";
28+
if (!warning) ss << endl << "Backtrace:";
2929
// the first tracepoint (which is parent-less) is an empty placeholder
3030
while (this_point->parent) {
3131
ss << endl
3232
<< "\t"
33+
<< (warning ? " " : "")
3334
<< this_point->path
3435
<< ":"
3536
<< this_point->line

eval_apply.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,10 @@ namespace Sass {
318318
result = result.substr(1, result.size()-2); // unquote if it's a single string
319319
}
320320
// These cerrs aren't log lines! They're supposed to be here!
321-
cerr << prefix << result << endl;
322-
cerr << indent << "on line " << expr.line() << " of " << expr.path();
321+
cerr << prefix << result;
322+
// cerr << indent << "on line " << expr.line() << " of " << expr.path();
323+
Backtrace top(&bt, expr.path(), expr.line(), "");
324+
cerr << top.to_string(true);
323325
cerr << endl << endl;
324326
} break;
325327

@@ -1026,8 +1028,10 @@ namespace Sass {
10261028
result = result.substr(1, result.size()-2); // unquote if it's a single string
10271029
}
10281030
// These cerrs aren't log lines! They're supposed to be here!
1029-
cerr << prefix << result << endl;
1030-
cerr << indent << "on line " << stm.line() << " of " << stm.path();
1031+
cerr << prefix << result;
1032+
// cerr << indent << "on line " << stm.line() << " of " << stm.path();
1033+
Backtrace top(&bt, stm.path(), stm.line(), "");
1034+
cerr << top.to_string(true);
10311035
cerr << endl << endl;
10321036
} break;
10331037

0 commit comments

Comments
 (0)