public ITypeSymbol ResolveVariableType() { if (CancellationToken.IsCancellationRequested) { return(null); } MethodDeclarationSyntax methodDeclaration = Invocation.GetDeclaringMethodNode(); if (methodDeclaration == null || !SemanticModel.IsLocalVariable(methodDeclaration, VariableName)) { return(null); } methodBodyWalker.Visit(methodDeclaration); if (CancellationToken.IsCancellationRequested || !methodBodyWalker.IsValid || methodBodyWalker.Candidates.Count == 0) { return(null); } TypeSyntax assignedType = GetTypeFromCandidates(); if (assignedType == null) { return(null); } SymbolInfo symbolInfo = SemanticModel.GetSymbolInfo(assignedType); return(symbolInfo.Symbol as ITypeSymbol); }
public bool CheckForBqlModifications() { if (CancellationToken.IsCancellationRequested) { return(false); } MethodDeclarationSyntax methodDeclaration = Invocation.GetDeclaringMethodNode(); if (methodDeclaration == null || CancellationToken.IsCancellationRequested) { return(false); } methodBodyWalker.Visit(methodDeclaration); return(methodBodyWalker.IsValid && !CancellationToken.IsCancellationRequested); }
/// <summary> /// Gets array elements count in array variable. If <c>null</c> then the number couldn't be counted. /// </summary> /// <returns/> public int?GetArrayElementsCount() { if (CancellationToken.IsCancellationRequested) { return(null); } MethodDeclarationSyntax methodDeclaration = Invocation.GetDeclaringMethodNode(); if (methodDeclaration == null || !SemanticModel.IsLocalVariable(methodDeclaration, VariableName)) { return(null); } methodBodyWalker.Visit(methodDeclaration); if (CancellationToken.IsCancellationRequested || !methodBodyWalker.IsValid || methodBodyWalker.Candidates.Count == 0) { return(null); } return(GetElementsCountFromCandidates()); }