@@ -143,29 +143,6 @@ AsyncContextLayout irgen::getAsyncContextLayout(
143
143
if (hasLocalContextParameter) {
144
144
parameters = parameters.drop_back ();
145
145
}
146
- Optional<AsyncContextLayout::ArgumentInfo> localContextInfo = llvm::None;
147
- if (hasLocalContext) {
148
- if (hasLocalContextParameter) {
149
- SILType ty =
150
- IGF.IGM .silConv .getSILType (localContextParameter, substitutedType,
151
- IGF.IGM .getMaximalTypeExpansionContext ());
152
- auto argumentLoweringType =
153
- getArgumentLoweringType (ty.getASTType (), localContextParameter,
154
- /* isNoEscape*/ true );
155
-
156
- auto &ti = IGF.getTypeInfoForLowered (argumentLoweringType);
157
- valTypes.push_back (ty);
158
- typeInfos.push_back (&ti);
159
- localContextInfo = {ty, localContextParameter.getConvention ()};
160
- } else {
161
- // TODO: DETERMINE: Is there a field in this case to match the sync ABI?
162
- auto &ti = IGF.IGM .getNativeObjectTypeInfo ();
163
- SILType ty = SILType::getNativeObjectType (IGF.IGM .Context );
164
- valTypes.push_back (ty);
165
- typeInfos.push_back (&ti);
166
- localContextInfo = {ty, substitutedType->getCalleeConvention ()};
167
- }
168
- }
169
146
170
147
// ArgTypes formalArguments...;
171
148
for (auto parameter : parameters) {
@@ -192,6 +169,31 @@ AsyncContextLayout irgen::getAsyncContextLayout(
192
169
typeInfos.push_back (&bindingsTI);
193
170
}
194
171
172
+ Optional<AsyncContextLayout::ArgumentInfo> localContextInfo = llvm::None;
173
+ if (hasLocalContext) {
174
+ if (hasLocalContextParameter) {
175
+ SILType ty =
176
+ IGF.IGM .silConv .getSILType (localContextParameter, substitutedType,
177
+ IGF.IGM .getMaximalTypeExpansionContext ());
178
+ auto argumentLoweringType =
179
+ getArgumentLoweringType (ty.getASTType (), localContextParameter,
180
+ /* isNoEscape*/ true );
181
+
182
+ auto &ti = IGF.getTypeInfoForLowered (argumentLoweringType);
183
+ valTypes.push_back (ty);
184
+ typeInfos.push_back (&ti);
185
+ localContextInfo = {ty, localContextParameter.getConvention ()};
186
+ } else {
187
+ // TODO: DETERMINE: Is there a field in this case to match the sync ABI?
188
+ auto &ti = IGF.IGM .getNativeObjectTypeInfo ();
189
+ SILType ty = SILType::getNativeObjectType (IGF.IGM .Context );
190
+ valTypes.push_back (ty);
191
+ typeInfos.push_back (&ti);
192
+ localContextInfo = {ty, substitutedType->getCalleeConvention ()};
193
+ }
194
+ }
195
+
196
+
195
197
Optional<AsyncContextLayout::TrailingWitnessInfo> trailingWitnessInfo;
196
198
if (originalType->getRepresentation () ==
197
199
SILFunctionTypeRepresentation::WitnessMethod) {
0 commit comments