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
@@ -17,8 +17,8 @@ namespace Carbon {
class ParseAndLexContext {
public:
// Creates an instance analyzing the given input file.
ParseAndLexContext(Nonnull<const std::string*> input_file_name)
: input_file_name(input_file_name) {}
ParseAndLexContext(Nonnull<const std::string*> input_file_name, bool trace)
: input_file_name(input_file_name), trace_(trace) {}
// Writes a syntax error diagnostic containing message to standard error.
auto PrintDiagnostic(const std::string& message) -> void;
@@ -28,6 +28,8 @@ class ParseAndLexContext {
static_cast<int>(current_token_position.begin.line));
}
auto trace() -> bool { return trace_; }
// The source range of the token being (or just) lex'd.
location current_token_position;
@@ -35,6 +37,8 @@ class ParseAndLexContext {
// A path to the file processed, relative to the current working directory
// when *this is called.
Nonnull<const std::string*> input_file_name;
bool trace_;
};
} // namespace Carbon