mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Const Extract] Extract property wrapper details even when no default init is present
This commit is contained in:
@@ -421,14 +421,19 @@ extractPropertyWrapperAttrValues(VarDecl *propertyDecl) {
|
||||
|
||||
static ConstValueTypePropertyInfo
|
||||
extractTypePropertyInfo(VarDecl *propertyDecl) {
|
||||
std::optional<AttrValueVector> propertyWrapperValues;
|
||||
if (propertyDecl->hasAttachedPropertyWrapper())
|
||||
propertyWrapperValues = extractPropertyWrapperAttrValues(propertyDecl);
|
||||
|
||||
if (const auto binding = propertyDecl->getParentPatternBinding()) {
|
||||
if (const auto originalInit = binding->getInit(0)) {
|
||||
if (propertyDecl->hasAttachedPropertyWrapper()) {
|
||||
return {propertyDecl, extractCompileTimeValue(originalInit),
|
||||
extractPropertyWrapperAttrValues(propertyDecl)};
|
||||
propertyWrapperValues};
|
||||
}
|
||||
|
||||
return {propertyDecl, extractCompileTimeValue(originalInit)};
|
||||
return {propertyDecl, extractCompileTimeValue(originalInit),
|
||||
propertyWrapperValues};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -438,7 +443,8 @@ extractTypePropertyInfo(VarDecl *propertyDecl) {
|
||||
if (auto *stmt = node.dyn_cast<Stmt *>()) {
|
||||
if (stmt->getKind() == StmtKind::Return) {
|
||||
return {propertyDecl,
|
||||
extractCompileTimeValue(cast<ReturnStmt>(stmt)->getResult())};
|
||||
extractCompileTimeValue(cast<ReturnStmt>(stmt)->getResult()),
|
||||
propertyWrapperValues};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user