mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 07:54:41 +01:00
Semantics for array index. (#3099)
Co-authored-by: Farzana Ahmed Siddique <fasiddique@google.com>
This commit is contained in:
co-authored by
Farzana Ahmed Siddique
parent
a692fb89a3
commit
a6ba7827cd
@@ -222,6 +222,7 @@ static auto GetTypePrecedence(SemanticsNodeKind kind) -> int {
|
||||
return 0;
|
||||
|
||||
case SemanticsNodeKind::AddressOf:
|
||||
case SemanticsNodeKind::ArrayIndex:
|
||||
case SemanticsNodeKind::ArrayValue:
|
||||
case SemanticsNodeKind::Assign:
|
||||
case SemanticsNodeKind::BinaryOperatorAdd:
|
||||
@@ -376,6 +377,7 @@ auto SemanticsIR::StringifyType(SemanticsTypeId type_id,
|
||||
break;
|
||||
}
|
||||
case SemanticsNodeKind::AddressOf:
|
||||
case SemanticsNodeKind::ArrayIndex:
|
||||
case SemanticsNodeKind::ArrayValue:
|
||||
case SemanticsNodeKind::Assign:
|
||||
case SemanticsNodeKind::BinaryOperatorAdd:
|
||||
@@ -479,6 +481,12 @@ auto GetSemanticsExpressionCategory(const SemanticsIR& semantics_ir,
|
||||
case SemanticsNodeKind::UnaryOperatorNot:
|
||||
return SemanticsExpressionCategory::Value;
|
||||
|
||||
case SemanticsNodeKind::ArrayIndex: {
|
||||
auto [base_id, index_id] = node.GetAsArrayIndex();
|
||||
node_id = base_id;
|
||||
continue;
|
||||
}
|
||||
|
||||
case SemanticsNodeKind::StructAccess: {
|
||||
auto [base_id, member_index] = node.GetAsStructAccess();
|
||||
node_id = base_id;
|
||||
|
||||
Reference in New Issue
Block a user