Changeset 342 for trunk


Ignore:
Timestamp:
Sep 29, 2007, 12:44:41 PM (17 years ago)
Author:
dai
Message:

静的メソッドのデリゲートに対応

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/TestCase/SimpleTestCase/DelegateTest.ab

    r340 r342  
    55Delegate Sub Callback3( a As Long )
    66Delegate Sub Callback4( a As String )
    7 Delegate Function Callback7() As Long
     7Delegate Function Callback7( str As String ) As String
    88
    99
     
    5959    End Sub
    6060
    61     Function Proc7() As String
    62         Return "Proc7 result"
     61    Static Function Proc7( str As String ) As String
     62        Return "Proc7 result[" + str + "]"
    6363    End Function
    6464End Class
     
    7979
    8080    UnitTest( "Delegate1", testObj.CheckFlags() )
    81 /*
     81
    8282    Dim dg7 = New Callback7( AddressOf(TestClass.Proc7) )
    83     UnitTest( "Delegate2", dg7() = "Proc7 result" )
    84 */
     83    UnitTest( "Delegate2", dg7( "test value" ) = "Proc7 result[test value]" )
     84
    8585End Sub
    8686
  • trunk/bin/SubOperation/templates/delegate_class.tab

    r340 r342  
    1515            For i = 0 To ELM(simpleDelegates.Count)
    1616                Dim sd = simpleDelegates[i]
    17                 #result# __delegate_dynamicmethod_call(sd.methodPtr, sd.object, #params#)
     17                If sd.hasThisPtr Then
     18                    #result# __delegate_dynamicmethod_call(sd.methodPtr, sd.object, #params#)
     19                Else
     20                    #result# __delegate_staticmethod_call(sd.methodPtr, #params#)
     21                End If
    1822            Next
    1923        'End Sub
     
    3034        End Function
    3135
    32         Static Function _CreateDelegate( object As Object, methodPtr As VoidPtr ) As #name#
     36        Static Function _CreateDynamicDelegate( object As Object, methodPtr As VoidPtr ) As #name#
    3337            Dim dg = New #name#
    3438            dg.simpleDelegates.Add( New System._SimpleDelegate( object, methodPtr ) )
    3539            Return dg
    3640        End Function
     41
     42        Static Function _CreateStaticDelegate( methodPtr As VoidPtr ) As #name#
     43            Dim dg = New #name#
     44            dg.simpleDelegates.Add( New System._SimpleDelegate( methodPtr ) )
     45            Return dg
     46        End Function
    3747    End Class
    3848#namespace_end#
Note: See TracChangeset for help on using the changeset viewer.