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:
Richard Smith
2026-09-29 21:13:51 +00:00
committed by GitHub
parent 99f910f179
commit 4ca08b136d
18 changed files with 846 additions and 5 deletions
+5
View File
@@ -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) {