mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-28 08:30:10 +01: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:
@@ -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