@@ -118,18 +118,19 @@ import Swift
118
118
% ]:
119
119
%
120
120
% for TYPE in TYPES:
121
- % OP_THROWS = "throws " if "Throwing" in TYPE else ""
122
- % IS_DISCARDING = "Discarding" in TYPE
123
- % IS_THROWING = "Throwing" in TYPE
121
+ % IS_DISCARDING = 'Discarding' in TYPE
122
+ % IS_THROWING = 'Throwing' in TYPE
124
123
%
125
- % def replace_child_task_result(strings, is_discarding, is_throwing):
126
- % if is_discarding:
127
- % for i in range(len(strings)):
128
- % strings[i] = strings[i].replace("-> ChildTaskResult", "-> Void")
129
- % if not is_throwing:
130
- % for i in range(len(strings)):
131
- % strings[i] = strings[i].replace("throws", "/* non throwing task group*/")
132
- % replace_child_task_result(PARAMS, IS_DISCARDING, IS_THROWING)
124
+ % def adjust_params_for_group_kind(params):
125
+ % res = []
126
+ % for p in params:
127
+ % np = p
128
+ % if IS_DISCARDING:
129
+ % np = np.replace("-> ChildTaskResult", "-> Void")
130
+ % if not IS_THROWING:
131
+ % np = np.replace("throws", "")
132
+ % res.append(np)
133
+ % return res
133
134
%
134
135
% for METHOD_NAME in ADD_TASK_METHOD_VARIANT:
135
136
%
@@ -161,8 +162,10 @@ extension ${TYPE} {
161
162
/// Adds a child task to the group.
162
163
% end
163
164
///
165
+ % if IS_THROWING:
164
166
/// This method doesn't throw an error, even if the child task does.
165
167
/// Instead, the corresponding call to `ThrowingTaskGroup.next()` rethrows that error.
168
+ % end
166
169
///
167
170
/// - Parameters:
168
171
% if HAS_TASK_NAME:
@@ -190,7 +193,7 @@ extension ${TYPE} {
190
193
${"\n ".join(ALL_AVAILABILITY)}
191
194
@_alwaysEmitIntoClient
192
195
public mutating func ${METHOD_NAME}(
193
- ${",\n ".join(PARAMS)}
196
+ ${",\n ".join(adjust_params_for_group_kind( PARAMS) )}
194
197
) ${ARROW_RETURN_TYPE}{
195
198
% if IS_IMPL_UNAVAILABLE:
196
199
fatalError("Unavailable in task-to-thread concurrency model")
0 commit comments