Switch executable semantics to use ErrorBuilder directly and relocate macros (#1184)

This commit is contained in:
Jon Meow
2022-04-13 09:05:21 -07:00
committed by GitHub
parent 6542506cdc
commit 87e58f5db3
37 changed files with 327 additions and 376 deletions
+2 -2
View File
@@ -9,7 +9,7 @@
#include "common/ostream.h"
#include "executable_semantics/ast/expression.h"
#include "executable_semantics/common/arena.h"
#include "executable_semantics/common/error.h"
#include "executable_semantics/common/error_builders.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Casting.h"
@@ -151,7 +151,7 @@ auto TuplePatternFromParenContents(Nonnull<Arena*> arena,
auto AlternativePattern::RequireFieldAccess(Nonnull<Expression*> alternative)
-> ErrorOr<Nonnull<FieldAccessExpression*>> {
if (alternative->kind() != ExpressionKind::FieldAccessExpression) {
return FATAL_PROGRAM_ERROR(alternative->source_loc())
return ProgramError(alternative->source_loc())
<< "Alternative pattern must have the form of a field access.";
}
return &cast<FieldAccessExpression>(*alternative);