void RemoveID(IdentifierNameSyntax identifierExpression) { string id = identifierExpression.Identifier.ValueText; if (IDs.ContainsKey(id)) { IDs.Remove(id); } }
void RemoveID(IdentifierNameSyntax identifierExpression, string callerName, bool isProperty = true) { string id = identifierExpression.Identifier.ValueText; if (IDs.ContainsKey(id)) { bool isProblematicCaller = isProperty ? IsProblematicProperty(IDs[id], callerName) : IsProblematicMethod(IDs[id], callerName); if (!isProblematicCaller) { IDs.Remove(id); } } }
public override void VisitMemberAccessExpression(MemberAccessExpressionSyntax node) { var expression = node.Expression as IdentifierNameSyntax; if (expression != null) { string id = expression.Identifier.ValueText; if (IsDisposedCalled(id, node.Name.ToString())) { IDs.Remove(id); } } base.VisitMemberAccessExpression(node); }
public override void VisitVariableDeclarator(VariableDeclaratorSyntax node) { string id = node.Identifier.ValueText; if (IDs.ContainsKey(id)) { var initializer = node.Initializer as EqualsValueClauseSyntax; if (initializer != null && !(initializer.Value is ObjectCreationExpressionSyntax)) { IDs.Remove(id); } } base.VisitVariableDeclarator(node); }