mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 19:01:05 +01:00
Support for typeof. (#7858)
Implements `typeof(expr)`, as described in #7697. `expr` is treated as an unevaluated operand, and is kept in an `ExprRegion` separate from the enclosing scope. Assisted-by: Claude via Antigravity
This commit is contained in:
@@ -179,6 +179,11 @@ auto HandleExprInPostfix(Context& context) -> void {
|
||||
context.PushState(StateKind::FormLiteral);
|
||||
break;
|
||||
}
|
||||
case Lex::TokenKind::TypeOf: {
|
||||
context.PushState(state);
|
||||
context.PushState(StateKind::TypeOfExpr);
|
||||
break;
|
||||
}
|
||||
case Lex::TokenKind::Package: {
|
||||
context.AddLeafNode(NodeKind::PackageExpr, context.Consume());
|
||||
if (context.PositionKind() != Lex::TokenKind::Period) {
|
||||
|
||||
Reference in New Issue
Block a user