Browse Source

Escape contextual keywords within query expressions.

newNRvisualizers
Daniel Grunwald 15 years ago
parent
commit
ec42611f0e
  1. 16
      ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs

16
ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs

@ -306,10 +306,10 @@ namespace ICSharpCode.NRefactory.CSharp @@ -306,10 +306,10 @@ namespace ICSharpCode.NRefactory.CSharp
"using", "virtual", "void", "volatile", "while"
};
// static readonly HashSet<string> queryKeywords = new HashSet<string> {
// "from", "where", "join", "on", "equals", "into", "let", "orderby",
// "ascending", "descending", "select", "group", "by"
// };
static readonly HashSet<string> queryKeywords = new HashSet<string> {
"from", "where", "join", "on", "equals", "into", "let", "orderby",
"ascending", "descending", "select", "group", "by"
};
/// <summary>
/// Determines whether the specified identifier is a keyword in the given context.
@ -318,10 +318,10 @@ namespace ICSharpCode.NRefactory.CSharp @@ -318,10 +318,10 @@ namespace ICSharpCode.NRefactory.CSharp
{
if (unconditionalKeywords.Contains(identifier))
return true;
// if (context.Ancestors.Any(a => a is QueryExpression)) {
// if (queryKeywords.Contains(identifier))
// return true;
// }
if (context.Ancestors.Any(a => a is QueryExpression)) {
if (queryKeywords.Contains(identifier))
return true;
}
return false;
}
#endregion

Loading…
Cancel
Save