rework our representations of subscripts to not curry the indexes

separately from the get/set value.  There is no exposed way in the
source language to use this, and this causes shorter term annoyance.

I chose to flatten the value and indices so the value comes first.
In principle, this allows us to completely eliminate our ObjC importer
thunks.  I haven't removed them though, because they might be useful
for something else.


Swift SVN r14049
This commit is contained in:
Chris Lattner
2014-02-18 21:34:33 +00:00
parent ccad57fb72
commit ecbbb4a42c
10 changed files with 134 additions and 109 deletions

View File

@@ -65,13 +65,12 @@ Initialization::getSubInitializationsForTuple(SILGenFunction &gen, CanType type,
SmallVectorImpl<InitializationPtr> &buf,
SILLocation Loc) {
assert(canSplitIntoSubelementAddresses() && "Client shouldn't call this");
auto tupleTy = cast<TupleType>(type);
switch (kind) {
case Kind::Tuple:
return getSubInitializations();
case Kind::Ignored:
// "Destructure" an ignored binding into multiple ignored bindings.
for (auto fieldType : tupleTy->getElementTypes()) {
for (auto fieldType : cast<TupleType>(type)->getElementTypes()) {
(void) fieldType;
buf.push_back(InitializationPtr(new BlackHoleInitialization()));
}
@@ -79,6 +78,7 @@ Initialization::getSubInitializationsForTuple(SILGenFunction &gen, CanType type,
case Kind::LetValue:
case Kind::SingleBuffer: {
// Destructure the buffer into per-element buffers.
auto tupleTy = cast<TupleType>(type);
SILValue baseAddr = getAddress();
for (unsigned i = 0, size = tupleTy->getNumElements(); i < size; ++i) {
auto fieldType = tupleTy.getElementType(i);