Permalink
Browse files

Adds Windows 8 RC reference assemblies, implements delegate creator v…

…ia Expression Trees for Win8
  • Loading branch information...
1 parent 8582506 commit 19afcac2d1a98c986c4845dd0dcffc6c4b9eea24 @tmat tmat committed Jul 1, 2012
Showing with 73,232 additions and 324 deletions.
  1. +36 −2 .gitignore
  2. +1 −1 Languages/IronPython/IronPython/Compiler/Ast/AstMethods.cs
  3. +1 −1 Languages/IronPython/IronPython/Runtime/FunctionCode.cs
  4. +2 −2 Languages/IronPython/IronPython/Runtime/PythonDynamicStackFrame.cs
  5. +44 −44 Languages/IronPython/IronPython/Runtime/Types/NewTypeMaker.cs
  6. +1 −1 Languages/IronPython/IronPython/Runtime/Types/PythonType.cs
  7. +38 −0 Languages/Ruby/IronRuby.Tests/DLR/ReflectionUtilsTests.cs
  8. +2 −0 Languages/Ruby/IronRuby.Tests/RubyTests.cs
  9. +2 −1 Languages/Ruby/IronRuby.Tests/Runtime/ClrTests.cs
  10. +2 −2 Languages/Ruby/Libraries/Builtins/ExceptionOps.cs
  11. +1 −1 Languages/Ruby/Libraries/Builtins/IoOps.cs
  12. +1 −1 Languages/Ruby/Ruby/Builtins/RubyClass.cs
  13. +2 −2 Languages/Ruby/Ruby/Compiler/Ast/AstFactory.cs
  14. +6 −6 Languages/Ruby/Ruby/Runtime/Calls/LibraryOverloadInfo.cs
  15. +1 −1 Languages/Ruby/Ruby/Runtime/Calls/RubyCustomMethodInfo.cs
  16. +1 −1 Languages/Ruby/Ruby/Runtime/Calls/RubyLambdaMethodInfo.cs
  17. +1 −1 Languages/Ruby/Ruby/Runtime/Calls/RubyMethodInfo.cs
  18. +2 −2 Languages/Ruby/Ruby/Runtime/RubyContext.cs
  19. +3 −3 Msi/{ → Ruby}/Installer.proj
  20. +1 −1 Runtime/Microsoft.Dynamic/Actions/ActionBinder.cs
  21. +1 −1 Runtime/Microsoft.Dynamic/Actions/Calls/ParamsDictArgBuilder.cs
  22. +1 −1 Runtime/Microsoft.Dynamic/Actions/Calls/ReferenceArgBuilder.cs
  23. +4 −4 Runtime/Microsoft.Dynamic/Actions/NamespaceTracker.cs
  24. +1 −1 Runtime/Microsoft.Dynamic/Actions/TypeGroup.cs
  25. +14 −0 Runtime/Microsoft.Dynamic/Actions/TypeTracker.cs
  26. +12 −12 Runtime/Microsoft.Dynamic/Ast/ConstantExpression.cs
  27. +2 −2 Runtime/Microsoft.Dynamic/Ast/LightExceptionRewriter.cs
  28. +1 −1 Runtime/Microsoft.Dynamic/Ast/LightThrowExpression.cs
  29. +2 −0 Runtime/Microsoft.Dynamic/Generation/CompilerHelpers.cs
  30. +2 −0 Runtime/Microsoft.Dynamic/Generation/DynamicILGen.cs
  31. +3 −0 Runtime/Microsoft.Dynamic/Generation/ILGen.cs
  32. +5 −0 Runtime/Microsoft.Dynamic/Generation/Snippets.cs
  33. +40 −40 Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.Generated.cs
  34. +3 −3 Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.cs
  35. +5 −1 Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs
  36. +1 −1 Runtime/Microsoft.Dynamic/Interpreter/LightLambda.cs
  37. +1 −1 Runtime/Microsoft.Dynamic/Runtime/ArgumentArray.cs
  38. +230 −71 Runtime/Microsoft.Dynamic/Runtime/DelegateInfo.cs
  39. +23 −20 Runtime/Microsoft.Dynamic/Runtime/DelegateSignatureInfo.cs
  40. +45 −20 Runtime/Microsoft.Dynamic/Runtime/DynamicDelegateCreator.cs
  41. +1 −1 Runtime/Microsoft.Dynamic/Runtime/LightExceptions.cs
  42. +29 −21 Runtime/Microsoft.Dynamic/Runtime/ReflectionCache.cs
  43. +3 −1 Runtime/Microsoft.Dynamic/Runtime/ReturnFixer.cs
  44. +57 −27 Runtime/Microsoft.Dynamic/Utils/ReflectionUtils.cs
  45. +1 −1 Runtime/Microsoft.Scripting/Runtime/DynamicOperations.Generated.cs
  46. +1 −9 Runtime/Microsoft.Scripting/Utils/ReflectionUtils.cs
  47. +1 −5 Solutions/Build.IronRuby.proj
  48. +7 −7 Solutions/Common.proj
  49. BIN Util/References/Win8/Microsoft.CSharp.dll
  50. +192 −0 Util/References/Win8/Microsoft.CSharp.xml
  51. BIN Util/References/Win8/Microsoft.VisualBasic.dll
  52. +969 −0 Util/References/Win8/Microsoft.VisualBasic.xml
  53. BIN Util/References/Win8/System.Collections.Concurrent.dll
  54. +1,126 −0 Util/References/Win8/System.Collections.Concurrent.xml
  55. BIN Util/References/Win8/System.Collections.dll
  56. +2,517 −0 Util/References/Win8/System.Collections.xml
  57. BIN Util/References/Win8/System.ComponentModel.Annotations.dll
  58. +739 −0 Util/References/Win8/System.ComponentModel.Annotations.xml
  59. BIN Util/References/Win8/System.ComponentModel.DataAnnotations.dll
  60. BIN Util/References/Win8/System.ComponentModel.EventBasedAsync.dll
  61. +64 −0 Util/References/Win8/System.ComponentModel.EventBasedAsync.xml
  62. BIN Util/References/Win8/System.ComponentModel.dll
  63. +50 −0 Util/References/Win8/System.ComponentModel.xml
  64. BIN Util/References/Win8/System.Core.dll
  65. BIN Util/References/Win8/System.Diagnostics.Contracts.dll
  66. +335 −0 Util/References/Win8/System.Diagnostics.Contracts.xml
  67. BIN Util/References/Win8/System.Diagnostics.Debug.dll
  68. +211 −0 Util/References/Win8/System.Diagnostics.Debug.xml
  69. BIN Util/References/Win8/System.Diagnostics.Tools.dll
  70. +56 −0 Util/References/Win8/System.Diagnostics.Tools.xml
  71. BIN Util/References/Win8/System.Diagnostics.Tracing.dll
  72. +467 −0 Util/References/Win8/System.Diagnostics.Tracing.xml
  73. BIN Util/References/Win8/System.Dynamic.Runtime.dll
  74. +1,142 −0 Util/References/Win8/System.Dynamic.Runtime.xml
  75. BIN Util/References/Win8/System.Globalization.dll
  76. +1,650 −0 Util/References/Win8/System.Globalization.xml
  77. BIN Util/References/Win8/System.IO.Compression.dll
  78. +433 −0 Util/References/Win8/System.IO.Compression.xml
  79. BIN Util/References/Win8/System.IO.dll
  80. +2,105 −0 Util/References/Win8/System.IO.xml
  81. BIN Util/References/Win8/System.Linq.Expressions.dll
  82. +3,928 −0 Util/References/Win8/System.Linq.Expressions.xml
  83. BIN Util/References/Win8/System.Linq.Parallel.dll
  84. +2,457 −0 Util/References/Win8/System.Linq.Parallel.xml
  85. BIN Util/References/Win8/System.Linq.Queryable.dll
  86. +1,282 −0 Util/References/Win8/System.Linq.Queryable.xml
  87. BIN Util/References/Win8/System.Linq.dll
  88. +1,763 −0 Util/References/Win8/System.Linq.xml
  89. BIN Util/References/Win8/System.Net.Http.Rtc.dll
  90. +17 −0 Util/References/Win8/System.Net.Http.Rtc.xml
  91. BIN Util/References/Win8/System.Net.Http.dll
  92. +1,853 −0 Util/References/Win8/System.Net.Http.xml
  93. BIN Util/References/Win8/System.Net.NetworkInformation.dll
  94. +28 −0 Util/References/Win8/System.Net.NetworkInformation.xml
  95. BIN Util/References/Win8/System.Net.Primitives.dll
  96. +589 −0 Util/References/Win8/System.Net.Primitives.xml
  97. BIN Util/References/Win8/System.Net.Requests.dll
  98. +648 −0 Util/References/Win8/System.Net.Requests.xml
  99. BIN Util/References/Win8/System.Net.dll
  100. BIN Util/References/Win8/System.Numerics.dll
  101. BIN Util/References/Win8/System.ObjectModel.dll
  102. +713 −0 Util/References/Win8/System.ObjectModel.xml
  103. BIN Util/References/Win8/System.Reflection.Context.dll
  104. +56 −0 Util/References/Win8/System.Reflection.Context.xml
  105. BIN Util/References/Win8/System.Reflection.Extensions.dll
  106. +260 −0 Util/References/Win8/System.Reflection.Extensions.xml
  107. BIN Util/References/Win8/System.Reflection.Primitives.dll
  108. +1,380 −0 Util/References/Win8/System.Reflection.Primitives.xml
  109. BIN Util/References/Win8/System.Reflection.dll
  110. +1,093 −0 Util/References/Win8/System.Reflection.xml
  111. BIN Util/References/Win8/System.Resources.ResourceManager.dll
  112. +78 −0 Util/References/Win8/System.Resources.ResourceManager.xml
  113. BIN Util/References/Win8/System.Runtime.Extensions.dll
  114. +3,396 −0 Util/References/Win8/System.Runtime.Extensions.xml
  115. BIN Util/References/Win8/System.Runtime.InteropServices.WindowsRuntime.dll
  116. +167 −0 Util/References/Win8/System.Runtime.InteropServices.WindowsRuntime.xml
  117. BIN Util/References/Win8/System.Runtime.InteropServices.dll
  118. +4,405 −0 Util/References/Win8/System.Runtime.InteropServices.xml
  119. BIN Util/References/Win8/System.Runtime.Numerics.dll
  120. +1,029 −0 Util/References/Win8/System.Runtime.Numerics.xml
  121. BIN Util/References/Win8/System.Runtime.Serialization.Json.dll
  122. +128 −0 Util/References/Win8/System.Runtime.Serialization.Json.xml
  123. BIN Util/References/Win8/System.Runtime.Serialization.Primitives.dll
  124. +180 −0 Util/References/Win8/System.Runtime.Serialization.Primitives.xml
  125. BIN Util/References/Win8/System.Runtime.Serialization.Xml.dll
  126. +2,021 −0 Util/References/Win8/System.Runtime.Serialization.Xml.xml
  127. BIN Util/References/Win8/System.Runtime.Serialization.dll
  128. BIN Util/References/Win8/System.Runtime.WindowsRuntime.UI.Xaml.dll
  129. +844 −0 Util/References/Win8/System.Runtime.WindowsRuntime.UI.Xaml.xml
  130. BIN Util/References/Win8/System.Runtime.WindowsRuntime.dll
  131. +476 −0 Util/References/Win8/System.Runtime.WindowsRuntime.xml
  132. BIN Util/References/Win8/System.Runtime.dll
  133. +13,286 −0 Util/References/Win8/System.Runtime.xml
  134. BIN Util/References/Win8/System.Security.Principal.dll
  135. +54 −0 Util/References/Win8/System.Security.Principal.xml
  136. BIN Util/References/Win8/System.ServiceModel.Duplex.dll
  137. +184 −0 Util/References/Win8/System.ServiceModel.Duplex.xml
  138. BIN Util/References/Win8/System.ServiceModel.Http.dll
  139. +419 −0 Util/References/Win8/System.ServiceModel.Http.xml
  140. BIN Util/References/Win8/System.ServiceModel.NetTcp.dll
  141. +270 −0 Util/References/Win8/System.ServiceModel.NetTcp.xml
  142. BIN Util/References/Win8/System.ServiceModel.Primitives.dll
  143. +4,968 −0 Util/References/Win8/System.ServiceModel.Primitives.xml
  144. BIN Util/References/Win8/System.ServiceModel.Security.dll
  145. +317 −0 Util/References/Win8/System.ServiceModel.Security.xml
  146. BIN Util/References/Win8/System.ServiceModel.Web.dll
  147. BIN Util/References/Win8/System.ServiceModel.dll
  148. BIN Util/References/Win8/System.Text.Encoding.Extensions.dll
  149. +444 −0 Util/References/Win8/System.Text.Encoding.Extensions.xml
  150. BIN Util/References/Win8/System.Text.Encoding.dll
  151. +658 −0 Util/References/Win8/System.Text.Encoding.xml
  152. BIN Util/References/Win8/System.Text.RegularExpressions.dll
  153. +834 −0 Util/References/Win8/System.Text.RegularExpressions.xml
  154. BIN Util/References/Win8/System.Threading.Tasks.Parallel.dll
  155. +461 −0 Util/References/Win8/System.Threading.Tasks.Parallel.xml
  156. BIN Util/References/Win8/System.Threading.Tasks.dll
  157. +3,117 −0 Util/References/Win8/System.Threading.Tasks.xml
  158. BIN Util/References/Win8/System.Threading.dll
  159. +1,789 −0 Util/References/Win8/System.Threading.xml
  160. BIN Util/References/Win8/System.Windows.dll
  161. BIN Util/References/Win8/System.Xml.Linq.dll
  162. BIN Util/References/Win8/System.Xml.ReaderWriter.dll
  163. +2,537 −0 Util/References/Win8/System.Xml.ReaderWriter.xml
  164. BIN Util/References/Win8/System.Xml.Serialization.dll
  165. BIN Util/References/Win8/System.Xml.XDocument.dll
  166. +1,658 −0 Util/References/Win8/System.Xml.XDocument.xml
  167. BIN Util/References/Win8/System.Xml.XmlSerializer.dll
  168. +745 −0 Util/References/Win8/System.Xml.XmlSerializer.xml
  169. BIN Util/References/Win8/System.Xml.dll
  170. BIN Util/References/Win8/System.dll
  171. BIN Util/References/Win8/mscorlib.dll
