mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Check and lowering support for for loops. (#5698)
Add check support for `for` loops following #1885. This also adds a basic `Optional` type to the prelude, as that's necessary to support the new `Iterate` interface. Depends on #5688, #5697. Those PRs aren't stacked here, but this change will crash until they land. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
a556cf41fc
commit
866794b82a
@@ -419,10 +419,10 @@ class NodeStack {
|
||||
case Parse::NodeKind::WhereOperand:
|
||||
return Id::KindFor<SemIR::InstId>();
|
||||
case Parse::NodeKind::ExplicitParamList:
|
||||
case Parse::NodeKind::ForIn:
|
||||
case Parse::NodeKind::IfCondition:
|
||||
case Parse::NodeKind::IfExprIf:
|
||||
case Parse::NodeKind::ImplicitParamList:
|
||||
case Parse::NodeKind::WhileCondition:
|
||||
case Parse::NodeKind::WhileConditionStart:
|
||||
return Id::KindFor<SemIR::InstBlockId>();
|
||||
case Parse::NodeKind::FunctionDefinitionStart:
|
||||
@@ -449,6 +449,7 @@ class NodeStack {
|
||||
case Parse::NodeKind::ExplicitParamListStart:
|
||||
case Parse::NodeKind::FieldInitializer:
|
||||
case Parse::NodeKind::FieldIntroducer:
|
||||
case Parse::NodeKind::ForHeaderStart:
|
||||
case Parse::NodeKind::FunctionIntroducer:
|
||||
case Parse::NodeKind::IfStatementElse:
|
||||
case Parse::NodeKind::ImplicitParamListStart:
|
||||
@@ -483,10 +484,8 @@ class NodeStack {
|
||||
case Parse::NodeKind::ExportIntroducer:
|
||||
case Parse::NodeKind::FileEnd:
|
||||
case Parse::NodeKind::FileStart:
|
||||
case Parse::NodeKind::Forall:
|
||||
case Parse::NodeKind::ForHeader:
|
||||
case Parse::NodeKind::ForHeaderStart:
|
||||
case Parse::NodeKind::ForIn:
|
||||
case Parse::NodeKind::Forall:
|
||||
case Parse::NodeKind::IdentifierNameQualifierWithParams:
|
||||
case Parse::NodeKind::IdentifierNameQualifierWithoutParams:
|
||||
case Parse::NodeKind::IdentifierPackageName:
|
||||
@@ -528,6 +527,7 @@ class NodeStack {
|
||||
case Parse::NodeKind::StructFieldDesignator:
|
||||
case Parse::NodeKind::StructTypeLiteralComma:
|
||||
case Parse::NodeKind::TupleLiteralComma:
|
||||
case Parse::NodeKind::WhileCondition:
|
||||
return Id::Kind::Invalid;
|
||||
default:
|
||||
// In this case, the kind must be determinable from the category, or we
|
||||
|
||||
Reference in New Issue
Block a user