diff options
author | Marek Safar <marek.safar@gmail.com> | 2014-01-10 13:45:51 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2014-01-10 13:46:45 +0400 |
commit | 9939588f48b82efec57e1445ae41239bdd3db9fc (patch) | |
tree | 5ba838cf885bc2070bccca961034a46d47201628 /mcs | |
parent | e7c6b18e4e9c7a04ae890e0b8cc0eb71fc67219e (diff) |
[System.Core] Update MonoTouch System.Linq.Expression to be 4.5 compatible
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/Facades/System.Dynamic.Runtime/TypeForwarders.cs | 4 | ||||
-rw-r--r-- | mcs/class/Facades/System.Linq.Expressions/TypeForwarders.cs | 2 | ||||
-rw-r--r-- | mcs/class/Makefile | 8 | ||||
-rw-r--r-- | mcs/class/System.Core/Makefile | 23 | ||||
-rw-r--r-- | mcs/class/System.Core/System.Linq.jvm/ChangeLog | 9 | ||||
-rw-r--r-- | mcs/class/System.Core/System.Linq.jvm/Conversion.cs | 463 | ||||
-rw-r--r-- | mcs/class/System.Core/System.Linq.jvm/ExpressionInterpreter.cs | 937 | ||||
-rw-r--r-- | mcs/class/System.Core/System.Linq.jvm/Math.cs | 695 | ||||
-rw-r--r-- | mcs/class/System.Core/System.Linq.jvm/Runner.cs | 227 | ||||
-rw-r--r-- | mcs/class/System.Core/dynamic_System.Core.dll.sources | 8 | ||||
-rw-r--r-- | mcs/class/System.Core/mobile_System.Core.dll.sources | 7 | ||||
-rw-r--r-- | mcs/class/System.Core/mobile_static_System.Core.dll.sources | 7 | ||||
-rw-r--r-- | mcs/class/System.Core/monotouch_System.Core.dll.sources | 6 | ||||
-rw-r--r-- | mcs/class/System.Core/net_4_0_System.Core.dll.sources | 121 | ||||
-rw-r--r-- | mcs/class/System.Core/static_System.Core.dll.sources | 28 |
15 files changed, 39 insertions, 2506 deletions
diff --git a/mcs/class/Facades/System.Dynamic.Runtime/TypeForwarders.cs b/mcs/class/Facades/System.Dynamic.Runtime/TypeForwarders.cs index ff800e52ef4..52c90435119 100644 --- a/mcs/class/Facades/System.Dynamic.Runtime/TypeForwarders.cs +++ b/mcs/class/Facades/System.Dynamic.Runtime/TypeForwarders.cs @@ -19,7 +19,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // -#if !FULL_AOT_RUNTIME + [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.BinaryOperationBinder))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.BindingRestrictions))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.CallInfo))] @@ -46,6 +46,4 @@ [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallSiteBinder))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallSiteHelpers))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.DynamicAttribute))] -#endif - [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.ConditionalWeakTable<,>))] diff --git a/mcs/class/Facades/System.Linq.Expressions/TypeForwarders.cs b/mcs/class/Facades/System.Linq.Expressions/TypeForwarders.cs index 438486c963f..db18f127821 100644 --- a/mcs/class/Facades/System.Linq.Expressions/TypeForwarders.cs +++ b/mcs/class/Facades/System.Linq.Expressions/TypeForwarders.cs @@ -20,7 +20,6 @@ // THE SOFTWARE. // -#if !FULL_AOT_RUNTIME [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.BlockExpression))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.CatchBlock))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.DebugInfoExpression))] @@ -36,7 +35,6 @@ [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.SwitchExpression))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.SymbolDocumentInfo))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.TryExpression))] -#endif [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.BinaryExpression))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.ConditionalExpression))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.ConstantExpression))] diff --git a/mcs/class/Makefile b/mcs/class/Makefile index 1cdaf5092af..03f7904f684 100644 --- a/mcs/class/Makefile +++ b/mcs/class/Makefile @@ -164,6 +164,10 @@ monodroid_dirs := \ monotouch_runtime_dirs := \ corlib +monotouch_dirs := \ + Mono.Dynamic.Interpreter \ + System.Core + net_4_0_dirs := \ System.Numerics \ Microsoft.CSharp \ @@ -235,7 +239,7 @@ xbuild_4_0_dirs := \ net_2_0_SUBDIRS := $(common_dirs) $(net_2_0_dirs) $(net_2_0_only_dirs) $(xbuild_2_0_dirs) aot-compiler monodroid_SUBDIRS := $(mobile_dirs) $(monodroid_dirs) -monotouch_SUBDIRS := $(mobile_dirs) +monotouch_SUBDIRS := $(mobile_dirs) $(monotouch_dirs) monotouch_runtime_SUBDIRS := $(monotouch_runtime_dirs) mobile_static_SUBDIRS := $(mobile_dirs) mobile_SUBDIRS := $(mobile_dirs) @@ -246,7 +250,7 @@ xbuild_12_SUBDIRS := $(xbuild_4_0_dirs) include ../build/rules.make -SUBDIRS = $(common_dirs) $(net_2_0_dirs) $(net_2_0_only_dirs) $(mobile_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(net_4_5_dirs) +SUBDIRS = $(common_dirs) $(net_2_0_dirs) $(net_2_0_only_dirs) $(mobile_dirs) $(monotouch_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(net_4_5_dirs) DIST_ONLY_SUBDIRS = dlr aot-compiler $(xbuild_dirs) diff --git a/mcs/class/System.Core/Makefile b/mcs/class/System.Core/Makefile index 22252d68b9f..0b433a2b4a6 100644 --- a/mcs/class/System.Core/Makefile +++ b/mcs/class/System.Core/Makefile @@ -6,6 +6,9 @@ LIBRARY = System.Core.dll LIB_MCS_FLAGS = -d:INSIDE_SYSCORE -d:LIBC /r:System.dll -unsafe +INTERPRETER_DEP := Mono.Dynamic.Interpreter.dll +INTERPRETER_DEP_FILE := $(wildcard ../lib/$(PROFILE)/$(INTERPRETER_DEP)) + ifneq (2.1, $(FRAMEWORK_VERSION)) LIB_MCS_FLAGS += -d:NET_3_5 -nowarn:1720 endif @@ -14,6 +17,22 @@ ifeq (monodroid, $(PROFILE)) LIB_MCS_FLAGS += -d:FEATURE_CORE_DLR,FEATURE_REFEMIT,ANDROID endif +ifeq (monotouch, $(PROFILE)) +LIBRARY_USE_INTERMEDIATE_FILE = yes + +CYCLIC_DEPS := $(INTERPRETER_DEP) +CYCLIC_DEP_FILES := $(INTERPRETER_DEP_FILE) +LIB_MCS_FLAGS += -d:FEATURE_CORE_DLR + +ifdef CYCLIC_DEP_FILES +LIB_MCS_FLAGS += -d:MONO_INTERPRETER -r:$(INTERPRETER_DEP) +else +NO_SIGN_ASSEMBLY = yes +NO_INSTALL = yes +endif + +endif + ifeq (4, $(FRAMEWORK_VERSION_MAJOR)) LIB_MCS_FLAGS += -d:FEATURE_CORE_DLR,FEATURE_REFEMIT,FEATURE_PDBEMIT endif @@ -30,3 +49,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) include ../../build/library.make +ifdef CYCLIC_DEP_FILES +$(build_lib): $(INTERPRETER_DEP_FILE) +endif + diff --git a/mcs/class/System.Core/System.Linq.jvm/ChangeLog b/mcs/class/System.Core/System.Linq.jvm/ChangeLog deleted file mode 100644 index 24d4b5a563a..00000000000 --- a/mcs/class/System.Core/System.Linq.jvm/ChangeLog +++ /dev/null @@ -1,9 +0,0 @@ -2008-09-23 Jb Evain <jbevain@novell.com> - - * ExpressionInterpreter.cs - * Interpreter.cs - * Conversion.cs - * ExpressionValidator.cs - * Math.cs: - Integrate changes from db4objects, Inc. The interpreter now - passes all linq tests. diff --git a/mcs/class/System.Core/System.Linq.jvm/Conversion.cs b/mcs/class/System.Core/System.Linq.jvm/Conversion.cs deleted file mode 100644 index a3dc754ba0a..00000000000 --- a/mcs/class/System.Core/System.Linq.jvm/Conversion.cs +++ /dev/null @@ -1,463 +0,0 @@ -// -// Conversion.cs -// -// (C) 2008 Mainsoft, Inc. (http://www.mainsoft.com) -// (C) 2008 db4objects, Inc. (http://www.db4o.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace System.Linq.jvm { - - class Conversion { - - public static object ConvertPrimitiveUnChecked (Type from, Type to, object value) - { - unchecked { - switch (Type.GetTypeCode (from)) { - case TypeCode.Byte: - return ConvertByte ((byte) value, to); - case TypeCode.Char: - return ConvertChar ((char) value, to); - case TypeCode.Decimal: - return ConvertDecimal ((decimal) value, to); - case TypeCode.Double: - return ConvertDouble ((double) value, to); - case TypeCode.Int16: - return ConvertShort ((short) value, to); - case TypeCode.Int32: - return ConvertInt ((int) value, to); - case TypeCode.Int64: - return ConvertLong ((long) value, to); - case TypeCode.SByte: - return ConvertSByte ((sbyte) value, to); - case TypeCode.Single: - return ConvertFloat ((float) value, to); - case TypeCode.UInt16: - return ConvertUShort ((ushort) value, to); - case TypeCode.UInt32: - return ConvertUInt ((uint) value, to); - case TypeCode.UInt64: - return ConvertULong ((ulong) value, to); - default: - throw new NotImplementedException (); - } - } - } - - static object ConvertByte (byte b, Type to) - { - unchecked { - switch (Type.GetTypeCode (to)) { - case TypeCode.Byte: - return (byte) b; - case TypeCode.Char: - return (char) b; - case TypeCode.Decimal: - return (decimal) b; - case TypeCode.Double: - return (double) b; - case TypeCode.Int16: - return (short) b; - case TypeCode.Int32: - return (int) b; - case TypeCode.Int64: - return (long) b; - case TypeCode.SByte: - return (sbyte) b; - case TypeCode.Single: - return (float) b; - case TypeCode.UInt16: - return (ushort) b; - case TypeCode.UInt32: - return (uint) b; - case TypeCode.UInt64: - return (ulong) b; - } - return null; - } - } - - static object ConvertChar (char b, Type to) - { - unchecked { - switch (Type.GetTypeCode (to)) { - case TypeCode.Byte: - return (byte) b; - case TypeCode.Char: - return (char) b; - case TypeCode.Decimal: - return (decimal) b; - case TypeCode.Double: - return (double) b; - case TypeCode.Int16: - return (short) b; - case TypeCode.Int32: - return (int) b; - case TypeCode.Int64: - return (long) b; - case TypeCode.SByte: - return (sbyte) b; - case TypeCode.Single: - return (float) b; - case TypeCode.UInt16: - return (ushort) b; - case TypeCode.UInt32: - return (uint) b; - case TypeCode.UInt64: - return (ulong) b; - } - return null; - } - } - - static object ConvertDecimal (decimal b, Type to) - { - unchecked { - switch (Type.GetTypeCode (to)) { - case TypeCode.Byte: - return (byte) b; - case TypeCode.Char: - return (char) (short) b; - case TypeCode.Decimal: - return (decimal) b; - case TypeCode.Double: - return (double) b; - case TypeCode.Int16: - return (short) b; - case TypeCode.Int32: - return (int) b; - case TypeCode.Int64: - return (long) b; - case TypeCode.SByte: - return (sbyte) b; - case TypeCode.Single: - return (float) b; - case TypeCode.UInt16: - return (ushort) b; - case TypeCode.UInt32: - return (uint) b; - case TypeCode.UInt64: - return (ulong) b; - } - return null; - } - } - - static object ConvertDouble (double b, Type to) - { - unchecked { - switch (Type.GetTypeCode (to)) { - case TypeCode.Byte: - return (byte) b; - case TypeCode.Char: - return (char) b; - case TypeCode.Decimal: - return (decimal) b; - case TypeCode.Double: - return (double) b; - case TypeCode.Int16: - return (short) b; - case TypeCode.Int32: - return (int) b; - case TypeCode.Int64: - return (long) b; - case TypeCode.SByte: - return (sbyte) b; - case TypeCode.Single: - return (float) b; - case TypeCode.UInt16: - return (ushort) b; - case TypeCode.UInt32: - return (uint) b; - case TypeCode.UInt64: - return (ulong) b; - } - return null; - } - } - - static object ConvertShort (short b, Type to) - { - unchecked { - switch (Type.GetTypeCode (to)) { - case TypeCode.Byte: - return (byte) b; - case TypeCode.Char: - return (char) b; - case TypeCode.Decimal: - return (decimal) b; - case TypeCode.Double: - return (double) b; - case TypeCode.Int16: - return (short) b; - case TypeCode.Int32: - return (int) b; - case TypeCode.Int64: - return (long) b; - case TypeCode.SByte: - return (sbyte) b; - case TypeCode.Single: - return (float) b; - case TypeCode.UInt16: - return (ushort) b; - case TypeCode.UInt32: - return (uint) b; - case TypeCode.UInt64: - return (ulong) b; - } - return null; - } - } - - static object ConvertInt (int b, Type to) - { - unchecked { - switch (Type.GetTypeCode (to)) { - case TypeCode.Byte: - return (byte) b; - case TypeCode.Char: - return (char) b; - case TypeCode.Decimal: - return (decimal) b; - case TypeCode.Double: - return (double) b; - case TypeCode.Int16: - return (short) b; - case TypeCode.Int32: - return (int) b; - case TypeCode.Int64: - return (long) b; - case TypeCode.SByte: - return (sbyte) b; - case TypeCode.Single: - return (float) b; - case TypeCode.UInt16: - return (ushort) b; - case TypeCode.UInt32: - return (uint) b; - case TypeCode.UInt64: - return (ulong) b; - } - return null; - } - } - - static object ConvertLong (long b, Type to) - { - unchecked { - switch (Type.GetTypeCode (to)) { - case TypeCode.Byte: - return (byte) b; - case TypeCode.Char: - return (char) b; - case TypeCode.Decimal: - return (decimal) b; - case TypeCode.Double: - return (double) b; - case TypeCode.Int16: - return (short) b; - case TypeCode.Int32: - return (int) b; - case TypeCode.Int64: - return (long) b; - case TypeCode.SByte: - return (sbyte) b; - case TypeCode.Single: - return (float) b; - case TypeCode.UInt16: - return (ushort) b; - case TypeCode.UInt32: - return (uint) b; - case TypeCode.UInt64: - return (ulong) b; - } - return null; - } - } - - static object ConvertSByte (sbyte b, Type to) - { - unchecked { - switch (Type.GetTypeCode (to)) { - case TypeCode.Byte: - return (byte) b; - case TypeCode.Char: - return (char) b; - case TypeCode.Decimal: - return (decimal) b; - case TypeCode.Double: - return (double) b; - case TypeCode.Int16: - return (short) b; - case TypeCode.Int32: - return (int) b; - case TypeCode.Int64: - return (long) b; - case TypeCode.SByte: - return (sbyte) b; - case TypeCode.Single: - return (float) b; - case TypeCode.UInt16: - return (ushort) b; - case TypeCode.UInt32: - return (uint) b; - case TypeCode.UInt64: - return (ulong) b; - } - return null; - } - } - - static object ConvertFloat (float b, Type to) - { - unchecked { - switch (Type.GetTypeCode (to)) { - case TypeCode.Byte: - return (byte) b; - case TypeCode.Char: - return (char) b; - case TypeCode.Decimal: - return (decimal) b; - case TypeCode.Double: - return (double) b; - case TypeCode.Int16: - return (short) b; - case TypeCode.Int32: - return (int) b; - case TypeCode.Int64: - return (long) b; - case TypeCode.SByte: - return (sbyte) b; - case TypeCode.Single: - return (float) b; - case TypeCode.UInt16: - return (ushort) b; - case TypeCode.UInt32: - return (uint) b; - case TypeCode.UInt64: - return (ulong) b; - } - return null; - } - } - - static object ConvertUShort (ushort b, Type to) - { - unchecked { - switch (Type.GetTypeCode (to)) { - case TypeCode.Byte: - return (byte) b; - case TypeCode.Char: - return (char) b; - case TypeCode.Decimal: - return (decimal) b; - case TypeCode.Double: - return (double) b; - case TypeCode.Int16: - return (short) b; - case TypeCode.Int32: - return (int) b; - case TypeCode.Int64: - return (long) b; - case TypeCode.SByte: - return (sbyte) b; - case TypeCode.Single: - return (float) b; - case TypeCode.UInt16: - return (ushort) b; - case TypeCode.UInt32: - return (uint) b; - case TypeCode.UInt64: - return (ulong) b; - } - return null; - } - } - - static object ConvertUInt (uint b, Type to) - { - unchecked { - switch (Type.GetTypeCode (to)) { - case TypeCode.Byte: - return (byte) b; - case TypeCode.Char: - return (char) b; - case TypeCode.Decimal: - return (decimal) b; - case TypeCode.Double: - return (double) b; - case TypeCode.Int16: - return (short) b; - case TypeCode.Int32: - return (int) b; - case TypeCode.Int64: - return (long) b; - case TypeCode.SByte: - return (sbyte) b; - case TypeCode.Single: - return (float) b; - case TypeCode.UInt16: - return (ushort) b; - case TypeCode.UInt32: - return (uint) b; - case TypeCode.UInt64: - return (ulong) b; - } - return null; - } - } - - static object ConvertULong (ulong b, Type to) - { - unchecked { - switch (Type.GetTypeCode (to)) { - case TypeCode.Byte: - return (byte) b; - case TypeCode.Char: - return (char) b; - case TypeCode.Decimal: - return (decimal) b; - case TypeCode.Double: - return (double) b; - case TypeCode.Int16: - return (short) b; - case TypeCode.Int32: - return (int) b; - case TypeCode.Int64: - return (long) b; - case TypeCode.SByte: - return (sbyte) b; - case TypeCode.Single: - return (float) b; - case TypeCode.UInt16: - return (ushort) b; - case TypeCode.UInt32: - return (uint) b; - case TypeCode.UInt64: - return (ulong) b; - } - return null; - } - } - } -} diff --git a/mcs/class/System.Core/System.Linq.jvm/ExpressionInterpreter.cs b/mcs/class/System.Core/System.Linq.jvm/ExpressionInterpreter.cs deleted file mode 100644 index 4d550d1ac5a..00000000000 --- a/mcs/class/System.Core/System.Linq.jvm/ExpressionInterpreter.cs +++ /dev/null @@ -1,937 +0,0 @@ -// -// ExpressionInterpreter.cs -// -// (C) 2008 Mainsoft, Inc. (http://www.mainsoft.com) -// (C) 2008 db4objects, Inc. (http://www.db4o.com) -// (C) 2010 Novell, Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq.Expressions; -using System.Reflection; - -namespace System.Linq.jvm { - - struct LambdaInfo { - public readonly LambdaExpression Lambda; - public readonly object [] Arguments; - - public LambdaInfo (LambdaExpression lambda, object [] arguments) - { - this.Lambda = lambda; - this.Arguments = arguments; - } - } - - class HoistedVariableDetector : ExpressionVisitor { - - readonly Dictionary<ParameterExpression, LambdaExpression> parameter_to_lambda = - new Dictionary<ParameterExpression, LambdaExpression> (); - - Dictionary<LambdaExpression, List<ParameterExpression>> hoisted_map; - - LambdaExpression lambda; - - public Dictionary<LambdaExpression, List<ParameterExpression>> Process (LambdaExpression lambda) - { - Visit (lambda); - return hoisted_map; - } - - protected override void VisitLambda (LambdaExpression lambda) - { - this.lambda = lambda; - foreach (var parameter in lambda.Parameters) - parameter_to_lambda [parameter] = lambda; - base.VisitLambda (lambda); - } - - protected override void VisitParameter (ParameterExpression parameter) - { - if (lambda.Parameters.Contains (parameter)) - return; - - Hoist (parameter); - } - - void Hoist (ParameterExpression parameter) - { - LambdaExpression lambda; - if (!parameter_to_lambda.TryGetValue (parameter, out lambda)) - return; - - if (hoisted_map == null) - hoisted_map = new Dictionary<LambdaExpression, List<ParameterExpression>> (); - - List<ParameterExpression> hoisted; - if (!hoisted_map.TryGetValue (lambda, out hoisted)) { - hoisted = new List<ParameterExpression> (); - hoisted_map [lambda] = hoisted; - } - - hoisted.Add (parameter); - } - } - - - class ExpressionInterpreter : ExpressionVisitor { - - readonly Stack<LambdaInfo> lambdas = new Stack<LambdaInfo> (); - readonly Stack<object> stack = new Stack<object> (); - - readonly Dictionary<LambdaExpression, List<ParameterExpression>> hoisted_map; - readonly Dictionary<ParameterExpression, object> hoisted_values; - - void Push (object value) - { - stack.Push (value); - } - - object Pop () - { - return stack.Pop (); - } - - public ExpressionInterpreter (LambdaExpression lambda) - { - hoisted_map = new HoistedVariableDetector ().Process (lambda); - - if (hoisted_map != null) - hoisted_values = new Dictionary<ParameterExpression, object> (); - } - - private void VisitCoalesce (BinaryExpression binary) - { - Visit (binary.Left); - - var left = Pop (); - - if (left == null) { - Visit (binary.Right); - return; - } - - if (binary.Conversion == null) { - Push (left); - return; - } - - Push (Invoke (binary.Conversion.Compile (this), new [] { left })); - } - - void VisitAndAlso (BinaryExpression binary) - { - object left = null; - object right = null; - - Visit (binary.Left); - - left = Pop (); - - if (left == null || ((bool) left)) { - Visit (binary.Right); - right = Pop (); - } - - Push (Math.And (left, right)); - } - - void VisitUserDefinedAndAlso (BinaryExpression binary) - { - object left = null; - object right = null; - - Visit (binary.Left); - - left = Pop (); - - if (InvokeFalseOperator (binary, left)) { - Push (left); - return; - } - - Visit (binary.Right); - right = Pop (); - - if (binary.IsLiftedToNull && right == null) { - Push (null); - return; - } - - Push (InvokeMethod (binary.Method, null, new [] { left, right })); - } - - static bool InvokeTrueOperator (BinaryExpression binary, object target) - { - return (bool) InvokeMethod (GetTrueOperator (binary), null, new [] { target }); - } - - static bool InvokeFalseOperator (BinaryExpression binary, object target) - { - return (bool) InvokeMethod (GetFalseOperator (binary), null, new [] { target }); - } - - static MethodInfo GetFalseOperator (BinaryExpression binary) - { - return Expression.GetFalseOperator (binary.Left.Type.GetNotNullableType ()); - } - - static MethodInfo GetTrueOperator (BinaryExpression binary) - { - return Expression.GetTrueOperator (binary.Left.Type.GetNotNullableType ()); - } - - void VisitOrElse (BinaryExpression binary) - { - object left = null; - object right = null; - - Visit (binary.Left); - left = Pop (); - - if (left == null || !((bool) left)) { - Visit (binary.Right); - right = Pop (); - } - - Push (Math.Or (left, right)); - } - - void VisitUserDefinedOrElse (BinaryExpression binary) - { - object left = null; - object right = null; - - Visit (binary.Left); - left = Pop (); - - if (InvokeTrueOperator (binary, left)) { - Push (left); - return; - } - - Visit (binary.Right); - right = Pop (); - - if (binary.IsLiftedToNull && right == null) { - Push (null); - return; - } - - Push (InvokeMethod (binary.Method, null, new [] { left, right })); - } - - void VisitLogicalBinary (BinaryExpression binary) - { - Visit (binary.Left); - Visit (binary.Right); - - var right = Pop (); - var left = Pop (); - - Push (Math.Evaluate (left, right, binary.Type, binary.NodeType)); - } - - void VisitArithmeticBinary (BinaryExpression binary) - { - Visit (binary.Left); - Visit (binary.Right); - - if (IsNullBinaryLifting (binary)) - return; - - var right = Pop (); - var left = Pop (); - - switch (binary.NodeType) { - case ExpressionType.RightShift: - Push (Math.RightShift (left, Convert.ToInt32 (right), Type.GetTypeCode (binary.Type.GetNotNullableType ()))); - return; - case ExpressionType.LeftShift: - Push (Math.LeftShift (left, Convert.ToInt32 (right), Type.GetTypeCode (binary.Type.GetNotNullableType ()))); - return; - default: - Push (Math.Evaluate (left, right, binary.Type, binary.NodeType)); - break; - } - } - - bool IsNullRelationalBinaryLifting (BinaryExpression binary) - { - var right = Pop (); - var left = Pop (); - - if (binary.IsLifted && (left == null || right == null)) { - if (binary.IsLiftedToNull) { - Push (null); - return true; - } - - switch (binary.NodeType) { - case ExpressionType.Equal: - Push (BinaryEqual (binary, left, right)); - break; - case ExpressionType.NotEqual: - Push (BinaryNotEqual (binary, left, right)); - break; - default: - Push (false); - break; - } - - return true; - } - - Push (left); - Push (right); - - return false; - } - - void VisitRelationalBinary (BinaryExpression binary) - { - Visit (binary.Left); - Visit (binary.Right); - - if (IsNullRelationalBinaryLifting (binary)) - return; - - var right = Pop (); - var left = Pop (); - - switch (binary.NodeType) { - case ExpressionType.Equal: - Push (BinaryEqual (binary, left, right)); - return; - case ExpressionType.NotEqual: - Push (BinaryNotEqual (binary, left, right)); - return; - case ExpressionType.LessThan: - Push (Comparer<object>.Default.Compare (left, right) < 0); - return; - case ExpressionType.LessThanOrEqual: - Push (Comparer<object>.Default.Compare (left, right) <= 0); - return; - case ExpressionType.GreaterThan: - Push (Comparer<object>.Default.Compare (left, right) > 0); - return; - case ExpressionType.GreaterThanOrEqual: - Push (Comparer<object>.Default.Compare (left, right) >= 0); - return; - } - } - - void VisitLogicalShortCircuitBinary (BinaryExpression binary) - { - switch (binary.NodeType) { - case ExpressionType.AndAlso: - VisitAndAlso (binary); - return; - case ExpressionType.OrElse: - VisitOrElse (binary); - return; - } - } - - void VisitArrayIndex (BinaryExpression binary) - { - Visit (binary.Left); - var left = Pop (); - Visit (binary.Right); - var right = Pop (); - - Push (((Array) left).GetValue ((int) right)); - } - - bool IsNullBinaryLifting (BinaryExpression binary) - { - var right = Pop (); - var left = Pop (); - - if (binary.IsLifted && (right == null || left == null)) { - if (binary.IsLiftedToNull) - Push (null); - else - Push (GetDefaultValue (binary.Type)); - - return true; - } - - Push (left); - Push (right); - - return false; - } - - static object GetDefaultValue (Type type) - { - var array = (Array) Array.CreateInstance (type, 1); - return array.GetValue (0); - } - - void VisitUserDefinedBinary (BinaryExpression binary) - { - switch (binary.NodeType) { - case ExpressionType.AndAlso: - case ExpressionType.OrElse: - VisitUserDefinedLogicalShortCircuitBinary (binary); - return; - case ExpressionType.Equal: - case ExpressionType.NotEqual: - VisitUserDefinedRelationalBinary (binary); - return; - default: - VisitUserDefinedCommonBinary (binary); - return; - } - } - - void VisitUserDefinedLogicalShortCircuitBinary (BinaryExpression binary) - { - switch (binary.NodeType) { - case ExpressionType.AndAlso: - VisitUserDefinedAndAlso (binary); - return; - case ExpressionType.OrElse: - VisitUserDefinedOrElse (binary); - return; - } - } - - void VisitUserDefinedRelationalBinary (BinaryExpression binary) - { - Visit (binary.Left); - Visit (binary.Right); - - if (IsNullRelationalBinaryLifting (binary)) - return; - - var right = Pop (); - var left = Pop (); - - Push (InvokeBinary (binary, left, right)); - } - - void VisitUserDefinedCommonBinary (BinaryExpression binary) - { - Visit (binary.Left); - Visit (binary.Right); - - if (IsNullBinaryLifting (binary)) - return; - - var right = Pop (); - var left = Pop (); - - Push (InvokeBinary (binary, left, right)); - } - - object InvokeBinary (BinaryExpression binary, object left, object right) - { - return InvokeMethod (binary.Method, null, new [] { left, right }); - } - - bool BinaryEqual (BinaryExpression binary, object left, object right) - { - if (typeof (ValueType).IsAssignableFrom (binary.Right.Type)) - return ValueType.Equals (left, right); - else - return left == right; - } - - bool BinaryNotEqual (BinaryExpression binary, object left, object right) - { - if (typeof (ValueType).IsAssignableFrom (binary.Right.Type)) - return !ValueType.Equals (left, right); - else - return left != right; - } - - protected override void VisitBinary (BinaryExpression binary) - { - if (binary.Method != null) { - VisitUserDefinedBinary (binary); - return; - } - - switch (binary.NodeType) { - case ExpressionType.ArrayIndex: - VisitArrayIndex (binary); - return; - case ExpressionType.Coalesce: - VisitCoalesce (binary); - return; - case ExpressionType.AndAlso: - case ExpressionType.OrElse: - VisitLogicalShortCircuitBinary (binary); - return; - case ExpressionType.Equal: - case ExpressionType.NotEqual: - case ExpressionType.GreaterThan: - case ExpressionType.GreaterThanOrEqual: - case ExpressionType.LessThan: - case ExpressionType.LessThanOrEqual: - VisitRelationalBinary (binary); - return; - case ExpressionType.And: - case ExpressionType.Or: - VisitLogicalBinary (binary); - return; - case ExpressionType.Power: - case ExpressionType.Add: - case ExpressionType.AddChecked: - case ExpressionType.Divide: - case ExpressionType.ExclusiveOr: - case ExpressionType.LeftShift: - case ExpressionType.Modulo: - case ExpressionType.Multiply: - case ExpressionType.MultiplyChecked: - case ExpressionType.RightShift: - case ExpressionType.Subtract: - case ExpressionType.SubtractChecked: - VisitArithmeticBinary (binary); - return; - } - } - - void VisitTypeAs (UnaryExpression unary) - { - Visit (unary.Operand); - - var value = Pop (); - if (value == null || !Math.IsType (unary.Type, value)) - Push (null); - else - Push (value); - } - - void VisitArrayLength (UnaryExpression unary) - { - Visit (unary.Operand); - - var array = (Array) Pop (); - Push (array.Length); - } - - void VisitConvert (UnaryExpression unary) - { - if (unary.NodeType == ExpressionType.ConvertChecked) - VisitConvertChecked (unary); - else - VisitConvertUnchecked (unary); - } - - void VisitConvertChecked (UnaryExpression unary) - { - VisitConvert (unary, Math.ConvertToTypeChecked); - } - - void VisitConvertUnchecked (UnaryExpression unary) - { - VisitConvert (unary, Math.ConvertToTypeUnchecked); - } - - void VisitConvert (UnaryExpression unary, Func<object, Type, Type, object> converter) - { - Visit (unary.Operand); - Push (converter (Pop (), unary.Operand.Type, unary.Type)); - } - - bool IsNullUnaryLifting (UnaryExpression unary) - { - var value = Pop (); - - if (unary.IsLifted && value == null) { - if (unary.IsLiftedToNull) { - Push (null); - return true; - } else { - throw new InvalidOperationException (); - } - } - - Push (value); - return false; - } - - void VisitQuote (UnaryExpression unary) - { - Push (unary.Operand); - } - - void VisitUserDefinedUnary (UnaryExpression unary) - { - Visit (unary.Operand); - - if (IsNullUnaryLifting (unary)) - return; - - var value = Pop (); - - Push (InvokeUnary (unary, value)); - } - - object InvokeUnary (UnaryExpression unary, object value) - { - return InvokeMethod (unary.Method, null, new [] { value }); - } - - void VisitArithmeticUnary (UnaryExpression unary) - { - Visit (unary.Operand); - - if (IsNullUnaryLifting (unary)) - return; - - var value = Pop (); - - switch (unary.NodeType) { - case ExpressionType.Not: - if (unary.Type.GetNotNullableType () == typeof (bool)) - Push (!Convert.ToBoolean (value)); - else - Push (~Convert.ToInt32 (value)); - return; - case ExpressionType.Negate: - Push (Math.Negate (value, Type.GetTypeCode (unary.Type.GetNotNullableType ()))); - return; - case ExpressionType.NegateChecked: - Push (Math.NegateChecked (value, Type.GetTypeCode (unary.Type.GetNotNullableType ()))); - return; - case ExpressionType.UnaryPlus: - Push (value); - return; - } - } - - protected override void VisitUnary (UnaryExpression unary) - { - if (unary.Method != null) { - VisitUserDefinedUnary (unary); - return; - } - - switch (unary.NodeType) { - case ExpressionType.Quote: - VisitQuote (unary); - return; - case ExpressionType.TypeAs: - VisitTypeAs (unary); - return; - case ExpressionType.ArrayLength: - VisitArrayLength (unary); - return; - case ExpressionType.Convert: - case ExpressionType.ConvertChecked: - VisitConvert (unary); - return; - case ExpressionType.Negate: - case ExpressionType.NegateChecked: - case ExpressionType.Not: - case ExpressionType.UnaryPlus: - VisitArithmeticUnary (unary); - return; - default: - throw new NotImplementedException (unary.NodeType.ToString ()); - } - } - - protected override void VisitNew (NewExpression nex) - { - if (nex.Constructor == null) - Push (Activator.CreateInstance (nex.Type)); - else - Push (InvokeConstructor (nex.Constructor, VisitListExpressions (nex.Arguments))); - } - - static object InvokeConstructor (ConstructorInfo constructor, object [] arguments) - { - try { - return constructor.Invoke (arguments); - } catch (TargetInvocationException e) { - throw e.InnerException; - } - } - - protected override void VisitTypeIs (TypeBinaryExpression type) - { - Visit (type.Expression); - Push (Math.IsType (type.TypeOperand, Pop ())); - } - - void VisitMemberInfo (MemberInfo mi) - { - mi.OnFieldOrProperty ( - field => { - object target = null; - if (!field.IsStatic) - target = Pop (); - - Push (field.GetValue (target)); - }, - property => { - object target = null; - var getter = property.GetGetMethod (true); - if (!getter.IsStatic) - target = Pop (); - - Push (property.GetValue (target, null)); - }); - } - - protected override void VisitMemberAccess (MemberExpression member) - { - Visit (member.Expression); - VisitMemberInfo (member.Member); - } - - protected override void VisitNewArray (NewArrayExpression newArray) - { - switch (newArray.NodeType) { - case ExpressionType.NewArrayInit: - VisitNewArrayInit (newArray); - return; - case ExpressionType.NewArrayBounds: - VisitNewArrayBounds (newArray); - return; - } - - throw new NotSupportedException (); - } - - void VisitNewArrayBounds (NewArrayExpression newArray) - { - var lengths = new int [newArray.Expressions.Count]; - for (int i = 0; i < lengths.Length; i++) { - Visit (newArray.Expressions [i]); - lengths [i] = (int) Pop (); - } - - Push (Array.CreateInstance (newArray.Type.GetElementType (), lengths)); - } - - void VisitNewArrayInit (NewArrayExpression newArray) - { - var array = Array.CreateInstance ( - newArray.Type.GetElementType (), - newArray.Expressions.Count); - - for (int i = 0; i < array.Length; i++) { - Visit (newArray.Expressions [i]); - array.SetValue (Pop (), i); - } - - Push (array); - } - - protected override void VisitConditional (ConditionalExpression conditional) - { - Visit (conditional.Test); - - if ((bool) Pop ()) - Visit (conditional.IfTrue); - else - Visit (conditional.IfFalse); - } - - protected override void VisitMethodCall (MethodCallExpression call) - { - object instance = null; - if (call.Object != null) { - Visit (call.Object); - instance = Pop (); - } - - Push (InvokeMethod (call.Method, instance, VisitListExpressions (call.Arguments))); - } - - protected override void VisitParameter (ParameterExpression parameter) - { - var info = lambdas.Peek (); - - var lambda = info.Lambda; - var arguments = info.Arguments; - - var index = GetParameterIndex (lambda, parameter); - if (index >= 0) { - Push (arguments [index]); - return; - } - - object value; - if (hoisted_values.TryGetValue (parameter, out value)) { - Push (value); - return; - } - - throw new ArgumentException (); - } - - protected override void VisitConstant (ConstantExpression constant) - { - Push (constant.Value); - } - - protected override void VisitInvocation (InvocationExpression invocation) - { - Visit (invocation.Expression); - Push (Invoke ((Delegate) Pop (), VisitListExpressions (invocation.Arguments))); - } - - static object Invoke (Delegate dlg, object [] arguments) - { - return InvokeMethod (dlg.Method, dlg.Target, arguments); - } - - static object InvokeMethod (MethodBase method, object obj, object [] arguments) - { - try { - return method.Invoke (obj, arguments); - } catch (TargetInvocationException e) { - throw e.InnerException; - } - } - - protected override void VisitMemberListBinding (MemberListBinding binding) - { - var value = Pop (); - Push (value); - VisitMemberInfo (binding.Member); - VisitElementInitializerList (binding.Initializers); - Pop (); // pop the member - Push (value); // push the original target - } - - protected override void VisitElementInitializer (ElementInit initializer) - { - object target = null; - if (!initializer.AddMethod.IsStatic) - target = Pop (); - - var arguments = VisitListExpressions (initializer.Arguments); - InvokeMethod (initializer.AddMethod, target, arguments); - - if (!initializer.AddMethod.IsStatic) - Push (target); - } - - protected override void VisitMemberMemberBinding (MemberMemberBinding binding) - { - var value = Pop (); - Push (value); - VisitMemberInfo (binding.Member); - VisitBindingList (binding.Bindings); - Pop (); - Push (value); - } - - protected override void VisitMemberAssignment (MemberAssignment assignment) - { - Visit (assignment.Expression); - - var value = Pop (); - - assignment.Member.OnFieldOrProperty ( - field => { - object target = null; - if (!field.IsStatic) - target = Pop (); - - field.SetValue (target, value); - - if (!field.IsStatic) - Push (target); - }, - property => { - object target = null; - var getter = property.GetGetMethod (true); - if (!getter.IsStatic) - target = Pop (); - - property.SetValue (target, value, null); - - if (!getter.IsStatic) - Push (target); - }); - } - - protected override void VisitLambda (LambdaExpression lambda) - { - Push (lambda.Compile (this)); - } - - private object [] VisitListExpressions (ReadOnlyCollection<Expression> collection) - { - object [] results = new object [collection.Count]; - for (int i = 0; i < results.Length; i++) { - Visit (collection [i]); - results [i] = Pop (); - } - - return results; - } - - void StoreHoistedVariables (LambdaExpression lambda, object [] arguments) - { - if (hoisted_map == null) - return; - - List<ParameterExpression> variables; - if (!hoisted_map.TryGetValue (lambda, out variables)) - return; - - foreach (var variable in variables) - StoreHoistedVariable (variable, lambda, arguments); - } - - void StoreHoistedVariable (ParameterExpression variable, LambdaExpression lambda, object [] arguments) - { - var index = GetParameterIndex (lambda, variable); - if (index < 0) - return; - - hoisted_values [variable] = arguments [index]; - } - - static int GetParameterIndex (LambdaExpression lambda, ParameterExpression parameter) - { - return lambda.Parameters.IndexOf (parameter); - } - - public object Interpret (LambdaExpression lambda, object [] arguments) - { - lambdas.Push (new LambdaInfo (lambda, arguments)); - - StoreHoistedVariables (lambda, arguments); - - Visit (lambda.Body); - - lambdas.Pop (); - - if (lambda.GetReturnType () != typeof (void)) - return Pop (); - - return null; - } - } -} diff --git a/mcs/class/System.Core/System.Linq.jvm/Math.cs b/mcs/class/System.Core/System.Linq.jvm/Math.cs deleted file mode 100644 index b3e322cfedf..00000000000 --- a/mcs/class/System.Core/System.Linq.jvm/Math.cs +++ /dev/null @@ -1,695 +0,0 @@ -// -// Math.cs -// -// (C) 2008 Mainsoft, Inc. (http://www.mainsoft.com) -// (C) 2008 db4objects, Inc. (http://www.db4o.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Globalization; -using System.Linq.Expressions; - -namespace System.Linq.jvm { - class Math { - - public static object Evaluate (object a, object b, Type t, ExpressionType et) - { - TypeCode tc = Type.GetTypeCode (t); - if (tc == TypeCode.Object) { - if (!t.IsNullable ()) { - throw new NotImplementedException ( - string.Format ( - "Expression with Node type {0} for type {1}", - t.FullName, - tc)); - - } - return EvaluateNullable (a, b, Type.GetTypeCode (t.GetGenericArguments () [0]), et); - } - return Evaluate (a, b, tc, et); - } - - public static object EvaluateNullable (object a, object b, TypeCode tc, ExpressionType et) - { - object o = null; - if (a == null || b == null) { - if (tc != TypeCode.Boolean) { - return null; - } - switch (et) { - case ExpressionType.And: - o = And (a, b); - break; - case ExpressionType.Or: - o = Or (a, b); - break; - case ExpressionType.ExclusiveOr: - o = ExclusiveOr (a, b); - break; - } - } else { - o = Evaluate (a, b, tc, et); - } - - return Convert2Nullable (o, tc); - - } - - private static object ExclusiveOr (object a, object b) - { - if (a == null || b == null) { - return null; - } - return (bool) a ^ (bool) b; - } - - public static object Or (object a, object b) - { - if (a == null) { - if (b == null || !((bool) b)) { - return null; - } - return true; - } - - if (b == null) { - if (a == null || !((bool) a)) { - return null; - } - return true; - } - - return (bool) a || (bool) b; - } - - public static object And (object a, object b) - { - if (a == null) { - if (b == null || (bool) b) { - return null; - } - return false; - } - - if (b == null) { - if (a == null || (bool) a) { - return null; - } - return false; - } - - return (bool) a && (bool) b; - } - - private static object Convert2Nullable (object o, TypeCode tc) - { - if (o == null) { - return null; - } - switch (tc) { - case TypeCode.Char: - return new Nullable<Char> ((Char) o); - case TypeCode.Byte: - return new Nullable<Byte> ((Byte) o); - case TypeCode.Decimal: - return new Nullable<Decimal> ((Decimal) o); - case TypeCode.Double: - return new Nullable<Double> ((Double) o); - case TypeCode.Int16: - return new Nullable<Int16> ((Int16) o); - case TypeCode.Int32: - return new Nullable<Int32> ((Int32) o); - case TypeCode.Int64: - return new Nullable<Int64> ((Int64) o); - case TypeCode.UInt16: - return new Nullable<UInt16> ((UInt16) o); - case TypeCode.UInt32: - return new Nullable<UInt32> ((UInt32) o); - case TypeCode.SByte: - return new Nullable<SByte> ((SByte) o); - case TypeCode.Single: - return new Nullable<Single> ((Single) o); - case TypeCode.Boolean: - return new Nullable<Boolean> ((Boolean) o); - } - - throw new NotImplementedException (); - } - - public static object Evaluate (object a, object b, TypeCode tc, ExpressionType et) - { - switch (tc) { - case TypeCode.Boolean: - return Evaluate (Convert.ToBoolean (a), Convert.ToBoolean (b), et); - case TypeCode.Char: - return Evaluate (Convert.ToChar (a), Convert.ToChar (b), et); - case TypeCode.Byte: - return unchecked ((Byte) Evaluate (Convert.ToByte (a), Convert.ToByte (b), et)); - case TypeCode.Decimal: - return Evaluate (Convert.ToDecimal (a), Convert.ToDecimal (b), et); - case TypeCode.Double: - return Evaluate (Convert.ToDouble (a), Convert.ToDouble (b), et); - case TypeCode.Int16: - return unchecked ((Int16) Evaluate (Convert.ToInt16 (a), Convert.ToInt16 (b), et)); - case TypeCode.Int32: - return Evaluate (Convert.ToInt32 (a), Convert.ToInt32 (b), et); - case TypeCode.Int64: - return Evaluate (Convert.ToInt64 (a), Convert.ToInt64 (b), et); - case TypeCode.UInt16: - return unchecked ((UInt16) Evaluate (Convert.ToUInt16 (a), Convert.ToUInt16 (b), et)); - case TypeCode.UInt32: - return Evaluate (Convert.ToUInt32 (a), Convert.ToUInt32 (b), et); - case TypeCode.UInt64: - return Evaluate (Convert.ToUInt64 (a), Convert.ToUInt64 (b), et); - case TypeCode.SByte: - return unchecked ((SByte) Evaluate (Convert.ToSByte (a), Convert.ToSByte (b), et)); - case TypeCode.Single: - return Evaluate (Convert.ToSingle (a), Convert.ToSingle (b), et); - - } - - throw new NotImplementedException (); - } - - public static object NegateChecked (object a, TypeCode tc) - { - switch (tc) { - case TypeCode.Char: - return checked (-Convert.ToChar (a)); - case TypeCode.Byte: - return checked (-Convert.ToByte (a)); - case TypeCode.Decimal: - return checked (-Convert.ToDecimal (a)); - case TypeCode.Double: - return checked (-Convert.ToDouble (a)); - case TypeCode.Int16: - return checked (-Convert.ToInt16 (a)); - case TypeCode.Int32: - return checked (-Convert.ToInt32 (a)); - case TypeCode.Int64: - return checked (-Convert.ToInt64 (a)); - case TypeCode.UInt16: - return checked (-Convert.ToUInt16 (a)); - case TypeCode.UInt32: - return checked (-Convert.ToUInt32 (a)); - case TypeCode.SByte: - return checked (-Convert.ToSByte (a)); - case TypeCode.Single: - return checked (-Convert.ToSingle (a)); - } - - throw new NotImplementedException (); - } - - static object CreateInstance (Type type, params object [] arguments) - { - return type.GetConstructor ( - (from argument in arguments select argument.GetType ()).ToArray ()).Invoke (arguments); - } - - public static object ConvertToTypeChecked (object a, Type fromType, Type toType) - { - if (toType.IsNullable ()) - return a == null ? a : CreateInstance (toType, - ConvertToTypeChecked (a, fromType.GetNotNullableType (), toType.GetNotNullableType ())); - - if (a == null) { - if (!toType.IsValueType) - return a; - if (fromType.IsNullable ()) - throw new InvalidOperationException ("Nullable object must have a value"); - } - - if (IsType (toType, a)) { - return a; - } - - if (Expression.IsPrimitiveConversion (fromType, toType)) - return Convert.ChangeType (a, toType, CultureInfo.CurrentCulture); - - throw new NotImplementedException ( - string.Format ("No Convert defined for type {0} ", toType)); - } - - public static object ConvertToTypeUnchecked (object a, Type fromType, Type toType) - { - if (toType.IsNullable ()) - return a == null ? a : CreateInstance (toType, - ConvertToTypeUnchecked (a, fromType.GetNotNullableType (), toType.GetNotNullableType ())); - - if (a == null) { - if (!toType.IsValueType) - return a; - if (fromType.IsNullable ()) - throw new InvalidOperationException ("Nullable object must have a value"); - } - - if (IsType (toType, a)) - return a; - - if (Expression.IsPrimitiveConversion (fromType, toType)) - return Conversion.ConvertPrimitiveUnChecked (fromType, toType, a); - - throw new NotImplementedException ( - string.Format ("No Convert defined for type {0} ", toType)); - } - - public static bool IsType (Type t, Object o) - { - return t.IsInstanceOfType (o); - } - - public static object Negate (object a, TypeCode tc) - { - switch (tc) { - case TypeCode.Char: - return unchecked (-Convert.ToChar (a)); - case TypeCode.Byte: - return unchecked (-Convert.ToByte (a)); - case TypeCode.Decimal: - return unchecked (-Convert.ToDecimal (a)); - case TypeCode.Double: - return unchecked (-Convert.ToDouble (a)); - case TypeCode.Int16: - return unchecked (-Convert.ToInt16 (a)); - case TypeCode.Int32: - return unchecked (-Convert.ToInt32 (a)); - case TypeCode.Int64: - return unchecked (-Convert.ToInt64 (a)); - case TypeCode.UInt16: - return unchecked (-Convert.ToUInt16 (a)); - case TypeCode.UInt32: - return unchecked (-Convert.ToUInt32 (a)); - case TypeCode.SByte: - return unchecked (-Convert.ToSByte (a)); - case TypeCode.Single: - return unchecked (-Convert.ToSingle (a)); - } - - throw new NotImplementedException (); - } - - public static object RightShift (object a, int n, TypeCode tc) - { - switch (tc) { - case TypeCode.Int16: - return Convert.ToInt16 (a) >> n; - case TypeCode.Int32: - return Convert.ToInt32 (a) >> n; - case TypeCode.Int64: - return Convert.ToInt64 (a) >> n; - case TypeCode.UInt16: - return Convert.ToUInt16 (a) >> n; - case TypeCode.UInt32: - return Convert.ToUInt32 (a) >> n; - case TypeCode.UInt64: - return Convert.ToUInt64 (a) >> n; - } - - throw new NotImplementedException (); - } - - public static object LeftShift (object a, int n, TypeCode tc) - { - switch (tc) { - case TypeCode.Int16: - return Convert.ToInt16 (a) << n; - case TypeCode.Int32: - return Convert.ToInt32 (a) << n; - case TypeCode.Int64: - return Convert.ToInt64 (a) << n; - case TypeCode.UInt16: - return Convert.ToUInt16 (a) << n; - case TypeCode.UInt32: - return Convert.ToUInt32 (a) << n; - case TypeCode.UInt64: - return Convert.ToUInt64 (a) << n; - } - - throw new NotImplementedException (); - } - - private static Decimal Evaluate (Decimal a, Decimal b, ExpressionType et) - { - switch (et) { - case ExpressionType.Add: - return unchecked (a + b); - case ExpressionType.AddChecked: - return checked (a + b); - case ExpressionType.Subtract: - return unchecked (a - b); - case ExpressionType.SubtractChecked: - return checked (a - b); - case ExpressionType.Multiply: - return unchecked (a * b); - case ExpressionType.MultiplyChecked: - return checked (a * b); - case ExpressionType.Divide: - return a / b; - case ExpressionType.Modulo: - return a % b; - - } - - throw new NotImplementedException (); - } - - private static Double Evaluate (Double a, Double b, ExpressionType et) - { - switch (et) { - case ExpressionType.Add: - return unchecked (a + b); - case ExpressionType.AddChecked: - return checked (a + b); - case ExpressionType.Subtract: - return unchecked (a - b); - case ExpressionType.SubtractChecked: - return checked (a - b); - case ExpressionType.Multiply: - return unchecked (a * b); - case ExpressionType.MultiplyChecked: - return checked (a * b); - case ExpressionType.Divide: - return a / b; - case ExpressionType.Modulo: - return a % b; - case ExpressionType.Power: - return System.Math.Pow (a, b); - } - - throw new NotImplementedException (); - - } - - private static Int32 Evaluate (Int16 a, Int16 b, ExpressionType et) - { - switch (et) { - case ExpressionType.Add: - return unchecked (a + b); - case ExpressionType.AddChecked: - return checked (a + b); - case ExpressionType.Subtract: - return unchecked (a - b); - case ExpressionType.SubtractChecked: - return checked (a - b); - case ExpressionType.Multiply: - return unchecked (a * b); - case ExpressionType.MultiplyChecked: - return checked (a * b); - case ExpressionType.Divide: - return a / b; - case ExpressionType.Modulo: - return a % b; - case ExpressionType.ExclusiveOr: - return a ^ b; - case ExpressionType.And: - return a & b; - case ExpressionType.Or: - return a | b; - } - - throw new NotImplementedException (); - } - - private static Int32 Evaluate (Int32 a, Int32 b, ExpressionType et) - { - switch (et) { - case ExpressionType.Add: - return unchecked (a + b); - case ExpressionType.AddChecked: - return checked (a + b); - case ExpressionType.Subtract: - return unchecked (a - b); - case ExpressionType.SubtractChecked: - return checked (a - b); - case ExpressionType.Multiply: - return unchecked (a * b); - case ExpressionType.MultiplyChecked: - return checked (a * b); - case ExpressionType.Divide: - return a / b; - case ExpressionType.Modulo: - return a % b; - case ExpressionType.ExclusiveOr: - return a ^ b; - case ExpressionType.And: - return a & b; - case ExpressionType.Or: - return a | b; - } - - throw new NotImplementedException (); - } - - private static Int64 Evaluate (Int64 a, Int64 b, ExpressionType et) - { - switch (et) { - case ExpressionType.Add: - return unchecked (a + b); - case ExpressionType.AddChecked: - return checked (a + b); - case ExpressionType.Subtract: - return unchecked (a - b); - case ExpressionType.SubtractChecked: - return checked (a - b); - case ExpressionType.Multiply: - return unchecked (a * b); - case ExpressionType.MultiplyChecked: - return checked (a * b); - case ExpressionType.Divide: - return a / b; - case ExpressionType.Modulo: - return a % b; - case ExpressionType.ExclusiveOr: - return a ^ b; - case ExpressionType.And: - return a & b; - case ExpressionType.Or: - return a | b; - } - - throw new NotImplementedException (); - } - - private static Int32 Evaluate (UInt16 a, UInt16 b, ExpressionType et) - { - switch (et) { - case ExpressionType.Add: - return unchecked (a + b); - case ExpressionType.AddChecked: - return checked (a + b); - case ExpressionType.Subtract: - return unchecked (a - b); - case ExpressionType.SubtractChecked: - return checked ((UInt16) (a - b)); - case ExpressionType.Multiply: - return unchecked (a * b); - case ExpressionType.MultiplyChecked: - return checked (a * b); - case ExpressionType.Divide: - return a / b; - case ExpressionType.Modulo: - return a % b; - case ExpressionType.ExclusiveOr: - return a ^ b; - case ExpressionType.And: - return a & b; - case ExpressionType.Or: - return a | b; - } - - throw new NotImplementedException (); - } - - private static UInt32 Evaluate (UInt32 a, UInt32 b, ExpressionType et) - { - switch (et) { - case ExpressionType.Add: - return unchecked (a + b); - case ExpressionType.AddChecked: - return checked (a + b); - case ExpressionType.Subtract: - return unchecked (a - b); - case ExpressionType.SubtractChecked: - return checked (a - b); - case ExpressionType.Multiply: - return unchecked (a * b); - case ExpressionType.MultiplyChecked: - return checked (a * b); - case ExpressionType.Divide: - return a / b; - case ExpressionType.Modulo: - return a % b; - case ExpressionType.ExclusiveOr: - return a ^ b; - case ExpressionType.And: - return a & b; - case ExpressionType.Or: - return a | b; - } - - throw new NotImplementedException (); - } - - private static UInt64 Evaluate (UInt64 a, UInt64 b, ExpressionType et) - { - switch (et) { - case ExpressionType.Add: - return unchecked (a + b); - case ExpressionType.AddChecked: - return checked (a + b); - case ExpressionType.Subtract: - return unchecked (a - b); - case ExpressionType.SubtractChecked: - return checked (a - b); - case ExpressionType.Multiply: - return unchecked (a * b); - case ExpressionType.MultiplyChecked: - return checked (a * b); - case ExpressionType.Divide: - return a / b; - case ExpressionType.Modulo: - return a % b; - case ExpressionType.ExclusiveOr: - return a ^ b; - case ExpressionType.And: - return a & b; - case ExpressionType.Or: - return a | b; - } - - throw new NotImplementedException (); - } - - private static object Evaluate (Char a, Char b, ExpressionType et) - { - switch (et) { - case ExpressionType.ExclusiveOr: - return a ^ b; - case ExpressionType.And: - return a & b; - case ExpressionType.Or: - return a | b; - } - - throw new NotImplementedException (); - } - - private static Int32 Evaluate (SByte a, SByte b, ExpressionType et) - { - switch (et) { - case ExpressionType.Add: - return unchecked (a + b); - case ExpressionType.AddChecked: - return checked (a + b); - case ExpressionType.Subtract: - return unchecked (a - b); - case ExpressionType.SubtractChecked: - return checked (a - b); - case ExpressionType.Multiply: - return unchecked (a * b); - case ExpressionType.MultiplyChecked: - return checked (a * b); - case ExpressionType.Divide: - return a / b; - case ExpressionType.Modulo: - return a % b; - case ExpressionType.ExclusiveOr: - return a ^ b; - case ExpressionType.And: - return a & b; - case ExpressionType.Or: - return a | b; - } - - throw new NotImplementedException (); - } - - private static Int32 Evaluate (Byte a, Byte b, ExpressionType et) - { - switch (et) { - case ExpressionType.Add: - return unchecked (a + b); - case ExpressionType.AddChecked: - return checked (a + b); - case ExpressionType.Subtract: - return unchecked (a - b); - case ExpressionType.SubtractChecked: - return checked (a - b); - case ExpressionType.Multiply: - return unchecked (a * b); - case ExpressionType.MultiplyChecked: - return checked (a * b); - case ExpressionType.Divide: - return a / b; - case ExpressionType.Modulo: - return a % b; - case ExpressionType.ExclusiveOr: - return a ^ b; - case ExpressionType.And: - return a & b; - case ExpressionType.Or: - return a | b; - } - - throw new NotImplementedException (); - } - - private static Single Evaluate (Single a, Single b, ExpressionType et) - { - switch (et) { - case ExpressionType.Add: - return unchecked (a + b); - case ExpressionType.AddChecked: - return checked (a + b); - case ExpressionType.Subtract: - return unchecked (a - b); - case ExpressionType.SubtractChecked: - return checked (a - b); - case ExpressionType.Multiply: - return unchecked (a * b); - case ExpressionType.MultiplyChecked: - return checked (a * b); - case ExpressionType.Divide: - return a / b; - case ExpressionType.Modulo: - return a % b; - } - - throw new NotImplementedException (); - } - - private static bool Evaluate (bool a, bool b, ExpressionType et) - { - switch (et) { - case ExpressionType.ExclusiveOr: - return a ^ b; - case ExpressionType.And: - return a & b; - case ExpressionType.Or: - return a | b; - } - - throw new NotImplementedException (); - } - } -} diff --git a/mcs/class/System.Core/System.Linq.jvm/Runner.cs b/mcs/class/System.Core/System.Linq.jvm/Runner.cs deleted file mode 100644 index 31f02100a25..00000000000 --- a/mcs/class/System.Core/System.Linq.jvm/Runner.cs +++ /dev/null @@ -1,227 +0,0 @@ -// -// Runner.cs -// -// (C) 2008 Mainsoft, Inc. (http://www.mainsoft.com) -// (C) 2008 db4objects, Inc. (http://www.db4o.com) -// (C) 2010 Novell, Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System.Linq.Expressions; -using System.Reflection; - -namespace System.Linq.jvm { - - sealed class Runner { - - sealed class VoidTypeMarker {} - - static readonly Type VoidMarker = typeof (VoidTypeMarker); - static readonly MethodInfo [] delegates = new MethodInfo [5]; - const BindingFlags method_flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance; - - readonly LambdaExpression lambda; - readonly ExpressionInterpreter interpreter; - - static Runner () - { - foreach (var method in typeof (Runner).GetMethods (method_flags).Where (m => m.Name == "GetDelegate")) - delegates [method.GetGenericArguments ().Length - 1] = method; - } - - public Runner (LambdaExpression lambda) - { - this.lambda = lambda; - } - - public Runner (LambdaExpression lambda, ExpressionInterpreter interpreter) - { - this.lambda = lambda; - this.interpreter = interpreter; - } - - public Delegate CreateDelegate () - { - var types = GetGenericSignature (); - var creator = delegates [types.Length - 1].MakeGenericMethod (types); - - return (Delegate) creator.Invoke (this, new object [0]); - } - - Type [] GetGenericSignature () - { - var count = lambda.Parameters.Count; - var types = new Type [count + 1]; - - var return_type = lambda.GetReturnType (); - if (return_type == typeof (void)) - return_type = VoidMarker; - - types [count] = return_type; - for (int i = 0; i < count; i++) { - types [i] = lambda.Parameters [i].Type; - } - - return types; - } - - object Run (object [] arguments) - { - var interpreter = this.interpreter ?? new ExpressionInterpreter (lambda); - - return interpreter.Interpret (lambda, arguments); - } - - MethodInfo GetActionRunner (params Type [] types) - { - return GetRunner ("ActionRunner", types); - } - - MethodInfo GetFuncRunner (params Type [] types) - { - return GetRunner ("FuncRunner", types); - } - - MethodInfo GetRunner (string name, Type [] type_arguments) - { - var method = GetMethod (name, type_arguments.Length); - if (method == null) - throw new InvalidOperationException (); - - if (type_arguments.Length == 0) - return method; - - return method.MakeGenericMethod (type_arguments); - } - - MethodInfo GetMethod (string name, int parameters) - { - foreach (var method in GetType ().GetMethods (method_flags)) { - if (method.Name != name) - continue; - - if (method.GetGenericArguments ().Length != parameters) - continue; - - return method; - } - - return null; - } - - Delegate CreateDelegate (MethodInfo runner) - { - return Delegate.CreateDelegate (lambda.Type, this, runner); - } - - // all methods below are called through reflection - - Delegate GetDelegate<TResult> () - { - if (typeof (TResult) == VoidMarker) - return CreateDelegate (GetActionRunner (Type.EmptyTypes)); - - return CreateDelegate (GetFuncRunner (typeof (TResult))); - } - - public TResult FuncRunner<TResult> () - { - return (TResult) Run (new object [0]); - } - - public void ActionRunner () - { - Run (new object [0]); - } - - Delegate GetDelegate<T, TResult> () - { - if (typeof (TResult) == VoidMarker) - return CreateDelegate (GetActionRunner (typeof (T))); - - return CreateDelegate (GetFuncRunner (typeof (T), typeof (TResult))); - } - - public TResult FuncRunner<T, TResult> (T arg) - { - return (TResult) Run (new object [] { arg }); - } - - public void ActionRunner<T> (T arg) - { - Run (new object [] { arg }); - } - - public Delegate GetDelegate<T1, T2, TResult> () - { - if (typeof (TResult) == VoidMarker) - return CreateDelegate (GetActionRunner (typeof (T1), typeof (T2))); - - return CreateDelegate (GetFuncRunner (typeof (T1), typeof (T2), typeof (TResult))); - } - - public TResult FuncRunner<T1, T2, TResult> (T1 arg1, T2 arg2) - { - return (TResult) Run (new object [] { arg1, arg2 }); - } - - public void ActionRunner<T1, T2> (T1 arg1, T2 arg2) - { - Run (new object [] { arg1, arg2 }); - } - - Delegate GetDelegate<T1, T2, T3, TResult> () - { - if (typeof (TResult) == VoidMarker) - return CreateDelegate (GetActionRunner (typeof (T1), typeof (T2), typeof (T3))); - - return CreateDelegate (GetFuncRunner (typeof (T1), typeof (T2), typeof (T3), typeof (TResult))); - } - - public TResult FuncRunner<T1, T2, T3, TResult> (T1 arg1, T2 arg2, T3 arg3) - { - return (TResult) Run (new object [] { arg1, arg2, arg3 }); - } - - public void ActionRunner<T1, T2, T3> (T1 arg1, T2 arg2, T3 arg3) - { - Run (new object [] { arg1, arg2, arg3 }); - } - - Delegate GetDelegate<T1, T2, T3, T4, TResult> () - { - if (typeof (TResult) == VoidMarker) - return CreateDelegate (GetActionRunner (typeof (T1), typeof (T2), typeof (T3), typeof (T4))); - - return CreateDelegate (GetFuncRunner (typeof (T1), typeof (T2), typeof (T3), typeof (T4), typeof (TResult))); - } - - public TResult FuncRunner<T1, T2, T3, T4, TResult> (T1 arg1, T2 arg2, T3 arg3, T4 arg4) - { - return (TResult) Run (new object [] { arg1, arg2, arg3, arg4 }); - } - - public void ActionRunner<T1, T2, T3, T4> (T1 arg1, T2 arg2, T3 arg3, T4 arg4) - { - Run (new object [] { arg1, arg2, arg3, arg4 }); - } - } -} diff --git a/mcs/class/System.Core/dynamic_System.Core.dll.sources b/mcs/class/System.Core/dynamic_System.Core.dll.sources index bd54b199760..f5f5034c95c 100644 --- a/mcs/class/System.Core/dynamic_System.Core.dll.sources +++ b/mcs/class/System.Core/dynamic_System.Core.dll.sources @@ -118,11 +118,3 @@ ../dlr/Runtime/Microsoft.Scripting.Core/Utils/ReflectionUtils.cs ../dlr/Runtime/Microsoft.Scripting.Core/Utils/TrueReadOnlyCollection.cs ../dlr/Runtime/Microsoft.Scripting.Core/Utils/TypeExtensions.cs - -System.Core/Dummy.cs - -System.Runtime.CompilerServices/ExecutionScope.cs -System.Runtime.CompilerServices/DynamicAttribute.cs -System.Linq.Expressions/ExpressionTransformer.cs -System.Linq.Expressions/Extensions.cs -System.Linq.Expressions/DynamicExpressionVisitor.cs diff --git a/mcs/class/System.Core/mobile_System.Core.dll.sources b/mcs/class/System.Core/mobile_System.Core.dll.sources index 28780b7708e..ba66db603d7 100644 --- a/mcs/class/System.Core/mobile_System.Core.dll.sources +++ b/mcs/class/System.Core/mobile_System.Core.dll.sources @@ -7,6 +7,7 @@ System/TimeZoneInfo.cs System/TimeZoneInfo.TransitionTime.cs System/TimeZoneNotFoundException.cs System/Util.cs +System.Runtime.CompilerServices/DynamicAttribute.cs System.Runtime.CompilerServices/ExecutionScope.cs System.Runtime.CompilerServices/ExtensionAttribute.cs System.Runtime.CompilerServices/IStrongBox.cs @@ -98,3 +99,9 @@ Microsoft.Win32.SafeHandles/SafeMemoryMappedFileHandle.cs Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs System.IO/HandleInheritability.cs System.Threading.Tasks/TaskExtensions.cs +System.Linq.Expressions/Extensions.cs +System.Linq.Expressions/ExpressionTransformer.cs +../dlr/Runtime/Microsoft.Scripting.Core/Ast/DynamicExpression.cs +../dlr/Runtime/Microsoft.Scripting.Core/Compiler/Closure.cs +System.Linq.Expressions/DynamicExpressionVisitor.cs + diff --git a/mcs/class/System.Core/mobile_static_System.Core.dll.sources b/mcs/class/System.Core/mobile_static_System.Core.dll.sources deleted file mode 100644 index 55e204afd6c..00000000000 --- a/mcs/class/System.Core/mobile_static_System.Core.dll.sources +++ /dev/null @@ -1,7 +0,0 @@ -#include mobile_System.Core.dll.sources -#include static_System.Core.dll.sources -System.Linq.jvm/Conversion.cs -System.Linq.jvm/ExpressionInterpreter.cs -System.Linq.jvm/Runner.cs -System.Linq.jvm/Math.cs -System/TimeZoneInfo.MonoTouch.cs diff --git a/mcs/class/System.Core/monotouch_System.Core.dll.sources b/mcs/class/System.Core/monotouch_System.Core.dll.sources index 55e204afd6c..fad05a08f1c 100644 --- a/mcs/class/System.Core/monotouch_System.Core.dll.sources +++ b/mcs/class/System.Core/monotouch_System.Core.dll.sources @@ -1,7 +1,3 @@ #include mobile_System.Core.dll.sources -#include static_System.Core.dll.sources -System.Linq.jvm/Conversion.cs -System.Linq.jvm/ExpressionInterpreter.cs -System.Linq.jvm/Runner.cs -System.Linq.jvm/Math.cs +#include interpreter_System.Core.dll.sources System/TimeZoneInfo.MonoTouch.cs diff --git a/mcs/class/System.Core/net_4_0_System.Core.dll.sources b/mcs/class/System.Core/net_4_0_System.Core.dll.sources index bb9240f7bf3..65bcfd88012 100644 --- a/mcs/class/System.Core/net_4_0_System.Core.dll.sources +++ b/mcs/class/System.Core/net_4_0_System.Core.dll.sources @@ -1,3 +1,4 @@ +#include dynamic_System.Core.dll.sources Assembly/AssemblyInfo.cs System/Actions.cs System/Funcs.cs @@ -88,126 +89,6 @@ System.IO.Pipes/PipeUnix.cs System.IO.Pipes/PipeWin32.cs System.IO/HandleInheritability.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/BinaryOperationBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/BindingRestrictions.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CallInfo.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSite.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteHelpers.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteOps.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/ConvertBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CreateInstanceBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/DeleteIndexBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/DeleteMemberBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicMetaObject.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicMetaObjectBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicObject.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/ExpandoClass.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/ExpandoObject.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/GetIndexBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/GetMemberBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/IDynamicMetaObjectProvider.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/InvokeBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/InvokeMemberBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/IInvokeOnGetBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/RuleCache.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/SetIndexBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/SetMemberBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/UnaryOperationBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/UpdateDelegates.Generated.cs - -../dlr/Runtime/Microsoft.Scripting.Core/Ast/BinaryExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/BlockExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/CatchBlock.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ConditionalExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ConstantExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/DebugInfoExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/DebugViewWriter.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/DefaultExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/DynamicExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ElementInit.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/Expression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/Expression.DebuggerProxy.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ExpressionStringBuilder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ExpressionType.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ExpressionVisitor.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/GotoExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/IArgumentProvider.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/IndexExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/InvocationExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/LabelExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/LabelTarget.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/LambdaExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ListArgumentProvider.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ListInitExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/LoopExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberAssignment.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberBinding.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberInitExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberListBinding.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberMemberBinding.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MethodCallExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/NewArrayExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/NewExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ParameterExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/RuntimeVariablesExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/SwitchCase.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/SwitchExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/SymbolDocumentInfo.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/TryExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/TypeBinaryExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/TypeUtils.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/UnaryExpression.cs - -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/AnalyzedTree.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/AssemblyGen.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/BoundConstants.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/Closure.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/CompilerScope.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/CompilerScope.Storage.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/ConstantCheck.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/DebugInfoGenerator.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.Generated.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/ExpressionQuoter.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/HoistedLocals.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/ILGen.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/KeyedQueue.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LabelInfo.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Address.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Binary.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.ControlFlow.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Expressions.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Generated.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Lambda.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Logical.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Statements.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Unary.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/OffsetTrackingILGenerator.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/RuntimeVariableList.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/Set.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.Bindings.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.Generated.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.Temps.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/SymbolDocumentGenerator.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/SymbolGuids.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/VariableBinder.cs - -../dlr/Runtime/Microsoft.Scripting.Core/Utils/CacheDict.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/CollectionExtensions.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ContractUtils.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ExceptionFactory.Generated.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/Helpers.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/IRuntimeVariables.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ReadOnlyCollectionBuilder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ReadOnlyDictionary.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ReferenceEqualityComparer.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ReflectionUtils.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/TrueReadOnlyCollection.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/TypeExtensions.cs System.Linq.Parallel/ParallelQueryEnumerator.cs System.Linq/OrderedParallelQuery.cs System.Linq/ParallelMergeOptions.cs diff --git a/mcs/class/System.Core/static_System.Core.dll.sources b/mcs/class/System.Core/static_System.Core.dll.sources deleted file mode 100644 index 7696cbef189..00000000000 --- a/mcs/class/System.Core/static_System.Core.dll.sources +++ /dev/null @@ -1,28 +0,0 @@ -System.Linq.Expressions/BinaryExpression.cs -System.Linq.Expressions/ConditionalExpression.cs -System.Linq.Expressions/ConstantExpression.cs -System.Linq.Expressions/ElementInit.cs -System.Linq.Expressions/EmitContext.cs -System.Linq.Expressions/Expression.cs -System.Linq.Expressions/Expression_T.cs -System.Linq.Expressions/ExpressionPrinter.cs -System.Linq.Expressions/ExpressionType.cs -System.Linq.Expressions/ExpressionVisitor.cs -System.Linq.Expressions/ExpressionTransformer.cs -System.Linq.Expressions/Extensions.cs -System.Linq.Expressions/InvocationExpression.cs -System.Linq.Expressions/LambdaExpression.cs -System.Linq.Expressions/ListInitExpression.cs -System.Linq.Expressions/MemberAssignment.cs -System.Linq.Expressions/MemberBinding.cs -System.Linq.Expressions/MemberBindingType.cs -System.Linq.Expressions/MemberExpression.cs -System.Linq.Expressions/MemberInitExpression.cs -System.Linq.Expressions/MemberListBinding.cs -System.Linq.Expressions/MemberMemberBinding.cs -System.Linq.Expressions/MethodCallExpression.cs -System.Linq.Expressions/NewArrayExpression.cs -System.Linq.Expressions/NewExpression.cs -System.Linq.Expressions/ParameterExpression.cs -System.Linq.Expressions/TypeBinaryExpression.cs -System.Linq.Expressions/UnaryExpression.cs |