diff options
Diffstat (limited to 'mcs/class/System.Core')
26 files changed, 326 insertions, 2511 deletions
diff --git a/mcs/class/System.Core/Makefile b/mcs/class/System.Core/Makefile index 22252d68b9..0b433a2b4a 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.Core/Dummy.cs b/mcs/class/System.Core/System.Core/Dummy.cs deleted file mode 100644 index 55a05266c5..0000000000 --- a/mcs/class/System.Core/System.Core/Dummy.cs +++ /dev/null @@ -1,4 +0,0 @@ -namespace System.Core { - /* Internal class so that the System.Core namespace exists. The dlr has a lot of "using System.Core;" in it when compiling for moonlight, which otherwise would cause compiler errors */ - class Dummy {} -} diff --git a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs index 014cde469f..21faf963a7 100644 --- a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs +++ b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs @@ -124,7 +124,7 @@ namespace System.IO.MemoryMappedFiles if (Syscall.stat (path, out buf) == -1) UnixMarshal.ThrowExceptionForLastError (); - if ((capacity == 0 && buf.st_size == 0) || (capacity > buf.st_size)) + if (capacity > buf.st_size) throw new ArgumentException ("capacity"); int fd = Syscall.open (path, ToUnixMode (mode) | ToUnixMode (access), FilePermissions.DEFFILEMODE); @@ -369,7 +369,7 @@ namespace System.IO.MemoryMappedFiles if (file_size < 0) throw new FileNotFoundException (path); - if ((capacity == 0 && file_size == 0) || (capacity > file_size)) + if (capacity > file_size) throw new ArgumentException ("capacity"); int fd = open (path, ToUnixMode (mode) | ToUnixMode (access), DEFFILEMODE); @@ -507,7 +507,7 @@ namespace System.IO.MemoryMappedFiles throw new ArgumentNullException ("fileStream"); if (mapName != null && mapName.Length == 0) throw new ArgumentException ("mapName"); - if ((capacity == 0 && fileStream.Length == 0) || (capacity > fileStream.Length)) + if ((!MonoUtil.IsUnix && capacity == 0 && fileStream.Length == 0) || (capacity > fileStream.Length)) throw new ArgumentException ("capacity"); MemoryMapImpl.ConfigureFD (fileStream.Handle, inheritability); diff --git a/mcs/class/System.Core/System.Linq.Expressions.Interpret/LambdaCompiler.cs b/mcs/class/System.Core/System.Linq.Expressions.Interpret/LambdaCompiler.cs new file mode 100644 index 0000000000..23d623a633 --- /dev/null +++ b/mcs/class/System.Core/System.Linq.Expressions.Interpret/LambdaCompiler.cs @@ -0,0 +1,47 @@ +// +// LambdaCompiler.cs: System.Linq.Expression interpreter entry point +// +// Authors: Marek Safar (marek.safar@gmail.com) +// +// Copyright 2014 Xamarin Inc +// +// 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.Runtime.CompilerServices; +#if MONO_INTERPRETER +using Microsoft.Scripting.Generation; +#endif + +namespace System.Linq.Expressions.Compiler +{ + static class LambdaCompiler + { + public static Delegate Compile (LambdaExpression lambda, DebugInfoGenerator debugInfoGenerator) + { +#if MONO_INTERPRETER + return lambda.LightCompile (); +#else + throw new NotSupportedException ("System.Linq.Expression interpreter is missing"); +#endif + } + } +}
\ No newline at end of file diff --git a/mcs/class/System.Core/System.Linq.Expressions/DynamicExpressionVisitor.cs b/mcs/class/System.Core/System.Linq.Expressions/DynamicExpressionVisitor.cs new file mode 100644 index 0000000000..d83e62ff58 --- /dev/null +++ b/mcs/class/System.Core/System.Linq.Expressions/DynamicExpressionVisitor.cs @@ -0,0 +1,38 @@ +// +// DynamicExpressionVisitor.cs +// +// Authors: +// Marek Safar <marek.safar@gmail.com> +// +// Copyright 2013 Xamarin Inc (http://www.xamarin.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. +// +// + +#if NET_4_5 + +namespace System.Linq.Expressions +{ + public abstract class DynamicExpressionVisitor : ExpressionVisitor + { + } +} + +#endif diff --git a/mcs/class/System.Core/System.Linq.Expressions/Expression.cs b/mcs/class/System.Core/System.Linq.Expressions/Expression.cs index 4c87173968..9685771de9 100644 --- a/mcs/class/System.Core/System.Linq.Expressions/Expression.cs +++ b/mcs/class/System.Core/System.Linq.Expressions/Expression.cs @@ -270,7 +270,7 @@ namespace System.Linq.Expressions { if (ltype == rtype && ultype.IsEnum) return null; - if (ltype == rtype && ultype == typeof (bool)) + if (ltype == rtype && (ultype == typeof (bool) || ultype == typeof (char))) return null; if (ltype.IsNullable () && ConstantExpression.IsNull (right) && !ConstantExpression.IsNull (left)) 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 24d4b5a563..0000000000 --- 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 a3dc754ba0..0000000000 --- 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 4d550d1ac5..0000000000 --- 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 b3e322cfed..0000000000 --- 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 31f02100a2..0000000000 --- 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/System.Linq/Enumerable.cs b/mcs/class/System.Core/System.Linq/Enumerable.cs index 71f392690a..23805636c6 100644 --- a/mcs/class/System.Core/System.Linq/Enumerable.cs +++ b/mcs/class/System.Core/System.Linq/Enumerable.cs @@ -744,6 +744,12 @@ namespace System.Linq if (list != null) return list [index]; +#if NET_4_5 + var readOnlyList = source as IReadOnlyList<TSource>; + if (readOnlyList != null) + return readOnlyList[index]; +#endif + return source.ElementAt (index, Fallback.Throw); } @@ -762,6 +768,12 @@ namespace System.Linq if (list != null) return index < list.Count ? list [index] : default (TSource); +#if NET_4_5 + var readOnlyList = source as IReadOnlyList<TSource>; + if (readOnlyList != null) + return index < readOnlyList.Count ? readOnlyList [index] : default (TSource); +#endif + return source.ElementAt (index, Fallback.Default); } @@ -1099,7 +1111,7 @@ namespace System.Linq foreach (TOuter element in outer) { TKey outerKey = outerKeySelector (element); - if (innerKeys.Contains (outerKey)) + if (outerKey != null && innerKeys.Contains (outerKey)) yield return resultSelector (element, innerKeys [outerKey]); else yield return resultSelector (element, Empty<TInner> ()); @@ -1166,7 +1178,7 @@ namespace System.Linq foreach (TOuter element in outer) { TKey outerKey = outerKeySelector (element); - if (innerKeys.Contains (outerKey)) { + if (outerKey != null && innerKeys.Contains (outerKey)) { foreach (TInner innerElement in innerKeys [outerKey]) yield return resultSelector (element, innerElement); } diff --git a/mcs/class/System.Core/System/TimeZoneInfo.Android.cs b/mcs/class/System.Core/System/TimeZoneInfo.Android.cs index a21edd6c93..aa2ae29974 100644 --- a/mcs/class/System.Core/System/TimeZoneInfo.Android.cs +++ b/mcs/class/System.Core/System/TimeZoneInfo.Android.cs @@ -346,7 +346,7 @@ namespace System { static void Fill (Stream stream, byte[] nbuf, int required) { - int read, offset = 0; + int read = 0, offset = 0; while (offset < required && (read = stream.Read (nbuf, offset, required - offset)) > 0) offset += read; if (read != required) diff --git a/mcs/class/System.Core/System/TimeZoneInfo.cs b/mcs/class/System.Core/System/TimeZoneInfo.cs index 1f580d76d8..5663e4b9bb 100644 --- a/mcs/class/System.Core/System/TimeZoneInfo.cs +++ b/mcs/class/System.Core/System/TimeZoneInfo.cs @@ -1,3 +1,4 @@ + /* * System.TimeZoneInfo * @@ -285,10 +286,17 @@ namespace System if (this == TimeZoneInfo.Utc) return DateTime.SpecifyKind (dateTime, DateTimeKind.Utc); - + //FIXME: do not rely on DateTime implementation ! - if (this == TimeZoneInfo.Local) + if (this == TimeZoneInfo.Local) + { +#if NET_4_0 + return dateTime.ToLocalTime (); +#else return DateTime.SpecifyKind (dateTime.ToLocalTime (), DateTimeKind.Unspecified); +#endif + } + AdjustmentRule rule = GetApplicableRule (dateTime); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Equal.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Equal.cs index 749d78e40f..be7e129d89 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Equal.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Equal.cs @@ -82,6 +82,18 @@ namespace MonoTests.System.Linq.Expressions } [Test] + public void PrimitiveNonNumeric () + { + BinaryExpression expr = Expression.Equal (Expression.Constant ('a'), Expression.Constant ('b')); + Assert.AreEqual (ExpressionType.Equal, expr.NodeType); + Assert.AreEqual (typeof (bool), expr.Type); + Assert.IsNull (expr.Method); + + var eq = Expression.Lambda<Func<bool>> (expr).Compile (); + Assert.IsFalse (eq ()); + } + + [Test] public void Nullable_LiftToNull_SetToFalse () { int? a = 1; diff --git a/mcs/class/System.Core/Test/System.Linq/EnumerableFixture.cs b/mcs/class/System.Core/Test/System.Linq/EnumerableFixture.cs index d98eea6446..1045c8521b 100644 --- a/mcs/class/System.Core/Test/System.Linq/EnumerableFixture.cs +++ b/mcs/class/System.Core/Test/System.Linq/EnumerableFixture.cs @@ -28,6 +28,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Globalization; using System.Text; using System.Threading; @@ -540,6 +541,13 @@ namespace MonoTests.System.Linq } [Test] + public void ElementAt_ReadOnlyListOptimization_ReturnsValueAtGivenIndex() + { + var source = new NonEnumerableReadOnlyList<int> (new List<int> (new[] { 1, 2, 3, 4, 5, 6 })); + Assert.That(source.ElementAt (2), Is.EqualTo (3)); + } + + [Test] public void ElementAtOrDefault_IntegersWithOutOfRangeIndex_ReturnsDefault () { var source = Read (3, 6, 8); @@ -561,6 +569,13 @@ namespace MonoTests.System.Linq } [Test] + public void ElementAtOrDefault_ReadOnlyListOptimization_ReturnsValueAtGivenIndex() + { + var source = new NonEnumerableReadOnlyList<int>(new List<int> (new[] { 1, 2, 3, 4, 5, 6 })); + Assert.That(source.ElementAtOrDefault (2), Is.EqualTo (3)); + } + + [Test] public void ElementAtOrDefault_BooleansAndNegativeIndex_ReturnsDefault () { var source = Read (true, false, true, false); @@ -2188,6 +2203,27 @@ namespace MonoTests.System.Linq } } + [Serializable] + internal sealed class NonEnumerableReadOnlyList<T> : ReadOnlyCollection<T>, IEnumerable<T> { + public NonEnumerableReadOnlyList () : + this (new List<T>()) { } + + public NonEnumerableReadOnlyList (IList<T> collection) : + base (collection) { } + + // Re-implement GetEnumerator to be undefined. + + IEnumerator<T> IEnumerable<T>.GetEnumerator () + { + throw new NotImplementedException (); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return ((IEnumerable<T>) this).GetEnumerator(); + } + } + internal sealed class Reader<T> : IEnumerable<T>, IEnumerator<T> { public event EventHandler Disposed; diff --git a/mcs/class/System.Core/Test/System.Linq/EnumerableMoreTest.cs b/mcs/class/System.Core/Test/System.Linq/EnumerableMoreTest.cs index f5559ae00e..1cf514c7aa 100644 --- a/mcs/class/System.Core/Test/System.Linq/EnumerableMoreTest.cs +++ b/mcs/class/System.Core/Test/System.Linq/EnumerableMoreTest.cs @@ -1554,6 +1554,18 @@ namespace MonoTests.System.Linq { } [Test] + public void JoinTestNullKeys () + { + var l1 = new [] { + new { Name = "name1", Nullable = (int?) null }, + new { Name = "name2", Nullable = (int?) null } + }; + + var count = l1.Join (l1, i => i.Nullable, i => i.Nullable, (x, y) => x.Name).Count (); + Assert.AreEqual (0, count); + } + + [Test] public void GroupJoinArgumentNullTest () { string [] data = { "2", "1", "5", "3", "4" }; @@ -1596,6 +1608,16 @@ namespace MonoTests.System.Linq { } [Test] + public void GroupJoinWithNullKeys () + { + string[] l1 = { null }; + string[] l2 = { null, null }; + var res = l1.GroupJoin (l2, x => x, y => y, (a, b) => new { Key = a, Count = b.Count () }).ToArray (); + Assert.AreEqual (1, res.Length); + Assert.AreEqual (0, res [0].Count); + } + + [Test] public void OrderByArgumentNullTest () { string [] data = { "2", "1", "5", "3", "4" }; diff --git a/mcs/class/System.Core/Test/System/TimeZoneInfoTest.cs b/mcs/class/System.Core/Test/System/TimeZoneInfoTest.cs index 609c6d20cf..89b4ec11d2 100644 --- a/mcs/class/System.Core/Test/System/TimeZoneInfoTest.cs +++ b/mcs/class/System.Core/Test/System/TimeZoneInfoTest.cs @@ -387,6 +387,23 @@ namespace MonoTests.System } + + [Test] + public void ConvertFromToLocal () + { + DateTime utc = DateTime.UtcNow; + Assert.AreEqual(utc.Kind, DateTimeKind.Utc); + DateTime converted = TimeZoneInfo.ConvertTimeFromUtc(utc, TimeZoneInfo.Local); + #if NET_4_0 + Assert.AreEqual(DateTimeKind.Local, converted.Kind); + #else + Assert.AreEqual(DateTimeKind.Unspecified, converted.Kind); + #endif + DateTime back = TimeZoneInfo.ConvertTimeToUtc(converted, TimeZoneInfo.Local); + Assert.AreEqual(back.Kind, DateTimeKind.Utc); + Assert.AreEqual(utc, back); + } + [Test] public void ConvertToTimeZone () { diff --git a/mcs/class/System.Core/dynamic_System.Core.dll.sources b/mcs/class/System.Core/dynamic_System.Core.dll.sources index 83eaf84606..f5f5034c95 100644 --- a/mcs/class/System.Core/dynamic_System.Core.dll.sources +++ b/mcs/class/System.Core/dynamic_System.Core.dll.sources @@ -118,10 +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 diff --git a/mcs/class/System.Core/interpreter_System.Core.dll.sources b/mcs/class/System.Core/interpreter_System.Core.dll.sources new file mode 100644 index 0000000000..5ca0d48849 --- /dev/null +++ b/mcs/class/System.Core/interpreter_System.Core.dll.sources @@ -0,0 +1,91 @@ +../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/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/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/Set.cs +../dlr/Runtime/Microsoft.Scripting.Core/Compiler/SymbolGuids.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.Expressions.Interpret/LambdaCompiler.cs diff --git a/mcs/class/System.Core/mobile_System.Core.dll.sources b/mcs/class/System.Core/mobile_System.Core.dll.sources index 2f79e102f9..ba66db603d 100644 --- a/mcs/class/System.Core/mobile_System.Core.dll.sources +++ b/mcs/class/System.Core/mobile_System.Core.dll.sources @@ -6,6 +6,8 @@ System/TimeZoneInfo.AdjustmentRule.cs 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 @@ -97,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 55e204afd6..0000000000 --- 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 55e204afd6..fad05a08f1 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 bb9240f7bf..65bcfd8801 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/net_4_5_System.Core.dll.sources b/mcs/class/System.Core/net_4_5_System.Core.dll.sources index 4d4f48c853..cd2aed8b93 100644 --- a/mcs/class/System.Core/net_4_5_System.Core.dll.sources +++ b/mcs/class/System.Core/net_4_5_System.Core.dll.sources @@ -1,3 +1,4 @@ #include net_4_0_System.Core.dll.sources ../dlr/Runtime/Microsoft.Scripting.Core/Ast/DynamicExpression.cs +System.Linq.Expressions/DynamicExpressionVisitor.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 7696cbef18..0000000000 --- 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 |