mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user