[SIL/Parse] InitAccessors: Implement printing and parsing of previously iniitalized properties

Properties that are marked as initialized are printed as `[assign=<index>]`
where `<index>` point to the property position in `getInitializedProperties()`
list.
This commit is contained in:
Pavel Yaskevich
2023-06-05 17:29:01 -07:00
parent 85a8a056f1
commit d191ef8fca
5 changed files with 118 additions and 8 deletions

View File

@@ -1270,12 +1270,17 @@ void AssignOrInitInst::markAsInitialized(VarDecl *property) {
auto toInitProperties = getInitializedProperties();
for (unsigned index : indices(toInitProperties)) {
if (toInitProperties[index] == property) {
Assignments.set(index);
markAsInitialized(index);
break;
}
}
}
void AssignOrInitInst::markAsInitialized(unsigned propertyIdx) {
assert(propertyIdx < getNumInitializedProperties());
Assignments.set(propertyIdx);
}
bool AssignOrInitInst::isPropertyAlreadyInitialized(unsigned propertyIdx) {
assert(propertyIdx < Assignments.size());
return Assignments.test(propertyIdx);