|
|
|
@ -53,6 +53,7 @@ namespace ICSharpCode.NRefactory.Visitors |
|
|
|
public class LookupTableVisitor : AbstractAstVisitor |
|
|
|
public class LookupTableVisitor : AbstractAstVisitor |
|
|
|
{ |
|
|
|
{ |
|
|
|
Dictionary<string, List<LocalLookupVariable>> variables; |
|
|
|
Dictionary<string, List<LocalLookupVariable>> variables; |
|
|
|
|
|
|
|
SupportedLanguage language; |
|
|
|
|
|
|
|
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] |
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] |
|
|
|
public Dictionary<string, List<LocalLookupVariable>> Variables { |
|
|
|
public Dictionary<string, List<LocalLookupVariable>> Variables { |
|
|
|
@ -69,9 +70,14 @@ namespace ICSharpCode.NRefactory.Visitors |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public LookupTableVisitor(StringComparer nameComparer) |
|
|
|
public LookupTableVisitor(SupportedLanguage language) |
|
|
|
{ |
|
|
|
{ |
|
|
|
variables = new Dictionary<string, List<LocalLookupVariable>>(nameComparer); |
|
|
|
this.language = language; |
|
|
|
|
|
|
|
if (language == SupportedLanguage.VBNet) { |
|
|
|
|
|
|
|
variables = new Dictionary<string, List<LocalLookupVariable>>(StringComparer.InvariantCultureIgnoreCase); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
variables = new Dictionary<string, List<LocalLookupVariable>>(StringComparer.InvariantCulture); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void AddVariable(TypeReference typeRef, string name, Location startPos, Location endPos, bool isConst) |
|
|
|
public void AddVariable(TypeReference typeRef, string name, Location startPos, Location endPos, bool isConst) |
|
|
|
@ -171,6 +177,15 @@ namespace ICSharpCode.NRefactory.Visitors |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override object VisitSwitchSection(SwitchSection switchSection, object data) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (language == SupportedLanguage.VBNet) { |
|
|
|
|
|
|
|
return VisitBlockStatement(switchSection, data); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return base.VisitSwitchSection(switchSection, data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override object VisitForeachStatement(ForeachStatement foreachStatement, object data) |
|
|
|
public override object VisitForeachStatement(ForeachStatement foreachStatement, object data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AddVariable(foreachStatement.TypeReference, |
|
|
|
AddVariable(foreachStatement.TypeReference, |
|
|
|
|