Changeset 413


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

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

Location:
trunk
Files:
3 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
  • trunk/Include/system/gc.sbp

    r400 r413  
    471471        End If
    472472
     473        If Object.ReferenceEquals( classTypeInfo, ActiveBasic.Core._System_TypeBase.selfTypeInfo ) Then
     474            ' TypeInfoクラスの場合はTypeBaseImplクラスとして扱う
     475            classTypeInfo = _System_TypeBase_Search( "ActiveBasic.Core.TypeBaseImpl" ) As ActiveBasic.Core._System_TypeForClass
     476        End If
     477
    473478        /*
    474479        _System_DebugOnly_OutputDebugString( "  (scanning object)" )
  • trunk/TestCase/SimpleTestCase/TypeInfoTest.ab

    r403 r413  
    44Sub TestMain()
    55    Dim str As String
    6     /*
     6
    77    Dim memberInfos = str.GetType().GetMembers()
    88    UnitTest( "TypeInfoTest(MemberInfo) ... ", True )
     
    1010        UnitTest( Ex"\t" + memberInfo.Name + " As " + memberInfo.MemberType.FullName, True )
    1111    Next
    12     */
     12
    1313End Sub
    1414
Note: See TracChangeset for help on using the changeset viewer.