diff --git a/runtime/CSharp/Antlr4.Runtime/Dfa/DFA.cs b/runtime/CSharp/Antlr4.Runtime/Dfa/DFA.cs index 73d24452..8fb63316 100644 --- a/runtime/CSharp/Antlr4.Runtime/Dfa/DFA.cs +++ b/runtime/CSharp/Antlr4.Runtime/Dfa/DFA.cs @@ -248,7 +248,7 @@ public virtual bool IsEmpty { if (IsPrecedenceDfa) { - return s0.Get().EdgeMap.Count == 0 && s0full.Get().EdgeMap.Count == 0; + return s0.Get().IsEdgeMapEmpty && s0full.Get().IsEdgeMapEmpty; } return s0.Get() == null && s0full.Get() == null; } @@ -260,7 +260,7 @@ public virtual bool IsContextSensitive { if (IsPrecedenceDfa) { - return s0full.Get().EdgeMap.Count != 0; + return !s0full.Get().IsEdgeMapEmpty; } return s0full.Get() != null; } diff --git a/runtime/CSharp/Antlr4.Runtime/Dfa/DFAState.cs b/runtime/CSharp/Antlr4.Runtime/Dfa/DFAState.cs index 8d6f4f12..29abba17 100644 --- a/runtime/CSharp/Antlr4.Runtime/Dfa/DFAState.cs +++ b/runtime/CSharp/Antlr4.Runtime/Dfa/DFAState.cs @@ -207,6 +207,14 @@ public virtual ReadOnlyDictionary EdgeMap } } + public bool IsEdgeMapEmpty + { + get + { + return edges.IsEmpty; + } + } + public virtual DFAState GetContextTarget(int invokingState) { lock (this)