Commit bd841192 by Aaron Leung

Re-ordering some arguments.

parent 20265121
...@@ -87,10 +87,10 @@ namespace Sass { ...@@ -87,10 +87,10 @@ namespace Sass {
} }
void Document::throw_syntax_error(string message, size_t ln) void Document::throw_syntax_error(string message, size_t ln)
{ throw Error(Error::syntax, ln ? ln : line, path, message); } { throw Error(Error::syntax, path, ln ? ln : line, message); }
void Document::throw_read_error(string message, size_t ln) void Document::throw_read_error(string message, size_t ln)
{ throw Error(Error::read, ln ? ln : line, path, message); } { throw Error(Error::read, path, ln ? ln : line, message); }
using std::string; using std::string;
using std::stringstream; using std::stringstream;
......
...@@ -4,12 +4,12 @@ namespace Sass { ...@@ -4,12 +4,12 @@ namespace Sass {
enum Type { read, write, syntax, evaluation }; enum Type { read, write, syntax, evaluation };
Type type; Type type;
size_t line_number; size_t line;
string file_name; string path;
string message; string message;
Error(Type type, size_t line_number, string file_name, string message) Error(Type type, string path, size_t line, string message)
: type(type), line_number(line_number), file_name(file_name), message(message) : type(type), path(path), line(line), message(message)
{ } { }
}; };
......
...@@ -11,12 +11,20 @@ namespace Sass { ...@@ -11,12 +11,20 @@ namespace Sass {
string fn; string fn;
if (path) { if (path) {
const char* end = Prelexer::string_constant(path); const char* end = Prelexer::string_constant(path);
if (end) fn = string(path, end - path); if (end) fn = path.substr(1, path.size() - 1);
else fn = string(path); else fn = path;
} }
throw Error(Error::evaluation, line, fn, message); throw Error(Error::evaluation, line, fn, message);
} }
static void throw_eval_error(string message, string path, size_t line)
{
if (!path.empty() && Prelexer::string_constant(path.c_str()))
path = path.substr(1, path.size() - 1);
throw Error(Error::evaluation, path, line, message);
}
Node eval(Node& expr, Environment& env, map<pair<string, size_t>, Function>& f_env, Node_Factory& new_Node) Node eval(Node& expr, Environment& env, map<pair<string, size_t>, Function>& f_env, Node_Factory& new_Node)
{ {
switch (expr.type) switch (expr.type)
......
...@@ -82,11 +82,11 @@ namespace Sass { ...@@ -82,11 +82,11 @@ namespace Sass {
return numeric_value() < rhs.numeric_value(); return numeric_value() < rhs.numeric_value();
} }
else { else {
throw Error(Error::evaluation, line(), path(), "incompatible units"); throw Error(Error::evaluation, path(), line(), "incompatible units");
} }
} }
else { else {
throw Error(Error::evaluation, line(), path(), "incomparable types"); throw Error(Error::evaluation, path(), line(), "incomparable types");
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment