"Remove Not Accessed Local Variable" doesn't work right

[THIS IS NOT REAL CODE IF YOU ARE GOING TO ASK - IT IS JUST A SIMPLE EXAMPLE OF SOMETHING MORE COMPLEX]...
On the line: "Dim sqlghi..." open the lightbulb and try to "remove not accessed local variable": sqlghi... --
THE MAIN PROBLEM - it is accessed but no use is made of the result... R#'s fix for this does something really bad...

Public Overrides Function GenerateSQLClause(ByVal abc As String, ByVal def As String, ByVal ghi As String, ByVal jkl As String) As String


Dim sqlabc As String = ""


Dim sqlghi As String = ""


Dim sqljkl As String = ""


If abc.Length > 0 Then sqlabc = " AND ABC='" & abc & "' "


If ghi.Length > 0 Then sqlghi = " AND GHI IN(" & ghi & ") "


If Not String.IsNullOrEmpty(jkl) Then sqljkl = " AND JKL IN (" & jkl & ") " '


Return sqlabc

End Function

1 comment
Comment actions Permalink

Hello Denis,

Thank you for reporting this problem! I've added a bug-report: http://youtrack.jetbrains.net/issue/RSRP-262165.


Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Try to remove "sqlghi"...

Public Overrides Function GenerateSQLClause(ByVal abc As String, ByVal
def As String, ByVal ghi As String, ByVal jkl As String) As String

Dim sqlabc As String = ""

Dim sqlghi As String = ""

Dim sqljkl As String = ""

If abc.Length > 0 Then sqlabc = " AND ABC='" & abc & "' "

If ghi.Length > 0 Then sqlghi = " AND GHI IN(" & ghi & ") "

If Not String.IsNullOrEmpty(jkl) Then sqljkl = " AND JKL IN (" & jkl &
") " '

Return sqlabc

End Function



0

Please sign in to leave a comment.