User: xtoff
Date: 2009/11/12 01:23 PM

Added:
 /DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/Interfaces/
  IOne.cs, ITwo.cs, One.cs, OneTwo.cs, Two.cs
 /DynamicProxy/trunk/src/Castle.DynamicProxy/Generators/Emitters/SimpleAST/
  NullCoalescingOperatorExpression.cs

Modified:
 /DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/
  Castle.DynamicProxy.Tests-vs2008.csproj, 
InterfaceProxyWithTargetInterfaceTestCase.cs, 
ProxyTargetAccessorHandlingTestCase.cs
 /DynamicProxy/trunk/src/Castle.DynamicProxy/
  Castle.DynamicProxy-vs2008.csproj
 /DynamicProxy/trunk/src/Castle.DynamicProxy/Contributors/
  InterfaceProxyTargetContributor.cs, 
InterfaceProxyWithoutTargetContributor.cs, MixinContributor.cs
 /DynamicProxy/trunk/src/Castle.DynamicProxy/Generators/
  InterfaceInvocationTypeGenerator.cs

Log:
 - some minor clean up and removed duplication
 - added ingnored failing test to demo DYNPROXY-ISSUE-121

File Changes:

Directory: /DynamicProxy/trunk/src/Castle.DynamicProxy/
=======================================================

File [modified]: Castle.DynamicProxy-vs2008.csproj
Delta lines: +3 -1
===================================================================

--- 
DynamicProxy/trunk/src/Castle.DynamicProxy/Contributors/InterfaceProxyTargetContributor.cs
  2009-11-12 20:21:18 UTC (rev 6316)
+++ 
DynamicProxy/trunk/src/Castle.DynamicProxy/Contributors/InterfaceProxyTargetContributor.cs
  2009-11-12 20:23:05 UTC (rev 6317)
@@ -144,7 +144,9 @@
                        }
                        else
                        {
-                               generator = new 
ForwardingMethodGenerator(method, createMethod, (c, m) => 
c.GetField("__target"));
+                               generator = new 
ForwardingMethodGenerator(method,
+                                                                         
createMethod,
+                                                                         (c, 
m) => c.GetField("__target"));
                        }
                        var proxyMethod = generator.Generate(@class, options, 
namingScope);

Directory: /DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/
=============================================================

File [modified]: Castle.DynamicProxy.Tests-vs2008.csproj
Delta lines: +13 -27
===================================================================

--- 
DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/InterfaceProxyWithTargetInterfaceTestCase.cs
       2009-11-12 20:21:18 UTC (rev 6316)
+++ 
DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/InterfaceProxyWithTargetInterfaceTestCase.cs
       2009-11-12 20:23:05 UTC (rev 6317)
@@ -15,6 +15,9 @@
 namespace Castle.DynamicProxy.Tests
 {
        using System;
+
+       using Castle.DynamicProxy.Tests.Interfaces;
+
        using Core.Interceptor;
        using NUnit.Framework;
 
@@ -52,36 +55,19 @@
                        int result = (proxy as IOne).OneMethod();
                        Assert.AreEqual(3, result);
                }
-       }
 
-       public interface IOne
-       {
-               int OneMethod();
-       }
-
-       public class OneTwo : IOne, ITwo
-       {
-               public int OneMethod()
+               [Test]
+               [Ignore("DYNPROXY-ISSUE-121")]
+               public void 
Mixin_methods_should_be_forwarded_to_target_if_implements_mixin_interface()
                {
-                       return 3;
+                       var options = new ProxyGenerationOptions();
+                       options.AddMixinInstance(new Two());
+                       var proxy = 
generator.CreateInterfaceProxyWithTargetInterface(typeof(IOne),
+                                                                               
      new OneTwo(),
+                                                                               
      options);
+                       int result = (proxy as ITwo).TwoMethod();
+                       Assert.AreEqual(2, result);
                }
 
-               public int TwoMethod()
-               {
-                       return 2;
-               }
        }
-
-       public class One : IOne
-       {
-               public int OneMethod()
-               {
-                       return 1;
-               }
-       }
-
-       public interface ITwo
-       {
-               int TwoMethod();
-       }

File [modified]: InterfaceProxyWithTargetInterfaceTestCase.cs
Delta lines: +21 -0
===================================================================

--- DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/Interfaces/IOne.cs         
                (rev 0)
