Parse ref as operator (#6539)

This is the first step of implementing the guidance in #6342.

---------

Co-authored-by: josh11b <15258583+josh11b@users.noreply.github.com>
This commit is contained in:
Geoff Romer
2025-12-30 19:18:34 +00:00
committed by GitHub
co-authored by josh11b
parent 9cdb9c803a
commit e940cb72b6
14 changed files with 177 additions and 162 deletions
-14
View File
@@ -33,18 +33,4 @@ auto HandleParseNode(Context& context, Parse::CallExprId node_id) -> bool {
return true;
}
auto HandleParseNode(Context& context, Parse::RefTagId node_id) -> bool {
auto expr_id = context.node_stack().Peek<Parse::NodeCategory::Expr>();
if (SemIR::GetExprCategory(context.sem_ir(), expr_id) !=
SemIR::ExprCategory::DurableRef) {
CARBON_DIAGNOSTIC(
RefTagNotDurableRef, Error,
"expression tagged with `ref` is not a durable reference");
context.emitter().Emit(node_id, RefTagNotDurableRef);
}
context.ref_tags().Insert(expr_id, Context::RefTag::Present);
return true;
}
} // namespace Carbon::Check