Fix issues in newly generated code

This commit is contained in:
Sam Harwell 2014-03-25 14:47:19 -05:00
parent 53f2c8f1a6
commit a14b197714
2 changed files with 5 additions and 6 deletions

View File

@ -1379,7 +1379,7 @@ namespace Antlr4.Runtime.Atn
[return: NotNull]
protected internal virtual ATNConfigSet ApplyPrecedenceFilter(ATNConfigSet configs, ParserRuleContext globalContext, PredictionContextCache contextCache)
{
IDictionary<int, PredictionContext> statesFromAlt1 = new Dictionary<int, PredictionContext>();
Dictionary<int, PredictionContext> statesFromAlt1 = new Dictionary<int, PredictionContext>();
ATNConfigSet configSet = new ATNConfigSet();
foreach (ATNConfig config in configs)
{
@ -1394,7 +1394,7 @@ namespace Antlr4.Runtime.Atn
// the configuration was eliminated
continue;
}
statesFromAlt1.Put(config.State.stateNumber, config.Context);
statesFromAlt1[config.State.stateNumber] = config.Context;
if (updatedContext != config.SemanticContext)
{
configSet.Add(config.Transform(config.State, updatedContext, false), contextCache);
@ -1411,8 +1411,8 @@ namespace Antlr4.Runtime.Atn
// already handled
continue;
}
PredictionContext context = statesFromAlt1.Get(config_1.State.stateNumber);
if (context != null && context.Equals(config_1.Context))
PredictionContext context;
if (statesFromAlt1.TryGetValue(config_1.State.stateNumber, out context) && context.Equals(config_1.Context))
{
// eliminated
continue;

View File

@ -229,8 +229,7 @@ namespace Antlr4.Runtime
/// your token objects because you don't have to go modify your lexer
/// so that it creates a new Java type.
/// </remarks>
[Obsolete]
[System.ObsoleteAttribute(@"This method is not called by the ANTLR 4 Runtime. Specific implementations of IAntlrErrorStrategy may provide a similar feature when necessary. For example, seeDefaultErrorStrategy.GetTokenErrorDisplay(IToken) .")]
[ObsoleteAttribute(@"This method is not called by the ANTLR 4 Runtime. Specific implementations of IAntlrErrorStrategy may provide a similar feature when necessary. For example, see DefaultErrorStrategy.GetTokenErrorDisplay(IToken).")]
public virtual string GetTokenErrorDisplay(IToken t)
{
if (t == null)