Commit bd841192 by Aaron Leung

Re-ordering some arguments.

parent 20265121
......@@ -87,10 +87,10 @@ namespace Sass {
}
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)
{ throw Error(Error::read, ln ? ln : line, path, message); }
{ throw Error(Error::read, path, ln ? ln : line, message); }
using std::string;
using std::stringstream;
......
......@@ -4,12 +4,12 @@ namespace Sass {
enum Type { read, write, syntax, evaluation };
Type type;
size_t line_number;
string file_name;
size_t line;
string path;
string message;
Error(Type type, size_t line_number, string file_name, string message)
: type(type), line_number(line_number), file_name(file_name), message(message)
Error(Type type, string path, size_t line, string message)
: type(type), path(path), line(line), message(message)
{ }
};
......
......@@ -11,12 +11,20 @@ namespace Sass {
string fn;
if (path) {
const char* end = Prelexer::string_constant(path);
if (end) fn = string(path, end - path);
else fn = string(path);
if (end) fn = path.substr(1, path.size() - 1);
else fn = path;
}
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)
{
switch (expr.type)
......
......@@ -82,11 +82,11 @@ namespace Sass {
return numeric_value() < rhs.numeric_value();
}
else {
throw Error(Error::evaluation, line(), path(), "incompatible units");
throw Error(Error::evaluation, path(), line(), "incompatible units");
}
}
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