/// <summary> /// Collects all variable accesses within the given expression. /// </summary> /// <param name="expression">The expression to collect the accesses from.</param> /// <returns>The collected variable accesses.</returns> public static VariableAccesses Collect(Expression expression) { var accesses = new VariableAccesses(); accesses.Visit(expression); return(accesses); }
/// <summary> /// Collects all variable accesses within the given code. /// </summary> /// <param name="code">The code to collect the accesses from.</param> /// <returns>The collected variable accesses.</returns> public static VariableAccesses Collect(Code code) { var accesses = new VariableAccesses(); foreach (var node in code.Root) { accesses.Visit(node); } return(accesses); }
/// <summary> /// Collects all possibilities of aliasing the arrays observed in variable accesses. /// </summary> /// <param name="semanticModel">The semantic model of the analyzed for statement.</param> /// <param name="loopStatement">The for statement being analyzed.</param> /// <param name="variableAccesses">The collected variable accesses within the for statement.</param> /// <returns>A set containing all possibilities of array aliases.</returns> public static ISet<VariableAlias> Collect(SemanticModel semanticModel, SyntaxNode loopStatement, VariableAccesses variableAccesses) { return new ExternalArrayAliasCollector(semanticModel, loopStatement, variableAccesses)._GetPossibleArrayAliases(); }
private ExternalArrayAliasCollector(SemanticModel semanticModel, SyntaxNode loopStatement, VariableAccesses variableAccesses) { _semanticModel = semanticModel; _loopStatement = loopStatement; _variableAccesses = variableAccesses; }