mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST: Rename 'synthetic' to 'witness thunk' in RequirementEnvironment and Witness
This commit is contained in:
@@ -42,12 +42,12 @@ STATISTIC(NumConformanceLookupTables, "# of conformance lookup tables built");
|
||||
using namespace swift;
|
||||
|
||||
Witness::Witness(ValueDecl *decl, SubstitutionMap substitutions,
|
||||
GenericSignature syntheticSig,
|
||||
SubstitutionMap reqToSyntheticSigSubs,
|
||||
GenericSignature witnessThunkSig,
|
||||
SubstitutionMap reqToWitnessThunkSigSubs,
|
||||
GenericSignature derivativeGenSig,
|
||||
Optional<ActorIsolation> enterIsolation) {
|
||||
if (!syntheticSig && substitutions.empty() &&
|
||||
reqToSyntheticSigSubs.empty() && !enterIsolation) {
|
||||
if (!witnessThunkSig && substitutions.empty() &&
|
||||
reqToWitnessThunkSigSubs.empty() && !enterIsolation) {
|
||||
storage = decl;
|
||||
return;
|
||||
}
|
||||
@@ -55,16 +55,16 @@ Witness::Witness(ValueDecl *decl, SubstitutionMap substitutions,
|
||||
auto &ctx = decl->getASTContext();
|
||||
auto declRef = ConcreteDeclRef(decl, substitutions);
|
||||
auto storedMem = ctx.Allocate(sizeof(StoredWitness), alignof(StoredWitness));
|
||||
auto stored = new (storedMem) StoredWitness{declRef, syntheticSig,
|
||||
reqToSyntheticSigSubs,
|
||||
auto stored = new (storedMem) StoredWitness{declRef, witnessThunkSig,
|
||||
reqToWitnessThunkSigSubs,
|
||||
derivativeGenSig, enterIsolation};
|
||||
|
||||
storage = stored;
|
||||
}
|
||||
|
||||
Witness Witness::withEnterIsolation(ActorIsolation enterIsolation) const {
|
||||
return Witness(getDecl(), getSubstitutions(), getSyntheticSignature(),
|
||||
getRequirementToSyntheticSubs(),
|
||||
return Witness(getDecl(), getSubstitutions(), getWitnessThunkSignature(),
|
||||
getRequirementToWitnessThunkSubs(),
|
||||
getDerivativeGenericSignature(), enterIsolation);
|
||||
}
|
||||
|
||||
@@ -919,13 +919,13 @@ RootProtocolConformance::getWitnessDeclRef(ValueDecl *requirement) const {
|
||||
auto *witnessDecl = witness.getDecl();
|
||||
|
||||
// If the witness is generic, you have to call getWitness() and build
|
||||
// your own substitutions in terms of the synthetic environment.
|
||||
// your own substitutions in terms of the witness thunk signature.
|
||||
if (auto *witnessDC = dyn_cast<DeclContext>(witnessDecl))
|
||||
assert(!witnessDC->isInnermostContextGeneric());
|
||||
|
||||
// If the witness is not generic, use type substitutions from the
|
||||
// witness's parent. Don't use witness.getSubstitutions(), which
|
||||
// are written in terms of the synthetic environment.
|
||||
// are written in terms of the witness thunk signature.
|
||||
auto subs =
|
||||
getType()->getContextSubstitutionMap(getDeclContext()->getParentModule(),
|
||||
witnessDecl->getDeclContext());
|
||||
|
||||
Reference in New Issue
Block a user