private TransitionRegex(SymbolicRegexBuilder <TSet> builder, TransitionRegexKind kind, TSet?test, TransitionRegex <TSet>?first, TransitionRegex <TSet>?second, SymbolicRegexNode <TSet>?node, DerivativeEffect?effect) { Debug.Assert(builder is not null); Debug.Assert( (kind is TransitionRegexKind.Leaf && node is not null && Equals(test, default(TSet)) && first is null && second is null && effect is null) || (kind is TransitionRegexKind.Conditional && test is not null && first is not null && second is not null && node is null && effect is null) || (kind is TransitionRegexKind.Union && Equals(test, default(TSet)) && first is not null && second is not null && node is null && effect is null) || (kind is TransitionRegexKind.Lookaround && Equals(test, default(TSet)) && first is not null && second is not null && node is not null && effect is null) || (kind is TransitionRegexKind.Effect && Equals(test, default(TSet)) && first is not null && second is null && node is null && effect is not null)); _builder = builder; _kind = kind; _test = test; _first = first; _second = second; _node = node; _effect = effect; }
private static TransitionRegex <TSet> GetOrCreate(SymbolicRegexBuilder <TSet> builder, TransitionRegexKind kind, TSet?test, TransitionRegex <TSet>?one, TransitionRegex <TSet>?two, SymbolicRegexNode <TSet>?node, DerivativeEffect?effect = null) { // Keep transition regexes internalized using the builder ref TransitionRegex <TSet>?tr = ref CollectionsMarshal.GetValueRefOrAddDefault(builder._trCache, (kind, test, one, two, node, effect), out _);