Remove global_arena (#814)

With this, only main.cpp instantiates an arena. Maybe we'll want to split that up more later (e.g., so that the runtime interpreter uses its own arena), but given the intent to have type-checking update the AST, I thought this was a reasonable approach for now in order to avoid ownership complexities.

Fixes #769
This commit is contained in:
Jon Meow
2021-09-09 11:00:57 -07:00
committed by GitHub
parent 3610325c38
commit 90f04700e2
27 changed files with 568 additions and 581 deletions
+3 -2
View File
@@ -9,6 +9,7 @@
#include <variant>
#include "executable_semantics/ast/ast.h"
#include "executable_semantics/common/arena.h"
namespace Carbon {
@@ -16,8 +17,8 @@ namespace Carbon {
using SyntaxErrorCode = int;
// Returns the AST representing the contents of the named file, or an error code
// if parsing fails.
auto Parse(const std::string& input_file_name)
// if parsing fails. Allocations go into the provided arena.
auto Parse(Ptr<Arena> arena, const std::string& input_file_name)
-> std::variant<Carbon::AST, SyntaxErrorCode>;
} // namespace Carbon