public static Expression createGetAtWithMapSupportMethodCall(Expression expression, int index, String key) {
    return new TernaryExpression(
      new BooleanExpression(
        new BinaryExpression(
          expression,
          Token.newKeyword("instanceof", -1, -1),
          new ClassExpression(ClassHelper.MAP_TYPE))),
      createGetAtMethodCall(expression, key),
      createGetAtMethodCall(expression, index)
    );
  }
Turns an argument list obtained from AstUtil.getArguments() into an Object[] array
suitable to be passed to InvokerHelper or SpockRuntime. The main challenge is
to handle SpreadExpression's correctly.
spock-core/src/main/java/org/spockframework/compiler/AstUtil.java