mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST: Turn NominalTypeDecl::getStoredProperties() into a request
This improves on the previous situation: - The request ensures that the backing storage for lazy properties and property wrappers gets synthesized first; previously it was only somewhat guaranteed by callers. - Instead of returning a range this just returns an ArrayRef, which simplifies clients. - Indexing into the ArrayRef is O(1), which addresses some FIXMEs in the SIL optimizer.
This commit is contained in:
@@ -803,9 +803,8 @@ SILValue SILGenFunction::emitUnwrapIntegerResult(SILLocation loc,
|
||||
while (!value->getType().is<BuiltinIntegerType>()) {
|
||||
auto structDecl = value->getType().getStructOrBoundGenericStruct();
|
||||
assert(structDecl && "value for error result wasn't of struct type!");
|
||||
assert(std::next(structDecl->getStoredProperties().begin())
|
||||
== structDecl->getStoredProperties().end());
|
||||
auto property = *structDecl->getStoredProperties().begin();
|
||||
assert(structDecl->getStoredProperties().size() == 1);
|
||||
auto property = structDecl->getStoredProperties()[0];
|
||||
value = B.createStructExtract(loc, value, property);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user