+++ DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/Interfaces/IOne.cs 
2009-11-12 20:23:05 UTC (rev 6317)
@@ -0,0 +1,21 @@
+// Copyright 2004-2009 Castle Project - http://www.castleproject.org/
+// 
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// 
+//     http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Castle.DynamicProxy.Tests.Interfaces
+{
+       public interface IOne
+       {
+               int OneMethod();
+       }
+}

File [modified]: ProxyTargetAccessorHandlingTestCase.cs
Delta lines: +0 -0
===================================================================

Directory: /DynamicProxy/trunk/src/Castle.DynamicProxy/Contributors/
====================================================================

File [modified]: InterfaceProxyTargetContributor.cs
Delta lines: +4 -4
===================================================================

--- 
DynamicProxy/trunk/src/Castle.DynamicProxy/Contributors/InterfaceProxyWithoutTargetContributor.cs
   2009-11-12 20:21:18 UTC (rev 6316)
+++ 
DynamicProxy/trunk/src/Castle.DynamicProxy/Contributors/InterfaceProxyWithoutTargetContributor.cs
   2009-11-12 20:23:05 UTC (rev 6317)
@@ -109,10 +109,10 @@
                                        .Generate(@class, options, namingScope);
 
                                generator = new InterfaceMethodGenerator(method,
-                                                                               
invocation,
-                                                                               
@class.GetField("__interceptors"),
-                                                                               
createMethod,
-                                                                               
GetTargetExpression);
+                                                                        
invocation,
+                                                                        
@class.GetField("__interceptors"),
+                                                                        
createMethod,
+                                                                        
GetTargetExpression);
                        }
                        else

File [modified]: InterfaceProxyWithoutTargetContributor.cs
Delta lines: +12 -14
===================================================================

--- DynamicProxy/trunk/src/Castle.DynamicProxy/Contributors/MixinContributor.cs 
2009-11-12 20:21:18 UTC (rev 6316)
+++ DynamicProxy/trunk/src/Castle.DynamicProxy/Contributors/MixinContributor.cs 
2009-11-12 20:23:05 UTC (rev 6317)
@@ -19,7 +19,6 @@
        using System.Reflection;
        using Castle.DynamicProxy.Generators;
        using Castle.DynamicProxy.Generators.Emitters;
-       using Castle.DynamicProxy.Generators.Emitters.SimpleAST;
 
        public class MixinContributor : MixinContributorBase
        {
@@ -69,52 +68,51 @@
                                ImplementMethod(method,
                                                @class,
                                                options,
-                                               @class.CreateMethod,
-                                               field);
+                                               @class.CreateMethod);
                        }
 
                        foreach (var property in target.Properties)
                        {
-                               ImplementProperty(@class, property, options, 
field);
+                               ImplementProperty(@class, property, options);
                        }
 
                        foreach (var @event in target.Events)
                        {
-                               ImplementEvent(@class, @event, options, field);
+                               ImplementEvent(@class, @event, options);
                        }
 
                }
 
 
-               private void ImplementEvent(ClassEmitter emitter, 
EventToGenerate @event, ProxyGenerationOptions options, FieldReference target)
+               private void ImplementEvent(ClassEmitter emitter, 
EventToGenerate @event, ProxyGenerationOptions options)
                {
                        @event.BuildEventEmitter(emitter);
                        var adder = @event.Adder;
-                       ImplementMethod(adder, emitter, options, 
@event.Emitter.CreateAddMethod, target);
+                       ImplementMethod(adder, emitter, options, 
@event.Emitter.CreateAddMethod);
                        var remover = @event.Remover;
-                       ImplementMethod(remover, emitter, options, 
@event.Emitter.CreateRemoveMethod, target);
+                       ImplementMethod(remover, emitter, options, 
@event.Emitter.CreateRemoveMethod);
 
                }
 
-               private void ImplementProperty(ClassEmitter emitter, 
PropertyToGenerate property, ProxyGenerationOptions options, FieldReference 
target)
+               private void ImplementProperty(ClassEmitter emitter, 
PropertyToGenerate property, ProxyGenerationOptions options)
                {
                        property.BuildPropertyEmitter(emitter);
                        if (property.CanRead)
                        {
                                var getter = property.Getter;
                                ImplementMethod(getter, emitter, options,
-                                                               (name, atts) => 
property.Emitter.CreateGetMethod(name, atts), target);
+                                                               (name, atts) => 
property.Emitter.CreateGetMethod(name, atts));
                        }
 
                        if (property.CanWrite)
                        {
                                var setter = property.Setter;
                                ImplementMethod(setter, emitter, options,
-                                                               (name, atts) => 
property.Emitter.CreateSetMethod(name, atts), target);
+                                                               (name, atts) => 
property.Emitter.CreateSetMethod(name, atts));
                        }
                }
 
