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:
Arnold Schwaighofer
2018-11-05 09:53:40 -08:00
parent 52c1903e54
commit b102c7f6b4
35 changed files with 1264 additions and 205 deletions

View File

@@ -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.