@@ -347,36 +347,20 @@ class TestCase extends TTestCase {
347
347
*/
348
348
string getInputTypeString ( ) { result = getShortNameIfPossible ( this .getInputType ( ) ) }
349
349
350
- /**
351
- * Returns the next-highest stack item in `input`, treating the list as circular, so
352
- * the top item's successor is `baseInput`, the bottom of the stack.
353
- */
354
- SummaryComponentStack nextInput ( SummaryComponentStack prev ) {
355
- exists ( SummaryComponentStack next | next .tail ( ) = prev and next = input .drop ( _) | result = next )
356
- or
357
- not exists ( SummaryComponentStack next | next .tail ( ) = prev and next = input .drop ( _) ) and
358
- result = baseInput
359
- }
360
-
361
350
/**
362
351
* Returns a call to `source()` wrapped in `newWith` methods as needed according to `input`.
363
352
* For example, if the input specification is `ArrayElement of MapValue of Argument[0]`, this
364
353
* will return `newWithMapValue(newWithArrayElement(source()))`.
365
- *
366
- * This requires a slightly awkward walk, out from the element above the root (`Argument[0]` above)
367
- * climbing up towards the outer `ArrayElement of...`. This is implemented by treating the stack as
368
- * a circular list, walking it backwards and treating the root as a sentinel indicating we should
369
- * emit `source()`.
370
354
*/
371
- string getInput ( SummaryComponentStack componentStack ) {
372
- componentStack = input .drop ( _) and
355
+ string getInput ( SummaryComponentStack stack ) {
356
+ stack = input .drop ( _) and
373
357
(
374
- if componentStack = baseInput
375
- then result = "source()"
376
- else
377
- result =
378
- "newWith" + contentToken ( getContent ( componentStack . head ( ) ) ) + "(" +
379
- this . getInput ( nextInput ( componentStack ) ) + ")"
358
+ stack = input and result = "source()"
359
+ or
360
+ exists ( SummaryComponentStack s |
361
+ result = "newWith" + contentToken ( getContent ( s . head ( ) ) ) + "(" + this . getInput ( s ) + ")" and
362
+ stack = s . tail ( )
363
+ )
380
364
)
381
365
}
382
366
@@ -476,9 +460,8 @@ class TestCase extends TTestCase {
476
460
result =
477
461
"\t\t{\n\t\t\t// \"" + row + "\"\n\t\t\t" + getShortNameIfPossible ( this .getOutputType ( ) ) +
478
462
" out = null;\n\t\t\t" + this .getInputTypeString ( ) + " in = (" + this .getInputTypeString ( ) +
479
- ")" + this .getInput ( this .nextInput ( baseInput ) ) + ";\n\t\t\t" + this .getInstancePrefix ( ) +
480
- this .makeCall ( ) + ";\n\t\t\t" + "sink(" + this .getOutput ( output ) + "); " +
481
- this .getExpectation ( ) + "\n\t\t}\n"
463
+ ")" + this .getInput ( baseInput ) + ";\n\t\t\t" + this .getInstancePrefix ( ) + this .makeCall ( ) +
464
+ ";\n\t\t\t" + "sink(" + this .getOutput ( output ) + "); " + this .getExpectation ( ) + "\n\t\t}\n"
482
465
}
483
466
}
484
467
0 commit comments