-               private void ImplementMethod(MethodToGenerate method, 
ClassEmitter emitter, ProxyGenerationOptions options, CreateMethodDelegate 
createMethod, Reference target)
+               private void ImplementMethod(MethodToGenerate method, 
ClassEmitter emitter, ProxyGenerationOptions options, CreateMethodDelegate 
createMethod)
                {
                        MethodGenerator generator;
                        if (method.Proxyable)
@@ -131,13 +129,13 @@
                                                                         
invocation,
                                                                         
interceptors,
                                                                         
createMethod,
-                                                                        (c, i) 
=> target.ToExpression());
+                                                                        (c, i) 
=> field.ToExpression());
                        }
                        else
                        {
                                generator = new 
ForwardingMethodGenerator(method,
                                                                          
createMethod,
-                                                                         (c, 
i) => target);
+                                                                         (c, 
i) => field);
                        }
                        var proxyMethod = generator.Generate(emitter, options, 
namingScope);

File [modified]: MixinContributor.cs
Delta lines: +52 -0
===================================================================

--- 
DynamicProxy/trunk/src/Castle.DynamicProxy/Generators/Emitters/SimpleAST/NullCoalescingOperatorExpression.cs
                                (rev 0)
+++ 
DynamicProxy/trunk/src/Castle.DynamicProxy/Generators/Emitters/SimpleAST/NullCoalescingOperatorExpression.cs
        2009-11-12 20:23:05 UTC (rev 6317)
@@ -0,0 +1,52 @@
+// Copyright 2004-2009 Castle Project - http://www.castleproject.org/
+// 
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// 
+//     http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Castle.DynamicProxy.Generators.Emitters.SimpleAST
+{
+       using System;
+       using System.Reflection.Emit;
+
+       public class NullCoalescingOperatorExpression:Expression
+       {
+               private readonly Reference reference;
+               private readonly Reference @default;
+
+               public NullCoalescingOperatorExpression(Reference reference, 
Reference @default)
+               {
+                       if (reference == null)
+                       {
+                               throw new ArgumentNullException("reference");
+                       }
+
+                       if (@default == null)
+                       {
+                               throw new ArgumentNullException("default");
+                       }
+
+                       this.reference = reference;
+                       th...@default = @default;
+               }
+
+               public override void Emit(IMemberEmitter member, ILGenerator 
gen)
+               {
+                       reference.LoadReference(gen);
+                       gen.Emit(OpCodes.Dup);
+                       var label = gen.DefineLabel();
+                       gen.Emit(OpCodes.Brtrue_S, label);
+                       gen.Emit(OpCodes.Pop);
+                       @default.LoadReference(gen);
+                       gen.MarkLabel(label);
+               }
+       }
+}

Directory: /DynamicProxy/trunk/src/Castle.DynamicProxy/Generators/
==================================================================

File [modified]: InterfaceInvocationTypeGenerator.cs
Delta lines: +11 -6
===================================================================

--- 
DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/Castle.DynamicProxy.Tests-vs2008.csproj
    2009-11-12 20:21:18 UTC (rev 6316)
+++ 
DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/Castle.DynamicProxy.Tests-vs2008.csproj
    2009-11-12 20:23:05 UTC (rev 6317)
@@ -108,12 +108,6 @@
     <Compile Include="XmlSerializationTestCase.cs" />
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference 
Include="..\Castle.DynamicProxy\Castle.DynamicProxy-vs2008.csproj">
-      <Project>{2DE7CC8C-6F06-43BC-A7B6-9466BEDEAC28}</Project>
-      <Name>Castle.DynamicProxy-vs2008</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
     <None Include="..\..\buildscripts\CastleKey.snk">
       <Link>CastleKey.snk</Link>
     </None>
@@ -183,7 +177,12 @@
     <Compile Include="Interfaces\IFooWithOutIntPtr.cs" />
     <Compile Include="Interfaces\IGenericWithRefOut.cs" />
     <Compile Include="Interfaces\INullable.cs" />
+    <Compile Include="Interfaces\IOne.cs" />
+    <Compile Include="Interfaces\ITwo.cs" />
     <Compile Include="Interfaces\IWithRefOut.cs" />
