mirror of
https://github.com/github/codeql.git
synced 2026-04-21 23:14:03 +02:00
C#: Add IntegerCollection class to the CollectionFlow tests and update line numbers in expected test output.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -448,4 +449,28 @@ public class CollectionFlow
|
||||
A[] array = [.. temp];
|
||||
Sink(array[0]); // flow
|
||||
}
|
||||
|
||||
[System.Runtime.CompilerServices.CollectionBuilder(typeof(IntegerCollectionBuilder), "Create")]
|
||||
public class IntegerCollection : IEnumerable<int>
|
||||
{
|
||||
private int[] items;
|
||||
|
||||
public A? Payload { get; set; }
|
||||
|
||||
public IntegerCollection(ReadOnlySpan<int> items)
|
||||
{
|
||||
this.items = items.ToArray();
|
||||
Payload = null;
|
||||
}
|
||||
|
||||
public IEnumerator<int> GetEnumerator() => items.AsEnumerable<int>().GetEnumerator();
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() => items.GetEnumerator();
|
||||
}
|
||||
|
||||
public static class IntegerCollectionBuilder
|
||||
{
|
||||
public static IntegerCollection Create(ReadOnlySpan<int> elements)
|
||||
=> new IntegerCollection(elements);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user