@@ -128,11 +128,7 @@ private static String workflowToLabel(WorkflowNode node) {
128128 }
129129 for ( var take : takes ) {
130130 fmt .appendIndent ();
131- fmt .append (take .getName ());
132- if ( fmt .hasType (take ) ) {
133- fmt .append (": " );
134- fmt .visitTypeAnnotation (take .getType ());
135- }
131+ typedInput (take , fmt );
136132 fmt .appendNewLine ();
137133 }
138134 fmt .appendNewLine ();
@@ -183,25 +179,7 @@ private static String processToLabel(ProcessNodeV2 node) {
183179 }
184180 for ( var input : node .inputs ) {
185181 fmt .appendIndent ();
186- if ( input instanceof TupleParameter tp ) {
187- var components = Arrays .stream (tp .components )
188- .map (p -> p .getName ())
189- .collect (Collectors .joining (", " ));
190- fmt .append ('(' );
191- fmt .append (components );
192- fmt .append (')' );
193- }
194- else {
195- fmt .append (input .getName ());
196- }
197- if ( fmt .hasType (input ) ) {
198- fmt .append (": " );
199- var type = input .getType ();
200- if ( type .getNameWithoutPackage ().startsWith ("__Record" ) )
201- processRecordToLabel (type .redirect (), fmt );
202- else
203- fmt .visitTypeAnnotation (type );
204- }
182+ typedInput (input , fmt );
205183 fmt .appendNewLine ();
206184 }
207185 fmt .appendNewLine ();
@@ -223,16 +201,32 @@ private static String processToLabel(ProcessNodeV2 node) {
223201 return fmt .toString ();
224202 }
225203
226- private static void processRecordToLabel (ClassNode type , Formatter fmt ) {
204+ private static void typedInput (Parameter input , Formatter fmt ) {
205+ if ( input instanceof TupleParameter tp ) {
206+ if ( "Record" .equals (tp .getType ().getNameWithoutPackage ()) )
207+ processRecordInput (tp , fmt );
208+ else
209+ processTupleInput (tp , fmt );
210+ }
211+ else {
212+ fmt .append (input .getName ());
213+ if ( fmt .hasType (input ) ) {
214+ fmt .append (": " );
215+ fmt .visitTypeAnnotation (input .getType ());
216+ }
217+ }
218+ }
219+
220+ private static void processRecordInput (TupleParameter tp , Formatter fmt ) {
227221 fmt .append ("Record {" );
228222 fmt .appendNewLine ();
229223 fmt .incIndent ();
230- for ( var fn : type . getFields () ) {
224+ for ( var p : tp . components ) {
231225 fmt .appendIndent ();
232- fmt .append (fn .getName ());
233- if ( fmt .hasType (fn ) ) {
226+ fmt .append (p .getName ());
227+ if ( fmt .hasType (p ) ) {
234228 fmt .append (": " );
235- fmt .append (TypesEx .getName (fn .getType ()));
229+ fmt .append (TypesEx .getName (p .getType ()));
236230 }
237231 fmt .appendNewLine ();
238232 }
@@ -241,6 +235,21 @@ private static void processRecordToLabel(ClassNode type, Formatter fmt) {
241235 fmt .append ('}' );
242236 }
243237
238+ private static void processTupleInput (TupleParameter tp , Formatter fmt ) {
239+ fmt .append ("Tuple<" );
240+ for ( int i = 0 ; i < tp .components .length ; i ++ ) {
241+ var p = tp .components [i ];
242+ fmt .append (p .getName ());
243+ if ( fmt .hasType (p ) ) {
244+ fmt .append (": " );
245+ fmt .append (TypesEx .getName (p .getType ()));
246+ }
247+ if ( i < tp .components .length - 1 )
248+ fmt .append (", " );
249+ }
250+ fmt .append (">" );
251+ }
252+
244253 private static String processToLabel (ProcessNodeV1 node ) {
245254 var fmt = new Formatter (new FormattingOptions (2 , true ));
246255 fmt .append ("process " );
0 commit comments