Ignore:
Timestamp:
Feb 24, 2008, 7:03:07 PM (17 years ago)
Author:
dai
Message:

ポインタ型の型情報取得に対応した。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/Classes/ActiveBasic/Core/TypeInfo.ab

    r403 r413  
    1010    name As String
    1111    fullName As String
     12
     13    ptrType As TypeBaseImpl
     14    ptrLevel As Long
    1215
    1316    ' メンバ情報
     
    2730        This.fullName = fullName
    2831        This.baseType = Nothing
     32
     33        ptrType = Nothing
     34        ptrLevel = 0
    2935    End Sub
    3036
    3137    Sub ~TypeBaseImpl()
    3238    End Sub
     39
     40    Sub PtrLevelUp()
     41        ptrLevel ++
     42        fullName = "*" + fullName
     43    End Sub
     44
     45    Function Clone() As TypeBaseImpl
     46        Dim result = New TypeBaseImpl( strNamespace, name, fullName )
     47        result.SetBaseType( baseType )
     48        result.SetMembers( memberNames, memberTypeFullNames, memberCounts )
     49        result.memberInfosCache = This.memberInfosCache
     50        result.ptrLevel = This.ptrLevel
     51        Return result
     52    End Function
    3353
    3454Public
     
    5171    End Sub
    5272
     73    Function GetPtrType() As TypeBaseImpl
     74        If Object.ReferenceEquals( ptrType, Nothing ) Then
     75            Dim clone = This.Clone()
     76
     77            ptrType = clone
     78            ptrType.PtrLevelUp()
     79        End If
     80        Return ptrType
     81    End Function
     82
    5383
    5484    '----------------------------------------------------------------
     
    89119
    90120    Override Function IsPointer() As Boolean
    91         Return False
     121        Return ( ptrLevel > 0 )
    92122    End Function
    93123
     
    258288        End If
    259289
     290        If fullName[0] = &H2A Then      ' fullName[0] = '*'
     291            Dim result = Search( fullName.Substring( 1 ) )
     292            Return result.GetPtrType()
     293        End If
     294
    260295        Search = types.Item(fullName)
    261296
Note: See TracChangeset for help on using the changeset viewer.