+    <Compile Include="Interfaces\One.cs" />
+    <Compile Include="Interfaces\OneTwo.cs" />
+    <Compile Include="Interfaces\Two.cs" />
     <Compile Include="InvocationMethodInvocationTargetTestCase.cs" />
     <Compile Include="MethodEquivalenceTestCase.cs" />
     <Compile Include="MixinDataTestCase.cs" />
@@ -241,6 +240,12 @@
   <ItemGroup>
     <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference 
Include="..\Castle.DynamicProxy\Castle.DynamicProxy-vs2008.csproj">
+      <Project>{2DE7CC8C-6F06-43BC-A7B6-9466BEDEAC28}</Project>
+      <Name>Castle.DynamicProxy-vs2008</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets 
below and uncomment it. 

Directory: /DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/Interfaces/
========================================================================

File [added]: IOne.cs
Delta lines: +21 -0
===================================================================

--- DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/Interfaces/ITwo.cs         
                (rev 0)
+++ DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/Interfaces/ITwo.cs 
2009-11-12 20:23:05 UTC (rev 6317)
@@ -0,0 +1,21 @@
+// Copyright 2004-2009 Castle Project - http://www.castleproject.org/
+// 
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// 
+//     http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Castle.DynamicProxy.Tests.Interfaces
+{
+       public interface ITwo
+       {
+               int TwoMethod();
+       }
+}

File [added]: ITwo.cs
Delta lines: +24 -0
===================================================================

--- DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/Interfaces/One.cs          
                (rev 0)
+++ DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/Interfaces/One.cs  
2009-11-12 20:23:05 UTC (rev 6317)
@@ -0,0 +1,24 @@
+// Copyright 2004-2009 Castle Project - http://www.castleproject.org/
+// 
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// 
+//     http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Castle.DynamicProxy.Tests.Interfaces
+{
+       public class One : IOne
+       {
+               public int OneMethod()
+               {
+                       return 1;
+               }
+       }
+}

File [added]: One.cs
Delta lines: +29 -0
===================================================================

--- DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/Interfaces/OneTwo.cs       
                        (rev 0)
+++ DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/Interfaces/OneTwo.cs       
2009-11-12 20:23:05 UTC (rev 6317)
@@ -0,0 +1,29 @@
+// Copyright 2004-2009 Castle Project - http://www.castleproject.org/
+// 
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// 
+//     http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Castle.DynamicProxy.Tests.Interfaces
+{
+       public class OneTwo : IOne, ITwo
+       {
+               public int OneMethod()
+               {
+                       return 3;
+               }
+
+               public int TwoMethod()
+               {
+                       return 2;
+               }
+       }
+}

File [added]: OneTwo.cs
Delta lines: +24 -0
===================================================================

--- DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/Interfaces/Two.cs          
                (rev 0)
+++ DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/Interfaces/Two.cs  
2009-11-12 20:23:05 UTC (rev 6317)
@@ -0,0 +1,24 @@
+// Copyright 2004-2009 Castle Project - http://www.castleproject.org/
+// 
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// 
+//     http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Castle.DynamicProxy.Tests.Interfaces
+{
+       public class Two : ITwo
+       {
+               public int TwoMethod()
+               {
+                       return 20;
+               }
+       }
+}

File [added]: Two.cs
Delta lines: +4 -1
===================================================================

--- 
DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/ProxyTargetAccessorHandlingTestCase.cs
     2009-11-12 20:21:18 UTC (rev 6316)
+++ 
DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/ProxyTargetAccessorHandlingTestCase.cs
     2009-11-12 20:23:05 UTC (rev 6317)
