Pass the flag instead of using a global. (#893)

Arguably missed in #769 

Note, this is reminding me we have more class members to rename for `_`, but I felt it's best to use the new naming instead of adding more to clean up.
This commit is contained in:
Jon Meow
2021-10-19 09:16:57 -07:00
committed by GitHub
parent a3eac75a5b
commit a9eed3dbf1
17 changed files with 43 additions and 79 deletions
+3 -6
View File
@@ -6,7 +6,6 @@
#include <cstring>
#include <iostream>
#include "executable_semantics/common/tracing_flag.h"
#include "executable_semantics/interpreter/exec_program.h"
#include "executable_semantics/syntax/parse.h"
#include "llvm/Support/CommandLine.h"
@@ -30,13 +29,10 @@ int main(int argc, char* argv[]) {
llvm::cl::Required);
llvm::cl::ParseCommandLineOptions(argc, argv);
if (trace_option) {
Carbon::tracing_output = true;
}
Carbon::Arena arena;
std::variant<Carbon::AST, Carbon::SyntaxErrorCode> ast_or_error =
Carbon::Parse(&arena, input_file_name);
Carbon::Parse(&arena, input_file_name, trace_option);
if (auto* error = std::get_if<Carbon::SyntaxErrorCode>(&ast_or_error)) {
// Diagnostic already reported to std::cerr; this is just a return code.
@@ -44,5 +40,6 @@ int main(int argc, char* argv[]) {
}
// Typecheck and run the parsed program.
Carbon::ExecProgram(&arena, std::get<Carbon::AST>(ast_or_error));
Carbon::ExecProgram(&arena, std::get<Carbon::AST>(ast_or_error),
trace_option);
}