/// <summary> /// Determines if a syntax tree has any invocation expression nodes with the specified semantic definition /// </summary> /// <param name="node">Syntax tree node to start searching from</param> /// <param name="semanticOriginalDefinition">Semantic definition to look for</param> /// <returns>Whether or not an invocation expression node with the specified semantic definition exists in the syntax tree</returns> public static bool ContainsInvocationExpressionsWithSemanticDefinition(this UstNode node, string semanticOriginalDefinition) => node.AllInvocationExpressions().Any(i => i.SemanticOriginalDefinition == semanticOriginalDefinition);
/// <summary> /// Searches a syntax tree to identify all invocation expression nodes with any of the specified semantic return types /// </summary> /// <param name="node">Syntax tree node to start searching from</param> /// <param name="semanticReturnTypes">Semantic return types to look for</param> /// <returns>Collection of invocation expression nodes with any of the specified semantic return types</returns> public static IEnumerable <UstNode> GetInvocationExpressionsBySemanticReturnType(this UstNode node, IEnumerable <string> semanticReturnTypes) => node.AllInvocationExpressions().Where(i => semanticReturnTypes.Contains(i.SemanticReturnType));
/// <summary> /// Searches a syntax tree to identify all invocation expression nodes with a specified semantic definition /// </summary> /// <param name="node">Syntax tree node to start searching from</param> /// <param name="semanticOriginalDefinition">Semantic definition to look for</param> /// <returns>Collection of invocation expression nodes with the specified semantic definition</returns> public static IEnumerable <UstNode> GetInvocationExpressionsBySemanticDefinition(this UstNode node, string semanticOriginalDefinition) => node.AllInvocationExpressions().Where(i => i.SemanticOriginalDefinition == semanticOriginalDefinition);
/// <summary> /// Searches a syntax tree to identify all invocation expression nodes with a specified semantic return type /// </summary> /// <param name="node">Syntax tree node to start searching from</param> /// <param name="semanticReturnType">Semantic return type to look for</param> /// <returns>Collection of invocation expression nodes with the specified semantic return type</returns> public static IEnumerable <UstNode> GetInvocationExpressionsBySemanticReturnType(this UstNode node, string semanticReturnType) => node.AllInvocationExpressions().Where(i => i.SemanticReturnType == semanticReturnType);
/// <summary> /// Get Invocation expressions by method name /// </summary> /// <param name="node">Node to query</param> /// <param name="identifier">Method Name to search for</param> /// <returns>Collection of invocation expressions with the given method name</returns> public static IEnumerable <UstNode> GetInvocationExpressionByMethodName(this UstNode node, string methodName) => node.AllInvocationExpressions().Where(i => i.MethodName == methodName);