mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-15 15:18:11 +00:00
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:
1 parent
3610325c38
commit
90f04700e2
27 files changed
+568
-581
No files matched your search
@@ -17,21 +17,21 @@ namespace Carbon {
|
||||
using llvm::cast;
|
||||
|
||||
auto ExpressionFromParenContents(
|
||||
SourceLocation loc, const ParenContents<Expression>& paren_contents)
|
||||
-> Ptr<const Expression> {
|
||||
Ptr<Arena> arena, SourceLocation loc,
|
||||
const ParenContents<Expression>& paren_contents) -> Ptr<const Expression> {
|
||||
std::optional<Ptr<const Expression>> single_term =
|
||||
paren_contents.SingleTerm();
|
||||
if (single_term.has_value()) {
|
||||
return *single_term;
|
||||
} else {
|
||||
return TupleExpressionFromParenContents(loc, paren_contents);
|
||||
return TupleExpressionFromParenContents(arena, loc, paren_contents);
|
||||
}
|
||||
}
|
||||
|
||||
auto TupleExpressionFromParenContents(
|
||||
SourceLocation loc, const ParenContents<Expression>& paren_contents)
|
||||
-> Ptr<const Expression> {
|
||||
return global_arena->New<TupleLiteral>(
|
||||
Ptr<Arena> arena, SourceLocation loc,
|
||||
const ParenContents<Expression>& paren_contents) -> Ptr<const Expression> {
|
||||
return arena->New<TupleLiteral>(
|
||||
loc, paren_contents.TupleElements<FieldInitializer>(loc));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user