You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rubberduck version information
Version 2.5.0.3853
OS: Microsoft Windows NT 10.0.17763.0, x64
Host Product: Microsoft Office x64
Host Version: 16.0.12430.20288
Host Executable: MSACCESS.EXE
Description
It seems that Declare statements are not handled correctly and get pushed down into middle of module when adding new property statements as a result of the refactoring.
To Reproduce
Start with this code in a class module:
Private foo As String
Private strBar As String
Private bizz As String
Private Declare PtrSafe Function GetFocus Lib "user32" () As LongPtr
Public Property Get Bar() As String
Bar = strBar
End Property
Public Sub doit()
Debug.Print "do it"
End Sub
Refactor as shown:
We end up with this uncompilable code:
Private Type TClass1
Foo As String
Bar_1 As String
Bizz As String
End Type
Private this As TClass1
Public Property Get Foo() As String
Foo = this.Foo
End Property
Public Property Let Foo(ByVal value As String)
this.Foo = value
End Property
Public Property Get Bar_1() As String
Bar_1 = this.Bar_1
End Property
Public Property Let Bar_1(ByVal value As String)
this.Bar_1 = value
End Property
Public Property Get Bizz() As String
Bizz = this.Bizz
End Property
Public Property Let Bizz(ByVal value As String)
this.Bizz = value
End Property
Private Declare PtrSafe Function GetFocus Lib "user32" () As LongPtr
Public Property Get Bar() As String
Bar = Bar_1
End Property
Public Sub doit()
Debug.Print "do it"
End Sub
Expected behavior
The refactoring should ensure that it actually insert at the end of the code declaration section and that should factor in Declare statements which are technically a part of the declaration section.
The text was updated successfully, but these errors were encountered:
Note, this refactoring has a tech debt refactor pending - I blocked it in Max' PR because I have a branch with UI & other tweaks to this feature... but I need to get back to it.
I'll wrap up these overdue changes and then this bug can be addressed.
BZngr
changed the title
Encapuslate Field refactoring does not always insert procedures in correct places
Encapsulate Field refactoring does not always insert procedures in correct places
Mar 9, 2020
Rubberduck version information
Version 2.5.0.3853
OS: Microsoft Windows NT 10.0.17763.0, x64
Host Product: Microsoft Office x64
Host Version: 16.0.12430.20288
Host Executable: MSACCESS.EXE
Description
It seems that
Declare
statements are not handled correctly and get pushed down into middle of module when adding new property statements as a result of the refactoring.To Reproduce
Start with this code in a class module:
Refactor as shown:
![image](https://user-images.githubusercontent.com/2367644/76226669-31913f00-61ec-11ea-8c79-b5a9cb60aa51.png)
We end up with this uncompilable code:
Expected behavior
The refactoring should ensure that it actually insert at the end of the code declaration section and that should factor in
Declare
statements which are technically a part of the declaration section.The text was updated successfully, but these errors were encountered: