ICSharpCode.NRefactory.CSharp.CSharpOutputVisitor.IsKeyword C# (CSharp) Метод

IsKeyword() публичный статический Метод

Determines whether the specified identifier is a keyword in the given context.
public static IsKeyword ( string identifier, AstNode context ) : bool
identifier string
context AstNode
Результат bool
		public static bool IsKeyword(string identifier, AstNode context)
		{
			if (unconditionalKeywords.Contains(identifier)) {
				return true;
			}
			foreach (AstNode ancestor in context.Ancestors) {
				if (ancestor is QueryExpression && queryKeywords.Contains(identifier)) {
					return true;
				}
				if (identifier == "await") {
					// with lambdas/anonymous methods,
					if (ancestor is LambdaExpression) {
						return ((LambdaExpression)ancestor).IsAsync;
					}
					if (ancestor is AnonymousMethodExpression) {
						return ((AnonymousMethodExpression)ancestor).IsAsync;
					}
					if (ancestor is EntityDeclaration) {
						return (((EntityDeclaration)ancestor).Modifiers & Modifiers.Async) == Modifiers.Async;
					}
				}
			}
			return false;
		}
		#endregion
CSharpOutputVisitor