Add a FatalUserError macro to help print user-caused errors. (#668)

This commit is contained in:
Jon Meow
2021-07-21 12:38:56 -07:00
committed by GitHub
parent f3cbfc04c6
commit 034f3600e3
15 changed files with 102 additions and 26 deletions
+5 -3
View File
@@ -4,6 +4,8 @@
#include "executable_semantics/ast/expression.h"
#include "executable_semantics/common/error.h"
namespace Carbon {
auto Expression::GetIdentifierExpression() const
@@ -166,9 +168,9 @@ auto Expression::MakeTupleLiteral(int line_num,
for (auto& arg : args) {
if (arg.name == "") {
if (seen_named_member) {
llvm::errs() << line_num
<< ": positional members must come before named members\n";
exit(-1);
FatalUserError()
<< line_num
<< ": positional members must come before named members";
}
arg.name = std::to_string(i);
++i;