@@ -15,7 +15,10 @@
 namespace Castle.DynamicProxy.Tests
 {
        using System;
-       using Core.Interceptor;
+
+       using Castle.Core.Interceptor;
+       using Castle.DynamicProxy.Tests.Interfaces;
+
        using NUnit.Framework;
 

Directory: 
/DynamicProxy/trunk/src/Castle.DynamicProxy/Generators/Emitters/SimpleAST/
=====================================================================================

File [added]: NullCoalescingOperatorExpression.cs
Delta lines: +1 -82
===================================================================

--- 
DynamicProxy/trunk/src/Castle.DynamicProxy/Generators/InterfaceInvocationTypeGenerator.cs
   2009-11-12 20:21:18 UTC (rev 6316)
+++ 
DynamicProxy/trunk/src/Castle.DynamicProxy/Generators/InterfaceInvocationTypeGenerator.cs
   2009-11-12 20:23:05 UTC (rev 6317)
@@ -15,7 +15,6 @@
 namespace Castle.DynamicProxy.Generators
 {
        using System;
-       using System.Collections.Generic;
        using System.Reflection;
        using Emitters;
        using Emitters.SimpleAST;
@@ -33,87 +32,7 @@
                        method.CodeBuilder.AddStatement(
                                new ExpressionStatement(
                                        new 
MethodInvocationExpression(SelfReference.Self, 
InvocationMethods.EnsureValidTarget)));
-                       Expression[] args = new Expression[parameters.Length];
-
-                       // Idea: instead of grab parameters one by one
-                       // we should grab an array
-                       Dictionary<int, LocalReference> byRefArguments = new 
Dictionary<int, LocalReference>();
-
-                       for (int i = 0; i < parameters.Length; i++)
-                       {
-                               ParameterInfo param = parameters[i];
-
-                               Type paramType = 
TypeUtil.GetClosedParameterType(nested, param.ParameterType);
-                               if (paramType.IsByRef)
-                               {
-                                       LocalReference localReference = 
method.CodeBuilder.DeclareLocal(paramType.GetElementType());
-                                       method.CodeBuilder.AddStatement(
-                                               new 
AssignStatement(localReference,
-                                                                   new 
ConvertExpression(paramType.GetElementType(),
-                                                                               
          new MethodInvocationExpression(SelfReference.Self,
-                                                                               
                                         InvocationMethods.GetArgumentValue,
-                                                                               
                                         new LiteralIntExpression(i)))));
-                                       ByRefReference byRefReference = new 
ByRefReference(localReference);
-                                       args[i] = new 
ReferenceExpression(byRefReference);
-                                       byRefArguments[i] = localReference;
-                               }
-                               else
-                               {
-                                       args[i] =
-                                               new ConvertExpression(paramType,
-                                                                     new 
MethodInvocationExpression(SelfReference.Self,
-                                                                               
                     InvocationMethods.GetArgumentValue,
-                                                                               
                     new LiteralIntExpression(i)));
-                               }
-                       }
-
-                       if (callbackMethod.IsGenericMethod)
-                       {
-                               callbackMethod = 
callbackMethod.MakeGenericMethod(nested.GetGenericArgumentsFor(callbackMethod));
-                       }
-
-                       var methodOnTargetInvocationExpression = new 
MethodInvocationExpression(
-                               new AsTypeReference(targetField, 
callbackMethod.DeclaringType),
-                               callbackMethod,
-                               args) { VirtualCall = true };
-
-                       LocalReference returnValue = null;
-                       if (callbackMethod.ReturnType != typeof(void))
-                       {
-                               Type returnType = 
TypeUtil.GetClosedParameterType(nested, callbackMethod.ReturnType);
-                               returnValue = 
method.CodeBuilder.DeclareLocal(returnType);
-                               method.CodeBuilder.AddStatement(new 
AssignStatement(returnValue, methodOnTargetInvocationExpression));
-                       }
-                       else
-                       {
-                               method.CodeBuilder.AddStatement(new 
ExpressionStatement(methodOnTargetInvocationExpression));
-                       }
-
-                       foreach (KeyValuePair<int, LocalReference> 
byRefArgument in byRefArguments)
-                       {
-                               int index = byRefArgument.Key;
-                               LocalReference localReference = 
byRefArgument.Value;
-                               method.CodeBuilder.AddStatement(
-                                       new ExpressionStatement(
-                                               new 
MethodInvocationExpression(SelfReference.Self,
-                                                                              
InvocationMethods.SetArgumentValue,
-                                                                              
new LiteralIntExpression(index),
-                                                                              
new ConvertExpression(typeof(object), localReference.Type,
-                                                                               
                     new ReferenceExpression(localReference)))
-                                               ));
-                       }
-
-                       if (callbackMethod.ReturnType != typeof(void))
-                       {
-                               MethodInvocationExpression setRetVal =
-                                       new 
MethodInvocationExpression(SelfReference.Self,
-                                                                      
InvocationMethods.SetReturnValue,
-                                                                      new 
ConvertExpression(typeof(object), returnValue.Type, 
returnValue.ToExpression()));
-
-                               method.CodeBuilder.AddStatement(new 
ExpressionStatement(setRetVal));
-                       }
-
-                       method.CodeBuilder.AddStatement(new ReturnStatement());
+                       base.ImplementInvokeMethodOnTarget(nested, parameters, 
method, callbackMethod, targetField);
                }
 

--

You received this message because you are subscribed to the Google Groups 
"Castle Project Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-commits?hl=.


Reply via email to