mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Parser/Sema/SILGen changes for @_dynamicReplacement(for:)
Dynamic replacements are currently written in extensions as
extension ExtendedType {
@_dynamicReplacement(for: replacedFun())
func replacement() { }
}
The runtime implementation allows an implementation in the future where
dynamic replacements are gather in a scope and can be dynamically
enabled and disabled.
For example:
dynamic_extension_scope CollectionOfReplacements {
extension ExtentedType {
func replacedFun() {}
}
extension ExtentedType2 {
func replacedFun() {}
}
}
CollectionOfReplacements.enable()
CollectionOfReplacements.disable()
This commit is contained in:
@@ -252,6 +252,12 @@ struct SILDeclRef {
|
||||
return kind == Kind::IVarInitializer || kind == Kind::IVarDestroyer;
|
||||
}
|
||||
|
||||
/// True if the SILDeclRef references an allocating or deallocating entry
|
||||
/// point.
|
||||
bool isInitializerOrDestroyer() const {
|
||||
return kind == Kind::Initializer || kind == Kind::Destroyer;
|
||||
}
|
||||
|
||||
/// \brief True if the function should be treated as transparent.
|
||||
bool isTransparent() const;
|
||||
/// \brief True if the function should have its body serialized.
|
||||
|
||||
Reference in New Issue
Block a user