mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 11:11:04 +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:
@@ -16,7 +16,6 @@
|
||||
#include "executable_semantics/ast/expression.h"
|
||||
#include "executable_semantics/common/arena.h"
|
||||
#include "executable_semantics/common/error.h"
|
||||
#include "executable_semantics/common/tracing_flag.h"
|
||||
#include "executable_semantics/interpreter/action.h"
|
||||
#include "executable_semantics/interpreter/frame.h"
|
||||
#include "executable_semantics/interpreter/stack.h"
|
||||
@@ -377,7 +376,7 @@ void Interpreter::PatternAssignment(Nonnull<const Value*> pat,
|
||||
auto Interpreter::StepLvalue() -> Transition {
|
||||
Nonnull<Action*> act = stack.Top()->todo.Top();
|
||||
const Expression& exp = cast<LValAction>(*act).expression();
|
||||
if (tracing_output) {
|
||||
if (trace_) {
|
||||
llvm::outs() << "--- step lvalue " << exp << " (" << exp.source_loc()
|
||||
<< ") --->\n";
|
||||
}
|
||||
@@ -460,7 +459,7 @@ auto Interpreter::StepLvalue() -> Transition {
|
||||
auto Interpreter::StepExp() -> Transition {
|
||||
Nonnull<Action*> act = stack.Top()->todo.Top();
|
||||
const Expression& exp = cast<ExpressionAction>(*act).expression();
|
||||
if (tracing_output) {
|
||||
if (trace_) {
|
||||
llvm::outs() << "--- step exp " << exp << " (" << exp.source_loc()
|
||||
<< ") --->\n";
|
||||
}
|
||||
@@ -658,7 +657,7 @@ auto Interpreter::StepExp() -> Transition {
|
||||
auto Interpreter::StepPattern() -> Transition {
|
||||
Nonnull<Action*> act = stack.Top()->todo.Top();
|
||||
const Pattern& pattern = cast<PatternAction>(*act).pattern();
|
||||
if (tracing_output) {
|
||||
if (trace_) {
|
||||
llvm::outs() << "--- step pattern " << pattern << " ("
|
||||
<< pattern.source_loc() << ") --->\n";
|
||||
}
|
||||
@@ -741,7 +740,7 @@ auto Interpreter::StepStmt() -> Transition {
|
||||
Nonnull<Frame*> frame = stack.Top();
|
||||
Nonnull<Action*> act = frame->todo.Top();
|
||||
const Statement& stmt = cast<StatementAction>(*act).statement();
|
||||
if (tracing_output) {
|
||||
if (trace_) {
|
||||
llvm::outs() << "--- step stmt ";
|
||||
stmt.PrintDepth(1, llvm::outs());
|
||||
llvm::outs() << " (" << stmt.source_loc() << ") --->\n";
|
||||
@@ -1136,7 +1135,7 @@ auto Interpreter::InterpProgram(llvm::ArrayRef<Nonnull<Declaration*>> fs,
|
||||
CHECK(stack.IsEmpty());
|
||||
CHECK(program_value == std::nullopt);
|
||||
|
||||
if (tracing_output) {
|
||||
if (trace_) {
|
||||
llvm::outs() << "********** initializing globals **********\n";
|
||||
}
|
||||
InitGlobals(fs);
|
||||
@@ -1145,14 +1144,14 @@ auto Interpreter::InterpProgram(llvm::ArrayRef<Nonnull<Declaration*>> fs,
|
||||
auto scopes = Stack<Nonnull<Scope*>>(arena->New<Scope>(globals));
|
||||
stack = Stack<Nonnull<Frame*>>(arena->New<Frame>("top", scopes, todo));
|
||||
|
||||
if (tracing_output) {
|
||||
if (trace_) {
|
||||
llvm::outs() << "********** calling main function **********\n";
|
||||
PrintState(llvm::outs());
|
||||
}
|
||||
|
||||
while (stack.Count() > 1 || !stack.Top()->todo.IsEmpty()) {
|
||||
Step();
|
||||
if (tracing_output) {
|
||||
if (trace_) {
|
||||
PrintState(llvm::outs());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user