View
@@ -21,5 +21,39 @@ TestResult.xml
Solutions/TestResults/
Runtime/Samples/Hosting/Scenarios/bin/
-# TODO - testing scripts should not created this file here
-debug.log
+# TODO - testing scripts should not create these files
+debug.log
+External.LCA_RESTRICTED/Languages/IronPython/27/Lib/@test_2000_tmp1
+External.LCA_RESTRICTED/Languages/IronPython/27/Lib/@test_2000_tmp2
+External.LCA_RESTRICTED/Languages/IronPython/27/Lib/@test_2928_tmp/
+External.LCA_RESTRICTED/Languages/IronPython/27/Lib/@test_4044_tmp
+External.LCA_RESTRICTED/Languages/IronPython/27/Lib/@test_4500_tmp
+External.LCA_RESTRICTED/Languages/IronPython/27/Lib/@test_4500_tmp.1341096880.IOCASTE.4500
+External.LCA_RESTRICTED/Languages/IronPython/27/Lib/@test_4500_tmp.lock
+External.LCA_RESTRICTED/Languages/IronPython/27/Lib/@test_5992_tmp
+External.LCA_RESTRICTED/Languages/IronPython/27/Lib/@test_7680_tmp.dir
+External.LCA_RESTRICTED/Languages/IronPython/27/Lib/lib2to3/Grammar2.9.9.alpha.0.pickle
+External.LCA_RESTRICTED/Languages/IronPython/27/Lib/lib2to3/PatternGrammar2.9.9.alpha.0.pickle
+Languages/IronPython/Tests/ImportTestDir/
+Languages/IronPython/Tests/InheritanceTypes.dll
+Languages/IronPython/Tests/OutterDir/
+Languages/IronPython/Tests/another.py
+Languages/IronPython/Tests/cached_type_dll.dll
+Languages/IronPython/Tests/cp7007/
+Languages/IronPython/Tests/finaltest.dll
+Languages/IronPython/Tests/foo
+Languages/IronPython/Tests/imfpstart.tpy
+Languages/IronPython/Tests/impcp13736.py
+Languages/IronPython/Tests/impmodfrmpkg/
+Languages/IronPython/Tests/onlyread.tmp
+Languages/IronPython/Tests/onlywrite.tmp
+Languages/IronPython/Tests/tempFile1.tpy
+Languages/IronPython/Tests/temp_syspath_none.py
+Languages/IronPython/Tests/test.dll
+Languages/IronPython/Tests/test.pyil
+Languages/IronPython/Tests/test.xaml
+Languages/IronPython/Tests/testfile.tmp
+Languages/IronPython/Tests/testilcode.dll
+Languages/IronPython/Tests/the_dir/
+Languages/IronPython/Tests/vbproptest0.159422.dll
+Languages/IronPython/Tests/vbproptest0.999147.dll
@@ -103,7 +103,7 @@ static class AstMethods {
public static readonly MethodInfo GeneratorCheckThrowableAndReturnSendValue = GetMethod((Func<object, object>)PythonOps.GeneratorCheckThrowableAndReturnSendValue);
private static MethodInfo GetMethod(Delegate x) {
- return x.GetMethod();
+ return x.GetMethodInfo();
}
}
}
@@ -579,7 +579,7 @@ public class FunctionCode : IExpressionSerializable {
throw PythonOps.TypeError("cannot exec code object that contains free variables: {0}", co_freevars.__repr__(context));
}
- if (Target == null || (Target.GetMethod() != null && Target.GetMethod().DeclaringType == typeof(PythonCallTargets))) {
+ if (Target == null || (Target.GetMethodInfo() != null && Target.GetMethodInfo().DeclaringType == typeof(PythonCallTargets))) {
UpdateDelegate(context.LanguageContext, true);
}
@@ -45,9 +45,9 @@ public PythonDynamicStackFrame(CodeContext/*!*/ context, FunctionCode/*!*/ funcC
MethodBase method;
Debug.Assert(funcCode._normalDelegate != null || funcCode._tracingDelegate != null);
if (!context.LanguageContext.EnableTracing || funcCode._tracingDelegate == null) {
- method = funcCode._normalDelegate.GetMethod();
+ method = funcCode._normalDelegate.GetMethodInfo();
} else {
- method = funcCode._tracingDelegate.GetMethod();
+ method = funcCode._tracingDelegate.GetMethodInfo();
}
return method;
}
@@ -1546,6 +1546,50 @@ sealed class NewTypeMaker {
}
return sig;
}
+
+ /// <summary>
+ /// Same as the DLR ReturnFixer, but accepts lower level constructs,
+ /// such as LocalBuilder, ParameterInfos and ILGen.
+ /// </summary>
+ private sealed class ReturnFixer {
+ private readonly ParameterInfo _parameter;
+ private readonly LocalBuilder _reference;
+ private readonly int _index;
+
+ private ReturnFixer(LocalBuilder reference, ParameterInfo parameter, int index) {
+ Debug.Assert(reference.LocalType.IsGenericType() && reference.LocalType.GetGenericTypeDefinition() == typeof(StrongBox<>));
+ Debug.Assert(parameter.ParameterType.IsByRef);
+
+ _parameter = parameter;
+ _reference = reference;
+ _index = index;
+ }
+
+ public void FixReturn(ILGen il) {
+ il.EmitLoadArg(_index);
+ il.Emit(OpCodes.Ldloc, _reference);
+ il.EmitFieldGet(_reference.LocalType.GetDeclaredField("Value"));
+ il.EmitStoreValueIndirect(_parameter.ParameterType.GetElementType());
+ }
+
+ public static ReturnFixer EmitArgument(ILGen il, ParameterInfo parameter, int index) {
+ il.EmitLoadArg(index);
+ if (parameter.ParameterType.IsByRef) {
+ Type elementType = parameter.ParameterType.GetElementType();
+ Type concreteType = typeof(StrongBox<>).MakeGenericType(elementType);
+ LocalBuilder refSlot = il.DeclareLocal(concreteType);
+ il.EmitLoadValueIndirect(elementType);
+ ConstructorInfo ci = concreteType.GetConstructor(new Type[] { elementType });
+ il.Emit(OpCodes.Newobj, ci);
+ il.Emit(OpCodes.Stloc, refSlot);
+ il.Emit(OpCodes.Ldloc, refSlot);
+ return new ReturnFixer(refSlot, parameter, index);
+ } else {
+ il.EmitBoxing(parameter.ParameterType);
+ return null;
+ }
+ }
+ }
#endif
#endregion
@@ -1789,48 +1833,4 @@ sealed class NewTypeMaker {
#endregion
}
-
- /// <summary>
- /// Same as the DLR ReturnFixer, but accepts lower level constructs,
- /// such as LocalBuilder, ParameterInfos and ILGen.
- /// </summary>
- sealed class ReturnFixer {
- private readonly ParameterInfo _parameter;
- private readonly LocalBuilder _reference;
- private readonly int _index;
-
- private ReturnFixer(LocalBuilder reference, ParameterInfo parameter, int index) {
- Debug.Assert(reference.LocalType.IsGenericType() && reference.LocalType.GetGenericTypeDefinition() == typeof(StrongBox<>));
- Debug.Assert(parameter.ParameterType.IsByRef);
-
- _parameter = parameter;
- _reference = reference;
- _index = index;
- }
-
- public void FixReturn(ILGen il) {
- il.EmitLoadArg(_index);
- il.Emit(OpCodes.Ldloc, _reference);
- il.EmitFieldGet(_reference.LocalType.GetDeclaredField("Value"));
- il.EmitStoreValueIndirect(_parameter.ParameterType.GetElementType());
- }
-
- public static ReturnFixer EmitArgument(ILGen il, ParameterInfo parameter, int index) {
- il.EmitLoadArg(index);
- if (parameter.ParameterType.IsByRef) {
- Type elementType = parameter.ParameterType.GetElementType();
- Type concreteType = typeof(StrongBox<>).MakeGenericType(elementType);
- LocalBuilder refSlot = il.DeclareLocal(concreteType);
- il.EmitLoadValueIndirect(elementType);
- ConstructorInfo ci = concreteType.GetConstructor(new Type[] { elementType });
- il.Emit(OpCodes.Newobj, ci);
- il.Emit(OpCodes.Stloc, refSlot);
- il.Emit(OpCodes.Ldloc, refSlot);
- return new ReturnFixer(refSlot, parameter, index);
- } else {
- il.EmitBoxing(parameter.ParameterType);
- return null;
- }
- }
- }
}
@@ -784,7 +784,7 @@ internal PythonType(PythonContext context, PythonType[] baseTypes, Type underlyi
}
public static implicit operator TypeTracker(PythonType self) {
- return ReflectionCache.GetTypeTracker(self.UnderlyingSystemType);
+ return TypeTracker.GetTypeTracker(self.UnderlyingSystemType);
}
#endregion
@@ -17,6 +17,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
+using Microsoft.Scripting.Runtime;
using Microsoft.Scripting.Utils;
namespace IronRuby.Tests {
@@ -302,5 +303,42 @@ public abstract class GetMembers<T> where T : GetMembers_A {
var gp_actual = gp.GetInheritedMembers();
AreSetsEqual(gp_actual.Select(m => m.ToString()), gp_expected.Select(m => m.ToString()));
}
+
+ public delegate int FRefIntIntOutInt(ref int a, int b, out int c);
+
+ public delegate int FIntIntInt(int a, int b);
+
+ public void DelegateInfo1() {
+ object lambda = Engine.Execute("lambda { |a,b| a + b }");
+
+ var creator = new DynamicDelegateCreator(Context);
+ var d1a = (Func<int, int, int>)creator.GetDelegate(lambda, typeof(Func<int, int, int>));
+ var d1b = (Func<int, int, int>)creator.GetDelegate(lambda, typeof(Func<int, int, int>));
+ var d2 = (FIntIntInt)creator.GetDelegate(lambda, typeof(FIntIntInt));
+ Assert(d1a == d1b);
+
+ int r1 = d1a(1, 2);
+ int r2 = d2(10, 20);
+
+ Assert(r1 == 3);
+ Assert(r2 == 30);
+ }
+
+ public void DelegateInfo2() {
+ object lambda = Engine.Execute("lambda { |a,b,c| r = a.value + b; a.value = 1; c.value = 10; r }");
+
+ var creator = new DynamicDelegateCreator(Context);
+ var da = (FRefIntIntOutInt)creator.GetDelegate(lambda, typeof(FRefIntIntOutInt));
+ var db = (FRefIntIntOutInt)creator.GetDelegate(lambda, typeof(FRefIntIntOutInt));
+ Assert(da == db);
+
+ int a = 2;
+ int c = 3;
+ int r = da(ref a, 3, out c);
+
+ Assert(r == 5);
+ Assert(a == 1);
+ Assert(c == 10);
+ }
}
}
@@ -62,6 +62,8 @@ public partial class Tests {
TypeMemberCache,
ReflectionUtils_GetMembers,
+ DelegateInfo1,
+ DelegateInfo2,
Scenario_ParserLogging,
Parser1,
@@ -28,6 +28,7 @@
using Microsoft.Scripting.Math;
using Microsoft.Scripting.Runtime;
using Microsoft.Scripting.Utils;
+using Microsoft.Scripting.Actions;
#if !CLR2
using BigInt = System.Numerics.BigInteger;
@@ -1780,7 +1781,7 @@ p Inst.clr_member(InterfaceFoo2, :[]).call(1)
/// </summary>
public void ClrTypes1() {
TestTypeAndTracker(typeof(ClassWithMethods1));
- TestTypeAndTracker(ReflectionCache.GetTypeTracker(typeof(ClassWithMethods1)));
+ TestTypeAndTracker(TypeTracker.GetTypeTracker(typeof(ClassWithMethods1)));
}
public void TestTypeAndTracker(object type) {
@@ -140,13 +140,13 @@ public static class ExceptionOps {
// RubyOps.MarkException(new <exception-type>(GetClrMessage(<class>, #message = <message>)))
if (cls.BuildAllocatorCall(metaBuilder, args, () =>
- Ast.Call(null, new Func<RubyClass, object, string>(GetClrMessage).GetMethod(),
+ Ast.Call(null, new Func<RubyClass, object, string>(GetClrMessage).GetMethodInfo(),
classExpression,
Ast.Assign(messageVariable = metaBuilder.GetTemporary(typeof(object), "#message"), AstUtils.Box(argsBuilder[0]))
)
)) {
// ReinitializeException(<result>, #message)
- metaBuilder.Result = Ast.Call(null, new Func<RubyContext, Exception, object, Exception>(ReinitializeException).GetMethod(),
+ metaBuilder.Result = Ast.Call(null, new Func<RubyContext, Exception, object, Exception>(ReinitializeException).GetMethodInfo(),
AstUtils.Convert(args.MetaContext.Expression, typeof(RubyContext)),
metaBuilder.Result,
messageVariable ?? AstUtils.Box(argsBuilder[0])
@@ -250,7 +250,7 @@ public static class WaitWritable {
metaBuilder.BfcVariable = metaBuilder.GetTemporary(typeof(BlockParam), "#bfc");
}
- metaBuilder.Result = Ast.Call(new Func<UnaryOpStorage, BlockParam, object, object>(InvokeOpenBlock).GetMethod(),
+ metaBuilder.Result = Ast.Call(new Func<UnaryOpStorage, BlockParam, object, object>(InvokeOpenBlock).GetMethodInfo(),
Ast.Constant(new UnaryOpStorage(args.RubyContext)),
metaBuilder.BfcVariable,
metaBuilder.Result
@@ -1401,7 +1401,7 @@ private sealed class ClrOverloadInfo {
} else if (_structInfo != null) {
constructionOverloads = new OverloadInfo[] { new ReflectionOverloadInfo(Methods.CreateStructInstance) };
} else if (_factories.Length != 0) {
- constructionOverloads = ArrayUtils.ConvertAll(_factories, (d) => new ReflectionOverloadInfo(d.GetMethod()));
+ constructionOverloads = ArrayUtils.ConvertAll(_factories, (d) => new ReflectionOverloadInfo(d.GetMethodInfo()));
} else {
// TODO: handle protected constructors
constructionOverloads = GetConstructors(type == typeof(object) ? typeof(RubyObject) : type).ToArray();
@@ -105,7 +105,7 @@ public static class AstFactory {
}
internal static MSA.Expression/*!*/ CallDelegate(Delegate/*!*/ method, MSA.Expression[]/*!*/ arguments) {
- MethodInfo methodInfo = method.GetMethod();
+ MethodInfo methodInfo = method.GetMethodInfo();
// We prefer to peek inside the delegate and call the target method directly. However, we need to
// exclude DynamicMethods since Delegate.Method returns a dummy MethodInfo, and we cannot emit a call to it.
@@ -117,7 +117,7 @@ public static class AstFactory {
if (method.Target != null) {
// inline a closed static delegate:
if (methodInfo.IsStatic) {
- return Ast.Call(null, method.GetMethod(), ArrayUtils.Insert(AstUtils.Constant(method.Target), arguments));
+ return Ast.Call(null, method.GetMethodInfo(), ArrayUtils.Insert(AstUtils.Constant(method.Target), arguments));
}
// inline a closed instance delegate:
@@ -99,23 +99,23 @@ public abstract class LibraryOverload : OverloadInfo {
}
internal static LibraryOverload/*!*/ Reflect(Delegate/*!*/ overloadDelegate) {
- return Create(overloadDelegate, EncodeCustomAttributes(overloadDelegate.GetMethod()));
+ return Create(overloadDelegate, EncodeCustomAttributes(overloadDelegate.GetMethodInfo()));
}
public override MethodBase ReflectionInfo {
- get { return _delegate.GetMethod(); }
+ get { return _delegate.GetMethodInfo(); }
}
public override Type ReturnType {
- get { return _delegate.GetMethod().ReturnType; }
+ get { return _delegate.GetMethodInfo().ReturnType; }
}
public override ParameterInfo/*!*/ ReturnParameter {
- get { return _delegate.GetMethod().ReturnParameter; }
+ get { return _delegate.GetMethodInfo().ReturnParameter; }
}
public override Type/*!*/ DeclaringType {
- get { return _delegate.GetMethod().DeclaringType; }
+ get { return _delegate.GetMethodInfo().DeclaringType; }
}
// name is irrelevant for library methods
@@ -124,7 +124,7 @@ public abstract class LibraryOverload : OverloadInfo {
}
public override IList<ParameterInfo>/*!*/ Parameters {
- get { return _parameters ?? (_parameters = new ReadOnlyCollection<ParameterInfo>(_delegate.GetMethod().GetParameters())); }
+ get { return _parameters ?? (_parameters = new ReadOnlyCollection<ParameterInfo>(_delegate.GetMethodInfo().GetParameters())); }
}
public override bool IsParamArray(int parameterIndex) {
@@ -40,7 +40,7 @@ public RubyCustomMethodInfo(RuleGenerator/*!*/ ruleGenerator, RubyMemberFlags fl
}
public override MemberInfo/*!*/[]/*!*/ GetMembers() {
- return new MemberInfo[] { _ruleGenerator.GetMethod() };
+ return new MemberInfo[] { _ruleGenerator.GetMethodInfo() };
}
public override RubyMemberInfo TrySelectOverload(Type/*!*/[]/*!*/ parameterTypes) {
@@ -65,7 +65,7 @@ internal RubyLambdaMethodInfo(Proc/*!*/ block, string/*!*/ definitionName, RubyM
}
public override MemberInfo/*!*/[]/*!*/ GetMembers() {
- return new MemberInfo[] { _lambda.Dispatcher.Method.GetMethod() };
+ return new MemberInfo[] { _lambda.Dispatcher.Method.GetMethodInfo() };
}
protected internal override RubyMemberInfo/*!*/ Copy(RubyMemberFlags flags, RubyModule/*!*/ module) {
@@ -67,7 +67,7 @@ internal RubyMethodInfo(RubyMethodBody/*!*/ body, RubyScope/*!*/ declaringScope,
}
public override MemberInfo/*!*/[]/*!*/ GetMembers() {
- return new MemberInfo[] { GetDelegate().GetMethod() };
+ return new MemberInfo[] { GetDelegate().GetMethodInfo() };
}
public override int GetArity() {
@@ -716,7 +716,7 @@ public RubyContext(ScriptDomainManager/*!*/ manager, IDictionary<string, object>
//
// only Object should expose CLR methods:
- TypeTracker objectTracker = ReflectionCache.GetTypeTracker(typeof(object));
+ TypeTracker objectTracker = TypeTracker.GetTypeTracker(typeof(object));
var moduleFactories = new Delegate[] {
new Func<RubyScope, BlockParam, RubyClass, object>(RubyModule.CreateAnonymousModule),
@@ -1366,7 +1366,7 @@ public RubyContext(ScriptDomainManager/*!*/ manager, IDictionary<string, object>
}
private static TypeTracker GetLibraryModuleTypeTracker(Type/*!*/ type, ModuleRestrictions restrictions) {
- return (restrictions & ModuleRestrictions.NoUnderlyingType) != 0 ? null : ReflectionCache.GetTypeTracker(type);
+ return (restrictions & ModuleRestrictions.NoUnderlyingType) != 0 ? null : TypeTracker.GetTypeTracker(type);
}
#endregion
Oops, something went wrong.

0 comments on commit 19afcac

Please sign in to comment.