Commit 0faad36b authored by Filipe Gonçalves's avatar Filipe Gonçalves

- Replaced hardcoded source filename in the error messages by __FILE__.

- Fixed subtle bug in getReverseOpName(): the reverse of AST_TYPE::NotEq and the reverse of AST_TYPE::Eq were wrong (ironically, they were reversed!)
parent 75f885b6
...@@ -76,7 +76,7 @@ std::string getOpSymbol(int op_type) { ...@@ -76,7 +76,7 @@ std::string getOpSymbol(int op_type) {
case AST_TYPE::USub: case AST_TYPE::USub:
return "-"; return "-";
default: default:
fprintf(stderr, "Unknown op type (ast.cpp:" STRINGIFY(__LINE__) "): %d\n", op_type); fprintf(stderr, "Unknown op type (" __FILE__ ":" STRINGIFY(__LINE__) "): %d\n", op_type);
abort(); abort();
} }
} }
...@@ -138,7 +138,7 @@ std::string getOpName(int op_type) { ...@@ -138,7 +138,7 @@ std::string getOpName(int op_type) {
case AST_TYPE::USub: case AST_TYPE::USub:
return "__neg__"; return "__neg__";
default: default:
fprintf(stderr, "Unknown op type (ast.cpp:" STRINGIFY(__LINE__) "): %d\n", op_type); fprintf(stderr, "Unknown op type (" __FILE__ ":" STRINGIFY(__LINE__) "): %d\n", op_type);
abort(); abort();
} }
} }
...@@ -158,9 +158,9 @@ std::string getReverseOpName(int op_type) { ...@@ -158,9 +158,9 @@ std::string getReverseOpName(int op_type) {
if (op_type == AST_TYPE::GtE) if (op_type == AST_TYPE::GtE)
return getOpName(AST_TYPE::Lt); return getOpName(AST_TYPE::Lt);
if (op_type == AST_TYPE::NotEq) if (op_type == AST_TYPE::NotEq)
return getOpName(AST_TYPE::NotEq);
if (op_type == AST_TYPE::Eq)
return getOpName(AST_TYPE::Eq); return getOpName(AST_TYPE::Eq);
if (op_type == AST_TYPE::Eq)
return getOpName(AST_TYPE::NotEq);
std::string normal_name = getOpName(op_type); std::string normal_name = getOpName(op_type);
return "__r" + normal_name.substr(2); return "__r" + normal_name.substr(2);
......
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