@@ -613,22 +613,19 @@ static void tuple_destroyArray(OpaqueValue *array, size_t n,
613
613
614
614
// The operation doesn't have to be initializeWithCopy, but they all
615
615
// have basically the same type.
616
- typedef value_witness_types::initializeWithCopy
617
- ValueWitnessTable::*forEachOperation;
616
+ typedef value_witness_types::initializeWithCopy forEachOperation;
618
617
619
618
// / Perform an operation for each field of two tuples.
620
619
static OpaqueValue *tuple_forEachField (OpaqueValue *destTuple,
621
620
OpaqueValue *srcTuple,
622
621
const Metadata *_metatype,
623
- forEachOperation member ) {
622
+ forEachOperation operation ) {
624
623
auto &metatype = *(const TupleTypeMetadata*) _metatype;
625
624
for (size_t i = 0 , e = metatype.NumElements ; i != e; ++i) {
626
625
auto &eltInfo = metatype.getElement (i);
627
- auto eltValueWitnesses = eltInfo.Type ->getValueWitnesses ();
628
-
629
626
OpaqueValue *destElt = eltInfo.findIn (destTuple);
630
627
OpaqueValue *srcElt = eltInfo.findIn (srcTuple);
631
- (eltValueWitnesses->*member) (destElt, srcElt, eltInfo.Type );
628
+ operation (destElt, srcElt, eltInfo.Type );
632
629
}
633
630
634
631
return destTuple;
@@ -671,7 +668,9 @@ static OpaqueValue *tuple_initializeWithCopy(OpaqueValue *dest,
671
668
672
669
if (IsPOD) return tuple_memcpy (dest, src, metatype);
673
670
return tuple_forEachField (dest, src, metatype,
674
- &ValueWitnessTable::initializeWithCopy);
671
+ [](OpaqueValue *dest, OpaqueValue *src, const Metadata *eltType) {
672
+ return eltType->vw_initializeWithCopy (dest, src);
673
+ });
675
674
}
676
675
677
676
// / Generic tuple value witness for 'initializeArrayWithCopy'.
@@ -709,7 +708,9 @@ static OpaqueValue *tuple_initializeWithTake(OpaqueValue *dest,
709
708
710
709
if (IsPOD) return tuple_memcpy (dest, src, metatype);
711
710
return tuple_forEachField (dest, src, metatype,
712
- &ValueWitnessTable::initializeWithTake);
711
+ [](OpaqueValue *dest, OpaqueValue *src, const Metadata *eltType) {
712
+ return eltType->vw_initializeWithTake (dest, src);
713
+ });
713
714
}
714
715
715
716
// / Generic tuple value witness for 'initializeArrayWithTakeFrontToBack'.
@@ -774,7 +775,9 @@ static OpaqueValue *tuple_assignWithCopy(OpaqueValue *dest,
774
775
775
776
if (IsPOD) return tuple_memcpy (dest, src, metatype);
776
777
return tuple_forEachField (dest, src, metatype,
777
- &ValueWitnessTable::assignWithCopy);
778
+ [](OpaqueValue *dest, OpaqueValue *src, const Metadata *eltType) {
779
+ return eltType->vw_assignWithCopy (dest, src);
780
+ });
778
781
}
779
782
780
783
// / Generic tuple value witness for 'assignWithTake'.
@@ -784,7 +787,9 @@ static OpaqueValue *tuple_assignWithTake(OpaqueValue *dest,
784
787
const Metadata *metatype) {
785
788
if (IsPOD) return tuple_memcpy (dest, src, metatype);
786
789
return tuple_forEachField (dest, src, metatype,
787
- &ValueWitnessTable::assignWithTake);
790
+ [](OpaqueValue *dest, OpaqueValue *src, const Metadata *eltType) {
791
+ return eltType->vw_assignWithTake (dest, src);
792
+ });
788
793
}
789
794
790
795
// / Generic tuple value witness for 'initializeBufferWithCopyOfBuffer'.
0 commit comments