@@ -339,20 +339,18 @@ static Tree sigMap(Tree key, tfun f, Tree t)
339
339
340
340
} else {
341
341
tvec br;
342
- int n = t->arity ();
343
- bool has_label = isUIInputItem (t) || isUIOutputItem (t) ;
344
- for ( int i = 0 ; i < n; i++ ) {
342
+ int n = t->arity ();
343
+ int arg = 0 ;
344
+ if ( isUIInputItem (t) || isUIOutputItem (t) ) {
345
345
// Do not handle labels to avoid simplifying them when using reserved keyword
346
- if (has_label && i == 0 ) {
347
- br. push_back (t-> branch (i)) ;
348
- } else {
349
- br. push_back ( sigMap (key, f, t-> branch (i)));
350
- }
346
+ br. push_back (t-> branch (arg));
347
+ arg++ ;
348
+ }
349
+ for ( int i = arg; i < n; i++) {
350
+ br. push_back ( sigMap (key, f, t-> branch (i)));
351
351
}
352
352
353
- Tree r1 = tree (t->node (), br);
354
-
355
- Tree r2 = f (r1);
353
+ Tree r2 = f (tree (t->node (), br));
356
354
if (r2 == t) {
357
355
setProperty (t, key, gGlobal ->nil );
358
356
} else {
@@ -390,20 +388,18 @@ static Tree sigMapRename(Tree key, Tree env, tfun f, Tree t)
390
388
391
389
} else {
392
390
tvec br;
393
- int n = t->arity ();
394
- bool has_label = isUIInputItem (t) || isUIOutputItem (t) ;
395
- for ( int i = 0 ; i < n; i++ ) {
391
+ int n = t->arity ();
392
+ int arg = 0 ;
393
+ if ( isUIInputItem (t) || isUIOutputItem (t) ) {
396
394
// Do not handle labels to avoid simplifying them when using reserved keyword
397
- if (has_label && i == 0 ) {
398
- br. push_back (t-> branch (i)) ;
399
- } else {
400
- br. push_back ( sigMapRename (key, env, f, t-> branch (i)));
401
- }
395
+ br. push_back (t-> branch (arg));
396
+ arg++ ;
397
+ }
398
+ for ( int i = arg; i < n; i++) {
399
+ br. push_back ( sigMapRename (key, env, f, t-> branch (i)));
402
400
}
403
401
404
- Tree r1 = tree (t->node (), br);
405
-
406
- Tree r2 = f (r1);
402
+ Tree r2 = f (tree (t->node (), br));
407
403
if (r2 == t) {
408
404
setProperty (t, key, gGlobal ->nil );
409
405
} else {
0 commit comments