File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/Draco.Compiler/Internal/Solver Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11using System ;
2+ using System . Collections ;
23using System . Collections . Generic ;
34using System . Diagnostics . CodeAnalysis ;
45using System . Linq ;
@@ -9,7 +10,7 @@ namespace Draco.Compiler.Internal.Solver;
910/// <summary>
1011/// A data-type to efficiently store and query constraints.
1112/// </summary>
12- internal sealed class ConstraintStore
13+ internal sealed class ConstraintStore : IEnumerable < Constraint >
1314{
1415 /// <summary>
1516 /// The number of constraints in the store.
@@ -18,6 +19,9 @@ internal sealed class ConstraintStore
1819
1920 private readonly Dictionary < Type , List < Constraint > > constraints = [ ] ;
2021
22+ public IEnumerator < Constraint > GetEnumerator ( ) => this . constraints . Values . SelectMany ( x => x ) . GetEnumerator ( ) ;
23+ IEnumerator IEnumerable . GetEnumerator ( ) => this . GetEnumerator ( ) ;
24+
2125 /// <summary>
2226 /// Adds a constraint to the store.
2327 /// </summary>
@@ -141,5 +145,5 @@ private List<Constraint> GetConstraintList(Type type)
141145
142146 [ DoesNotReturn ]
143147 private static void ThrowConstraintNotFound ( Constraint constraint ) =>
144- throw new InvalidOperationException ( $ "Constraint { constraint } not found in the store. ") ;
148+ throw new InvalidOperationException ( $ "constraint { constraint } not found in the store") ;
145149}
You can’t perform that action at this time.
0 commit comments