set x = new Ext
x.examplecall
ParentModule: vbeProcedure
Name: Name
StarLine: 21
EndLine: 29
CountOfLines: 8
ParentModule: vbeProcedure
Name: ParentModule
Public Property Get Signature() As String
Dim code() As String
code = Split(Me.ParentModule.Lines(Me.startLine, Me.CountOfLines), vbNewLine)
Dim i As Long
For i = 0 To UBound(code)
If code(i) <> vbNullString And Left(Trim(code(i)), 1) <> "'" Then
Signature = code(i)
Exit Property
End If
Next
End Property
set x = new Ext
x.examplecall
ParentModule: vbeProcedure
Name: Name
StarLine: 35
EndLine: 43
CountOfLines: 8
Accessibility: Public
Member Type: Property (Get)
Signature: Property Get Name() As String
Body:
If isNameSet Then
Name = mName
Else
RaiseObjectNotIntializedError
End If
I'm having so much fun with your code!
@ckuhn203 I can now use it to inspect code that have Public Function's or property getters that return a Variant!
@ckuhn203 I'm returning an enum type, not a string - so the "Property (Get)" is a string representation of the result :)
now I just need to clean it up (and perhaps make those methods instead of properties):
Public Property Get ModuleMemberType() As MemberType
Dim result As MemberType
Dim code() As String
code = Split(Trim(Signature), " ")
Dim modifier As String
modifier = code(0)
Dim mType As String, mPropType As String
If modifier = "Property" Or modifier = "Function" Or modifier = "Sub" Then
mType = modifier
mPropType = code(1)
Else
mType = code(1)
mPropType = code(2)
End If
Select Case mType
Case "Property"
If mPropType = "Get" Then
the idea is to avoid magic strings in the code that would consume that API
'access modifier "Public" intentionally not specified
Property Get Accessibility() As MemberAccessibility
Dim code() As String
code() = Split(Trim(Signature), " ")
Dim modifier As String
modifier = code(0)
If modifier = "Property" Or modifier = "Function" Or modifier = "Sub" Then modifier = "Public"
Select Case modifier
Case "Public"
Accessibility = ma_Public
Case "Private"
Accessibility = ma_Private
Case "Friend"
Accessibility = ma_Friend
@ckuhn203 perhaps we should create a new chatroom to discuss that code...