Skip to content

Commit afaf393

Browse files
committed
[ast] Add a helper method to SILFunctionType to grab the SILParameterInfo of the type's isolated parameter if one exists.
1 parent d541190 commit afaf393

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

include/swift/AST/Types.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5348,6 +5348,18 @@ class SILFunctionType final
53485348
return getParameters().back();
53495349
}
53505350

5351+
/// Return SILParameterInfo for the isolated parameter in this SILFunctionType
5352+
/// if one exists. Returns None otherwise.
5353+
std::optional<SILParameterInfo> maybeGetIsolatedParameter() const {
5354+
for (auto param : getParameters()) {
5355+
if (param.hasOption(SILParameterInfo::Isolated)) {
5356+
return param;
5357+
}
5358+
}
5359+
5360+
return {};
5361+
}
5362+
53515363
struct IndirectMutatingParameterFilter {
53525364
bool operator()(SILParameterInfo param) const {
53535365
return param.isIndirectMutating();

0 commit comments

Comments
 (0)