mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-01 22:02:45 +01:00
Switch executable semantics to use ErrorBuilder directly and relocate macros (#1184)
This commit is contained in:
@@ -85,7 +85,7 @@ cc_library(
|
||||
"//executable_semantics/ast:pattern",
|
||||
"//executable_semantics/ast:value_category",
|
||||
"//executable_semantics/common:arena",
|
||||
"//executable_semantics/common:error",
|
||||
"//executable_semantics/common:error_builders",
|
||||
"//executable_semantics/common:nonnull",
|
||||
"@llvm-project//llvm:Support",
|
||||
],
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "common/check.h"
|
||||
#include "common/error.h"
|
||||
#include "executable_semantics/common/error.h"
|
||||
#include "executable_semantics/common/error_builders.h"
|
||||
#include "executable_semantics/syntax/lexer.h"
|
||||
#include "executable_semantics/syntax/parse_and_lex_context.h"
|
||||
#include "executable_semantics/syntax/parser.h"
|
||||
@@ -41,10 +41,11 @@ auto ParseImpl(yyscan_t scanner, Nonnull<Arena*> arena,
|
||||
|
||||
auto Parse(Nonnull<Arena*> arena, std::string_view input_file_name, bool trace)
|
||||
-> ErrorOr<AST> {
|
||||
FILE* input_file = fopen(std::string(input_file_name).c_str(), "r");
|
||||
std::string name_str(input_file_name);
|
||||
FILE* input_file = fopen(name_str.c_str(), "r");
|
||||
if (input_file == nullptr) {
|
||||
return FATAL_PROGRAM_ERROR_NO_LINE() << "Error opening '" << input_file_name
|
||||
<< "': " << std::strerror(errno);
|
||||
return ProgramError(SourceLocation(name_str.c_str(), 0))
|
||||
<< "Error opening file: " << std::strerror(errno);
|
||||
}
|
||||
|
||||
// Prepare the lexer.
|
||||
|
||||
Reference in New Issue
Block a user