コード例 #1
0
ファイル: UstNodeQueries.cs プロジェクト: NanoFabricFX/cta
 /// <summary>
 /// Determines whether or not a node has the specified attribute
 /// </summary>
 /// <param name="node">Node to query</param>
 /// <param name="attributeType">Semantic type of attribute being searched for</param>
 /// <returns>Whether or not the class declaration node has the specified attribute</returns>
 public static bool HasAttribute(this UstNode node, string attributeType)
 => node.AllAnnotations().Any(a => a.SemanticClassType.Equals(attributeType, StringComparison.OrdinalIgnoreCase));
コード例 #2
0
 /// <summary>
 /// Determines if a node has the given annotations as it child.
 /// </summary>
 /// <param name="node">Node to query</param>
 /// <param name="annotationIdentifier">Annotation to query for</param>
 /// <returns></returns>
 public static bool HasAnnotation(this UstNode node, string annotationIdentifier)
 => node.AllAnnotations().Any(a => a.Identifier == annotationIdentifier);