From ec42611f0e7be19c53a16b2902808bd4d894b1ea Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 12 Feb 2011 15:55:46 +0100 Subject: [PATCH] Escape contextual keywords within query expressions. --- .../CSharp/OutputVisitor/OutputVisitor.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs b/ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs index b0ef7b0d0f..c6e6605b23 100644 --- a/ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs +++ b/ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs @@ -306,10 +306,10 @@ namespace ICSharpCode.NRefactory.CSharp "using", "virtual", "void", "volatile", "while" }; -// static readonly HashSet queryKeywords = new HashSet { -// "from", "where", "join", "on", "equals", "into", "let", "orderby", -// "ascending", "descending", "select", "group", "by" -// }; + static readonly HashSet queryKeywords = new HashSet { + "from", "where", "join", "on", "equals", "into", "let", "orderby", + "ascending", "descending", "select", "group", "by" + }; /// /// Determines whether the specified identifier is a keyword in the given context. @@ -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