Просмотр исходного кода

[System.Core] More reference sources

Marek Safar 11 лет назад
Родитель
Сommit
b23077459a
100 измененных файлов с 50 добавлено и 15313 удалено
  1. 0 1
      mcs/class/System.Core/Assembly/AssemblyInfo.cs
  2. 30 0
      mcs/class/System.Core/ReferenceSources/SR.cs
  3. 0 4
      mcs/class/System.Core/System.Dynamic/ChangeLog
  4. 0 45
      mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileAccess.cs
  5. 0 41
      mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileOptions.cs
  6. 0 52
      mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileRights.cs
  7. 0 41
      mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileSecurity.cs
  8. 0 3
      mcs/class/System.Core/System.IO/ChangeLog
  9. 0 8
      mcs/class/System.Core/System.IO/HandleInheritability.cs
  10. 0 812
      mcs/class/System.Core/System.Linq.Expressions/BinaryExpression.cs
  11. 0 831
      mcs/class/System.Core/System.Linq.Expressions/ChangeLog
  12. 0 82
      mcs/class/System.Core/System.Linq.Expressions/ConditionalExpression.cs
  13. 0 204
      mcs/class/System.Core/System.Linq.Expressions/ConstantExpression.cs
  14. 0 78
      mcs/class/System.Core/System.Linq.Expressions/ElementInit.cs
  15. 0 610
      mcs/class/System.Core/System.Linq.Expressions/EmitContext.cs
  16. 0 2288
      mcs/class/System.Core/System.Linq.Expressions/Expression.cs
  17. 0 398
      mcs/class/System.Core/System.Linq.Expressions/ExpressionPrinter.cs
  18. 0 79
      mcs/class/System.Core/System.Linq.Expressions/ExpressionType.cs
  19. 0 28
      mcs/class/System.Core/System.Linq.Expressions/ExpressionVisitor.cs
  20. 0 47
      mcs/class/System.Core/System.Linq.Expressions/Expression_T.cs
  21. 0 63
      mcs/class/System.Core/System.Linq.Expressions/InvocationExpression.cs
  22. 0 104
      mcs/class/System.Core/System.Linq.Expressions/LambdaExpression.cs
  23. 0 65
      mcs/class/System.Core/System.Linq.Expressions/ListInitExpression.cs
  24. 0 79
      mcs/class/System.Core/System.Linq.Expressions/MemberAssignment.cs
  25. 0 94
      mcs/class/System.Core/System.Linq.Expressions/MemberBinding.cs
  26. 0 36
      mcs/class/System.Core/System.Linq.Expressions/MemberBindingType.cs
  27. 0 84
      mcs/class/System.Core/System.Linq.Expressions/MemberExpression.cs
  28. 0 64
      mcs/class/System.Core/System.Linq.Expressions/MemberInitExpression.cs
  29. 0 62
      mcs/class/System.Core/System.Linq.Expressions/MemberListBinding.cs
  30. 0 62
      mcs/class/System.Core/System.Linq.Expressions/MemberMemberBinding.cs
  31. 0 78
      mcs/class/System.Core/System.Linq.Expressions/MethodCallExpression.cs
  32. 0 115
      mcs/class/System.Core/System.Linq.Expressions/NewArrayExpression.cs
  33. 0 103
      mcs/class/System.Core/System.Linq.Expressions/NewExpression.cs
  34. 0 90
      mcs/class/System.Core/System.Linq.Expressions/ParameterExpression.cs
  35. 0 71
      mcs/class/System.Core/System.Linq.Expressions/TypeBinaryExpression.cs
  36. 0 439
      mcs/class/System.Core/System.Linq.Expressions/UnaryExpression.cs
  37. 0 27
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/ChangeLog
  38. 0 51
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryBaseNode.cs
  39. 0 62
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryCastNode.cs
  40. 0 60
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryChildNode.cs
  41. 0 76
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryConcatNode.cs
  42. 0 89
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryDefaultEmptyNode.cs
  43. 0 88
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryGroupByNode.cs
  44. 0 148
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryHeadWorkerNode.cs
  45. 0 186
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryJoinNode.cs
  46. 0 59
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryMuxNode.cs
  47. 0 158
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryOptionNode.cs
  48. 0 120
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryOrderByNode.cs
  49. 0 101
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryOrderGuardNode.cs
  50. 0 38
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryOrderedStreamNode.cs
  51. 0 65
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryReverseNode.cs
  52. 0 205
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QuerySelectManyNode.cs
  53. 0 82
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QuerySelectNode.cs
  54. 0 142
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QuerySetNode.cs
  55. 0 125
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryStartNode.cs
  56. 0 77
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryStreamNode.cs
  57. 0 165
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryWhereNode.cs
  58. 0 158
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryZipNode.cs
  59. 0 50
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/SetInclusion.cs
  60. 0 64
      mcs/class/System.Core/System.Linq.Parallel.QueryNodes/WrapHelper.cs
  61. 0 133
      mcs/class/System.Core/System.Linq.Parallel/AggregationList.cs
  62. 0 17
      mcs/class/System.Core/System.Linq.Parallel/ChangeLog
  63. 0 63
      mcs/class/System.Core/System.Linq.Parallel/ConcurrentGrouping.cs
  64. 0 115
      mcs/class/System.Core/System.Linq.Parallel/ConcurrentLookup.cs
  65. 0 43
      mcs/class/System.Core/System.Linq.Parallel/INodeVisitor.cs
  66. 0 35
      mcs/class/System.Core/System.Linq.Parallel/IVisitableNode.cs
  67. 0 217
      mcs/class/System.Core/System.Linq.Parallel/OrderingEnumerator.cs
  68. 0 268
      mcs/class/System.Core/System.Linq.Parallel/ParallelExecuter.cs
  69. 0 75
      mcs/class/System.Core/System.Linq.Parallel/ParallelPartitioner.cs
  70. 0 129
      mcs/class/System.Core/System.Linq.Parallel/ParallelQueryEnumerator.cs
  71. 0 283
      mcs/class/System.Core/System.Linq.Parallel/ParallelQuickSort.cs
  72. 0 186
      mcs/class/System.Core/System.Linq.Parallel/QueryCheckerVisitor.cs
  73. 0 81
      mcs/class/System.Core/System.Linq.Parallel/QueryIsOrderedVisitor.cs
  74. 0 127
      mcs/class/System.Core/System.Linq.Parallel/QueryOptions.cs
  75. 0 123
      mcs/class/System.Core/System.Linq.Parallel/RangeList.cs
  76. 0 117
      mcs/class/System.Core/System.Linq.Parallel/RepeatList.cs
  77. 0 117
      mcs/class/System.Core/System.Linq.Parallel/ReverseList.cs
  78. 0 60
      mcs/class/System.Core/System.Linq.Parallel/StripPartitioner.cs
  79. 0 69
      mcs/class/System.Core/System.Linq.Parallel/TemporaryArea.cs
  80. 0 58
      mcs/class/System.Core/System.Linq/OrderedParallelQuery.cs
  81. 0 2330
      mcs/class/System.Core/System.Linq/ParallelEnumerable.cs
  82. 0 36
      mcs/class/System.Core/System.Linq/ParallelExecutionMode.cs
  83. 0 38
      mcs/class/System.Core/System.Linq/ParallelMergeOptions.cs
  84. 0 125
      mcs/class/System.Core/System.Linq/ParallelQuery.cs
  85. 0 43
      mcs/class/System.Core/System.Runtime.CompilerServices/ChangeLog
  86. 0 63
      mcs/class/System.Core/System.Runtime.CompilerServices/DynamicAttribute.cs
  87. 0 100
      mcs/class/System.Core/System.Runtime.CompilerServices/ExecutionScope.cs
  88. 0 34
      mcs/class/System.Core/System.Runtime.CompilerServices/ExtensionAttribute.cs
  89. 0 34
      mcs/class/System.Core/System.Runtime.CompilerServices/IStrongBox.cs
  90. 0 50
      mcs/class/System.Core/System.Runtime.CompilerServices/StrongBox_T.cs
  91. 0 130
      mcs/class/System.Core/System.Security.Cryptography/AesManaged.cs
  92. 0 23
      mcs/class/System.Core/System.Threading/ChangeLog
  93. 0 32
      mcs/class/System.Core/System.Threading/LockRecursionException.cs
  94. 0 45
      mcs/class/System.Core/System.Threading/ReaderWriterLockSlimExtensions.cs
  95. 0 51
      mcs/class/System.Core/System.Threading/ThreadLockState.cs
  96. 0 63
      mcs/class/System.Core/System/Actions.cs
  97. 0 62
      mcs/class/System.Core/System/Funcs.cs
  98. 0 32
      mcs/class/System.Core/System/InvalidTimeZoneException.cs
  99. 0 32
      mcs/class/System.Core/System/TimeZoneNotFoundException.cs
  100. 20 17
      mcs/class/System.Core/common_System.Core.dll.sources

+ 0 - 1
mcs/class/System.Core/Assembly/AssemblyInfo.cs

@@ -67,6 +67,5 @@ using System.Runtime.InteropServices;
 
 [assembly: ComVisible (false)]
 
-[assembly: TypeForwardedTo (typeof (System.Security.Cryptography.Aes))]
 [assembly: TypeForwardedTo (typeof (System.Threading.LazyThreadSafetyMode ))]
 [assembly: TypeForwardedTo (typeof (System.Lazy<>))]

+ 30 - 0
mcs/class/System.Core/ReferenceSources/SR.cs

@@ -70,4 +70,34 @@ partial class SR
 	public const string InvalidOperation_EnumFailedVersion = "InvalidOperation_EnumFailedVersion";
 	public const string InvalidOperation_EnumOpCantHappen = "InvalidOperation_EnumOpCantHappen";
 	public const string Serialization_MissingKeys = "Serialization_MissingKeys";
+
+	public const string Cryptography_ArgECDHKeySizeMismatch = "Cryptography_ArgECDHKeySizeMismatch";
+	public const string Cryptography_ArgECDHRequiresECDHKey = "Cryptography_ArgECDHRequiresECDHKey";
+	public const string Cryptography_ArgECDsaRequiresECDsaKey = "Cryptography_ArgECDsaRequiresECDsaKey";
+	public const string Cryptography_ArgExpectedECDiffieHellmanCngPublicKey = "Cryptography_ArgExpectedECDiffieHellmanCngPublicKey";
+	public const string Cryptography_DecryptWithNoKey = "Cryptography_DecryptWithNoKey";
+	public const string Cryptography_ECXmlSerializationFormatRequired = "Cryptography_ECXmlSerializationFormatRequired";
+	public const string Cryptography_InvalidAlgorithmGroup = "Cryptography_InvalidAlgorithmGroup";
+	public const string Cryptography_InvalidAlgorithmName = "Cryptography_InvalidAlgorithmName";
+	public const string Cryptography_InvalidCipherMode = "Cryptography_InvalidCipherMode";
+	public const string Cryptography_InvalidIVSize = "Cryptography_InvalidIVSize";
+	public const string Cryptography_InvalidKeyBlobFormat = "Cryptography_InvalidKeyBlobFormat";
+	public const string Cryptography_InvalidKeySize = "Cryptography_InvalidKeySize";
+	public const string Cryptography_InvalidPadding = "Cryptography_InvalidPadding";
+	public const string Cryptography_InvalidProviderName = "Cryptography_InvalidProviderName";
+	public const string Cryptography_MissingDomainParameters = "Cryptography_MissingDomainParameters";
+	public const string Cryptography_MissingIV = "Cryptography_MissingIV";
+	public const string Cryptography_MissingPublicKey = "Cryptography_MissingPublicKey";
+	public const string Cryptography_MustTransformWholeBlock = "Cryptography_MustTransformWholeBlock";
+	public const string Cryptography_NonCompliantFIPSAlgorithm = "Cryptography_NonCompliantFIPSAlgorithm";
+	public const string Cryptography_OpenEphemeralKeyHandleWithoutEphemeralFlag = "Cryptography_OpenEphemeralKeyHandleWithoutEphemeralFlag";
+	public const string Cryptography_OpenInvalidHandle = "Cryptography_OpenInvalidHandle";
+	public const string Cryptography_PartialBlock = "Cryptography_PartialBlock";
+	public const string Cryptography_PlatformNotSupported = "Cryptography_PlatformNotSupported";
+	public const string Cryptography_TlsRequiresLabelAndSeed = "Cryptography_TlsRequiresLabelAndSeed";
+	public const string Cryptography_TransformBeyondEndOfBuffer = "Cryptography_TransformBeyondEndOfBuffer";
+	public const string Cryptography_UnexpectedXmlNamespace = "Cryptography_UnexpectedXmlNamespace";
+	public const string Cryptography_UnknownEllipticCurve = "Cryptography_UnknownEllipticCurve";
+	public const string Cryptography_UnknownEllipticCurveAlgorithm = "Cryptography_UnknownEllipticCurveAlgorithm";
+	public const string Cryptography_UnknownPaddingMode = "Cryptography_UnknownPaddingMode";
 }

+ 0 - 4
mcs/class/System.Core/System.Dynamic/ChangeLog

@@ -1,4 +0,0 @@
-2009-07-02  Marek Safar <[email protected]>
-
-	* ChangeLog: Implementation imported from class/dlr.
-

+ 0 - 45
mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileAccess.cs

@@ -1,45 +0,0 @@
-//
-// MemoryMappedFileAccess.cs
-//
-// Authors:
-//	Zoltan Varga ([email protected])
-//
-// Copyright (C) 2009, 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;
-using System.IO;
-
-namespace System.IO.MemoryMappedFiles
-{
-	public enum MemoryMappedFileAccess {
-		ReadWrite = 0,
-		Read = 1,
-		Write = 2,
-		CopyOnWrite = 3,
-		ReadExecute = 4,
-		ReadWriteExecute = 5
-	}
-}
-
-

+ 0 - 41
mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileOptions.cs

@@ -1,41 +0,0 @@
-//
-// MemoryMappedFileOptions.cs
-//
-// Authors:
-//	Zoltan Varga ([email protected])
-//
-// Copyright (C) 2009, 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;
-using System.IO;
-
-namespace System.IO.MemoryMappedFiles
-{
-	[Flags]
-	public enum MemoryMappedFileOptions {
-		None = 0,
-		DelayAllocatePages = 0x4000000
-	}
-}
-

+ 0 - 52
mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileRights.cs

@@ -1,52 +0,0 @@
-//
-// MemoryMappedFileRights.cs
-//
-// Authors:
-//	Zoltan Varga ([email protected])
-//
-// Copyright (C) 2009, 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;
-using System.IO;
-
-namespace System.IO.MemoryMappedFiles
-{
-	[Flags]
-	public enum MemoryMappedFileRights {
-		CopyOnWrite = 1,
-		Write = 2,
-		Read  = 4,
-		ReadWrite = 6,
-		Execute = 8,
-		ReadExecute = 12,
-		ReadWriteExecute = 14,
-		Delete = 0x10000,
-		ReadPermissions = 0x20000,
-		ChangePermissions = 0x40000,
-		TakeOwnership = 0x80000,
-		FullControl = 0xf000f,
-		AccessSystemSecurity = 0x1000000
-	}
-}
-

+ 0 - 41
mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileSecurity.cs

@@ -1,41 +0,0 @@
-//
-// MemoryMappedFileSecurity.cs
-//
-// Authors:
-//	Marek Safar ([email protected])
-//
-// Copyright (C) 2009, 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.Security.AccessControl;
-
-namespace System.IO.MemoryMappedFiles
-{
-	public class MemoryMappedFileSecurity : ObjectSecurity<MemoryMappedFileRights>
-	{
-		public MemoryMappedFileSecurity() : base (false, ResourceType.FileObject) {
-
-		}
-	}
-}
-

+ 0 - 3
mcs/class/System.Core/System.IO/ChangeLog

@@ -1,3 +0,0 @@
-2009-08-18  Atsushi Enomoto  <[email protected]>
-
-	* HandleInheritability.cs : initial code.

+ 0 - 8
mcs/class/System.Core/System.IO/HandleInheritability.cs

@@ -1,8 +0,0 @@
-namespace System.IO
-{
-	public enum HandleInheritability
-	{
-		None,
-		Inheritable
-	}
-}

+ 0 - 812
mcs/class/System.Core/System.Linq.Expressions/BinaryExpression.cs

@@ -1,812 +0,0 @@
-//
-// BinaryExpression.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//   Miguel de Icaza ([email protected])
-//
-// Contains code from the Mono C# compiler:
-//   Marek Safar ([email protected])
-//   Martin Baulig ([email protected])
-//   Raja Harinath ([email protected])
-//
-// (C) 2001-2003 Ximian, Inc.
-// (C) 2004-2008 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;
-using System.Reflection;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-
-namespace System.Linq.Expressions {
-
-	public sealed class BinaryExpression : Expression {
-
-		Expression left;
-		Expression right;
-		LambdaExpression conversion;
-		MethodInfo method;
-		bool lift_to_null, is_lifted;
-
-		public Expression Left {
-			get { return left; }
-		}
-
-		public Expression Right {
-			get { return right; }
-		}
-
-		public MethodInfo Method {
-			get { return method; }
-		}
-
-		public bool IsLifted {
-			get { return is_lifted;  }
-		}
-
-		public bool IsLiftedToNull {
-			get { return lift_to_null; }
-		}
-
-		public LambdaExpression Conversion {
-			get { return conversion; }
-		}
-
-		internal BinaryExpression (ExpressionType node_type, Type type, Expression left, Expression right)
-			: base (node_type, type)
-		{
-			this.left = left;
-			this.right = right;
-		}
-
-		internal BinaryExpression (ExpressionType node_type, Type type, Expression left, Expression right, MethodInfo method)
-			: base (node_type, type)
-		{
-			this.left = left;
-			this.right = right;
-			this.method = method;
-		}
-
-		internal BinaryExpression (ExpressionType node_type, Type type, Expression left, Expression right, bool lift_to_null,
-			bool is_lifted, MethodInfo method, LambdaExpression conversion) : base (node_type, type)
-		{
-			this.left = left;
-			this.right = right;
-			this.method = method;
-			this.conversion = conversion;
-			this.lift_to_null = lift_to_null;
-			this.is_lifted = is_lifted;
-		}
-
-#if !FULL_AOT_RUNTIME
-		void EmitArrayAccess (EmitContext ec)
-		{
-			left.Emit (ec);
-			right.Emit (ec);
-			ec.ig.Emit (OpCodes.Ldelem, this.Type);
-		}
-
-		void EmitLogicalBinary (EmitContext ec)
-		{
-			switch (NodeType) {
-			case ExpressionType.And:
-			case ExpressionType.Or:
-				if (!IsLifted)
-					EmitLogical (ec);
-				else if (Type == typeof (bool?))
-					EmitLiftedLogical (ec);
-				else
-					EmitLiftedArithmeticBinary (ec);
-				break;
-			case ExpressionType.AndAlso:
-			case ExpressionType.OrElse:
-				if (!IsLifted)
-					EmitLogicalShortCircuit (ec);
-				else
-					EmitLiftedLogicalShortCircuit (ec);
-				break;
-			}
-		}
-
-		void EmitLogical (EmitContext ec)
-		{
-			EmitNonLiftedBinary (ec);
-		}
-
-		void EmitLiftedLogical (EmitContext ec)
-		{
-			var ig = ec.ig;
-			var and = NodeType == ExpressionType.And;
-			var left = ec.EmitStored (this.left);
-			var right = ec.EmitStored (this.right);
-
-			var ret_from_left = ig.DefineLabel ();
-			var ret_from_right = ig.DefineLabel ();
-			var done = ig.DefineLabel ();
-
-			ec.EmitNullableGetValueOrDefault (left);
-			ig.Emit (OpCodes.Brtrue, ret_from_left);
-			ec.EmitNullableGetValueOrDefault (right);
-			ig.Emit (OpCodes.Brtrue, ret_from_right);
-
-			ec.EmitNullableHasValue (left);
-			ig.Emit (OpCodes.Brfalse, ret_from_left);
-
-			ig.MarkLabel (ret_from_right);
-			ec.EmitLoad (and ? left : right);
-			ig.Emit (OpCodes.Br, done);
-
-			ig.MarkLabel (ret_from_left);
-			ec.EmitLoad (and ? right : left);
-
-			ig.MarkLabel (done);
-		}
-
-		void EmitLogicalShortCircuit (EmitContext ec)
-		{
-			var ig = ec.ig;
-			var and = NodeType == ExpressionType.AndAlso;
-			var ret = ig.DefineLabel ();
-			var done = ig.DefineLabel ();
-
-			ec.Emit (left);
-			ig.Emit (and ? OpCodes.Brfalse : OpCodes.Brtrue, ret);
-
-			ec.Emit (right);
-
-			ig.Emit (OpCodes.Br, done);
-
-			ig.MarkLabel (ret);
-			ig.Emit (and ? OpCodes.Ldc_I4_0 : OpCodes.Ldc_I4_1);
-
-			ig.MarkLabel (done);
-		}
-
-		MethodInfo GetFalseOperator ()
-		{
-			return GetFalseOperator (left.Type.GetNotNullableType ());
-		}
-
-		MethodInfo GetTrueOperator ()
-		{
-			return GetTrueOperator (left.Type.GetNotNullableType ());
-		}
-
-		void EmitUserDefinedLogicalShortCircuit (EmitContext ec)
-		{
-			var ig = ec.ig;
-			var and = NodeType == ExpressionType.AndAlso;
-
-			var done = ig.DefineLabel ();
-
-			var left = ec.EmitStored (this.left);
-
-			ec.EmitLoad (left);
-			ig.Emit (OpCodes.Dup);
-			ec.EmitCall (and ? GetFalseOperator () : GetTrueOperator ());
-			ig.Emit (OpCodes.Brtrue, done);
-
-			ec.Emit (this.right);
-			ec.EmitCall (method);
-
-			ig.MarkLabel (done);
-		}
-
-		void EmitLiftedLogicalShortCircuit (EmitContext ec)
-		{
-			var ig = ec.ig;
-			var and = NodeType == ExpressionType.AndAlso;
-			var left_is_null = ig.DefineLabel ();
-			var ret_from_left = ig.DefineLabel ();
-			var ret_null = ig.DefineLabel ();
-			var ret_new = ig.DefineLabel();
-			var done = ig.DefineLabel();
-
-			var left = ec.EmitStored (this.left);
-
-			ec.EmitNullableHasValue (left);
-			ig.Emit (OpCodes.Brfalse, left_is_null);
-
-			ec.EmitNullableGetValueOrDefault (left);
-
-			ig.Emit (OpCodes.Ldc_I4_0);
-			ig.Emit (OpCodes.Ceq);
-			ig.Emit (and ? OpCodes.Brtrue : OpCodes.Brfalse, ret_from_left);
-
-			ig.MarkLabel (left_is_null);
-			var right = ec.EmitStored (this.right);
-
-			ec.EmitNullableHasValue (right);
-			ig.Emit (OpCodes.Brfalse_S, ret_null);
-
-			ec.EmitNullableGetValueOrDefault (right);
-
-			ig.Emit (OpCodes.Ldc_I4_0);
-			ig.Emit (OpCodes.Ceq);
-
-			ig.Emit (and ? OpCodes.Brtrue : OpCodes.Brfalse, ret_from_left);
-
-			ec.EmitNullableHasValue (left);
-			ig.Emit (OpCodes.Brfalse, ret_null);
-
-			ig.Emit (and ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0);
-			ig.Emit (OpCodes.Br_S, ret_new);
-
-			ig.MarkLabel (ret_from_left);
-			ig.Emit (and ? OpCodes.Ldc_I4_0 : OpCodes.Ldc_I4_1);
-
-			ig.MarkLabel (ret_new);
-			ec.EmitNullableNew (Type);
-			ig.Emit (OpCodes.Br, done);
-
-			ig.MarkLabel (ret_null);
-			var ret = ig.DeclareLocal (Type);
-			ec.EmitNullableInitialize (ret);
-
-			ig.MarkLabel (done);
-		}
-
-		void EmitCoalesce (EmitContext ec)
-		{
-			var ig = ec.ig;
-			var done = ig.DefineLabel ();
-			var load_right = ig.DefineLabel ();
-
-			var left = ec.EmitStored (this.left);
-			var left_is_nullable = left.LocalType.IsNullable ();
-
-			if (left_is_nullable)
-				ec.EmitNullableHasValue (left);
-			else
-				ec.EmitLoad (left);
-
-			ig.Emit (OpCodes.Brfalse, load_right);
-
-			if (left_is_nullable && !Type.IsNullable ())
-				ec.EmitNullableGetValue (left);
-			else
-				ec.EmitLoad (left);
-
-			ig.Emit (OpCodes.Br, done);
-
-			ig.MarkLabel (load_right);
-			ec.Emit (this.right);
-
-			ig.MarkLabel (done);
-		}
-
-		void EmitConvertedCoalesce (EmitContext ec)
-		{
-			var ig = ec.ig;
-			var done = ig.DefineLabel ();
-			var load_right = ig.DefineLabel ();
-
-			var left = ec.EmitStored (this.left);
-
-			if (left.LocalType.IsNullable ())
-				ec.EmitNullableHasValue (left);
-			else
-				ec.EmitLoad (left);
-
-			ig.Emit (OpCodes.Brfalse, load_right);
-
-			ec.Emit (conversion);
-			ec.EmitLoad (left);
-			ig.Emit (OpCodes.Callvirt, conversion.Type.GetInvokeMethod ());
-
-			ig.Emit (OpCodes.Br, done);
-
-			ig.MarkLabel (load_right);
-			ec.Emit (this.right);
-
-			ig.MarkLabel (done);
-		}
-
-		static bool IsInt32OrInt64 (Type type)
-		{
-			return type == typeof (int) || type == typeof (long);
-		}
-
-		static bool IsSingleOrDouble (Type type)
-		{
-			return type == typeof (float) || type == typeof (double);
-		}
-
-		void EmitBinaryOperator (EmitContext ec)
-		{
-			var ig = ec.ig;
-			bool is_unsigned = IsUnsigned (left.Type);
-
-			switch (NodeType) {
-			case ExpressionType.Add:
-				ig.Emit (OpCodes.Add);
-				break;
-			case ExpressionType.AddChecked:
-				if (IsInt32OrInt64 (left.Type))
-					ig.Emit (OpCodes.Add_Ovf);
-				else
-					ig.Emit (is_unsigned ? OpCodes.Add_Ovf_Un : OpCodes.Add);
-				break;
-			case ExpressionType.Subtract:
-				ig.Emit (OpCodes.Sub);
-				break;
-			case ExpressionType.SubtractChecked:
-				if (IsInt32OrInt64 (left.Type))
-					ig.Emit (OpCodes.Sub_Ovf);
-				else
-					ig.Emit (is_unsigned ? OpCodes.Sub_Ovf_Un : OpCodes.Sub);
-				break;
-			case ExpressionType.Multiply:
-				ig.Emit (OpCodes.Mul);
-				break;
-			case ExpressionType.MultiplyChecked:
-				if (IsInt32OrInt64 (left.Type))
-					ig.Emit (OpCodes.Mul_Ovf);
-				else
-					ig.Emit (is_unsigned ? OpCodes.Mul_Ovf_Un : OpCodes.Mul);
-				break;
-			case ExpressionType.Divide:
-				ig.Emit (is_unsigned ? OpCodes.Div_Un : OpCodes.Div);
-				break;
-			case ExpressionType.Modulo:
-				ig.Emit (is_unsigned ? OpCodes.Rem_Un : OpCodes.Rem);
-				break;
-			case ExpressionType.RightShift:
-			case ExpressionType.LeftShift:
-				ig.Emit (OpCodes.Ldc_I4, left.Type == typeof (int) ? 0x1f : 0x3f);
-				ig.Emit (OpCodes.And);
-				if (NodeType == ExpressionType.RightShift)
-					ig.Emit (is_unsigned ? OpCodes.Shr_Un : OpCodes.Shr);
-				else
-					ig.Emit (OpCodes.Shl);
-				break;
-			case ExpressionType.And:
-				ig.Emit (OpCodes.And);
-				break;
-			case ExpressionType.Or:
-				ig.Emit (OpCodes.Or);
-				break;
-			case ExpressionType.ExclusiveOr:
-				ig.Emit (OpCodes.Xor);
-				break;
-			case ExpressionType.GreaterThan:
-				ig.Emit (is_unsigned ? OpCodes.Cgt_Un : OpCodes.Cgt);
-				break;
-			case ExpressionType.GreaterThanOrEqual:
-				if (is_unsigned || IsSingleOrDouble (left.Type))
-					ig.Emit (OpCodes.Clt_Un);
-				else
-					ig.Emit (OpCodes.Clt);
-
-				ig.Emit (OpCodes.Ldc_I4_0);
-				ig.Emit (OpCodes.Ceq);
-				break;
-			case ExpressionType.LessThan:
-				ig.Emit (is_unsigned ? OpCodes.Clt_Un : OpCodes.Clt);
-				break;
-			case ExpressionType.LessThanOrEqual:
-				if (is_unsigned || IsSingleOrDouble (left.Type))
-					ig.Emit (OpCodes.Cgt_Un);
-				else
-					ig.Emit (OpCodes.Cgt);
-
-				ig.Emit (OpCodes.Ldc_I4_0);
-				ig.Emit (OpCodes.Ceq);
-				break;
-			case ExpressionType.Equal:
-				ig.Emit (OpCodes.Ceq);
-				break;
-			case ExpressionType.NotEqual:
-				ig.Emit (OpCodes.Ceq);
-				ig.Emit (OpCodes.Ldc_I4_0);
-				ig.Emit (OpCodes.Ceq);
-				break;
-			case ExpressionType.Power:
-				ig.Emit (OpCodes.Call, typeof (Math).GetMethod ("Pow"));
-				break;
-			default:
-				throw new InvalidOperationException (
-					string.Format ("Internal error: BinaryExpression contains non-Binary nodetype {0}", NodeType));
-			}
-		}
-
-		bool IsLeftLiftedBinary ()
-		{
-			return left.Type.IsNullable () && !right.Type.IsNullable ();
-		}
-
-		void EmitLeftLiftedToNullBinary (EmitContext ec)
-		{
-			var ig = ec.ig;
-
-			var ret = ig.DefineLabel ();
-			var done = ig.DefineLabel ();
-
-			var left = ec.EmitStored (this.left);
-
-			ec.EmitNullableHasValue (left);
-			ig.Emit (OpCodes.Brfalse, ret);
-
-			ec.EmitNullableGetValueOrDefault (left);
-			ec.Emit (right);
-
-			EmitBinaryOperator (ec);
-
-			ec.EmitNullableNew (Type);
-
-			ig.Emit (OpCodes.Br, done);
-
-			ig.MarkLabel (ret);
-
-			var temp = ig.DeclareLocal (Type);
-			ec.EmitNullableInitialize (temp);
-
-			ig.MarkLabel (done);
-		}
-
-		void EmitLiftedArithmeticBinary (EmitContext ec)
-		{
-			if (IsLeftLiftedBinary ())
-				EmitLeftLiftedToNullBinary (ec);
-			else
-				EmitLiftedToNullBinary (ec);
-		}
-
-		void EmitLiftedToNullBinary (EmitContext ec)
-		{
-			var ig = ec.ig;
-			var left = ec.EmitStored (this.left);
-			var right = ec.EmitStored (this.right);
-			var result = ig.DeclareLocal (Type);
-
-			var has_value = ig.DefineLabel ();
-			var done = ig.DefineLabel ();
-
-			ec.EmitNullableHasValue (left);
-			ec.EmitNullableHasValue (right);
-			ig.Emit (OpCodes.And);
-			ig.Emit (OpCodes.Brtrue, has_value);
-
-			ec.EmitNullableInitialize (result);
-
-			ig.Emit (OpCodes.Br, done);
-
-			ig.MarkLabel (has_value);
-
-			ec.EmitNullableGetValueOrDefault (left);
-			ec.EmitNullableGetValueOrDefault (right);
-
-			EmitBinaryOperator (ec);
-
-			ec.EmitNullableNew (result.LocalType);
-
-			ig.MarkLabel (done);
-		}
-
-		void EmitLiftedRelationalBinary (EmitContext ec)
-		{
-			var ig = ec.ig;
-			var left = ec.EmitStored (this.left);
-			var right = ec.EmitStored (this.right);
-
-			var ret = ig.DefineLabel ();
-			var done = ig.DefineLabel ();
-
-			ec.EmitNullableGetValueOrDefault (left);
-			ec.EmitNullableGetValueOrDefault (right);
-
-			switch (NodeType) {
-			case ExpressionType.Equal:
-			case ExpressionType.NotEqual:
-				ig.Emit (OpCodes.Bne_Un, ret);
-				break;
-			default:
-				EmitBinaryOperator (ec);
-				ig.Emit (OpCodes.Brfalse, ret);
-				break;
-			}
-
-			ec.EmitNullableHasValue (left);
-			ec.EmitNullableHasValue (right);
-
-			switch (NodeType) {
-			case ExpressionType.Equal:
-				ig.Emit (OpCodes.Ceq);
-				break;
-			case ExpressionType.NotEqual:
-				ig.Emit (OpCodes.Ceq);
-				ig.Emit (OpCodes.Ldc_I4_0);
-				ig.Emit (OpCodes.Ceq);
-				break;
-			default:
-				ig.Emit (OpCodes.And);
-				break;
-			}
-
-			ig.Emit (OpCodes.Br, done);
-
-			ig.MarkLabel (ret);
-
-			ig.Emit (NodeType == ExpressionType.NotEqual ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0);
-
-			ig.MarkLabel (done);
-		}
-
-		void EmitArithmeticBinary (EmitContext ec)
-		{
-			if (!IsLifted)
-				EmitNonLiftedBinary (ec);
-			else
-				EmitLiftedArithmeticBinary (ec);
-		}
-
-		void EmitNonLiftedBinary (EmitContext ec)
-		{
-			ec.Emit (left);
-			ec.Emit (right);
-			EmitBinaryOperator (ec);
-		}
-
-		void EmitRelationalBinary (EmitContext ec)
-		{
-			if (!IsLifted) {
-				EmitNonLiftedBinary (ec);
-				return;
-			}
-
-			if (IsLiftedToNull) {
-				EmitLiftedToNullBinary (ec);
-				return;
-			}
-
-			if (ConstantExpression.IsNull (right) && !ConstantExpression.IsNull (left) && left.Type.IsNullable ()) {
-				EmitNullEquality (ec, left);
-				return;
-			}
-
-			if (ConstantExpression.IsNull (left) && !ConstantExpression.IsNull (right) && right.Type.IsNullable ()) {
-				EmitNullEquality (ec, right);
-				return;
-			}
-
-			EmitLiftedRelationalBinary (ec);
-		}
-
-		void EmitNullEquality (EmitContext ec, Expression e)
-		{
-			var ig = ec.ig;
-
-			if (IsLiftedToNull) {
-				e.Emit (ec);
-				if (e.Type != typeof (void))
-					ig.Emit (OpCodes.Pop);
-
-				ec.EmitNullableNew (typeof (bool?));
-				return;
-			}
-
-			var se = ec.EmitStored (e);
-			ec.EmitNullableHasValue (se);
-			if (NodeType == ExpressionType.Equal) {
-				ig.Emit (OpCodes.Ldc_I4_0);
-				ig.Emit (OpCodes.Ceq);
-			}		
-		}
-
-		void EmitLiftedUserDefinedOperator (EmitContext ec)
-		{
-			var ig = ec.ig;
-
-			var ret_true = ig.DefineLabel ();
-			var ret_false = ig.DefineLabel ();
-			var done = ig.DefineLabel ();
-
-			var left = ec.EmitStored (this.left);
-			var right = ec.EmitStored (this.right);
-
-			ec.EmitNullableHasValue (left);
-			ec.EmitNullableHasValue (right);
-			switch (NodeType) {
-			case ExpressionType.Equal:
-				ig.Emit (OpCodes.Bne_Un, ret_false);
-				ec.EmitNullableHasValue (left);
-				ig.Emit (OpCodes.Brfalse, ret_true);
-				break;
-			case ExpressionType.NotEqual:
-				ig.Emit (OpCodes.Bne_Un, ret_true);
-				ec.EmitNullableHasValue (left);
-				ig.Emit (OpCodes.Brfalse, ret_false);
-				break;
-			default:
-				ig.Emit (OpCodes.And);
-				ig.Emit (OpCodes.Brfalse, ret_false);
-				break;
-			}
-
-			ec.EmitNullableGetValueOrDefault (left);
-			ec.EmitNullableGetValueOrDefault (right);
-			ec.EmitCall (method);
-			ig.Emit (OpCodes.Br, done);
-
-			ig.MarkLabel (ret_true);
-			ig.Emit (OpCodes.Ldc_I4_1);
-			ig.Emit (OpCodes.Br, done);
-
-			ig.MarkLabel (ret_false);
-			ig.Emit (OpCodes.Ldc_I4_0);
-			ig.Emit (OpCodes.Br, done);
-
-			ig.MarkLabel (done);
-		}
-
-		void EmitLiftedToNullUserDefinedOperator (EmitContext ec)
-		{
-			var ig = ec.ig;
-
-			var ret = ig.DefineLabel ();
-			var done = ig.DefineLabel ();
-
-			var left = ec.EmitStored (this.left);
-			var right = ec.EmitStored (this.right);
-
-			ec.EmitNullableHasValue (left);
-			ec.EmitNullableHasValue (right);
-			ig.Emit (OpCodes.And);
-			ig.Emit (OpCodes.Brfalse, ret);
-
-			ec.EmitNullableGetValueOrDefault (left);
-			ec.EmitNullableGetValueOrDefault (right);
-			ec.EmitCall (method);
-			ec.EmitNullableNew (Type);
-			ig.Emit (OpCodes.Br, done);
-
-			ig.MarkLabel (ret);
-			var temp = ig.DeclareLocal (Type);
-			ec.EmitNullableInitialize (temp);
-
-			ig.MarkLabel (done);
-		}
-
-		void EmitUserDefinedLiftedLogicalShortCircuit (EmitContext ec)
-		{
-			var ig = ec.ig;
-			var and = NodeType == ExpressionType.AndAlso;
-
-			var left_is_null = ig.DefineLabel ();
-			var ret_left = ig.DefineLabel ();
-			var ret_null = ig.DefineLabel ();
-			var done = ig.DefineLabel ();
-
-			var left = ec.EmitStored (this.left);
-
-			ec.EmitNullableHasValue (left);
-			ig.Emit (OpCodes.Brfalse, and ? ret_null : left_is_null);
-
-			ec.EmitNullableGetValueOrDefault (left);
-			ec.EmitCall (and ? GetFalseOperator () : GetTrueOperator ());
-			ig.Emit (OpCodes.Brtrue, ret_left);
-
-			ig.MarkLabel (left_is_null);
-			var right = ec.EmitStored (this.right);
-			ec.EmitNullableHasValue (right);
-			ig.Emit (OpCodes.Brfalse, ret_null);
-
-			ec.EmitNullableGetValueOrDefault (left);
-			ec.EmitNullableGetValueOrDefault (right);
-			ec.EmitCall (method);
-
-			ec.EmitNullableNew (Type);
-			ig.Emit (OpCodes.Br, done);
-
-			ig.MarkLabel (ret_left);
-			ec.EmitLoad (left);
-			ig.Emit (OpCodes.Br, done);
-
-			ig.MarkLabel (ret_null);
-			var ret = ig.DeclareLocal (Type);
-			ec.EmitNullableInitialize (ret);
-
-			ig.MarkLabel (done);
-		}
-
-		void EmitUserDefinedOperator (EmitContext ec)
-		{
-			if (!IsLifted) {
-				switch (NodeType) {
-				case ExpressionType.AndAlso:
-				case ExpressionType.OrElse:
-					EmitUserDefinedLogicalShortCircuit (ec);
-					break;
-				default:
-					left.Emit (ec);
-					right.Emit (ec);
-					ec.EmitCall (method);
-					break;
-				}
-			} else if (IsLiftedToNull) {
-				switch (NodeType) {
-				case ExpressionType.AndAlso:
-				case ExpressionType.OrElse:
-					EmitUserDefinedLiftedLogicalShortCircuit (ec);
-					break;
-				default:
-					EmitLiftedToNullUserDefinedOperator (ec);
-					break;
-				}
-			}  else
-				EmitLiftedUserDefinedOperator (ec);
-		}
-
-		internal override void Emit (EmitContext ec)
-		{
-			if (method != null) {
-				EmitUserDefinedOperator (ec);
-				return;
-			}
-
-			switch (NodeType){
-			case ExpressionType.ArrayIndex:
-				EmitArrayAccess (ec);
-				return;
-			case ExpressionType.Coalesce:
-				if (conversion != null)
-					EmitConvertedCoalesce (ec);
-				else
-					EmitCoalesce (ec);
-				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:
-				EmitArithmeticBinary (ec);
-				return;
-			case ExpressionType.Equal:
-			case ExpressionType.GreaterThan:
-			case ExpressionType.GreaterThanOrEqual:
-			case ExpressionType.LessThan:
-			case ExpressionType.LessThanOrEqual:
-			case ExpressionType.NotEqual:
-				EmitRelationalBinary (ec);
-				return;
-			case ExpressionType.And:
-			case ExpressionType.Or:
-			case ExpressionType.AndAlso:
-			case ExpressionType.OrElse:
-				EmitLogicalBinary (ec);
-				return;
-			default:
-				throw new NotSupportedException (this.NodeType.ToString ());
-			}
-		}
-#endif
-	}
-}

+ 0 - 831
mcs/class/System.Core/System.Linq.Expressions/ChangeLog

@@ -1,831 +0,0 @@
-2010-07-26  Jb Evain  <[email protected]>
-
-	* EmitContext.cs: Properly call methods on enumerations.
-	Fixes #625367.
-
-2010-05-19  Jb Evain  <[email protected]>
-
-	* ConstantExpression.cs: fix emission of nullable constants.
-
-2010-01-08  Jb Evain  <[email protected]>
-
-	* Expression.cs (Call): properly deal with zero length array
-	of type arguments for non generic methods. Fixes #568989.
-
-2009-12-02 Gonzalo Paniagua Javier <[email protected]>
-
-	* Expression.cs: expression can be null for static getters. Patch from
-	Miguel de Icaza ([email protected]).
-
-2009-11-15  Jb Evain  <[email protected]>
-
-	* Expression (Call): deal with lambda expression <> delegate
-	comparison when filtering methods.
-	Fixes #536637.
-
-2009-11-15  Jb Evain  <[email protected]>
-
-	* Expression (Call): better filtering of generic methods.
-	Fixes #537768.
-
-2009-11-14  Jb Evain  <[email protected]>
-
-	* UnaryExpression.cs: isolate quoted expressions.
-	* EmitContext.cs (ParameterReplacer): new helper type
-	to replace the parameters of isolated expressions.
-	Fix #550722.
-
-2009-11-14  Jb Evain  <[email protected]>
-
-	* ExpressionTransformer.cs: adjust return type of all
-	 tranformation methods to make the transformer actually
-	 useful.
-
-2009-10-08  Jb Evain  <[email protected]>
-
-	* LambdaExpression.cs (Compile): use the interpreter on MonoTouch.
-
-2009-09-03  Jb Evain  <[email protected]>
-
-	* ConstantExpression.cs (Emit): add support to emit DBNull values.
-
-2009-09-03  Jb Evain  <[email protected]>
-
-	* ConstantExpression.cs (Emit): add support for emitting
-	DateTime constants.
-
-2009-03-05  Jb Evain  <[email protected]>
-
-	* EmitContext.cs
-	* ParameterExpression.cs:
-		add support for hoisted locals.
-
-2009-02-24  Jb Evain  <[email protected]>
-
-	* Expression.cs (BinaryCoreCheck): fix comparison of enums
-
-2009-02-23  Jb Evain  <[email protected]>
-
-	* Expression.cs (IsNumber): actually decimal is rather a special
-	case, and not a primitive number.
-
-2009-02-23  Jb Evain  <[email protected]>
-
-	* Expression.cs (BinaryCoreCheck): add decimal operations
-	are provided by custom operators.
-
-2008-12-17  Jb Evain  <[email protected]>
-
-	* ExpressionTransformer.cs: fix VisitList.
-
-2008-11-19  Jb Evain  <[email protected]>
-
-	* Expression.cs: protect against open generic methods.
-
-2008-10-08  Atsushi Enomoto  <[email protected]>
-
-	* Expression.cs : give us information about which type does not
-	  implement Emit().
-
-2008-10-03  Jb Evain  <[email protected]>
-
-	* Expression.cs: make sure we properly test complex generic methods
-	as a Call candidate.
-
-2008-09-22  Jb Evain  <[email protected]>
-
-	* TypeBinaryExpression.cs: protect against testing void expressions.
-	Fixes bug #428309.
-
-2008-09-01  Jb Evain  <[email protected]>
-
-	* MemberBinding.cs: make .ctor protected instead of public.
-
-2008-09-01  Jb Evain  <[email protected]>
-
-	* Expression.cs: guard against null parameters passed to Lambda.
-
-2008-08-30  Marek Safar  <[email protected]>
-
-	* MemberBinding.cs: Made MemberBinding ctor public
-
-2008-08-07  Jb Evain  <[email protected]>
-
-	* Expression.cs (GetAssociatedProperty): strengthen accessors
-	comparisons.
-
-2008-08-02  Zoltan Varga  <[email protected]>
-
-	* BinaryExpression.cs (EmitBinaryOperator): Mask out the upper bits of the
-	shift amount like mcs compiled code does.
-
-2008-07-19  Jb Evain  <[email protected]>
-
-	* Expression.cs (Call, Field, Property): disallow instance arguments
-	on static members. See ms connect #339351.
-
-2008-07-18  Jb Evain  <[email protected]>
-
-	* Expression.cs, BinaryExpression.cs: fix retrieval of true and false
-	operators.
-
-2008-06-20  Jb Evain  <[email protected]>
-
-	* LambdaExpression.cs, EmitContext.cs: refactor the emit context to
-	handle the fact that lambdas are compiled in a general context where
-	they share globals but are also able to use parameters from parent lambdas.
-	(Although parameter sharing is not implemented yet).
-
-	* BinaryExpression.cs (fix converted coalesce case to use the lambda
-	compilation code).
-
-2008-06-09  Jb Evain  <[email protected]>
-
-	* Extensions.cs (Type.IsExpression): add
-	* Expression.cs (CheckMethodArguments): modify the argument list
-	to quote arguments when if necessary.
-
-
-2008-06-09  Jb Evain  <[email protected]>
-
-	* Expression.cs (CheckLambda): quote body if required.
-
-2008-06-07  Jb Evain  <[email protected]>
-
-	* BinaryExpression.cs (EmitConvertedCoalesce): implement.
-
-2008-06-05  Jb Evain  <[email protected]>
-
-	* Expression.cs (GetUserConversionMethod): check for convertion
-	operators on both types.
-
-2008-06-05  Jb Evain  <[email protected]>
-
-	* Expression.cs (ConditionalBinaryCheck): if a method is passed,
-	checked that the operators true and false are also defined.
-
-2008-06-05  Jb Evain  <[email protected]>
-
-	* BinaryExpression.cs (Emit): deal with binary expressions
-	where only the left is lifted.
-
-2008-06-05  Jb Evain  <[email protected]>
-
-	* Extensions.cs: Add Type.MakeNullableType helper.
-	* Expression.cs (MakeSimpleBinary, MakeBoolBinar): Properly
-	creat lifted/lifted to null/not lifted
-	user defined binary expressions.
-	* BinaryExpression.cs (Emit): implement compilation of
-	lifted and lifted to null user defined binary operators.
-
-2008-06-05  Jb Evain  <[email protected]>
-
-	* Expression.cs (MakeSimpleUnary): properly create lifted/not lifted
-	unary expressions with user defined operators.
-	* UnaryExpression.cs (Emit): fix compilation of lifted user operators.
-
-2008-05-30  Jb Evain  <[email protected]>
-
-	* UnaryExpression.cs (Emit): fix convertion from nullable
-	to nullable types.
-
-2008-05-29  Jb Evain  <[email protected]>
-
-	* Expression.cs (Power): allow bool?.
-	* BinaryExpression.cs: properly deal with lifted power expression.
-
-2008-05-29  Jb Evain  <[email protected]>
-
-	* BinaryExpression.cs (Emit): fix lifted andalso and orelse.
-
-2008-05-29  Jb Evain  <[email protected]>
-
-	* BinaryExpression.cs (Emit): properly emit lifted to null
-	relational binary expressions.
-
-2008-05-28  Jb Evain  <[email protected]>
-
-	* BinaryExpression.cs (Emit): rework compilation of
-	arithmetic and relational lifted binary expressions.
-
-2008-05-28  Jb Evain  <[email protected]>
-
-	* UnaryExpression.cs (Emit): implement support for compiling
-	lifted unary expressions.
-
-2008-05-27  Jb Evain  <[email protected]>
-
-	* UnaryExpression.cs (EmitConvert): implement nullable to nullable
-	convert.
-
-2008-05-20  Roei Erez  <[email protected]>
-
-	* Extensions.cs: Add 'IsGenericImplementationOf' extension method
-
-2008-05-15  Jb Evain  <[email protected]>
-
-	* UnaryExpression.cs, EmitContext.cs: emit convert from and
-	to nullable types.
-
-2008-05-15  Jb Evain  <[email protected]>
-
-	* Extensions.cs: add a few useful extensions such as
-	IsGenericInstanceOf and MakeGenericFrom.
-
-2008-05-15  Roei Erez  <[email protected]>
-
-	* ExpressionTransformer.cs: Add a base class for transforming Expressions.
-	In use at AsQueryable() implementation.
-
-2008-05-14  Jb Evain  <[email protected]>
-
-	* EmitContext.cs: only generate a new lambda name if we're in
-	a debug context.
-
-2008-05-14  Jb Evain  <[email protected]>
-
-	* LambdaExpression.cs, EmitContext.cs: When encountering a lambda
-	inside an ET, compile it as a read of a global. Based on a patch
-	by Roei Erez <[email protected]>
-
-2008-05-08  Jb Evain  <[email protected]>
-
-	* Expression.cs, EmitContext.cs: deal with call to methods
-	with byref parameters.
-
-2008-05-07  Roei Erez  <[email protected]>
-
-	* Add ifdef TARGET_JVM
-
-2008-05-03  Jb Evain  <[email protected]>
-
-	* LambdaExpression.cs: move checks to Expression
-	* Expression.cs: apply check for both typed and untyped lambda
-	creation, so that the constructor does not throws exception.
-	Needed to create instances of Expression<> for untyped lambda
-	factory method. Fixes #386322.
-
-2008-05-02  Jb Evain  <[email protected]>
-
-	* Expression.cs: make Emit virtual instead of abstract,
-	to allow externals libraries to extend Expression.
-	Patch by Jan Oravec <[email protected]>. Fixes #386097.
-
-2008-04-29  Jb Evain  <[email protected]>
-
-	* UnaryExpression.cs (EmitPrimitiveConversion): implement.
-
-2008-04-28  Jb Evain  <[email protected]>
-
-	* EmitContext.cs: deal with globals when encountering them while
-	compiling, and not ahead of time with a dedicated visitor.
-
-2008-04-27  Jb Evain  <[email protected]>
-
-	* ConstantExpression.cs (Emit): emit properly null nullable types.
-
-2008-04-27  Jb Evain  <[email protected]>
-
-	* Expression.cs: improve method finder.
-
-2008-04-24  Jb Evain  <[email protected]>
-
-	* UnaryExpression.cs, EmitContext.cs: implement compilation
-	of Quote as a global load.
-
-2008-04-23  Jb Evain  <[email protected]>
-
-	* UnaryExpression.cs: start implementing EmitConvert.
-
-2008-04-23  Jb Evain  <[email protected]>
-
-	* ConstantExpression.cs (Emit): properly Emit null constants.
-
-2008-04-23  Jb Evain  <[email protected]>
-
-	* Expression.cs (Constant): check for assignability, not for type
-	equality, when a type is passed.
-
-2008-04-23  Jb Evain  <[email protected]>
-
-	* ExpressionPrinter.cs: ToString convert properly.
-
-2008-04-22  Jb Evain  <[email protected]>
-
-	* UnaryExpression.cs: implement IsLiftedToNull properly.
-	* Expression.cs (Convert, ConvertChecked): implemented computing
-	of IsLifted and IsLiftedToNull for conversions.
-
-2008-04-22  Jb Evain  <[email protected]>
-
-	* Expression.cs (Convert, ConvertChecked): implement.
-
-2008-04-21  Jb Evain  <[email protected]>
-
-	* Expression.cs (Call): don't rely on the fact that if the
-	instance expression is null, then it's a static call. Explicitely
-	check on the MethodInfo for that.
-	* EmitContext.cs (EmitCall): same pattern.
-
-2008-04-20  Jb Evain  <[email protected]>
-
-	* MemberMemberBinding.cs (Emit): implement.
-
-2008-04-19  Jb Evain  <[email protected]>
-
-	* EmitContext.cs: infrastructure work to attach a compiled
-	lambda expression to an execution scope, and to detect and store
-	external globals in the scope.
-	* ConstantExpression.cs: load globals from the scope.
-
-2008-04-19  Jb Evain  <[email protected]>
-
-	* ExpressionVisitor.cs (Visit): don't die because of Power.
-
-2008-04-09  Jb Evain  <[email protected]>
-
-	* Expression.cs: check for illegal booleab unary expressions.
-
-2008-04-09  Jb Evain  <[email protected]>
-
-	* UnaryExpression.cs: implement compilation of negate.
-
-2008-04-09  Jb Evain  <[email protected]>
-
-	* UnaryExpression.cs, Expression.cs: implement IsLifted and IsLifted
-	to null for simple unary operators. Implement Not compilation.
-
-2008-04-08  Jb Evain  <[email protected]>
-
-	* ElementInit.cs: emit pop if the add method doesn't return void.
-
-2008-03-20  Jb Evain  <[email protected]>
-
-	* Expression.cs: use the new and more complete IsAssignableTo
-	instead of IsAssignableFrom.
-
-2008-03-19  Jb Evain  <[email protected]>
-
-	* LambdaExpression.cs: use the new standardified IsAssignableTo,
-	fixes ExpressionTest_NewArrayBounds.TestArrayAssignability.
-
-2008-03-19  Jb Evain  <[email protected]>
-
-	* Extensions.cs (Type.IsAssignableTo): deal with arrays.
-
-2008-03-13  Jb Evain  <[email protected]>
-
-	* NewArrayExpression.cs (EmitNewArrayBounds): implement.
-
-2008-03-12  Jb Evain  <[email protected]>
-
-	* NewArrayExpression.cs (Emit): naive implementation of emit support
-	for array initialization.
-
-2008-03-11  Jb Evain  <[email protected]>
-
-	* BinaryExpression.cs: very naive implementation of emitting
-	array accesses.
-
-2008-03-11  Jb Evain  <[email protected]>
-
-	* *.cs: Move the different Emit* helpers to EmitContext,
-	so that they get used more naturally by the non Expression
-	types.
-
-2008-03-10  Jb Evain  <[email protected]>
-
-	* TypeBinaryExpression.cs, Expression.cs: refactor an EmitIsInst.
-	* UnaryExpression.cs: implement TypeAs using the EmitIsInst.
-
-2008-03-10  Jb Evain  <[email protected]>
-
-	* TypeBinaryExpression.cs (Emit): implement.
-
-2008-03-08  Jb Evain  <[email protected]>
-
-	* MemberListBinding.cs (Emit): implement.
-	* MemberBinding.cs (EmitLoadMember): add helper.
-
-2008-03-08  Jb Evain  <[email protected]>
-
-	* MemberAssignment.cs (Emit): implement.
-
-2008-03-08  Jb Evain  <[email protected]>
-
-	* ElementInit.cs (Emit): implement.
-
-2008-03-06  Jb Evain  <[email protected]>
-
-	* EmitContext.cs: the DebugContext delegate the CreateDelegate
-	to a DynamicContext to avoid visibility issues in debug mode.
-
-2008-03-06  Jb Evain  <[email protected]>
-
-	* EmitContext.cs: Lambda methods bypass JIT visibility checks.
-
-2008-03-06  Jb Evain  <[email protected]>
-
-	* MethodCallExpression.cs, Expression.cs: refactor method calling
-	into a more sophisticated EmitCall in Expression.
-	* InvocationExpression.cs (Emit): implement using the previous EmitCall.
-
-2008-03-06  Jb Evain  <[email protected]>
-
-	* Expression.cs: add a EmitCall helper.
-	* MemberExpression.cs: implement property access.
-
-2008-03-06  Jb Evain  <[email protected]>
-
-	* MethodCallExpression.cs, Expression.cs: refactor a EmitLoad in Expression.
-	* MemberExpression.cs: use EmitLoad to load the instance field if needed.
-
-2008-03-06  Jb Evain  <[email protected]>
-
-	* BinaryExpression.cs, Expression.cs: move EmitStored from
-	BinaryExpression to Expression.
-	* MethodCallExpression.cs: allow method calls on structs.
-
-2008-03-05  Jb Evain  <[email protected]>
-
-	* Expression.cs: Fix the Call method which takes an array
-	of type arguments.
-
-2008-03-05  Jb Evain  <[email protected]>
-
-	* Expression.cs: fix for a good chunk of lifted/liftToNull tests.
-
-2008-02-26  Jb Evain  <[email protected]>
-
-	* Expression.cs (Call): Guess the parameters type from the argument
-	types if needed.
-
-2008-02-25  Jb Evain  <[email protected]>
-
-	* NewExpression.cs (Emit): deal with value types construction.
-
-2008-02-25  Jb Evain  <[email protected]>
-
-	* Expression.cs, NewExpression.cs: deal with the fact that value types
-	don't have a parameterless constructor.
-
-2008-02-24  Jb Evain  <[email protected]>
-
-	* LambdaExpression.cs, EmitContext.cs: make compilation
-	of delegate returning void work.
-
-2008-02-24  Jb Evain  <[email protected]>
-
-	* MethodCallExpression.cs: emit call or callvirt depending
-	on the virtuality of the method.
-
-2008-02-24  Jb Evain  <[email protected]>
-
-	* LambdaExpression.cs: properly format error message.
-
-2008-02-21  Jb Evain  <[email protected]>
-
-	* BinaryExpression.cs (EmitCoalesce): fix setup_null.
-
-2008-02-21  Jb Evain  <[email protected]>
-
-	* BinaryExpression.cs (Emit): fix the both_are_null case.
-
-2008-02-20  Jb Evain  <[email protected]>
-
-	* Expression.cs, ExpressionPrinter.cs: implement MemberBind.
-
-2008-02-20  Jb Evain  <[email protected]>
-
-	* Expression.cs, ExpressionPrinter.cs: implement ListInit.
-
-2008-02-19  Jb Evain  <[email protected]>
-
-	* Expression.cs, ExpressionPrinter.cs: implement MemberInit.
-
-2008-02-19  Jb Evain  <[email protected]>
-
-	* Expression.cs, ExpressionPrinter.cs: implement last New
-	overload for anonymous types.
-
-2008-02-08  Jb Evain  <[email protected]>
-
-	* Expression.cs, InvocationExpression.cs, ExpressionPrinter.cs
-		add support for Invoke.
-
-2008-02-04  Jb Evain  <[email protected]>
-
-	* ExpressionPrinter.cs: fix printing of MemberListBinding.
-
-2008-02-04  Jb Evain  <[email protected]>
-
-	* Expression.cs, NewExpression.cs: make New(Type) test pass.
-
-2008-02-04  Jb Evain  <[email protected]>
-
-	* ExpressionPrinter.cs: fix and clean printing of ElementInit.
-
-2008-02-02  Jb Evain  <[email protected]>
-
-	* Expression.cs: fix ListBind(MemberInfo,IEnumerable<ElementInit>).
-
-2008-02-02  Jb Evain  <[email protected]>
-
-	* Expression.cs: fix ListBind(MethodInfo,IEnumerable<ElementInit>).
-
-2008-02-01  Olivier Dufour  <[email protected]>
-
-	* Expression.cs, ExpressionPrinter.cs:Add ListBind
-
-2008-02-01  Olivier Dufour  <[email protected]>
-
-	* Expression.cs, ExpressionPrinter.cs:Add Elementinit
-
-2008-01-31  Jb Evain  <[email protected]>
-
-	* UnaryExpression.cs: emit array length.
-
-2008-01-31  Jb Evain  <[email protected]>
-
-	* MemberExpression.cs: Simple support for emitting fields.
-
-2008-01-30  Jb Evain  <[email protected]>
-
-	* MethodCallExpression.cs: very naive implementation of Emit.
-
-2008-01-30  Jb Evain  <[email protected]>
-
-	* NewExpression.cs: add Emit support for reference types.
-
-2008-01-30  Jb Evain  <[email protected]>
-
-	* LambdaExpression.cs, EmitContext.cs: small refactoring.
-	Extract the different EmitContexts to their own file.
-
-2008-01-29  Jb Evain  <[email protected]>
-
-	* MethodCallExpression.cs, Expression.cs: complete Calls.
-
-2008-01-29  Jb Evain  <[email protected]>
-
-	* Expression.cs, NewExpression.cs, ExpressionPrinter.cs:
-	implement the first flavors of New.
-
-2008-01-27  Jb Evain  <[email protected]>
-
-	* ConditionalExpression.cs: implement Emit.
-
-2008-01-27  Jb Evain  <[email protected]>
-
-	* Expression.cs: implement the last Lambda method.
-
-2008-01-27  Jb Evain  <[email protected]>
-
-	* LambdaExpression.cs: fix the Type of the LambdaExpressions.
-
-2008-01-27  Olivier Dufour  <[email protected]>
-
-	* Expression.cs, InvocationExpession.cs,
-	ListInitExpression.cs, MemberInitExpression.cs
-	NewExpression.cs : Add all missing
-	constructor in Expressions and remove the base one
-
-2008-01-25  Jb Evain  <[email protected]>
-
-	* Expression.cs, ExpressionPrinter.cs: implement Bind.
-
-2008-01-25  Jb Evain  <[email protected]>
-
-	* MemberMemberBinding.cs, MemberListBinding.cs,
-	MemberAssignment.cs, MemberBinding.cs:
-	add constructors.
-
-2008-01-25  Jb Evain  <[email protected]>
-
-	* Expression.cs: implement PropertyOrField.
-
-2008-01-24  Jb Evain  <[email protected]>
-
-	* Expression.cs, MemberExpression.cs, ExpressionPrinter.cs:
-	implement Field and Property.
-
-2008-01-22  Miguel de Icaza  <[email protected]>
-
-	* BinaryExpression.cs: Unleash the power of cut and paste.
-
-	Bring a bunch of operatros from mcs/expression.cs
-
-	* Expression.cs: There is no op_LogicalAnd or op_LogicalOr, I just
-	used those from mcs, that was wrong.   use the proper ones, clean
-	up the result.
-
-	* BinaryExpression.cs: Add method invocations for binary methods.
-
-2008-01-22  Jb Evain  <[email protected]>
-
-	* Expression.cs, ExpressionPrinter.cs: implement NewArrayList.
-
-2008-01-22  Jb Evain  <[email protected]>
-
-	* Expression.cs, ExpressionPrinter.cs, NewArrayExpression.cs:
-	implement Expression.NewArrayBounds.
-
-2008-01-22  Jb Evain  <[email protected]>
-
-	* ExpressionPrinter.cs: fix Lambda and Equal.
-
-2008-01-22  Miguel de Icaza  <[email protected]>
-
-	* BinaryExpression.cs (EmitCoalesce): Add support for emitting
-	code for Coalesce.
-
-	TODO: this does not use the "Conversion" Lambda, which am not sure
-	who generates this or what it is used for.
-
-	(EmitLogical): Fix a couple of bugs in AndAlso, OrElse.
-
-	* Expression.cs: Add support for Coalesce.
-	(BinaryCoreCheck): Move more checking here, instead of the helper
-	routines, will remove them next.
-
-	* LambdaExpression.cs (Compile): Create the delegate last, so we
-	manage to save the assembly while debugging in case of error
-
-2008-01-21  Miguel de Icaza  <[email protected]>
-
-	* Expression.cs (BinaryCoreCheck): Add checking for a few
-	operators here (to avoid doing a second pass, handles AndAlso and
-	OrElse).
-
-	(AndAlso, OrElse): Add some code.
-
-	* BinaryExpression.cs: Instead of using GetValueOrDefault use
-	get_Value, as we already probed for the lack of value.
-
-	Split out support for And/Or to a separate routine as the code is
-	not very easy to share with the arithmetics code.
-
-2008-01-21  Marek Safar  <[email protected]>
-
-	* BinaryExpression.cs: Fixed initobj initialization.
-
-2008-01-21  Jb Evain  <[email protected]>
-
-	* Expression.cs, UnaryExpression.cs, BinaryExpression.cs:
-	Move the IsUnsigned helper from BinaryExpression to Expression,
-	so it can be used in UnaryExpression.
-
-2008-01-21  Miguel de Icaza  <[email protected]>
-
-	* Start code generation for nullables, currently this generates
-	incorrect code for things like:
-
-	Expression<Func<int?, int?, int?>> e2 = (a, b) => a + b;
-	e2.Compile ().Invoke (null, 3))
-
-	This should return null, but returns something else.
-
-	* Introduce LINQ_DBG env variable, which generates a linq file in
-	/tmp;   It currently does not work as well as it should, as the
-	Func<> parameters do not mwatch the generated method.
-	Investigate.
-
-
-2008-01-20  Miguel de Icaza  <[email protected]>
-
-	Introduce support for Nullable arguments, no code is generated for
-	these yet, its only tests + node creation behavior at this point.
-
-	* Expression.cs (BinaryCoreCheck): Do not allow "int?" and "int"
-	as operators, they must both be nullable.
-
-	NullableTypes in the arguments are transformed into the underlying
-	values when doing the method validation.
-
-2008-01-18  Miguel de Icaza  <[email protected]>
-
-	* ParameterExpression.cs: Add emit support.
-
-2008-01-18  Jb Evain  <[email protected]>
-
-	* Expression[Printer|Visitor].cs: implement UnaryPlus, Not, Negate.
-
-2008-01-18  Miguel de Icaza  <[email protected]>
-
-	* BinaryExpression.cs: Add support for emitting code for some
-	operators (ported from the Mono C# compiler).
-
-	Add tests.
-
-2008-01-17  Miguel de Icaza  <[email protected]>
-
-	Beginning of code generation framework for Linq.Expressions.
-	Some code was borrowed by from the C# compiler
-
-	* Expression_T.cs: Fill in the blanks.
-
-	* LambdaExpression.cs: Validation of parameters mostly, a tiny bit
-	of codegen.
-
-	* ConstantExpression.cs: Mostly done, need to write tests for
-	non-fundamental types and other ValueType initializations.
-
-2008-01-17  Jb Evain  <[email protected]>
-
-	* Expression.cs: implement MakeMemberAccess.
-
-2008-01-17  Jb Evain  <[email protected]>
-
-	* Expression.cs, ExpressionPrinter.cs, BinaryExpression.cs:
-	implement ArrayIndex.
-
-2008-01-17  Jb Evain  <[email protected]>
-
-	* Expression.cs: Use TypeCode for IsInt and IsNumber.
-
-2008-01-16  Miguel de Icaza  <[email protected]>
-
-	* Expression.cs: Add support for user-defined operators.
-
-	Put back various binary operator tests.
-
-2008-01-16  Jb Evain  <[email protected]>
-
-	* Expression.cs, ExpressionPrinter.cs: fix call for static methods.
-
-2008-01-15  Miguel de Icaza  <[email protected]>
-
-	* Expression.cs: Do validation on the method parameters and use
-	the return type if provided.
-
-2008-01-15  Jb Evain  <[email protected]>
-
-	* MethodCallExpression.cs, Expression.cs
-	ExpressionPrinter.cs: Implement Call (Expression, ...)
-
-2008-01-15  Jb Evain  <[email protected]>
-
-	* Expression.cs, ConditionalExpressionExpression.cs
-	ExpressionPrinter.cs : implement Expression.Condition.
-
-2008-01-15  Jb Evain  <[email protected]>
-
-	* Expression.cs,
-	ParameterExpression.cs,
-	ExpressionPrinter.cs: implement Expression.Parameter
-
-2008-01-15  Jb Evain  <[email protected]>
-
-	* ExpressionPrinter.cs (VisitBinaryExpression): simple
-	implementation (probably misses a few cases).
-
-2008-01-14  Miguel de Icaza  <[email protected]>
-
-	* Expression.cs: Bring back the (most) of binary operators.  Added
-	type checking as well and reorganized the source file by topic
-	instead of alphabetical sorting.
-
-2008-01-14  Jb Evain  <[email protected]>
-
-	* ExpressionPrinter.cs: print ArrayLength.
-
-2008-01-14  Jb Evain  <[email protected]>
-
-	* Expression.cs: TypeAs can't take value types.
-	* ExpressionPrinter.cs: implement TypeAs.
-
-2008-01-14  Jb Evain  <[email protected]>
-
-	* Expression.cs: implement TypeIs.
-	* ExpressionPrinter.cs: implement VisitTypeBinaryExpression.
-	* TypeBinaryExpression.cs: add proper ctor.
-
-2008-01-14  Jb Evain  <[email protected]>
-
-	* Expression.cs, ExpressionPrinter.cs: fix for Quote's type.
-
-2008-01-14  Jb Evain  <[email protected]>
-
-	* BinaryExpression.cs,
-	* Expression.cs: revert part of Miguel's last patch.
-	MakeBinary is expected to call the appropriate factory
-	methods. Whose methods that are responsible for creating
-	the good BinaryExpression, wether they use a custom method
-	or not.
-
-2008-01-14  Jb Evain  <[email protected]>
-
-	* Expression.cs: MakeUnary is expected to call the appropriate
-	factory methods.
-
-2008-01-14  Miguel de Icaza  <[email protected]>
-
-	* Expression.cs (Constant, MakeBinary and consumers of it): Some
-	more fill-up changes.
-
-	MakeBinary will need much more work to support user-provided
-	types.
-
-2008-01-13  Jb Evain  <[email protected]>
-
-	* *.cs: fresh implementation.

+ 0 - 82
mcs/class/System.Core/System.Linq.Expressions/ConditionalExpression.cs

@@ -1,82 +0,0 @@
-//
-// ConditionalExpression.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-
-namespace System.Linq.Expressions {
-
-	public sealed class ConditionalExpression : Expression {
-
-		Expression test;
-		Expression if_true;
-		Expression if_false;
-
-		public Expression Test {
-			get { return test; }
-		}
-
-		public Expression IfTrue {
-			get { return if_true; }
-		}
-
-		public Expression IfFalse {
-			get { return if_false; }
-		}
-
-		internal ConditionalExpression (Expression test, Expression if_true, Expression if_false)
-			: base (ExpressionType.Conditional, if_true.Type)
-		{
-			this.test = test;
-			this.if_true = if_true;
-			this.if_false = if_false;
-		}
-
-#if !FULL_AOT_RUNTIME
-		internal override void Emit (EmitContext ec)
-		{
-			var ig = ec.ig;
-			var false_target = ig.DefineLabel ();
-			var end_target = ig.DefineLabel ();
-
-			test.Emit (ec);
-			ig.Emit (OpCodes.Brfalse, false_target);
-
-			if_true.Emit (ec);
-			ig.Emit (OpCodes.Br, end_target);
-
-			ig.MarkLabel (false_target);
-			if_false.Emit (ec);
-
-			ig.MarkLabel (end_target);
-		}
-#endif
-	}
-}

+ 0 - 204
mcs/class/System.Core/System.Linq.Expressions/ConstantExpression.cs

@@ -1,204 +0,0 @@
-//
-// ConstantExpression.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//   Miguel de Icaza ([email protected])
-//
-// Some code is based on the Mono C# compiler:
-//   Marek Safar ([email protected])
-//   Martin Baulig ([email protected])
-//
-// (C) 2001-2008 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;
-using System.Reflection;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-
-namespace System.Linq.Expressions {
-
-	public sealed class ConstantExpression : Expression {
-		object value;
-
-		public object Value {
-			get { return value; }
-		}
-
-		internal ConstantExpression (object value, Type type)
-			: base (ExpressionType.Constant, type)
-		{
-			this.value = value;
-		}
-		
-		internal static bool IsNull (Expression e)
-		{
-			var c = e as ConstantExpression;
-			return c != null && c.value == null;
-		}
-
-#if !FULL_AOT_RUNTIME
-		internal override void Emit (EmitContext ec)
-		{
-			if (Type.IsNullable ()) {
-				EmitNullableConstant (ec, Type, value);
-				return;
-			}
-
-			EmitConstant (ec, Type, value);
-		}
-
-		void EmitNullableConstant (EmitContext ec, Type type, object value)
-		{
-			if (value == null) {
-				var local = ec.ig.DeclareLocal (type);
-				ec.EmitNullableInitialize (local);
-			} else {
-				EmitConstant (ec, type.GetFirstGenericArgument (), value);
-				ec.EmitNullableNew (type);
-			}
-		}
-
-		void EmitConstant (EmitContext ec, Type type, object value)
-		{
-			var ig = ec.ig;
-
-			switch (Type.GetTypeCode (type)){
-			case TypeCode.Byte:
-				ig.Emit (OpCodes.Ldc_I4, (int) ((byte)value));
-				return;
-
-			case TypeCode.SByte:
-				ig.Emit (OpCodes.Ldc_I4, (int) ((sbyte)value));
-				return;
-
-			case TypeCode.Int16:
-				ig.Emit (OpCodes.Ldc_I4, (int) ((short)value));
-				return;
-
-			case TypeCode.UInt16:
-				ig.Emit (OpCodes.Ldc_I4, (int) ((ushort)value));
-				return;
-
-			case TypeCode.Int32:
-				ig.Emit (OpCodes.Ldc_I4, (int) value);
-				return;
-
-			case TypeCode.UInt32:
-				ig.Emit (OpCodes.Ldc_I4, unchecked ((int) ((uint)Value)));
-				return;
-
-			case TypeCode.Int64:
-				ig.Emit (OpCodes.Ldc_I8, (long) value);
-				return;
-
-			case TypeCode.UInt64:
-				ig.Emit (OpCodes.Ldc_I8, unchecked ((long) ((ulong)value)));
-				return;
-
-			case TypeCode.Boolean:
-				if ((bool) Value)
-					ig.Emit (OpCodes.Ldc_I4_1);
-				else
-					ec.ig.Emit (OpCodes.Ldc_I4_0);
-				return;
-
-			case TypeCode.Char:
-				ig.Emit (OpCodes.Ldc_I4, (int) ((char) value));
-				return;
-
-			case TypeCode.Single:
-				ig.Emit (OpCodes.Ldc_R4, (float) value);
-				return;
-
-			case TypeCode.Double:
-				ig.Emit (OpCodes.Ldc_R8, (double) value);
-				return;
-
-			case TypeCode.Decimal: {
-				Decimal v = (decimal) value;
-				int [] words = Decimal.GetBits (v);
-				int power = (words [3] >> 16) & 0xff;
-				Type ti = typeof (int);
-
-				if (power == 0 && v <= int.MaxValue && v >= int.MinValue) {
-					ig.Emit (OpCodes.Ldc_I4, (int) v);
-
-					ig.Emit (OpCodes.Newobj, typeof (Decimal).GetConstructor (new Type [1] { ti }));
-					return;
-				}
-				ig.Emit (OpCodes.Ldc_I4, words [0]);
-				ig.Emit (OpCodes.Ldc_I4, words [1]);
-				ig.Emit (OpCodes.Ldc_I4, words [2]);
-				// sign
-				ig.Emit (OpCodes.Ldc_I4, words [3] >> 31);
-
-				// power
-				ig.Emit (OpCodes.Ldc_I4, power);
-
-				ig.Emit (OpCodes.Newobj, typeof (Decimal).GetConstructor (new Type [5] { ti, ti, ti, typeof(bool), typeof(byte) }));
-				return;
-			}
-
-			case TypeCode.DateTime: {
-				var date = (DateTime) value;
-				var local = ig.DeclareLocal (typeof (DateTime));
-
-				ig.Emit (OpCodes.Ldloca, local);
-				ig.Emit (OpCodes.Ldc_I8, date.Ticks);
-				ig.Emit (OpCodes.Ldc_I4, (int) date.Kind);
-				ig.Emit (OpCodes.Call, typeof (DateTime).GetConstructor (new [] { typeof (long), typeof (DateTimeKind) }));
-				ig.Emit (OpCodes.Ldloc, local);
-
-				return;
-			}
-
-			case TypeCode.DBNull:
-				ig.Emit (OpCodes.Ldsfld, typeof (DBNull).GetField ("Value", BindingFlags.Public | BindingFlags.Static));
-				return;
-
-			case TypeCode.String:
-				EmitIfNotNull (ec, c => c.ig.Emit (OpCodes.Ldstr, (string) value));
-				return;
-
-			case TypeCode.Object:
-				EmitIfNotNull (ec, c => c.EmitReadGlobal (value));
-				return;
-			}
-
-			throw new NotImplementedException (String.Format ("No support for constants of type {0} yet", Type));
-		}
-
-		void EmitIfNotNull (EmitContext ec, Action<EmitContext> emit)
-		{
-			if (value == null) {
-				ec.ig.Emit (OpCodes.Ldnull);
-				return;
-			}
-
-			emit (ec);
-		}
-#endif
-	}
-}

+ 0 - 78
mcs/class/System.Core/System.Linq.Expressions/ElementInit.cs

@@ -1,78 +0,0 @@
-//
-// ElementInit.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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;
-using System.Collections.ObjectModel;
-using System.Reflection;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-
-namespace System.Linq.Expressions {
-
-	public sealed class ElementInit {
-
-		MethodInfo add_method;
-		ReadOnlyCollection<Expression> arguments;
-
-		public MethodInfo AddMethod {
-			get { return add_method; }
-		}
-
-		public ReadOnlyCollection<Expression> Arguments {
-			get { return arguments; }
-		}
-
-		internal ElementInit (MethodInfo add_method, ReadOnlyCollection<Expression> arguments)
-		{
-			this.add_method = add_method;
-			this.arguments = arguments;
-		}
-
-		public override string ToString ()
-		{
-			return ExpressionPrinter.ToString (this);
-		}
-
-#if !FULL_AOT_RUNTIME
-		void EmitPopIfNeeded (EmitContext ec)
-		{
-			if (add_method.ReturnType == typeof (void))
-				return;
-
-			ec.ig.Emit (OpCodes.Pop);
-		}
-
-		internal void Emit (EmitContext ec, LocalBuilder local)
-		{
-			ec.EmitCall (local, arguments, add_method);
-			EmitPopIfNeeded (ec);
-		}
-#endif
-	}
-}

+ 0 - 610
mcs/class/System.Core/System.Linq.Expressions/EmitContext.cs

@@ -1,610 +0,0 @@
-//
-// EmitContext.cs
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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.
-//
-
-#if !FULL_AOT_RUNTIME
-using System;
-using System.Collections.ObjectModel;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Reflection.Emit;
-using System.Runtime.CompilerServices;
-
-namespace System.Linq.Expressions {
-
-	class CompilationContext {
-
-		class ParameterReplacer : ExpressionTransformer {
-
-			CompilationContext context;
-			ExecutionScope scope;
-			object [] locals;
-
-			public ParameterReplacer (CompilationContext context, ExecutionScope scope, object [] locals)
-			{
-				this.context = context;
-				this.scope = scope;
-				this.locals = locals;
-			}
-
-			protected override Expression VisitParameter (ParameterExpression parameter)
-			{
-				var scope = this.scope;
-				var locals = this.locals;
-
-				while (scope != null) {
-					int position = IndexOfHoistedLocal (scope, parameter);
-					if (position != -1)
-						return ReadHoistedLocalFromArray (locals, position);
-
-					locals = scope.Locals;
-					scope = scope.Parent;
-				}
-
-				return parameter;
-			}
-
-			Expression ReadHoistedLocalFromArray (object [] locals, int position)
-			{
-				return Expression.Field (
-					Expression.Convert (
-						Expression.ArrayIndex (
-							Expression.Constant (locals),
-							Expression.Constant (position)),
-						locals [position].GetType ()),
-					"Value");
-			}
-
-			int IndexOfHoistedLocal (ExecutionScope scope, ParameterExpression parameter)
-			{
-				return context.units [scope.compilation_unit].IndexOfHoistedLocal (parameter);
-			}
-		}
-
-		class HoistedVariableDetector : ExpressionVisitor {
-
-			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);
-			}
-		}
-
-		List<object> globals = new List<object> ();
-		List<EmitContext> units = new List<EmitContext> ();
-		Dictionary<LambdaExpression, List<ParameterExpression>> hoisted_map;
-
-		public int AddGlobal (object global)
-		{
-			return AddItemToList (global, globals);
-		}
-
-		public object [] GetGlobals ()
-		{
-			return globals.ToArray ();
-		}
-
-		static int AddItemToList<T> (T item, IList<T> list)
-		{
-			list.Add (item);
-			return list.Count - 1;
-		}
-
-		public int AddCompilationUnit (LambdaExpression lambda)
-		{
-			DetectHoistedVariables (lambda);
-			return AddCompilationUnit (null, lambda);
-		}
-
-		public int AddCompilationUnit (EmitContext parent, LambdaExpression lambda)
-		{
-			var context = new EmitContext (this, parent, lambda);
-			var unit = AddItemToList (context, units);
-			context.Emit ();
-			return unit;
-		}
-
-		void DetectHoistedVariables (LambdaExpression lambda)
-		{
-			hoisted_map = new HoistedVariableDetector ().Process (lambda);
-		}
-
-		public List<ParameterExpression> GetHoistedLocals (LambdaExpression lambda)
-		{
-			if (hoisted_map == null)
-				return null;
-
-			List<ParameterExpression> hoisted;
-			hoisted_map.TryGetValue (lambda, out hoisted);
-			return hoisted;
-		}
-
-		public object [] CreateHoistedLocals (int unit)
-		{
-			var hoisted = GetHoistedLocals (units [unit].Lambda);
-			return new object [hoisted == null ? 0 : hoisted.Count];
-		}
-
-		public Expression IsolateExpression (ExecutionScope scope, object [] locals, Expression expression)
-		{
-			return new ParameterReplacer (this, scope, locals).Transform (expression);
-		}
-
-		public Delegate CreateDelegate ()
-		{
-			return CreateDelegate (0, new ExecutionScope (this));
-		}
-
-		public Delegate CreateDelegate (int unit, ExecutionScope scope)
-		{
-			return units [unit].CreateDelegate (scope);
-		}
-	}
-
-	class EmitContext {
-
-		CompilationContext context;
-		EmitContext parent;
-		LambdaExpression lambda;
-		DynamicMethod method;
-		LocalBuilder hoisted_store;
-		List<ParameterExpression> hoisted;
-
-		public readonly ILGenerator ig;
-
-		public bool HasHoistedLocals {
-			get { return hoisted != null && hoisted.Count > 0; }
-		}
-
-		public LambdaExpression Lambda {
-			get { return lambda; }
-		}
-
-		public EmitContext (CompilationContext context, EmitContext parent, LambdaExpression lambda)
-		{
-			this.context = context;
-			this.parent = parent;
-			this.lambda = lambda;
-			this.hoisted = context.GetHoistedLocals (lambda);
-
-			method = new DynamicMethod (
-				"lambda_method",
-				lambda.GetReturnType (),
-				CreateParameterTypes (lambda.Parameters),
-				typeof (ExecutionScope),
-				true);
-
-			ig = method.GetILGenerator ();
-		}
-
-		public void Emit ()
-		{
-			if (HasHoistedLocals)
-				EmitStoreHoistedLocals ();
-
-			lambda.EmitBody (this);
-		}
-
-		static Type [] CreateParameterTypes (IList<ParameterExpression> parameters)
-		{
-			var types = new Type [parameters.Count + 1];
-			types [0] = typeof (ExecutionScope);
-
-			for (int i = 0; i < parameters.Count; i++)
-				types [i + 1] = parameters [i].Type;
-
-			return types;
-		}
-
-		public bool IsLocalParameter (ParameterExpression parameter, ref int position)
-		{
-			position = lambda.Parameters.IndexOf (parameter);
-			if (position > -1) {
-				position++;
-				return true;
-			}
-
-			return false;
-		}
-
-		public Delegate CreateDelegate (ExecutionScope scope)
-		{
-			return method.CreateDelegate (lambda.Type, scope);
-		}
-
-		public void Emit (Expression expression)
-		{
-			expression.Emit (this);
-		}
-
-		public LocalBuilder EmitStored (Expression expression)
-		{
-			var local = ig.DeclareLocal (expression.Type);
-			expression.Emit (this);
-			ig.Emit (OpCodes.Stloc, local);
-
-			return local;
-		}
-
-		public void EmitLoadAddress (Expression expression)
-		{
-			ig.Emit (OpCodes.Ldloca, EmitStored (expression));
-		}
-
-		public void EmitLoadEnum (Expression expression)
-		{
-			expression.Emit (this);
-			ig.Emit (OpCodes.Box, expression.Type);
-		}
-
-		public void EmitLoadEnum (LocalBuilder local)
-		{
-			ig.Emit (OpCodes.Ldloc, local);
-			ig.Emit (OpCodes.Box, local.LocalType);
-		}
-
-		public void EmitLoadSubject (Expression expression)
-		{
-			if (expression.Type.IsEnum) {
-				EmitLoadEnum (expression);
-				return;
-			}
-
-			if (expression.Type.IsValueType) {
-				EmitLoadAddress (expression);
-				return;
-			}
-
-			Emit (expression);
-		}
-
-		public void EmitLoadSubject (LocalBuilder local)
-		{
-			if (local.LocalType.IsEnum) {
-				EmitLoadEnum (local);
-				return;
-			}
-
-			if (local.LocalType.IsValueType) {
-				EmitLoadAddress (local);
-				return;
-			}
-
-			EmitLoad (local);
-		}
-
-		public void EmitLoadAddress (LocalBuilder local)
-		{
-			ig.Emit (OpCodes.Ldloca, local);
-		}
-
-		public void EmitLoad (LocalBuilder local)
-		{
-			ig.Emit (OpCodes.Ldloc, local);
-		}
-
-		public void EmitCall (LocalBuilder local, IList<Expression> arguments, MethodInfo method)
-		{
-			EmitLoadSubject (local);
-			EmitArguments (method, arguments);
-			EmitCall (method);
-		}
-
-		public void EmitCall (LocalBuilder local, MethodInfo method)
-		{
-			EmitLoadSubject (local);
-			EmitCall (method);
-		}
-
-		public void EmitCall (Expression expression, MethodInfo method)
-		{
-			if (!method.IsStatic)
-				EmitLoadSubject (expression);
-
-			EmitCall (method);
-		}
-
-		public void EmitCall (Expression expression, IList<Expression> arguments, MethodInfo method)
-		{
-			if (!method.IsStatic)
-				EmitLoadSubject (expression);
-
-			EmitArguments (method, arguments);
-			EmitCall (method);
-		}
-
-		void EmitArguments (MethodInfo method, IList<Expression> arguments)
-		{
-			var parameters = method.GetParameters ();
-
-			for (int i = 0; i < parameters.Length; i++) {
-				var parameter = parameters [i];
-				var argument = arguments [i];
-
-				if (parameter.ParameterType.IsByRef) {
-					ig.Emit (OpCodes.Ldloca, EmitStored (argument));
-					continue;
-				}
-
-				Emit (arguments [i]);
-			}
-		}
-
-		public void EmitCall (MethodInfo method)
-		{
-			ig.Emit (
-				method.IsVirtual ? OpCodes.Callvirt : OpCodes.Call,
-				method);
-		}
-
-		public void EmitNullableHasValue (LocalBuilder local)
-		{
-			EmitCall (local, "get_HasValue");
-		}
-
-		public void EmitNullableInitialize (LocalBuilder local)
-		{
-			ig.Emit (OpCodes.Ldloca, local);
-			ig.Emit (OpCodes.Initobj, local.LocalType);
-			ig.Emit (OpCodes.Ldloc, local);
-		}
-
-		public void EmitNullableGetValue (LocalBuilder local)
-		{
-			EmitCall (local, "get_Value");
-		}
-
-		public void EmitNullableGetValueOrDefault (LocalBuilder local)
-		{
-			EmitCall (local, "GetValueOrDefault");
-		}
-
-		void EmitCall (LocalBuilder local, string method_name)
-		{
-			EmitCall (local, local.LocalType.GetMethod (method_name, Type.EmptyTypes));
-		}
-
-		public void EmitNullableNew (Type of)
-		{
-			ig.Emit (OpCodes.Newobj, of.GetConstructor (new [] { of.GetFirstGenericArgument () }));
-		}
-
-		public void EmitCollection<T> (IEnumerable<T> collection) where T : Expression
-		{
-			foreach (var expression in collection)
-				expression.Emit (this);
-		}
-
-		public void EmitCollection (IEnumerable<ElementInit> initializers, LocalBuilder local)
-		{
-			foreach (var initializer in initializers)
-				initializer.Emit (this, local);
-		}
-
-		public void EmitCollection (IEnumerable<MemberBinding> bindings, LocalBuilder local)
-		{
-			foreach (var binding in bindings)
-				binding.Emit (this, local);
-		}
-
-		public void EmitIsInst (Expression expression, Type candidate)
-		{
-			expression.Emit (this);
-
-			var type = expression.Type;
-
-			if (type.IsValueType)
-				ig.Emit (OpCodes.Box, type);
-
-			ig.Emit (OpCodes.Isinst, candidate);
-		}
-
-		public void EmitScope ()
-		{
-			ig.Emit (OpCodes.Ldarg_0);
-		}
-
-		public void EmitReadGlobal (object global)
-		{
-			EmitReadGlobal (global, global.GetType ());
-		}
-
-		public void EmitLoadGlobals ()
-		{
-			EmitScope ();
-
-			ig.Emit (OpCodes.Ldfld, typeof (ExecutionScope).GetField ("Globals"));
-		}
-
-		public void EmitReadGlobal (object global, Type type)
-		{
-			EmitLoadGlobals ();
-
-			ig.Emit (OpCodes.Ldc_I4, AddGlobal (global, type));
-			ig.Emit (OpCodes.Ldelem, typeof (object));
-
-			EmitLoadStrongBoxValue (type);
-		}
-
-		public void EmitLoadStrongBoxValue (Type type)
-		{
-			var strongbox = type.MakeStrongBoxType ();
-
-			ig.Emit (OpCodes.Isinst, strongbox);
-			ig.Emit (OpCodes.Ldfld, strongbox.GetField ("Value"));
-		}
-
-		int AddGlobal (object value, Type type)
-		{
-			return context.AddGlobal (CreateStrongBox (value, type));
-		}
-
-		public void EmitCreateDelegate (LambdaExpression lambda)
-		{
-			EmitScope ();
-
-			ig.Emit (OpCodes.Ldc_I4, AddChildContext (lambda));
-			if (hoisted_store != null)
-				ig.Emit (OpCodes.Ldloc, hoisted_store);
-			else
-				ig.Emit (OpCodes.Ldnull);
-
-			ig.Emit (OpCodes.Callvirt, typeof (ExecutionScope).GetMethod ("CreateDelegate"));
-
-			ig.Emit (OpCodes.Castclass, lambda.Type);
-		}
-
-		void EmitStoreHoistedLocals ()
-		{
-			EmitHoistedLocalsStore ();
-			for (int i = 0; i < hoisted.Count; i++)
-				EmitStoreHoistedLocal (i, hoisted [i]);
-		}
-
-		void EmitStoreHoistedLocal (int position, ParameterExpression parameter)
-		{
-			ig.Emit (OpCodes.Ldloc, hoisted_store);
-			ig.Emit (OpCodes.Ldc_I4, position);
-			parameter.Emit (this);
-			EmitCreateStrongBox (parameter.Type);
-			ig.Emit (OpCodes.Stelem, typeof (object));
-		}
-
-		public void EmitLoadHoistedLocalsStore ()
-		{
-			ig.Emit (OpCodes.Ldloc, hoisted_store);
-		}
-
-		void EmitCreateStrongBox (Type type)
-		{
-			ig.Emit (OpCodes.Newobj, type.MakeStrongBoxType ().GetConstructor (new [] { type }));
-		}
-
-		void EmitHoistedLocalsStore ()
-		{
-			EmitScope ();
-			hoisted_store = ig.DeclareLocal (typeof (object []));
-			ig.Emit (OpCodes.Callvirt, typeof (ExecutionScope).GetMethod ("CreateHoistedLocals"));
-			ig.Emit (OpCodes.Stloc, hoisted_store);
-		}
-
-		public void EmitLoadLocals ()
-		{
-			ig.Emit (OpCodes.Ldfld, typeof (ExecutionScope).GetField ("Locals"));
-		}
-
-		public void EmitParentScope ()
-		{
-			ig.Emit (OpCodes.Ldfld, typeof (ExecutionScope).GetField ("Parent"));
-		}
-
-		public void EmitIsolateExpression ()
-		{
-			ig.Emit (OpCodes.Callvirt, typeof (ExecutionScope).GetMethod ("IsolateExpression"));
-		}
-
-		public int IndexOfHoistedLocal (ParameterExpression parameter)
-		{
-			if (!HasHoistedLocals)
-				return -1;
-
-			return hoisted.IndexOf (parameter);
-		}
-
-		public bool IsHoistedLocal (ParameterExpression parameter, ref int level, ref int position)
-		{
-			if (parent == null)
-				return false;
-
-			if (parent.hoisted != null) {
-				position = parent.hoisted.IndexOf (parameter);
-				if (position > -1)
-					return true;
-			}
-
-			level++;
-
-			return parent.IsHoistedLocal (parameter, ref level, ref position);
-		}
-
-		int AddChildContext (LambdaExpression lambda)
-		{
-			return context.AddCompilationUnit (this, lambda);
-		}
-
-		static object CreateStrongBox (object value, Type type)
-		{
-			return Activator.CreateInstance (
-				type.MakeStrongBoxType (), value);
-		}
-	}
-}
-#endif

+ 0 - 2288
mcs/class/System.Core/System.Linq.Expressions/Expression.cs

@@ -1,2288 +0,0 @@
-//
-// Expression.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2008 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;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-
-namespace System.Linq.Expressions {
-
-	public abstract class Expression {
-
-		ExpressionType node_type;
-		Type type;
-
-		internal const BindingFlags PublicInstance = BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy;
-		internal const BindingFlags NonPublicInstance = BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy;
-		internal const BindingFlags PublicStatic = BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy;
-		internal const BindingFlags AllInstance = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy;
-		internal const BindingFlags AllStatic = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy;
-		internal const BindingFlags All = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance | BindingFlags.FlattenHierarchy;
-
-		public virtual ExpressionType NodeType {
-			get { return node_type; }
-		}
-
-		public virtual Type Type {
-			get { return type; }
-		}
-
-		protected Expression (ExpressionType node_type, Type type)
-		{
-			this.node_type = node_type;
-			this.type = type;
-		}
-
-		public override string ToString ()
-		{
-			return ExpressionPrinter.ToString (this);
-		}
-
-		#region Binary Expressions
-
-		static MethodInfo GetUnaryOperator (string oper_name, Type declaring, Type param)
-		{
-			return GetUnaryOperator (oper_name, declaring, param, null);
-		}
-
-		static MethodInfo GetUnaryOperator (string oper_name, Type declaring, Type param, Type ret)
-		{
-			var methods = declaring.GetNotNullableType ().GetMethods (PublicStatic);
-
-			foreach (var method in methods) {
-				if (method.Name != oper_name)
-					continue;
-
-				var parameters = method.GetParameters ();
-				if (parameters.Length != 1)
-					continue;
-
-				if (method.IsGenericMethod)
-					continue;
-
-				if (!IsAssignableToParameterType (param.GetNotNullableType (), parameters [0]))
-					continue;
-
-				if (ret != null && method.ReturnType != ret.GetNotNullableType ())
-					continue;
-
-				return method;
-			}
-
-			return null;
-		}
-
-		internal static MethodInfo GetTrueOperator (Type self)
-		{
-			return GetBooleanOperator ("op_True", self);
-		}
-
-		internal static MethodInfo GetFalseOperator (Type self)
-		{
-			return GetBooleanOperator ("op_False", self);
-		}
-
-		static MethodInfo GetBooleanOperator (string op, Type self)
-		{
-			return GetUnaryOperator (op, self, self, typeof (bool));
-		}
-
-		static bool IsAssignableToParameterType (Type type, ParameterInfo param)
-		{
-			var ptype = param.ParameterType;
-			if (ptype.IsByRef)
-				ptype = ptype.GetElementType ();
-
-			return type.GetNotNullableType ().IsAssignableTo (ptype);
-		}
-
-		static MethodInfo CheckUnaryMethod (MethodInfo method, Type param)
-		{
-			if (method.ReturnType == typeof (void))
-				throw new ArgumentException ("Specified method must return a value", "method");
-
-			if (!method.IsStatic)
-				throw new ArgumentException ("Method must be static", "method");
-
-			var parameters = method.GetParameters ();
-
-			if (parameters.Length != 1)
-				throw new ArgumentException ("Must have only one parameters", "method");
-
-			if (!IsAssignableToParameterType (param.GetNotNullableType (), parameters [0]))
-				throw new InvalidOperationException ("left-side argument type does not match expression type");
-
-			return method;
-		}
-
-		static MethodInfo UnaryCoreCheck (string oper_name, Expression expression, MethodInfo method, Func<Type, bool> validator)
-		{
-			if (expression == null)
-				throw new ArgumentNullException ("expression");
-
-			if (method != null)
-				return CheckUnaryMethod (method, expression.Type);
-
-			var type = expression.Type.GetNotNullableType ();
-
-				if (validator (type))
-					return null;
-
-				if (oper_name != null) {
-					method = GetUnaryOperator (oper_name, type, expression.Type);
-					if (method != null)
-						return method;
-				}
-
-				throw new InvalidOperationException (
-					string.Format ("Operation {0} not defined for {1}", oper_name != null ? oper_name.Substring (3) : "is", expression.Type));
-		}
-
-		static MethodInfo GetBinaryOperator (string oper_name, Type on_type, Expression left, Expression right)
-		{
-			MethodInfo [] methods = on_type.GetMethods (PublicStatic);
-
-			foreach (var method in methods) {
-				if (method.Name != oper_name)
-					continue;
-
-				var parameters = method.GetParameters ();
-				if (parameters.Length != 2)
-					continue;
-
-				if (method.IsGenericMethod)
-					continue;
-
-				if (!IsAssignableToParameterType (left.Type, parameters [0]))
-					continue;
-
-				if (!IsAssignableToParameterType (right.Type, parameters [1]))
-					continue;
-
-				// Method has papers in order.
-				return method;
-			}
-
-			return null;
-		}
-
-		//
-		// Performs basic checks on the incoming expressions for binary expressions
-		// and any provided MethodInfo.
-		//
-		static MethodInfo BinaryCoreCheck (string oper_name, Expression left, Expression right, MethodInfo method)
-		{
-			if (left == null)
-				throw new ArgumentNullException ("left");
-			if (right == null)
-				throw new ArgumentNullException ("right");
-
-			if (method != null){
-				if (method.ReturnType == typeof (void))
-					throw new ArgumentException ("Specified method must return a value", "method");
-
-				if (!method.IsStatic)
-					throw new ArgumentException ("Method must be static", "method");
-
-				var parameters = method.GetParameters ();
-
-				if (parameters.Length != 2)
-					throw new ArgumentException ("Must have only two parameters", "method");
-
-				if (!IsAssignableToParameterType (left.Type, parameters [0]))
-					throw new InvalidOperationException ("left-side argument type does not match left expression type");
-
-				if (!IsAssignableToParameterType (right.Type, parameters [1]))
-					throw new InvalidOperationException ("right-side argument type does not match right expression type");
-
-				return method;
-			} else {
-				Type ltype = left.Type;
-				Type rtype = right.Type;
-				Type ultype = ltype.GetNotNullableType ();
-				Type urtype = rtype.GetNotNullableType ();
-
-				if (oper_name == "op_BitwiseOr" || oper_name == "op_BitwiseAnd") {
-					if (ultype == typeof (bool)) {
-						if (ultype == urtype && ltype == rtype)
-							return null;
-					}
-				}
-
-				// Use IsNumber to avoid expensive reflection.
-				if (IsNumber (ultype)) {
-					if (ultype == urtype && ltype == rtype)
-						return null;
-
-					if (oper_name != null){
-						method = GetBinaryOperator (oper_name, urtype, left, right);
-						if (method != null)
-							return method;
-					}
-				}
-
-				if (oper_name != null){
-					method = GetBinaryOperator (oper_name, ultype, left, right);
-					if (method != null)
-						return method;
-				}
-
-				if (oper_name == "op_Equality" || oper_name == "op_Inequality") {
-					//
-					// == and != allow reference types without operators defined.
-					//
-					if (!ltype.IsValueType && !rtype.IsValueType)
-						return null;
-
-					if (ltype == rtype && ultype.IsEnum)
-						return null;
-
-					if (ltype == rtype && (ultype == typeof (bool) || ultype == typeof (char)))
-						return null;
-
-					if (ltype.IsNullable () && ConstantExpression.IsNull (right) && !ConstantExpression.IsNull (left))
-						return null;
-
-					if (rtype.IsNullable () && ConstantExpression.IsNull (left) && !ConstantExpression.IsNull (right))
-						return null;
-				}
-
-				if (oper_name == "op_LeftShift" || oper_name == "op_RightShift") {
-					if (IsInt (ultype) && urtype == typeof (int))
-						return null;
-				}
-
-				throw new InvalidOperationException (
-					String.Format ("Operation {0} not defined for {1} and {2}", oper_name != null ? oper_name.Substring (3) : "is", ltype, rtype));
-			}
-		}
-
-		//
-		// This is like BinaryCoreCheck, but if no method is used adds the restriction that
-		// only ints and bools are allowed
-		//
-		static MethodInfo BinaryBitwiseCoreCheck (string oper_name, Expression left, Expression right, MethodInfo method)
-		{
-			if (left == null)
-				throw new ArgumentNullException ("left");
-			if (right == null)
-				throw new ArgumentNullException ("right");
-
-			if (method == null) {
-				// avoid reflection shortcut and catches Ints/bools before we check Numbers in general
-				if (left.Type == right.Type && IsIntOrBool (left.Type))
-					return null;
-			}
-
-			method = BinaryCoreCheck (oper_name, left, right, method);
-			if (method == null) {
-				// The check in BinaryCoreCheck allows a bit more than we do
-				// (floats and doubles).  Catch this here
-				if (left.Type == typeof (double) || left.Type == typeof (float))
-					throw new InvalidOperationException ("Types not supported");
-			}
-
-			return method;
-		}
-
-		static BinaryExpression MakeSimpleBinary (ExpressionType et, Expression left, Expression right, MethodInfo method)
-		{
-			bool is_lifted;
-			Type type;
-
-			if (method == null) {
-				is_lifted = left.Type.IsNullable ();
-				type = left.Type;
-			} else {
-				var parameters = method.GetParameters ();
-
-				var lp = parameters [0];
-				var rp = parameters [1];
-
-				if (IsAssignableToOperatorParameter (left, lp) && IsAssignableToOperatorParameter (right, rp)) {
-					is_lifted = false;
-					type = method.ReturnType;
-				} else if (left.Type.IsNullable ()
-					&& right.Type.IsNullable ()
-					&& left.Type.GetNotNullableType () == lp.ParameterType
-					&& right.Type.GetNotNullableType () == rp.ParameterType
-					&& !method.ReturnType.IsNullable ()) {
-
-					is_lifted = true;
-					type = method.ReturnType.MakeNullableType ();
-				} else
-					throw new InvalidOperationException ();
-			}
-
-			return new BinaryExpression (et, type, left, right, is_lifted, is_lifted, method, null);
-		}
-
-		static bool IsAssignableToOperatorParameter (Expression expression, ParameterInfo parameter)
-		{
-			if (expression.Type == parameter.ParameterType)
-				return true;
-
-			if ((!expression.Type.IsNullable () && !parameter.ParameterType.IsNullable ())
-				&& IsAssignableToParameterType (expression.Type, parameter))
-				return true;
-
-			return false;
-		}
-
-		static UnaryExpression MakeSimpleUnary (ExpressionType et, Expression expression, MethodInfo method)
-		{
-			bool is_lifted;
-			Type type;
-
-			if (method == null) {
-				type = expression.Type;
-				is_lifted = type.IsNullable ();
-			} else {
-				var parameter = method.GetParameters () [0];
-
-				if (IsAssignableToOperatorParameter (expression, parameter)) {
-					is_lifted = false;
-					type = method.ReturnType;
-				} else if (expression.Type.IsNullable ()
-					&& expression.Type.GetNotNullableType () == parameter.ParameterType
-					&& !method.ReturnType.IsNullable ()) {
-
-					is_lifted = true;
-					type = method.ReturnType.MakeNullableType ();
-				} else
-					throw new InvalidOperationException ();
-			}
-
-			return new UnaryExpression (et, expression, type, method, is_lifted);
-		}
-
-		static BinaryExpression MakeBoolBinary (ExpressionType et, Expression left, Expression right, bool liftToNull, MethodInfo method)
-		{
-			bool is_lifted;
-			Type type;
-
-			if (method == null) {
-				if (!left.Type.IsNullable () && !right.Type.IsNullable ()) {
-					is_lifted = false;
-					liftToNull = false;
-					type = typeof(bool);
-				} else if (left.Type.IsNullable () && right.Type.IsNullable ()) {
-					is_lifted = true;
-					type = liftToNull ? typeof(bool?) : typeof(bool);
-				} else if (ConstantExpression.IsNull (left) || ConstantExpression.IsNull (right)) {
-					is_lifted = true;
-					type = typeof (bool);
-				} else {			
-					throw new InvalidOperationException ();
-				}
-			} else {
-				var parameters = method.GetParameters ();
-
-				var lp = parameters [0];
-				var rp = parameters [1];
-
-				if (IsAssignableToOperatorParameter (left, lp) && IsAssignableToOperatorParameter (right, rp)) {
-					is_lifted = false;
-					liftToNull = false;
-					type = method.ReturnType;
-				} else if (left.Type.IsNullable ()
-					&& right.Type.IsNullable ()
-					&& left.Type.GetNotNullableType () == lp.ParameterType
-					&& right.Type.GetNotNullableType () == rp.ParameterType) {
-
-					is_lifted = true;
-
-					if (method.ReturnType == typeof (bool))
-						type = liftToNull ? typeof (bool?) : typeof (bool);
-					else if (!method.ReturnType.IsNullable ()) {
-						//
-						// This behavior is not documented: what
-						// happens if the result is not typeof(bool), but
-						// the parameters are nullable: the result
-						// becomes nullable<returntype>
-						//
-						// See:
-						// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=323139
-
-						type = method.ReturnType.MakeNullableType ();
-					} else
-						throw new InvalidOperationException ();
-				} else
-					throw new InvalidOperationException ();
-			}
-
-			return new BinaryExpression (et, type, left, right, liftToNull, is_lifted, method, null);
-		}
-
-		//
-		// Arithmetic
-		//
-		public static BinaryExpression Add (Expression left, Expression right)
-		{
-			return Add (left, right, null);
-		}
-
-		public static BinaryExpression Add (Expression left, Expression right, MethodInfo method)
-		{
-			method = BinaryCoreCheck ("op_Addition", left, right, method);
-
-			return MakeSimpleBinary (ExpressionType.Add, left, right, method);
-		}
-
-		public static BinaryExpression AddChecked (Expression left, Expression right)
-		{
-			return AddChecked (left, right, null);
-		}
-
-		public static BinaryExpression AddChecked (Expression left, Expression right, MethodInfo method)
-		{
-			method = BinaryCoreCheck ("op_Addition", left, right, method);
-
-			// The check in BinaryCoreCheck allows a bit more than we do
-			// (byte, sbyte).  Catch that here
-			if (method == null) {
-				if (left.Type == typeof (byte) || left.Type == typeof (sbyte))
-					throw new InvalidOperationException (String.Format ("AddChecked not defined for {0} and {1}", left.Type, right.Type));
-			}
-
-			return MakeSimpleBinary (ExpressionType.AddChecked, left, right, method);
-		}
-
-		public static BinaryExpression Subtract (Expression left, Expression right)
-		{
-			return Subtract (left, right, null);
-		}
-
-		public static BinaryExpression Subtract (Expression left, Expression right, MethodInfo method)
-		{
-			method = BinaryCoreCheck ("op_Subtraction", left, right, method);
-
-			return MakeSimpleBinary (ExpressionType.Subtract, left, right, method);
-		}
-
-		public static BinaryExpression SubtractChecked (Expression left, Expression right)
-		{
-			return SubtractChecked (left, right, null);
-		}
-
-		public static BinaryExpression SubtractChecked (Expression left, Expression right, MethodInfo method)
-		{
-			method = BinaryCoreCheck ("op_Subtraction", left, right, method);
-
-			// The check in BinaryCoreCheck allows a bit more than we do
-			// (byte, sbyte).  Catch that here
-			if (method == null) {
-				if (left.Type == typeof (byte) || left.Type == typeof (sbyte))
-					throw new InvalidOperationException (String.Format ("SubtractChecked not defined for {0} and {1}", left.Type, right.Type));
-			}
-
-			return MakeSimpleBinary (ExpressionType.SubtractChecked, left, right, method);
-		}
-
-		public static BinaryExpression Modulo (Expression left, Expression right)
-		{
-			return Modulo (left, right, null);
-		}
-
-		public static BinaryExpression Modulo (Expression left, Expression right, MethodInfo method)
-		{
-			method = BinaryCoreCheck ("op_Modulus", left, right, method);
-
-			return MakeSimpleBinary (ExpressionType.Modulo, left, right, method);
-		}
-
-		public static BinaryExpression Multiply (Expression left, Expression right)
-		{
-			return Multiply (left, right, null);
-		}
-
-		public static BinaryExpression Multiply (Expression left, Expression right, MethodInfo method)
-		{
-			method = BinaryCoreCheck ("op_Multiply", left, right, method);
-
-			return MakeSimpleBinary (ExpressionType.Multiply, left, right, method);
-		}
-
-		public static BinaryExpression MultiplyChecked (Expression left, Expression right)
-		{
-			return MultiplyChecked (left, right, null);
-		}
-
-		public static BinaryExpression MultiplyChecked (Expression left, Expression right, MethodInfo method)
-		{
-			method = BinaryCoreCheck ("op_Multiply", left, right, method);
-
-			return MakeSimpleBinary (ExpressionType.MultiplyChecked, left, right, method);
-		}
-
-		public static BinaryExpression Divide (Expression left, Expression right)
-		{
-			return Divide (left, right, null);
-		}
-
-		public static BinaryExpression Divide (Expression left, Expression right, MethodInfo method)
-		{
-			method = BinaryCoreCheck ("op_Division", left, right, method);
-
-			return MakeSimpleBinary (ExpressionType.Divide, left, right, method);
-		}
-
-		public static BinaryExpression Power (Expression left, Expression right)
-		{
-			return Power (left, right, null);
-		}
-
-		public static BinaryExpression Power (Expression left, Expression right, MethodInfo method)
-		{
-			method = BinaryCoreCheck (null, left, right, method);
-
-			if (left.Type.GetNotNullableType () != typeof (double))
-				throw new InvalidOperationException ("Power only supports double arguments");
-
-			return MakeSimpleBinary (ExpressionType.Power, left, right, method);
-		}
-
-		//
-		// Bitwise
-		//
-		public static BinaryExpression And (Expression left, Expression right)
-		{
-			return And (left, right, null);
-		}
-
-		public static BinaryExpression And (Expression left, Expression right, MethodInfo method)
-		{
-			method = BinaryBitwiseCoreCheck ("op_BitwiseAnd", left, right, method);
-
-			return MakeSimpleBinary (ExpressionType.And, left, right, method);
-		}
-
-		public static BinaryExpression Or (Expression left, Expression right)
-		{
-			return Or (left, right, null);
-		}
-
-		public static BinaryExpression Or (Expression left, Expression right, MethodInfo method)
-		{
-			method = BinaryBitwiseCoreCheck ("op_BitwiseOr", left, right, method);
-
-			return MakeSimpleBinary (ExpressionType.Or, left, right, method);
-		}
-
-		public static BinaryExpression ExclusiveOr (Expression left, Expression right)
-		{
-			return ExclusiveOr (left, right, null);
-		}
-
-		public static BinaryExpression ExclusiveOr (Expression left, Expression right, MethodInfo method)
-		{
-			method = BinaryBitwiseCoreCheck ("op_ExclusiveOr", left, right, method);
-
-			return MakeSimpleBinary (ExpressionType.ExclusiveOr, left, right, method);
-		}
-
-		public static BinaryExpression LeftShift (Expression left, Expression right)
-		{
-			return LeftShift (left, right, null);
-		}
-
-		public static BinaryExpression LeftShift (Expression left, Expression right, MethodInfo method)
-		{
-			method = BinaryBitwiseCoreCheck ("op_LeftShift", left, right, method);
-
-			return MakeSimpleBinary (ExpressionType.LeftShift, left, right, method);
-		}
-
-		public static BinaryExpression RightShift (Expression left, Expression right)
-		{
-			return RightShift (left, right, null);
-		}
-
-		public static BinaryExpression RightShift (Expression left, Expression right, MethodInfo method)
-		{
-			method = BinaryCoreCheck ("op_RightShift", left, right, method);
-
-			return MakeSimpleBinary (ExpressionType.RightShift, left, right, method);
-		}
-
-		//
-		// Short-circuit
-		//
-		public static BinaryExpression AndAlso (Expression left, Expression right)
-		{
-			return AndAlso (left, right, null);
-		}
-
-		public static BinaryExpression AndAlso (Expression left, Expression right, MethodInfo method)
-		{
-			method = ConditionalBinaryCheck ("op_BitwiseAnd", left, right, method);
-
-			return MakeBoolBinary (ExpressionType.AndAlso, left, right, true, method);
-		}
-
-		static MethodInfo ConditionalBinaryCheck (string oper, Expression left, Expression right, MethodInfo method)
-		{
-			method = BinaryCoreCheck (oper, left, right, method);
-
-			if (method == null) {
-				if (left.Type.GetNotNullableType () != typeof (bool))
-					throw new InvalidOperationException ("Only booleans are allowed");
-			} else {
-				var type = left.Type.GetNotNullableType ();
-
-				// The method should have identical parameter and return types.
-				if (left.Type != right.Type || method.ReturnType != type)
-					throw new ArgumentException ("left, right and return type must match");
-
-				var optrue = GetTrueOperator (type);
-				var opfalse = GetFalseOperator (type);
-
-				if (optrue == null || opfalse == null)
-					throw new ArgumentException ("Operators true and false are required but not defined");
-			}
-
-			return method;
-		}
-
-		public static BinaryExpression OrElse (Expression left, Expression right)
-		{
-			return OrElse (left, right, null);
-		}
-
-		public static BinaryExpression OrElse (Expression left, Expression right, MethodInfo method)
-		{
-			method = ConditionalBinaryCheck ("op_BitwiseOr", left, right, method);
-
-			return MakeBoolBinary (ExpressionType.OrElse, left, right, true, method);
-		}
-
-		//
-		// Comparison
-		//
-		public static BinaryExpression Equal (Expression left, Expression right)
-		{
-			return Equal (left, right, false, null);
-		}
-
-		public static BinaryExpression Equal (Expression left, Expression right, bool liftToNull, MethodInfo method)
-		{
-			method = BinaryCoreCheck ("op_Equality", left, right, method);
-
-			return MakeBoolBinary (ExpressionType.Equal, left, right, liftToNull, method);
-		}
-
-		public static BinaryExpression NotEqual (Expression left, Expression right)
-		{
-			return NotEqual (left, right, false, null);
-		}
-
-
-		public static BinaryExpression NotEqual (Expression left, Expression right, bool liftToNull, MethodInfo method)
-		{
-			method = BinaryCoreCheck ("op_Inequality", left, right, method);
-
-			return MakeBoolBinary (ExpressionType.NotEqual, left, right, liftToNull, method);
-		}
-
-		public static BinaryExpression GreaterThan (Expression left, Expression right)
-		{
-			return GreaterThan (left, right, false, null);
-		}
-
-		public static BinaryExpression GreaterThan (Expression left, Expression right, bool liftToNull, MethodInfo method)
-		{
-			method = BinaryCoreCheck ("op_GreaterThan", left, right, method);
-
-			return MakeBoolBinary (ExpressionType.GreaterThan, left, right, liftToNull, method);
-		}
-
-		public static BinaryExpression GreaterThanOrEqual (Expression left, Expression right)
-		{
-			return GreaterThanOrEqual (left, right, false, null);
-		}
-
-
-		public static BinaryExpression GreaterThanOrEqual (Expression left, Expression right, bool liftToNull, MethodInfo method)
-		{
-			method = BinaryCoreCheck ("op_GreaterThanOrEqual", left, right, method);
-
-			return MakeBoolBinary (ExpressionType.GreaterThanOrEqual, left, right, liftToNull, method);
-		}
-
-		public static BinaryExpression LessThan (Expression left, Expression right)
-		{
-			return LessThan (left, right, false, null);
-		}
-
-		public static BinaryExpression LessThan (Expression left, Expression right, bool liftToNull, MethodInfo method)
-		{
-			method = BinaryCoreCheck ("op_LessThan", left, right, method);
-
-			return MakeBoolBinary (ExpressionType.LessThan, left, right, liftToNull, method);
-		}
-
-		public static BinaryExpression LessThanOrEqual (Expression left, Expression right)
-		{
-			return LessThanOrEqual (left, right, false, null);
-		}
-
-		public static BinaryExpression LessThanOrEqual (Expression left, Expression right, bool liftToNull, MethodInfo method)
-		{
-			method = BinaryCoreCheck ("op_LessThanOrEqual", left, right, method);
-
-			return MakeBoolBinary (ExpressionType.LessThanOrEqual, left, right, liftToNull, method);
-		}
-
-		//
-		// Miscelaneous
-		//
-
-		static void CheckArray (Expression array)
-		{
-			if (array == null)
-				throw new ArgumentNullException ("array");
-			if (!array.Type.IsArray)
-				throw new ArgumentException ("The array argument must be of type array");
-		}
-
-		public static BinaryExpression ArrayIndex (Expression array, Expression index)
-		{
-			CheckArray (array);
-
-			if (index == null)
-				throw new ArgumentNullException ("index");
-			if (array.Type.GetArrayRank () != 1)
-				throw new ArgumentException ("The array argument must be a single dimensional array");
-			if (index.Type != typeof (int))
-				throw new ArgumentException ("The index must be of type int");
-
-			return new BinaryExpression (ExpressionType.ArrayIndex, array.Type.GetElementType (), array, index);
-		}
-
-		public static BinaryExpression Coalesce (Expression left, Expression right)
-		{
-			return Coalesce (left, right, null);
-		}
-
-		static BinaryExpression MakeCoalesce (Expression left, Expression right)
-		{
-			Type result = null;
-
-			if (left.Type.IsNullable ()) {
-				Type lbase = left.Type.GetNotNullableType ();
-
-				if (!right.Type.IsNullable () && right.Type.IsAssignableTo (lbase))
-					result = lbase;
-			}
-
-			if (result == null && right.Type.IsAssignableTo (left.Type))
-				result = left.Type;
-
-			if (result == null) {
-				if (left.Type.IsNullable () && left.Type.GetNotNullableType ().IsAssignableTo (right.Type))
-					result = right.Type;
-			}
-
-			if (result == null)
-				throw new ArgumentException ("Incompatible argument types");
-
-			return new BinaryExpression (ExpressionType.Coalesce, result, left, right, false, false, null, null);
-		}
-
-		static BinaryExpression MakeConvertedCoalesce (Expression left, Expression right, LambdaExpression conversion)
-		{
-			var invoke = conversion.Type.GetInvokeMethod ();
-
-			CheckNotVoid (invoke.ReturnType);
-
-			if (invoke.ReturnType != right.Type)
-				throw new InvalidOperationException ("Conversion return type doesn't march right type");
-
-			var parameters = invoke.GetParameters ();
-
-			if (parameters.Length != 1)
-				throw new ArgumentException ("Conversion has wrong number of parameters");
-
-			if (!IsAssignableToParameterType (left.Type, parameters [0]))
-				throw new InvalidOperationException ("Conversion argument doesn't marcht left type");
-
-			return new BinaryExpression (ExpressionType.Coalesce, right.Type, left, right, false, false, null, conversion);
-		}
-
-		public static BinaryExpression Coalesce (Expression left, Expression right, LambdaExpression conversion)
-		{
-			if (left == null)
-				throw new ArgumentNullException ("left");
-			if (right == null)
-				throw new ArgumentNullException ("right");
-
-			//
-			// First arg must ne nullable (either Nullable<T> or a reference type
-			//
-			if (left.Type.IsValueType && !left.Type.IsNullable ())
-				throw new InvalidOperationException ("Left expression can never be null");
-
-			if (conversion != null)
-				return MakeConvertedCoalesce (left, right, conversion);
-
-			return MakeCoalesce (left, right);
-		}
-
-		//
-		// MakeBinary constructors
-		//
-		public static BinaryExpression MakeBinary (ExpressionType binaryType, Expression left, Expression right)
-		{
-			return MakeBinary (binaryType, left, right, false, null);
-		}
-
-		public static BinaryExpression MakeBinary (ExpressionType binaryType, Expression left, Expression right, bool liftToNull, MethodInfo method)
-		{
-			return MakeBinary (binaryType, left, right, liftToNull, method, null);
-		}
-
-		public static BinaryExpression MakeBinary (ExpressionType binaryType, Expression left, Expression right, bool liftToNull, MethodInfo method, LambdaExpression conversion)
-		{
-			switch (binaryType) {
-			case ExpressionType.Add:
-				return Add (left, right, method);
-			case ExpressionType.AddChecked:
-				return AddChecked (left, right, method);
-			case ExpressionType.AndAlso:
-				return AndAlso (left, right);
-			case ExpressionType.ArrayIndex:
-				return ArrayIndex (left, right);
-			case ExpressionType.Coalesce:
-				return Coalesce (left, right, conversion);
-			case ExpressionType.Divide:
-				return Divide (left, right, method);
-			case ExpressionType.Equal:
-				return Equal (left, right, liftToNull, method);
-			case ExpressionType.ExclusiveOr:
-				return ExclusiveOr (left, right, method);
-			case ExpressionType.GreaterThan:
-				return GreaterThan (left, right, liftToNull, method);
-			case ExpressionType.GreaterThanOrEqual:
-				return GreaterThanOrEqual (left, right, liftToNull, method);
-			case ExpressionType.LeftShift:
-				return LeftShift (left, right, method);
-			case ExpressionType.LessThan:
-				return LessThan (left, right, liftToNull, method);
-			case ExpressionType.LessThanOrEqual:
-				return LessThanOrEqual (left, right, liftToNull, method);
-			case ExpressionType.Modulo:
-				return Modulo (left, right, method);
-			case ExpressionType.Multiply:
-				return Multiply (left, right, method);
-			case ExpressionType.MultiplyChecked:
-				return MultiplyChecked (left, right, method);
-			case ExpressionType.NotEqual:
-				return NotEqual (left, right, liftToNull, method);
-			case ExpressionType.OrElse:
-				return OrElse (left, right);
-			case ExpressionType.Power:
-				return Power (left, right, method);
-			case ExpressionType.RightShift:
-				return RightShift (left, right, method);
-			case ExpressionType.Subtract:
-				return Subtract (left, right, method);
-			case ExpressionType.SubtractChecked:
-				return SubtractChecked (left, right, method);
-			case ExpressionType.And:
-				return And (left, right, method);
-			case ExpressionType.Or:
-				return Or (left, right, method);
-			}
-
-			throw new ArgumentException ("MakeBinary expect a binary node type");
-		}
-
-		#endregion
-
-		public static MethodCallExpression ArrayIndex (Expression array, params Expression [] indexes)
-		{
-			return ArrayIndex (array, indexes as IEnumerable<Expression>);
-		}
-
-		public static MethodCallExpression ArrayIndex (Expression array, IEnumerable<Expression> indexes)
-		{
-			CheckArray (array);
-
-			if (indexes == null)
-				throw new ArgumentNullException ("indexes");
-
-			var args = indexes.ToReadOnlyCollection ();
-			if (array.Type.GetArrayRank () != args.Count)
-				throw new ArgumentException ("The number of arguments doesn't match the rank of the array");
-
-			foreach (var arg in args)
-				if (arg.Type != typeof (int))
-					throw new ArgumentException ("The index must be of type int");
-
-			return Call (array, array.Type.GetMethod ("Get", PublicInstance), args);
-		}
-
-		public static UnaryExpression ArrayLength (Expression array)
-		{
-			if (array == null)
-				throw new ArgumentNullException ("array");
-			if (!array.Type.IsArray)
-				throw new ArgumentException ("The type of the expression must me Array");
-			if (array.Type.GetArrayRank () != 1)
-				throw new ArgumentException ("The array must be a single dimensional array");
-
-			return new UnaryExpression (ExpressionType.ArrayLength, array, typeof (int));
-		}
-
-		public static MemberAssignment Bind (MemberInfo member, Expression expression)
-		{
-			if (member == null)
-				throw new ArgumentNullException ("member");
-			if (expression == null)
-				throw new ArgumentNullException ("expression");
-
-			Type type = null;
-
-			var prop = member as PropertyInfo;
-			if (prop != null && prop.GetSetMethod (true) != null)
-				type = prop.PropertyType;
-
-			var field = member as FieldInfo;
-			if (field != null)
-				type = field.FieldType;
-
-			if (type == null)
-				throw new ArgumentException ("member");
-
-			if (!expression.Type.IsAssignableTo (type))
-				throw new ArgumentException ("member");
-
-			return new MemberAssignment (member, expression);
-		}
-
-		public static MemberAssignment Bind (MethodInfo propertyAccessor, Expression expression)
-		{
-			if (propertyAccessor == null)
-				throw new ArgumentNullException ("propertyAccessor");
-			if (expression == null)
-				throw new ArgumentNullException ("expression");
-
-			CheckNonGenericMethod (propertyAccessor);
-
-			var prop = GetAssociatedProperty (propertyAccessor);
-			if (prop == null)
-				throw new ArgumentException ("propertyAccessor");
-
-			var setter = prop.GetSetMethod (true);
-			if (setter == null)
-				throw new ArgumentException ("setter");
-
-			if (!expression.Type.IsAssignableTo (prop.PropertyType))
-				throw new ArgumentException ("member");
-
-			return new MemberAssignment (prop, expression);
-		}
-
-		public static MethodCallExpression Call (Expression instance, MethodInfo method)
-		{
-			return Call (instance, method, null as IEnumerable<Expression>);
-		}
-
-		public static MethodCallExpression Call (MethodInfo method, params Expression [] arguments)
-		{
-			return Call (null, method, arguments as IEnumerable<Expression>);
-		}
-
-		public static MethodCallExpression Call (Expression instance, MethodInfo method, params Expression [] arguments)
-		{
-			return Call (instance, method, arguments as IEnumerable<Expression>);
-		}
-
-		public static MethodCallExpression Call (Expression instance, MethodInfo method, IEnumerable<Expression> arguments)
-		{
-			if (method == null)
-				throw new ArgumentNullException ("method");
-			if (instance == null && !method.IsStatic)
-				throw new ArgumentNullException ("instance");
-			if (method.IsStatic && instance != null)
-				throw new ArgumentException ("instance");
-			if (!method.IsStatic && !instance.Type.IsAssignableTo (method.DeclaringType))
-				throw new ArgumentException ("Type is not assignable to the declaring type of the method");
-
-			var args = CheckMethodArguments (method, arguments);
-
-			return new MethodCallExpression (instance, method, args);
-		}
-
-		static Type [] CollectTypes (IEnumerable<Expression> expressions)
-		{
-			return (from arg in expressions select arg.Type).ToArray ();
-		}
-
-		static MethodInfo TryMakeGeneric (MethodInfo method, Type [] args)
-		{
-			if (method == null)
-				return null;
-
-			if (!method.IsGenericMethod && (args == null || args.Length == 0))
-				return method;
-
-			if (args.Length == method.GetGenericArguments ().Length)
-				return method.MakeGenericMethod (args);
-
-			return null;
-		}
-
-		public static MethodCallExpression Call (Expression instance, string methodName, Type [] typeArguments, params Expression [] arguments)
-		{
-			if (instance == null)
-				throw new ArgumentNullException ("instance");
-			if (methodName == null)
-				throw new ArgumentNullException ("methodName");
-
-			var method = TryGetMethod (instance.Type, methodName, AllInstance,
-				CollectTypes (arguments), typeArguments);
-
-			var args = CheckMethodArguments (method, arguments);
-
-			return new MethodCallExpression (instance, method, args);
-		}
-
-		static bool MethodMatch (MethodInfo method, string name, Type [] parameterTypes, Type [] argumentTypes)
-		{
-			if (method.Name != name)
-				return false;
-
-			var parameters = method.GetParameters ();
-
-			if (parameters.Length != parameterTypes.Length)
-				return false;
-
-			if (method.IsGenericMethod && method.IsGenericMethodDefinition) {
-				var closed = TryMakeGeneric (method, argumentTypes);
-				if (closed == null)
-					return false;
-
-				return MethodMatch (closed, name, parameterTypes, argumentTypes);
-			} else if (!method.IsGenericMethod && (argumentTypes != null && argumentTypes.Length > 0))
-				return false;
-
-			for (int i = 0; i < parameters.Length; i++) {
-				var type = parameterTypes [i];
-				var parameter = parameters [i];
-				if (!IsAssignableToParameterType (type, parameter)
-					&& !IsExpressionOfParameter (type, parameter.ParameterType))
-					return false;
-			}
-
-			return true;
-		}
-
-		static bool IsExpressionOfParameter (Type type, Type ptype)
-		{
-			return ptype.IsGenericInstanceOf (typeof (Expression<>)) && ptype.GetFirstGenericArgument () == type;
-		}
-
-		static MethodInfo TryGetMethod (Type type, string methodName, BindingFlags flags, Type [] parameterTypes, Type [] argumentTypes)
-		{
-			var methods = from meth in type.GetMethods (flags)
-						  where MethodMatch (meth, methodName, parameterTypes, argumentTypes)
-						  select meth;
-
-			if (methods.Count () > 1)
-				throw new InvalidOperationException ("Too many method candidates");
-
-			var method = TryMakeGeneric (methods.FirstOrDefault (), argumentTypes);
-			if (method != null)
-				return method;
-
-			throw new InvalidOperationException ("No such method");
-		}
-
-		public static MethodCallExpression Call (Type type, string methodName, Type [] typeArguments, params Expression [] arguments)
-		{
-			if (type == null)
-				throw new ArgumentNullException ("type");
-			if (methodName == null)
-				throw new ArgumentNullException ("methodName");
-
-			var method = TryGetMethod (type, methodName, AllStatic,
-				CollectTypes (arguments), typeArguments);
-
-			var args = CheckMethodArguments (method, arguments);
-
-			return new MethodCallExpression (method, args);
-		}
-
-		public static ConditionalExpression Condition (Expression test, Expression ifTrue, Expression ifFalse)
-		{
-			if (test == null)
-				throw new ArgumentNullException ("test");
-			if (ifTrue == null)
-				throw new ArgumentNullException ("ifTrue");
-			if (ifFalse == null)
-				throw new ArgumentNullException ("ifFalse");
-			if (test.Type != typeof (bool))
-				throw new ArgumentException ("Test expression should be of type bool");
-			if (ifTrue.Type != ifFalse.Type)
-				throw new ArgumentException ("The ifTrue and ifFalse type do not match");
-
-			return new ConditionalExpression (test, ifTrue, ifFalse);
-		}
-
-		public static ConstantExpression Constant (object value)
-		{
-			if (value == null)
-				return new ConstantExpression (null, typeof (object));
-
-			return Constant (value, value.GetType ());
-		}
-
-		public static ConstantExpression Constant (object value, Type type)
-		{
-			if (type == null)
-				throw new ArgumentNullException ("type");
-
-			//
-			// value must be compatible with type, no conversions
-			// are allowed
-			//
-			if (value == null){
-				if (type.IsValueType && !type.IsNullable ())
-					throw new ArgumentException ();
-			} else {
-				if (!(type.IsValueType && type.IsNullable ()) && !value.GetType ().IsAssignableTo (type))
-					throw new ArgumentException ();
-
-			}
-
-			return new ConstantExpression (value, type);
-		}
-
-		static bool IsConvertiblePrimitive (Type type)
-		{
-			var t = type.GetNotNullableType ();
-	
-			if (t == typeof (bool))
-				return false;
-
-			if (t.IsEnum)
-				return true;
-
-			return t.IsPrimitive;
-		}
-
-		internal static bool IsPrimitiveConversion (Type type, Type target)
-		{
-			if (type == target)
-				return true;
-
-			if (type.IsNullable () && target == type.GetNotNullableType ())
-				return true;
-
-			if (target.IsNullable () && type == target.GetNotNullableType ())
-				return true;
-
-			if (IsConvertiblePrimitive (type) && IsConvertiblePrimitive (target))
-				return true;
-
-			return false;
-		}
-
-		internal static bool IsReferenceConversion (Type type, Type target)
-		{
-			if (type == target)
-				return true;
-
-			if (type == typeof (object) || target == typeof (object))
-				return true;
-
-			if (type.IsInterface || target.IsInterface)
-				return true;
-
-			if (type.IsEnum && target == typeof (Enum))
-				return true;
-
-			if (type.IsValueType || target.IsValueType)
-				return false;
-
-			if (type.IsAssignableTo (target) || target.IsAssignableTo (type))
-				return true;
-
-			return false;
-		}
-
-		public static UnaryExpression Convert (Expression expression, Type type)
-		{
-			return Convert (expression, type, null);
-		}
-
-		static MethodInfo GetUserConversionMethod (Type type, Type target)
-		{
-			var method = GetUnaryOperator ("op_Explicit", type, type, target);
-			if (method == null)
-				method = GetUnaryOperator ("op_Implicit", type, type, target);
-			if (method == null)
-				method = GetUnaryOperator ("op_Explicit", target, type, target);
-			if (method == null)
-				method = GetUnaryOperator ("op_Implicit", target, type, target);
-			if (method == null)
-				throw new InvalidOperationException ();
-
-			return method;
-		}
-
-		public static UnaryExpression Convert (Expression expression, Type type, MethodInfo method)
-		{
-			if (expression == null)
-				throw new ArgumentNullException ("expression");
-			if (type == null)
-				throw new ArgumentNullException ("type");
-
-			var et = expression.Type;
-
-			if (method != null)
-				CheckUnaryMethod (method, et);
-			else if (!IsPrimitiveConversion (et, type) && !IsReferenceConversion (et, type))
-				method = GetUserConversionMethod (et, type);
-
-			return new UnaryExpression (ExpressionType.Convert,
-				expression, type, method,
-				IsConvertNodeLifted (method, expression, type));
-		}
-
-		static bool IsConvertNodeLifted (MethodInfo method, Expression operand, Type target)
-		{
-			if (method == null)
-				return operand.Type.IsNullable () || target.IsNullable ();
-
-			if (operand.Type.IsNullable () && !ParameterMatch (method, operand.Type))
-				return true;
-
-			if (target.IsNullable () && !ReturnTypeMatch (method, target))
-				return true;
-
-			return false;
-		}
-
-		static bool ParameterMatch (MethodInfo method, Type type)
-		{
-			return method.GetParameters () [0].ParameterType == type;
-		}
-
-		static bool ReturnTypeMatch (MethodInfo method, Type type)
-		{
-			return method.ReturnType == type;
-		}
-
-		public static UnaryExpression ConvertChecked (Expression expression, Type type)
-		{
-			return ConvertChecked (expression, type, null);
-		}
-
-		public static UnaryExpression ConvertChecked (Expression expression, Type type, MethodInfo method)
-		{
-			if (expression == null)
-				throw new ArgumentNullException ("expression");
-			if (type == null)
-				throw new ArgumentNullException ("type");
-
-			var et = expression.Type;
-
-			if (method != null)
-				CheckUnaryMethod (method, et);
-			else if (IsReferenceConversion (et, type))
-				return Convert (expression, type, method);
-			else if (!IsPrimitiveConversion (et, type))
-				method = GetUserConversionMethod (et, type);
-
-			return new UnaryExpression (ExpressionType.ConvertChecked,
-				expression, type, method,
-				IsConvertNodeLifted (method, expression, type));
-		}
-
-		public static ElementInit ElementInit (MethodInfo addMethod, params Expression [] arguments)
-		{
-			return ElementInit (addMethod, arguments as IEnumerable<Expression>);
-		}
-
-		public static ElementInit ElementInit (MethodInfo addMethod, IEnumerable<Expression> arguments)
-		{
-			if (addMethod == null)
-				throw new ArgumentNullException ("addMethod");
-			if (arguments == null)
-				throw new ArgumentNullException ("arguments");
-			if (addMethod.Name.ToLowerInvariant () != "add")
-				throw new ArgumentException ("addMethod");
-			if (addMethod.IsStatic)
-				throw new ArgumentException ("addMethod must be an instance method", "addMethod");
-
-			var args = CheckMethodArguments (addMethod, arguments);
-
-			return new ElementInit (addMethod, args);
-		}
-
-		public static MemberExpression Field (Expression expression, FieldInfo field)
-		{
-			if (field == null)
-				throw new ArgumentNullException ("field");
-			if (!field.IsStatic) {
-				if (expression == null)
-					throw new ArgumentNullException ("expression");
-				if (!expression.Type.IsAssignableTo (field.DeclaringType))
-					throw new ArgumentException ("field");
-			} else if (expression != null)
-				throw new ArgumentException ("expression");
-
-			return new MemberExpression (expression, field, field.FieldType);
-		}
-
-		public static MemberExpression Field (Expression expression, string fieldName)
-		{
-			if (expression == null)
-				throw new ArgumentNullException ("expression");
-
-			var field = expression.Type.GetField (fieldName, AllInstance);
-			if (field == null)
-				throw new ArgumentException (string.Format ("No field named {0} on {1}", fieldName, expression.Type));
-
-			return new MemberExpression (expression, field, field.FieldType);
-		}
-
-		public static Type GetActionType (params Type [] typeArgs)
-		{
-			if (typeArgs == null)
-				throw new ArgumentNullException ("typeArgs");
-
-			if (typeArgs.Length > 4)
-				throw new ArgumentException ("No Action type of this arity");
-
-			if (typeArgs.Length == 0)
-				return typeof (Action);
-
-			Type action = null;
-			switch (typeArgs.Length) {
-			case 1:
-				action = typeof (Action<>);
-				break;
-			case 2:
-				action = typeof (Action<,>);
-				break;
-			case 3:
-				action = typeof (Action<,,>);
-				break;
-			case 4:
-				action = typeof (Action<,,,>);
-				break;
-			}
-
-			return action.MakeGenericType (typeArgs);
-		}
-
-		public static Type GetFuncType (params Type [] typeArgs)
-		{
-			if (typeArgs == null)
-				throw new ArgumentNullException ("typeArgs");
-
-			if (typeArgs.Length < 1 || typeArgs.Length > 5)
-				throw new ArgumentException ("No Func type of this arity");
-
-			Type func = null;
-			switch (typeArgs.Length) {
-			case 1:
-				func = typeof (Func<>);
-				break;
-			case 2:
-				func = typeof (Func<,>);
-				break;
-			case 3:
-				func = typeof (Func<,,>);
-				break;
-			case 4:
-				func = typeof (Func<,,,>);
-				break;
-			case 5:
-				func = typeof (Func<,,,,>);
-				break;
-			}
-
-			return func.MakeGenericType (typeArgs);
-		}
-
-		public static InvocationExpression Invoke (Expression expression, params Expression [] arguments)
-		{
-			return Invoke (expression, arguments as IEnumerable<Expression>);
-		}
-
-		static Type GetInvokableType (Type t)
-		{
-			if (t.IsAssignableTo (typeof (Delegate)))
-				return t;
-
-			return GetGenericType (t, typeof (Expression<>));
-		}
-
-		static Type GetGenericType (Type t, Type def)
-		{
-			if (t == null)
-				return null;
-
-			if (t.IsGenericType && t.GetGenericTypeDefinition () == def)
-				return t;
-
-			return GetGenericType (t.BaseType, def);
-		}
-
-		public static InvocationExpression Invoke (Expression expression, IEnumerable<Expression> arguments)
-		{
-			if (expression == null)
-				throw new ArgumentNullException ("expression");
-
-			var type = GetInvokableType (expression.Type);
-			if (type == null)
-				throw new ArgumentException ("The type of the expression is not invokable");
-
-			var args = arguments.ToReadOnlyCollection ();
-			CheckForNull (args, "arguments");
-
-			var invoke = type.GetInvokeMethod ();
-			if (invoke == null)
-				throw new ArgumentException ("expression");
-
-			if (invoke.GetParameters ().Length != args.Count)
-				throw new InvalidOperationException ("Arguments count doesn't match parameters length");
-
-			args = CheckMethodArguments (invoke, args);
-
-			return new InvocationExpression (expression, invoke.ReturnType, args);
-		}
-
-		static bool CanAssign (Type target, Type source)
-		{
-			// This catches object and value type mixage, type compatibility is handled later
-			if (target.IsValueType ^ source.IsValueType)
-				return false;
-
-			return source.IsAssignableTo (target);
-		}
-
-		static Expression CheckLambda (Type delegateType, Expression body, ReadOnlyCollection<ParameterExpression> parameters)
-		{
-			if (!delegateType.IsSubclassOf (typeof (System.Delegate)))
-				throw new ArgumentException ("delegateType");
-
-			var invoke = delegateType.GetInvokeMethod ();
-			if (invoke == null)
-				throw new ArgumentException ("delegate must contain an Invoke method", "delegateType");
-
-			var invoke_parameters = invoke.GetParameters ();
-			if (invoke_parameters.Length != parameters.Count)
-				throw new ArgumentException (string.Format ("Different number of arguments in delegate {0}", delegateType), "delegateType");
-
-			for (int i = 0; i < invoke_parameters.Length; i++) {
-				var parameter = parameters [i];
-				if (parameter == null)
-					throw new ArgumentNullException ("parameters");
-
-				if (!CanAssign (parameter.Type, invoke_parameters [i].ParameterType))
-					throw new ArgumentException (String.Format ("Can not assign a {0} to a {1}", invoke_parameters [i].ParameterType, parameter.Type));
-			}
-
-			if (invoke.ReturnType != typeof (void)) {
-				if (!CanAssign (invoke.ReturnType, body.Type)) {
-					if (invoke.ReturnType.IsExpression ())
-						return Expression.Quote (body);
-
-					throw new ArgumentException (String.Format ("body type {0} can not be assigned to {1}", body.Type, invoke.ReturnType));
-				}
-			}
-			return body;
-		}
-
-		public static Expression<TDelegate> Lambda<TDelegate> (Expression body, params ParameterExpression [] parameters)
-		{
-			return Lambda<TDelegate> (body, parameters as IEnumerable<ParameterExpression>);
-		}
-
-		public static Expression<TDelegate> Lambda<TDelegate> (Expression body, IEnumerable<ParameterExpression> parameters)
-		{
-			if (body == null)
-				throw new ArgumentNullException ("body");
-
-			var ps = parameters.ToReadOnlyCollection ();
-
-			body = CheckLambda (typeof (TDelegate), body, ps);
-
-			return new Expression<TDelegate> (body, ps);
-		}
-
-		public static LambdaExpression Lambda (Expression body, params ParameterExpression [] parameters)
-		{
-			if (body == null)
-				throw new ArgumentNullException ("body");
-			if (parameters.Length > 4)
-				throw new ArgumentException ("Too many parameters");
-
-			return Lambda (GetDelegateType (body.Type, parameters), body, parameters);
-		}
-
-		static Type GetDelegateType (Type return_type, ParameterExpression [] parameters)
-		{
-			if (parameters == null)
-				parameters = new ParameterExpression [0];
-
-			if (return_type == typeof (void))
-				return GetActionType (parameters.Select (p => p.Type).ToArray ());
-
-			var types = new Type [parameters.Length + 1];
-			for (int i = 0; i < types.Length - 1; i++)
-				types [i] = parameters [i].Type;
-
-			types [types.Length - 1] = return_type;
-			return GetFuncType (types);
-		}
-
-		public static LambdaExpression Lambda (Type delegateType, Expression body, params ParameterExpression [] parameters)
-		{
-			return Lambda (delegateType, body, parameters as IEnumerable<ParameterExpression>);
-		}
-
-		static LambdaExpression CreateExpressionOf (Type type, Expression body, ReadOnlyCollection<ParameterExpression> parameters)
-		{
-			return (LambdaExpression) typeof (Expression<>).MakeGenericType (type).GetConstructor (
-				NonPublicInstance, null, new [] { typeof (Expression), typeof (ReadOnlyCollection<ParameterExpression>) }, null).Invoke (new object [] { body, parameters } );
-		}
-
-		public static LambdaExpression Lambda (Type delegateType, Expression body, IEnumerable<ParameterExpression> parameters)
-		{
-			if (delegateType == null)
-				throw new ArgumentNullException ("delegateType");
-			if (body == null)
-				throw new ArgumentNullException ("body");
-
-			var ps = parameters.ToReadOnlyCollection ();
-
-			body = CheckLambda (delegateType, body, ps);
-
-			return CreateExpressionOf (delegateType, body, ps);
-		}
-
-		public static MemberListBinding ListBind (MemberInfo member, params ElementInit [] initializers)
-		{
-			return ListBind (member, initializers as IEnumerable<ElementInit>);
-		}
-
-		static void CheckIsAssignableToIEnumerable (Type t)
-		{
-			if (!t.IsAssignableTo (typeof (IEnumerable)))
-				throw new ArgumentException (string.Format ("Type {0} doesn't implemen IEnumerable", t));
-		}
-
-		public static MemberListBinding ListBind (MemberInfo member, IEnumerable<ElementInit> initializers)
-		{
-			if (member == null)
-				throw new ArgumentNullException ("member");
-			if (initializers == null)
-				throw new ArgumentNullException ("initializers");
-
-			var inits = initializers.ToReadOnlyCollection ();
-			CheckForNull (inits, "initializers");
-
-			member.OnFieldOrProperty (
-				field => CheckIsAssignableToIEnumerable (field.FieldType),
-				prop => CheckIsAssignableToIEnumerable (prop.PropertyType));
-
-			return new MemberListBinding (member, inits);
-		}
-
-		public static MemberListBinding ListBind (MethodInfo propertyAccessor, params ElementInit [] initializers)
-		{
-			return ListBind (propertyAccessor, initializers as IEnumerable<ElementInit>);
-		}
-
-		static void CheckForNull<T> (ReadOnlyCollection<T> collection, string name) where T : class
-		{
-			foreach (var t in collection)
-				if (t == null)
-					throw new ArgumentNullException (name);
-		}
-
-		public static MemberListBinding ListBind (MethodInfo propertyAccessor, IEnumerable<ElementInit> initializers)
-		{
-			if (propertyAccessor == null)
-				throw new ArgumentNullException ("propertyAccessor");
-			if (initializers == null)
-				throw new ArgumentNullException ("initializers");
-
-			var inits = initializers.ToReadOnlyCollection ();
-			CheckForNull (inits, "initializers");
-
-			var prop = GetAssociatedProperty (propertyAccessor);
-			if (prop == null)
-				throw new ArgumentException ("propertyAccessor");
-
-			CheckIsAssignableToIEnumerable (prop.PropertyType);
-
-			return new MemberListBinding (prop, inits);
-		}
-
-		public static ListInitExpression ListInit (NewExpression newExpression, params ElementInit [] initializers)
-		{
-			return ListInit (newExpression, initializers as IEnumerable<ElementInit>);
-		}
-
-		public static ListInitExpression ListInit (NewExpression newExpression, IEnumerable<ElementInit> initializers)
-		{
-			var inits = CheckListInit (newExpression, initializers);
-
-			return new ListInitExpression (newExpression, inits);
-		}
-
-		public static ListInitExpression ListInit (NewExpression newExpression, params Expression [] initializers)
-		{
-			return ListInit (newExpression, initializers as IEnumerable<Expression>);
-		}
-
-		public static ListInitExpression ListInit (NewExpression newExpression, IEnumerable<Expression> initializers)
-		{
-			var inits = CheckListInit (newExpression, initializers);
-
-			var add_method = GetAddMethod (newExpression.Type, inits [0].Type);
-			if (add_method == null)
-				throw new InvalidOperationException ("No suitable add method found");
-
-			return new ListInitExpression (newExpression, CreateInitializers (add_method, inits));
-		}
-
-		static ReadOnlyCollection<ElementInit> CreateInitializers (MethodInfo add_method, ReadOnlyCollection<Expression> initializers)
-		{
-			return (from init in initializers select Expression.ElementInit (add_method, init)).ToReadOnlyCollection ();
-		}
-
-		static MethodInfo GetAddMethod (Type type, Type arg)
-		{
-			return type.GetMethod ("Add", PublicInstance | BindingFlags.IgnoreCase, null, new [] { arg }, null);
-		}
-
-		public static ListInitExpression ListInit (NewExpression newExpression, MethodInfo addMethod, params Expression [] initializers)
-		{
-			return ListInit (newExpression, addMethod, initializers as IEnumerable<Expression>);
-		}
-
-		static ReadOnlyCollection<T> CheckListInit<T> (NewExpression newExpression, IEnumerable<T> initializers) where T : class
-		{
-			if (newExpression == null)
-				throw new ArgumentNullException ("newExpression");
-			if (initializers == null)
-				throw new ArgumentNullException ("initializers");
-			if (!newExpression.Type.IsAssignableTo (typeof (IEnumerable)))
-				throw new InvalidOperationException ("The type of the new expression does not implement IEnumerable");
-
-			var inits = initializers.ToReadOnlyCollection ();
-			if (inits.Count == 0)
-				throw new ArgumentException ("Empty initializers");
-
-			CheckForNull (inits, "initializers");
-
-			return inits;
-		}
-
-		public static ListInitExpression ListInit (NewExpression newExpression, MethodInfo addMethod, IEnumerable<Expression> initializers)
-		{
-			var inits = CheckListInit (newExpression, initializers);
-
-			if (addMethod != null) {
-				if (addMethod.Name.ToLowerInvariant () != "add")
-					throw new ArgumentException ("addMethod");
-
-				var parameters = addMethod.GetParameters ();
-				if (parameters.Length != 1)
-					throw new ArgumentException ("addMethod");
-
-				foreach (var expression in inits)
-					if (!IsAssignableToParameterType (expression.Type, parameters [0]))
-						throw new InvalidOperationException ("Initializer not assignable to the add method parameter type");
-			}
-
-			if (addMethod == null)
-				addMethod = GetAddMethod (newExpression.Type, inits [0].Type);
-
-			if (addMethod == null)
-				throw new InvalidOperationException ("No suitable add method found");
-
-			return new ListInitExpression (newExpression, CreateInitializers (addMethod, inits));
-		}
-
-		public static MemberExpression MakeMemberAccess (Expression expression, MemberInfo member)
-		{
-			if (expression == null)
-				throw new ArgumentNullException ("expression");
-			if (member == null)
-				throw new ArgumentNullException ("member");
-
-			var field = member as FieldInfo;
-			if (field != null)
-				return Field (expression, field);
-
-			var property = member as PropertyInfo;
-			if (property != null)
-				return Property (expression, property);
-
-			throw new ArgumentException ("Member should either be a field or a property");
-		}
-
-		public static UnaryExpression MakeUnary (ExpressionType unaryType, Expression operand, Type type)
-		{
-			return MakeUnary (unaryType, operand, type, null);
-		}
-
-		public static UnaryExpression MakeUnary (ExpressionType unaryType, Expression operand, Type type, MethodInfo method)
-		{
-			switch (unaryType) {
-			case ExpressionType.ArrayLength:
-				return ArrayLength (operand);
-			case ExpressionType.Convert:
-				return Convert (operand, type, method);
-			case ExpressionType.ConvertChecked:
-				return ConvertChecked (operand, type, method);
-			case ExpressionType.Negate:
-				return Negate (operand, method);
-			case ExpressionType.NegateChecked:
-				return NegateChecked (operand, method);
-			case ExpressionType.Not:
-				return Not (operand, method);
-			case ExpressionType.Quote:
-				return Quote (operand);
-			case ExpressionType.TypeAs:
-				return TypeAs (operand, type);
-			case ExpressionType.UnaryPlus:
-				return UnaryPlus (operand, method);
-			}
-
-			throw new ArgumentException ("MakeUnary expect an unary operator");
-		}
-
-		public static MemberMemberBinding MemberBind (MemberInfo member, params MemberBinding [] bindings)
-		{
-			return MemberBind (member, bindings as IEnumerable<MemberBinding>);
-		}
-
-		public static MemberMemberBinding MemberBind (MemberInfo member, IEnumerable<MemberBinding> bindings)
-		{
-			if (member == null)
-				throw new ArgumentNullException ("member");
-
-			var type = member.OnFieldOrProperty (
-				field => field.FieldType,
-				prop => prop.PropertyType);
-
-			return new MemberMemberBinding (member, CheckMemberBindings (type, bindings));
-		}
-
-		public static MemberMemberBinding MemberBind (MethodInfo propertyAccessor, params MemberBinding [] bindings)
-		{
-			return MemberBind (propertyAccessor, bindings as IEnumerable<MemberBinding>);
-		}
-
-		public static MemberMemberBinding MemberBind (MethodInfo propertyAccessor, IEnumerable<MemberBinding> bindings)
-		{
-			if (propertyAccessor == null)
-				throw new ArgumentNullException ("propertyAccessor");
-
-			var bds = bindings.ToReadOnlyCollection ();
-			CheckForNull (bds, "bindings");
-
-			var prop = GetAssociatedProperty (propertyAccessor);
-			if (prop == null)
-				throw new ArgumentException ("propertyAccessor");
-
-			return new MemberMemberBinding (prop, CheckMemberBindings (prop.PropertyType, bindings));
-		}
-
-		static ReadOnlyCollection<MemberBinding> CheckMemberBindings (Type type, IEnumerable<MemberBinding> bindings)
-		{
-			if (bindings == null)
-				throw new ArgumentNullException ("bindings");
-
-			var bds = bindings.ToReadOnlyCollection ();
-			CheckForNull (bds, "bindings");
-
-			foreach (var binding in bds)
-				if (!type.IsAssignableTo (binding.Member.DeclaringType))
-					throw new ArgumentException ("Type not assignable to member type");
-
-			return bds;
-		}
-
-		public static MemberInitExpression MemberInit (NewExpression newExpression, params MemberBinding [] bindings)
-		{
-			return MemberInit (newExpression, bindings as IEnumerable<MemberBinding>);
-		}
-
-		public static MemberInitExpression MemberInit (NewExpression newExpression, IEnumerable<MemberBinding> bindings)
-		{
-			if (newExpression == null)
-				throw new ArgumentNullException ("newExpression");
-
-			return new MemberInitExpression (newExpression, CheckMemberBindings (newExpression.Type, bindings));
-		}
-
-		public static UnaryExpression Negate (Expression expression)
-		{
-			return Negate (expression, null);
-		}
-
-		public static UnaryExpression Negate (Expression expression, MethodInfo method)
-		{
-			method = UnaryCoreCheck ("op_UnaryNegation", expression, method, type => IsSignedNumber (type));
-
-			return MakeSimpleUnary (ExpressionType.Negate, expression, method);
-		}
-
-		public static UnaryExpression NegateChecked (Expression expression)
-		{
-			return NegateChecked (expression, null);
-		}
-
-		public static UnaryExpression NegateChecked (Expression expression, MethodInfo method)
-		{
-			method = UnaryCoreCheck ("op_UnaryNegation", expression, method, type => IsSignedNumber (type));
-
-			return MakeSimpleUnary (ExpressionType.NegateChecked, expression, method);
-		}
-
-		public static NewExpression New (ConstructorInfo constructor)
-		{
-			if (constructor == null)
-				throw new ArgumentNullException ("constructor");
-
-			if (constructor.GetParameters ().Length > 0)
-				throw new ArgumentException ("Constructor must be parameter less");
-
-			return new NewExpression (constructor, (null as IEnumerable<Expression>).ToReadOnlyCollection (), null);
-		}
-
-		public static NewExpression New (Type type)
-		{
-			if (type == null)
-				throw new ArgumentNullException ("type");
-
-			CheckNotVoid (type);
-
-			var args = (null as IEnumerable<Expression>).ToReadOnlyCollection ();
-
-			if (type.IsValueType)
-				return new NewExpression (type, args);
-
-			var ctor = type.GetConstructor (Type.EmptyTypes);
-			if (ctor == null)
-				throw new ArgumentException ("Type doesn't have a parameter less constructor");
-
-			return new NewExpression (ctor, args, null);
-		}
-
-		public static NewExpression New (ConstructorInfo constructor, params Expression [] arguments)
-		{
-			return New (constructor, arguments as IEnumerable<Expression>);
-		}
-
-		public static NewExpression New (ConstructorInfo constructor, IEnumerable<Expression> arguments)
-		{
-			if (constructor == null)
-				throw new ArgumentNullException ("constructor");
-
-			var args = CheckMethodArguments (constructor, arguments);
-
-			return new NewExpression (constructor, args, null);
-		}
-
-		static IList<Expression> CreateArgumentList (IEnumerable<Expression> arguments)
-		{
-			if (arguments == null)
-				return arguments.ToReadOnlyCollection ();
-
-			return arguments.ToList ();
-		}
-
-		static void CheckNonGenericMethod (MethodBase method)
-		{
-			if (method.IsGenericMethodDefinition || method.ContainsGenericParameters)
-				throw new ArgumentException ("Can not used open generic methods");
-		}
-
-		static ReadOnlyCollection<Expression> CheckMethodArguments (MethodBase method, IEnumerable<Expression> args)
-		{
-			CheckNonGenericMethod (method);
-
-			var arguments = CreateArgumentList (args);
-			var parameters = method.GetParameters ();
-
-			if (arguments.Count != parameters.Length)
-				throw new ArgumentException ("The number of arguments doesn't match the number of parameters");
-
-			for (int i = 0; i < parameters.Length; i++) {
-				if (arguments [i] == null)
-					throw new ArgumentNullException ("arguments");
-
-				if (!IsAssignableToParameterType (arguments [i].Type, parameters [i])) {
-					if (!parameters [i].ParameterType.IsExpression ())
-						throw new ArgumentException ("arguments");
-
-					arguments [i] = Expression.Quote (arguments [i]);
-				}
-			}
-
-			return arguments.ToReadOnlyCollection ();
-		}
-
-		public static NewExpression New (ConstructorInfo constructor, IEnumerable<Expression> arguments, params MemberInfo [] members)
-		{
-			return New (constructor, arguments, members as IEnumerable<MemberInfo>);
-		}
-
-		public static NewExpression New (ConstructorInfo constructor, IEnumerable<Expression> arguments, IEnumerable<MemberInfo> members)
-		{
-			if (constructor == null)
-				throw new ArgumentNullException ("constructor");
-
-			var args = arguments.ToReadOnlyCollection ();
-			var mmbs = members.ToReadOnlyCollection ();
-
-			CheckForNull (args, "arguments");
-			CheckForNull (mmbs, "members");
-
-			args = CheckMethodArguments (constructor, arguments);
-
-			if (args.Count != mmbs.Count)
-				throw new ArgumentException ("Arguments count does not match members count");
-
-			for (int i = 0; i < mmbs.Count; i++) {
-				var member = mmbs [i];
-				Type type = null;
-				switch (member.MemberType) {
-				case MemberTypes.Field:
-					type = (member as FieldInfo).FieldType;
-					break;
-				case MemberTypes.Method:
-					type = (member as MethodInfo).ReturnType;
-					break;
-				case MemberTypes.Property:
-					var prop = member as PropertyInfo;
-					if (prop.GetGetMethod (true) == null)
-						throw new ArgumentException ("Property must have a getter");
-
-					type = (member as PropertyInfo).PropertyType;
-					break;
-				default:
-					throw new ArgumentException ("Member type not allowed");
-				}
-
-				if (!args [i].Type.IsAssignableTo (type))
-					throw new ArgumentException ("Argument type not assignable to member type");
-			}
-
-			return new NewExpression (constructor, args, mmbs);
-		}
-
-		public static NewArrayExpression NewArrayBounds (Type type, params Expression [] bounds)
-		{
-			return NewArrayBounds (type, bounds as IEnumerable<Expression>);
-		}
-
-		public static NewArrayExpression NewArrayBounds (Type type, IEnumerable<Expression> bounds)
-		{
-			if (type == null)
-				throw new ArgumentNullException ("type");
-			if (bounds == null)
-				throw new ArgumentNullException ("bounds");
-
-			CheckNotVoid (type);
-
-			var array_bounds = bounds.ToReadOnlyCollection ();
-			foreach (var expression in array_bounds)
-				if (!IsInt (expression.Type))
-					throw new ArgumentException ("The bounds collection can only contain expression of integers types");
-
-			return new NewArrayExpression (ExpressionType.NewArrayBounds, type.MakeArrayType (array_bounds.Count), array_bounds);
-		}
-
-		public static NewArrayExpression NewArrayInit (Type type, params Expression [] initializers)
-		{
-			return NewArrayInit (type, initializers as IEnumerable<Expression>);
-		}
-
-		public static NewArrayExpression NewArrayInit (Type type, IEnumerable<Expression> initializers)
-		{
-			if (type == null)
-				throw new ArgumentNullException ("type");
-			if (initializers == null)
-				throw new ArgumentNullException ("initializers");
-
-			CheckNotVoid (type);
-
-			var inits = initializers.ToReadOnlyCollection ();
-
-			foreach (var expression in inits) {
-				if (expression == null)
-					throw new ArgumentNullException ("initializers");
-
-				if (!expression.Type.IsAssignableTo (type))
-					throw new InvalidOperationException (
-						string.Format ("{0} IsAssignableTo {1}, expression [ {2} ] : {3}", expression.Type, type, expression.NodeType, expression));
-
-				// TODO: Quote elements if type == typeof (Expression)
-			}
-
-			return new NewArrayExpression (ExpressionType.NewArrayInit, type.MakeArrayType (), inits);
-		}
-
-		public static UnaryExpression Not (Expression expression)
-		{
-			return Not (expression, null);
-		}
-
-		public static UnaryExpression Not (Expression expression, MethodInfo method)
-		{
-			Func<Type, bool> validator = type => IsIntOrBool (type);
-
-			method = UnaryCoreCheck ("op_LogicalNot", expression, method, validator);
-
-			if (method == null)
-				method = UnaryCoreCheck ("op_OnesComplement", expression, method, validator);
-
-			return MakeSimpleUnary (ExpressionType.Not, expression, method);
-		}
-
-		static void CheckNotVoid (Type type)
-		{
-			if (type == typeof (void))
-				throw new ArgumentException ("Type can't be void");
-		}
-
-		public static ParameterExpression Parameter (Type type, string name)
-		{
-			if (type == null)
-				throw new ArgumentNullException ("type");
-
-			CheckNotVoid (type);
-
-			return new ParameterExpression (type, name);
-		}
-
-		public static MemberExpression Property (Expression expression, MethodInfo propertyAccessor)
-		{
-			if (propertyAccessor == null)
-				throw new ArgumentNullException ("propertyAccessor");
-
-			CheckNonGenericMethod (propertyAccessor);
-
-			if (!propertyAccessor.IsStatic) {
-				if (expression == null)
-					throw new ArgumentNullException ("expression");
-				if (!expression.Type.IsAssignableTo (propertyAccessor.DeclaringType))
-					throw new ArgumentException ("expression");
-			}
-			//
-			// .NET does not mandate that if the property is static, that the expression must be null
-			// fixes a bug exposed by Orchard's ContentItemRecordAlteration.Alteration
-			// else if (expression != null)
-			//		throw new ArgumentException ("expression");
-
-			var prop = GetAssociatedProperty (propertyAccessor);
-			if (prop == null)
-				throw new ArgumentException (string.Format ("Method {0} has no associated property", propertyAccessor));
-
-			return new MemberExpression (expression, prop, prop.PropertyType);
-		}
-
-		static PropertyInfo GetAssociatedProperty (MethodInfo method)
-		{
-			if (method == null)
-				return null;
-
-			foreach (var prop in method.DeclaringType.GetProperties (All)) {
-				if (method.Equals (prop.GetGetMethod (true)))
-					return prop;
-				if (method.Equals (prop.GetSetMethod (true)))
-					return prop;
-			}
-
-			return null;
-		}
-
-		public static MemberExpression Property (Expression expression, PropertyInfo property)
-		{
-			if (property == null)
-				throw new ArgumentNullException ("property");
-
-			var getter = property.GetGetMethod (true);
-			if (getter == null)
-				throw new ArgumentException ("getter");
-
-			if (!getter.IsStatic) {
-				if (expression == null)
-					throw new ArgumentNullException ("expression");
-				if (!expression.Type.IsAssignableTo (property.DeclaringType))
-					throw new ArgumentException ("expression");
-			} else if (expression != null)
-				throw new ArgumentException ("expression");
-
-			return new MemberExpression (expression, property, property.PropertyType);
-		}
-
-		public static MemberExpression Property (Expression expression, string propertyName)
-		{
-			if (expression == null)
-				throw new ArgumentNullException ("expression");
-
-			var prop = expression.Type.GetProperty (propertyName, AllInstance);
-			if (prop == null)
-				throw new ArgumentException (string.Format ("No property named {0} on {1}", propertyName, expression.Type));
-
-			return new MemberExpression (expression, prop, prop.PropertyType);
-		}
-
-		public static MemberExpression PropertyOrField (Expression expression, string propertyOrFieldName)
-		{
-			if (expression == null)
-				throw new ArgumentNullException ("expression");
-			if (propertyOrFieldName == null)
-				throw new ArgumentNullException ("propertyOrFieldName");
-
-			var prop = expression.Type.GetProperty (propertyOrFieldName, AllInstance);
-			if (prop != null)
-				return new MemberExpression (expression, prop, prop.PropertyType);
-
-			var field = expression.Type.GetField (propertyOrFieldName, AllInstance);
-			if (field != null)
-				return new MemberExpression (expression, field, field.FieldType);
-
-			throw new ArgumentException (string.Format ("No field or property named {0} on {1}", propertyOrFieldName, expression.Type));
-		}
-
-		public static UnaryExpression Quote (Expression expression)
-		{
-			if (expression == null)
-				throw new ArgumentNullException ("expression");
-
-			return new UnaryExpression (ExpressionType.Quote, expression, expression.GetType ());
-		}
-
-		public static UnaryExpression TypeAs (Expression expression, Type type)
-		{
-			if (expression == null)
-				throw new ArgumentNullException ("expression");
-			if (type == null)
-				throw new ArgumentNullException ("type");
-			if (type.IsValueType && !type.IsNullable ())
-				throw new ArgumentException ("TypeAs expect a reference or a nullable type");
-
-			return new UnaryExpression (ExpressionType.TypeAs, expression, type);
-		}
-
-		public static TypeBinaryExpression TypeIs (Expression expression, Type type)
-		{
-			if (expression == null)
-				throw new ArgumentNullException ("expression");
-			if (type == null)
-				throw new ArgumentNullException ("type");
-
-			CheckNotVoid (type);
-
-			return new TypeBinaryExpression (ExpressionType.TypeIs, expression, type, typeof (bool));
-		}
-
-		public static UnaryExpression UnaryPlus (Expression expression)
-		{
-			return UnaryPlus (expression, null);
-		}
-
-		public static UnaryExpression UnaryPlus (Expression expression, MethodInfo method)
-		{
-			method = UnaryCoreCheck ("op_UnaryPlus", expression, method, type => IsNumber (type));
-
-			return MakeSimpleUnary (ExpressionType.UnaryPlus, expression, method);
-		}
-
-		static bool IsInt (Type t)
-		{
-			return t == typeof (byte) || t == typeof (sbyte) ||
-				t == typeof (short) || t == typeof (ushort) ||
-				t == typeof (int) || t == typeof (uint) ||
-				t == typeof (long) || t == typeof (ulong);
-		}
-
-		static bool IsIntOrBool (Type t)
-		{
-			return IsInt (t) || t == typeof (bool);
-		}
-
-		static bool IsNumber (Type t)
-		{
-			if (IsInt (t))
-				return true;
-
-			return t == typeof (float) || t == typeof (double);
-		}
-
-		static bool IsSignedNumber (Type t)
-		{
-			return IsNumber (t) && !IsUnsigned (t);
-		}
-
-		internal static bool IsUnsigned (Type t)
-		{
-			if (t.IsPointer)
-				return IsUnsigned (t.GetElementType ());
-
-			return t == typeof (ushort) ||
-				t == typeof (uint) ||
-				t == typeof (ulong) ||
-				t == typeof (byte);
-		}
-
-		//
-		// This method must be overwritten by derived classes to
-		// compile the expression
-		//
-#if !FULL_AOT_RUNTIME
-		internal virtual void Emit (EmitContext ec)
-		{
-			throw new NotImplementedException (String.Format ("Emit method is not implemented in expression type {0}", GetType ()));
-		}
-#endif
-	}
-}

+ 0 - 398
mcs/class/System.Core/System.Linq.Expressions/ExpressionPrinter.cs

@@ -1,398 +0,0 @@
-//
-// ExpressionPrinter.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Text;
-
-namespace System.Linq.Expressions {
-
-	class ExpressionPrinter : ExpressionVisitor {
-
-		StringBuilder builder;
-
-		const string ListSeparator = ", ";
-
-		ExpressionPrinter (StringBuilder builder)
-		{
-			this.builder = builder;
-		}
-
-		ExpressionPrinter () : this (new StringBuilder ())
-		{
-		}
-
-		public static string ToString (Expression expression)
-		{
-			var printer = new ExpressionPrinter ();
-			printer.Visit (expression);
-			return printer.builder.ToString ();
-		}
-
-		public static string ToString (ElementInit init)
-		{
-			var printer = new ExpressionPrinter ();
-			printer.VisitElementInitializer (init);
-			return printer.builder.ToString ();
-		}
-
-		public static string ToString (MemberBinding binding)
-		{
-			var printer = new ExpressionPrinter ();
-			printer.VisitBinding (binding);
-			return printer.builder.ToString ();
-		}
-
-		void Print (string str)
-		{
-			builder.Append (str);
-		}
-
-		void Print (object obj)
-		{
-			builder.Append (obj);
-		}
-
-		void Print (string str, params object [] objs)
-		{
-			builder.AppendFormat (str, objs);
-		}
-
-		protected override void VisitElementInitializer (ElementInit initializer)
-		{
-			Print (initializer.AddMethod);
-			Print ("(");
-			VisitExpressionList (initializer.Arguments);
-			Print (")");
-		}
-
-		protected override void VisitUnary (UnaryExpression unary)
-		{
-			switch (unary.NodeType) {
-			case ExpressionType.ArrayLength:
-			case ExpressionType.Convert:
-			case ExpressionType.ConvertChecked:
-			case ExpressionType.Not:
-				Print ("{0}(", unary.NodeType);
-				Visit (unary.Operand);
-				Print (")");
-				return;
-			case ExpressionType.Negate:
-				Print ("-");
-				Visit (unary.Operand);
-				return;
-			case ExpressionType.Quote:
-				Visit (unary.Operand);
-				return;
-			case ExpressionType.TypeAs:
-				Print ("(");
-				Visit (unary.Operand);
-				Print (" As {0})", unary.Type.Name);
-				return;
-			case ExpressionType.UnaryPlus:
-				Print ("+");
-				Visit (unary.Operand);
-				return;
-			}
-
-			throw new NotImplementedException ();
-		}
-
-		static string OperatorToString (BinaryExpression binary)
-		{
-			switch (binary.NodeType) {
-			case ExpressionType.Add:
-			case ExpressionType.AddChecked:
-				return "+";
-			case ExpressionType.AndAlso:
-				return "&&";
-			case ExpressionType.Coalesce:
-				return "??";
-			case ExpressionType.Divide:
-				return "/";
-			case ExpressionType.Equal:
-				return "=";
-			case ExpressionType.ExclusiveOr:
-				return "^";
-			case ExpressionType.GreaterThan:
-				return ">";
-			case ExpressionType.GreaterThanOrEqual:
-				return ">=";
-			case ExpressionType.LeftShift:
-				return "<<";
-			case ExpressionType.LessThan:
-				return "<";
-			case ExpressionType.LessThanOrEqual:
-				return "<=";
-			case ExpressionType.Modulo:
-				return "%";
-			case ExpressionType.Multiply:
-			case ExpressionType.MultiplyChecked:
-				return "*";
-			case ExpressionType.NotEqual:
-				return "!=";
-			case ExpressionType.OrElse:
-				return "||";
-			case ExpressionType.Power:
-				return "^";
-			case ExpressionType.RightShift:
-				return ">>";
-			case ExpressionType.Subtract:
-			case ExpressionType.SubtractChecked:
-				return "-";
-			case ExpressionType.And:
-				return IsBoolean (binary) ? "And" : "&";
-			case ExpressionType.Or:
-				return IsBoolean (binary) ? "Or" : "|";
-			default:
-				return null;
-			}
-		}
-
-		static bool IsBoolean (Expression expression)
-		{
-			return expression.Type == typeof (bool) || expression.Type == typeof (bool?);
-		}
-
-		void PrintArrayIndex (BinaryExpression index)
-		{
-			Visit (index.Left);
-			Print ("[");
-			Visit (index.Right);
-			Print ("]");
-		}
-
-		protected override void VisitBinary (BinaryExpression binary)
-		{
-			switch (binary.NodeType) {
-			case ExpressionType.ArrayIndex:
-				PrintArrayIndex (binary);
-				return;
-			default:
-				Print ("(");
-				Visit (binary.Left);
-				Print (" {0} ", OperatorToString (binary));
-				Visit (binary.Right);
-				Print (")");
-				return;
-			}
-		}
-
-		protected override void VisitTypeIs (TypeBinaryExpression type)
-		{
-			switch (type.NodeType) {
-			case ExpressionType.TypeIs:
-				Print ("(");
-				Visit (type.Expression);
-				Print (" Is {0})", type.TypeOperand.Name);
-				return;
-			}
-
-			throw new NotImplementedException ();
-		}
-
-		protected override void VisitConstant (ConstantExpression constant)
-		{
-			var value = constant.Value;
-
-			if (value == null) {
-				Print ("null");
-			} else if (value is string) {
-				Print ("\"");
-				Print (value);
-				Print ("\"");
-			} else if (!HasStringRepresentation (value)) {
-				Print ("value(");
-				Print (value);
-				Print (")");
-			} else
-				Print (value);
-		}
-
-		static bool HasStringRepresentation (object obj)
-		{
-			return obj.ToString () != obj.GetType ().ToString ();
-		}
-
-		protected override void VisitConditional (ConditionalExpression conditional)
-		{
-			Print ("IIF(");
-			Visit (conditional.Test);
-			Print (ListSeparator);
-			Visit (conditional.IfTrue);
-			Print (ListSeparator);
-			Visit (conditional.IfFalse);
-			Print (")");
-		}
-
-		protected override void VisitParameter (ParameterExpression parameter)
-		{
-			Print (parameter.Name ?? "<param>");
-		}
-
-		protected override void VisitMemberAccess (MemberExpression access)
-		{
-			if (access.Expression == null)
-				Print (access.Member.DeclaringType.Name);
-			else
-				Visit (access.Expression);
-
-			Print (".{0}", access.Member.Name);
-		}
-
-		protected override void VisitMethodCall (MethodCallExpression call)
-		{
-			if (call.Object != null) {
-				Visit (call.Object);
-				Print (".");
-			}
-			Print (call.Method.Name);
-			Print ("(");
-			VisitExpressionList (call.Arguments);
-			Print (")");
-		}
-
-		protected override void VisitMemberAssignment (MemberAssignment assignment)
-		{
-			Print ("{0} = ", assignment.Member.Name);
-			Visit (assignment.Expression);
-		}
-
-		protected override void VisitMemberMemberBinding (MemberMemberBinding binding)
-		{
-			Print (binding.Member.Name);
-			Print (" = {");
-			// VisitBindingList (binding.Bindings);
-			VisitList (binding.Bindings, VisitBinding);
-			Print ("}");
-		}
-
-		protected override void VisitMemberListBinding (MemberListBinding binding)
-		{
-			Print (binding.Member.Name);
-			Print (" = {");
-			// replace when the patch to the visitor is in
-			// VisitElementInitializerList (binding.Initializers);
-			VisitList (binding.Initializers, VisitElementInitializer);
-			Print ("}");
-		}
-
-		protected override void VisitList<T> (ReadOnlyCollection<T> list, Action<T> visitor)
-		{
-			for (int i = 0; i < list.Count; i++) {
-				if (i > 0)
-					Print (ListSeparator);
-
-				visitor (list [i]);
-			}
-		}
-
-		protected override void VisitLambda (LambdaExpression lambda)
-		{
-			if (lambda.Parameters.Count != 1) {
-				Print ("(");
-				// replace when the patch to the visitor is in
-				// VisitExpressionList (lambda.Parameters);
-				VisitList (lambda.Parameters, Visit);
-				Print (")");
-			} else
-				Visit (lambda.Parameters [0]);
-
-			Print (" => ");
-			Visit (lambda.Body);
-		}
-
-		protected override void VisitNew (NewExpression nex)
-		{
-			Print ("new {0}(", nex.Type.Name);
-			if (nex.Members != null && nex.Members.Count > 0) {
-				for (int i = 0; i < nex.Members.Count; i++) {
-					if (i > 0)
-						Print (ListSeparator);
-
-					Print ("{0} = ", nex.Members [i].Name);
-					Visit (nex.Arguments [i]);
-				}
-			} else
-				VisitExpressionList (nex.Arguments);
-			Print (")");
-		}
-
-		protected override void VisitMemberInit (MemberInitExpression init)
-		{
-			Visit (init.NewExpression);
-			Print (" {");
-			// VisitBindingList (init.Bindings)
-			VisitList (init.Bindings, VisitBinding);
-			Print ("}");
-		}
-
-		protected override void VisitListInit (ListInitExpression init)
-		{
-			Visit (init.NewExpression);
-			Print (" {");
-			// VisitElementInitializerList
-			VisitList (init.Initializers, VisitElementInitializer);
-			Print ("}");
-		}
-
-		protected override void VisitNewArray (NewArrayExpression newArray)
-		{
-			Print ("new ");
-			switch (newArray.NodeType) {
-			case ExpressionType.NewArrayBounds:
-				Print (newArray.Type);
-				Print ("(");
-				VisitExpressionList (newArray.Expressions);
-				Print (")");
-				return;
-			case ExpressionType.NewArrayInit:
-				Print ("[] {");
-				VisitExpressionList (newArray.Expressions);
-				Print ("}");
-				return;
-			}
-
-			throw new NotSupportedException ();
-		}
-
-		protected override void VisitInvocation (InvocationExpression invocation)
-		{
-			Print ("Invoke(");
-			Visit (invocation.Expression);
-
-			if (invocation.Arguments.Count != 0) {
-				Print (ListSeparator);
-				VisitExpressionList (invocation.Arguments);
-			}
-
-			Print (")");
-		}
-	}
-}

+ 0 - 79
mcs/class/System.Core/System.Linq.Expressions/ExpressionType.cs

@@ -1,79 +0,0 @@
-//
-// Expression.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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.
-//
-
-namespace System.Linq.Expressions {
-
-	public enum ExpressionType {
-		Add,
-		AddChecked,
-		And,
-		AndAlso,
-		ArrayLength,
-		ArrayIndex,
-		Call,
-		Coalesce,
-		Conditional,
-		Constant,
-		Convert,
-		ConvertChecked,
-		Divide,
-		Equal,
-		ExclusiveOr,
-		GreaterThan,
-		GreaterThanOrEqual,
-		Invoke,
-		Lambda,
-		LeftShift,
-		LessThan,
-		LessThanOrEqual,
-		ListInit,
-		MemberAccess,
-		MemberInit,
-		Modulo,
-		Multiply,
-		MultiplyChecked,
-		Negate,
-		UnaryPlus,
-		NegateChecked,
-		New,
-		NewArrayInit,
-		NewArrayBounds,
-		Not,
-		NotEqual,
-		Or,
-		OrElse,
-		Parameter,
-		Power,
-		Quote,
-		RightShift,
-		Subtract,
-		SubtractChecked,
-		TypeAs,
-		TypeIs,
-	}
-}

+ 0 - 28
mcs/class/System.Core/System.Linq.Expressions/ExpressionVisitor.cs

@@ -1,28 +0,0 @@
-//
-// ExpressionVisitor.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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.
-//
-

+ 0 - 47
mcs/class/System.Core/System.Linq.Expressions/Expression_T.cs

@@ -1,47 +0,0 @@
-//
-// Expression_T.cs
-//
-// Author:
-//  Jb Evain ([email protected])
-//
-// Copyright (C) 2008 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;
-using System.Collections.ObjectModel;
-using System.Collections.Generic;
-
-namespace System.Linq.Expressions {
-
-	public sealed class Expression<TDelegate> : LambdaExpression {
-
-		internal Expression (Expression body, ReadOnlyCollection<ParameterExpression> parameters)
-			: base (typeof (TDelegate), body, parameters)
-		{
-		}
-
-		public new TDelegate Compile ()
-		{
-			return (TDelegate) (object) base.Compile ();
-		}
-	}
-}

+ 0 - 63
mcs/class/System.Core/System.Linq.Expressions/InvocationExpression.cs

@@ -1,63 +0,0 @@
-//
-// InvocationExpression.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Text;
-
-namespace System.Linq.Expressions {
-
-	public sealed class InvocationExpression : Expression {
-
-		Expression expression;
-		ReadOnlyCollection<Expression> arguments;
-
-		public Expression Expression {
-			get { return expression; }
-		}
-
-		public ReadOnlyCollection<Expression> Arguments {
-			get { return arguments; }
-		}
-
-		internal InvocationExpression (Expression expression, Type type, ReadOnlyCollection<Expression> arguments)
-			: base (ExpressionType.Invoke, type)
-		{
-			this.expression = expression;
-			this.arguments = arguments;
-		}
-
-#if !FULL_AOT_RUNTIME
-		internal override void Emit (EmitContext ec)
-		{
-			ec.EmitCall (expression, arguments, expression.Type.GetInvokeMethod ());
-		}
-#endif
-	}
-}

+ 0 - 104
mcs/class/System.Core/System.Linq.Expressions/LambdaExpression.cs

@@ -1,104 +0,0 @@
-//
-// LambdaExpression.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2008 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;
-using System.Collections.ObjectModel;
-using System.Collections.Generic;
-using System.Reflection;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-
-
-namespace System.Linq.Expressions {
-
-	public class LambdaExpression : Expression {
-
-		Expression body;
-		ReadOnlyCollection<ParameterExpression> parameters;
-
-		public Expression Body {
-			get { return body; }
-		}
-
-		public ReadOnlyCollection<ParameterExpression> Parameters {
-			get { return parameters; }
-		}
-
-		internal LambdaExpression (Type delegateType, Expression body, ReadOnlyCollection<ParameterExpression> parameters)
-			: base (ExpressionType.Lambda, delegateType)
-		{
-			this.body = body;
-			this.parameters = parameters;
-		}
-
-#if !FULL_AOT_RUNTIME
-		void EmitPopIfNeeded (EmitContext ec)
-		{
-			if (GetReturnType () == typeof (void) && body.Type != typeof (void))
-				ec.ig.Emit (OpCodes.Pop);
-		}
-
-		internal override void Emit (EmitContext ec)
-		{
-			ec.EmitCreateDelegate (this);
-		}
-
-		internal void EmitBody (EmitContext ec)
-		{
-			body.Emit (ec);
-			EmitPopIfNeeded (ec);
-			ec.ig.Emit (OpCodes.Ret);
-		}
-#endif
-
-		internal Type GetReturnType ()
-		{
-			return this.Type.GetInvokeMethod ().ReturnType;
-		}
-
-		public Delegate Compile ()
-		{
-#if FULL_AOT_RUNTIME
-			return new System.Linq.jvm.Runner (this).CreateDelegate ();
-#else
-			var context = new CompilationContext ();
-			context.AddCompilationUnit (this);
-			return context.CreateDelegate ();
-#endif
-		}
-
-#if FULL_AOT_RUNTIME
-		internal Delegate Compile (System.Linq.jvm.ExpressionInterpreter interpreter)
-		{
-			return new System.Linq.jvm.Runner (this, interpreter).CreateDelegate ();
-		}
-#endif
-	}
-}

+ 0 - 65
mcs/class/System.Core/System.Linq.Expressions/ListInitExpression.cs

@@ -1,65 +0,0 @@
-//
-// ListInitExpression.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Text;
-
-namespace System.Linq.Expressions {
-
-	public sealed class ListInitExpression : Expression {
-
-		NewExpression new_expression;
-		ReadOnlyCollection<ElementInit> initializers;
-
-		public NewExpression NewExpression {
-			get { return new_expression; }
-		}
-
-		public ReadOnlyCollection<ElementInit> Initializers {
-			get { return initializers; }
-		}
-
-		internal ListInitExpression (NewExpression new_expression, ReadOnlyCollection<ElementInit> initializers)
-			: base (ExpressionType.ListInit, new_expression.Type)
-		{
-			this.new_expression = new_expression;
-			this.initializers = initializers;
-		}
-
-#if !FULL_AOT_RUNTIME
-		internal override void Emit (EmitContext ec)
-		{
-			var local = ec.EmitStored (new_expression);
-			ec.EmitCollection (initializers, local);
-			ec.EmitLoad (local);
-		}
-#endif
-	}
-}

+ 0 - 79
mcs/class/System.Core/System.Linq.Expressions/MemberAssignment.cs

@@ -1,79 +0,0 @@
-//
-// MemberAssignement.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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;
-using System.Reflection;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-using System.Text;
-
-namespace System.Linq.Expressions {
-
-	public sealed class MemberAssignment : MemberBinding {
-
-		Expression expression;
-
-		public Expression Expression {
-			get { return expression; }
-		}
-
-		internal MemberAssignment (MemberInfo member, Expression expression)
-			: base (MemberBindingType.Assignment, member)
-		{
-			this.expression = expression;
-		}
-
-#if !FULL_AOT_RUNTIME
-		internal override void Emit (EmitContext ec, LocalBuilder local)
-		{
-			this.Member.OnFieldOrProperty (
-				field => EmitFieldAssignment (ec, field, local),
-				prop => EmitPropertyAssignment (ec, prop, local));
-		}
-
-		void EmitFieldAssignment (EmitContext ec, FieldInfo field, LocalBuilder local)
-		{
-			ec.EmitLoadSubject (local);
-			expression.Emit (ec);
-			ec.ig.Emit (OpCodes.Stfld, field);
-		}
-
-		void EmitPropertyAssignment (EmitContext ec, PropertyInfo property, LocalBuilder local)
-		{
-			var setter = property.GetSetMethod (true);
-			if (setter == null)
-				throw new InvalidOperationException ();
-
-			ec.EmitLoadSubject (local);
-			expression.Emit (ec);
-			ec.EmitCall (setter);
-		}
-#endif
-	}
-}

+ 0 - 94
mcs/class/System.Core/System.Linq.Expressions/MemberBinding.cs

@@ -1,94 +0,0 @@
-//
-// MemberBinding.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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;
-using System.Reflection;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-
-namespace System.Linq.Expressions {
-
-	public abstract class MemberBinding {
-
-		MemberBindingType binding_type;
-		MemberInfo member;
-
-		public MemberBindingType BindingType {
-			get { return binding_type; }
-		}
-
-		public MemberInfo Member {
-			get { return member; }
-		}
-
-		protected MemberBinding (MemberBindingType binding_type, MemberInfo member)
-		{
-			this.binding_type = binding_type;
-			this.member = member;
-		}
-
-		public override string ToString ()
-		{
-			return ExpressionPrinter.ToString (this);
-		}
-
-#if !FULL_AOT_RUNTIME
-		internal abstract void Emit (EmitContext ec, LocalBuilder local);
-
-		internal LocalBuilder EmitLoadMember (EmitContext ec, LocalBuilder local)
-		{
-			ec.EmitLoadSubject (local);
-
-			return member.OnFieldOrProperty<LocalBuilder> (
-				field => EmitLoadField (ec, field),
-				prop => EmitLoadProperty (ec, prop));
-		}
-
-		LocalBuilder EmitLoadProperty (EmitContext ec, PropertyInfo property)
-		{
-			var getter = property.GetGetMethod (true);
-			if (getter == null)
-				throw new NotSupportedException ();
-
-			var store = ec.ig.DeclareLocal (property.PropertyType);
-			ec.EmitCall (getter);
-			ec.ig.Emit (OpCodes.Stloc, store);
-			return store;
-		}
-
-		LocalBuilder EmitLoadField (EmitContext ec, FieldInfo field)
-		{
-			var store = ec.ig.DeclareLocal (field.FieldType);
-			ec.ig.Emit (OpCodes.Ldfld, field);
-			ec.ig.Emit (OpCodes.Stloc, store);
-			return store;
-		}
-#endif
-	}
-}

+ 0 - 36
mcs/class/System.Core/System.Linq.Expressions/MemberBindingType.cs

@@ -1,36 +0,0 @@
-//
-// MemberBindingType.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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.
-//
-
-namespace System.Linq.Expressions {
-
-	public enum MemberBindingType {
-		Assignment,
-		MemberBinding,
-		ListBinding
-	}
-}

+ 0 - 84
mcs/class/System.Core/System.Linq.Expressions/MemberExpression.cs

@@ -1,84 +0,0 @@
-//
-// MemberExpression.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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;
-using System.Reflection;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-
-namespace System.Linq.Expressions {
-
-	public sealed class MemberExpression : Expression {
-
-		Expression expression;
-		MemberInfo member;
-
-		public Expression Expression {
-			get { return expression; }
-		}
-
-		public MemberInfo Member {
-			get { return member; }
-		}
-
-		internal MemberExpression (Expression expression, MemberInfo member, Type type)
-			: base (ExpressionType.MemberAccess, type)
-		{
-			this.expression = expression;
-			this.member = member;
-		}
-
-#if !FULL_AOT_RUNTIME
-		internal override void Emit (EmitContext ec)
-		{
-			member.OnFieldOrProperty (
-				field => EmitFieldAccess (ec, field),
-				prop => EmitPropertyAccess (ec, prop));
-		}
-
-		void EmitPropertyAccess (EmitContext ec, PropertyInfo property)
-		{
-			var getter = property.GetGetMethod (true);
-			if (!getter.IsStatic)
-				ec.EmitLoadSubject (expression);
-
-			ec.EmitCall (getter);
-		}
-
-		void EmitFieldAccess (EmitContext ec, FieldInfo field)
-		{
-			if (!field.IsStatic) {
-				ec.EmitLoadSubject (expression);
-				ec.ig.Emit (OpCodes.Ldfld, field);
-			} else
-				ec.ig.Emit (OpCodes.Ldsfld, field);
-		}
-#endif
-	}
-}

+ 0 - 64
mcs/class/System.Core/System.Linq.Expressions/MemberInitExpression.cs

@@ -1,64 +0,0 @@
-//
-// MemberInitExpression.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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;
-using System.Collections.ObjectModel;
-using System.Reflection;
-
-namespace System.Linq.Expressions {
-
-	public sealed class MemberInitExpression : Expression {
-
-		NewExpression new_expression;
-		ReadOnlyCollection<MemberBinding> bindings;
-
-		public NewExpression NewExpression {
-			get { return new_expression; }
-		}
-
-		public ReadOnlyCollection<MemberBinding> Bindings {
-			get { return bindings; }
-		}
-
-		internal MemberInitExpression (NewExpression new_expression, ReadOnlyCollection<MemberBinding> bindings)
-			: base (ExpressionType.MemberInit, new_expression.Type)
-		{
-			this.new_expression = new_expression;
-			this.bindings = bindings;
-		}
-
-#if !FULL_AOT_RUNTIME
-		internal override void Emit (EmitContext ec)
-		{
-			var local = ec.EmitStored (new_expression);
-			ec.EmitCollection (bindings, local);
-			ec.EmitLoad (local);
-		}
-#endif
-	}
-}

+ 0 - 62
mcs/class/System.Core/System.Linq.Expressions/MemberListBinding.cs

@@ -1,62 +0,0 @@
-//
-// MemberListBinding.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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;
-using System.Collections.ObjectModel;
-using System.Reflection;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-
-namespace System.Linq.Expressions {
-
-	public sealed class MemberListBinding : MemberBinding {
-
-		ReadOnlyCollection<ElementInit> initializers;
-
-		public ReadOnlyCollection<ElementInit> Initializers {
-			get { return initializers; }
-		}
-
-		internal MemberListBinding (MemberInfo member, ReadOnlyCollection<ElementInit> initializers)
-			: base (MemberBindingType.ListBinding, member)
-		{
-			this.initializers = initializers;
-		}
-
-#if !FULL_AOT_RUNTIME
-		internal override void Emit (EmitContext ec, LocalBuilder local)
-		{
-			var member = EmitLoadMember (ec, local);
-
-			foreach (var initializer in initializers)
-				initializer.Emit (ec, member);
-		}
-#endif
-	}
-}

+ 0 - 62
mcs/class/System.Core/System.Linq.Expressions/MemberMemberBinding.cs

@@ -1,62 +0,0 @@
-//
-// MemberMemberBinding.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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;
-using System.Collections.ObjectModel;
-using System.Reflection;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-
-namespace System.Linq.Expressions {
-
-	public sealed class MemberMemberBinding : MemberBinding {
-
-		ReadOnlyCollection<MemberBinding> bindings;
-
-		public ReadOnlyCollection<MemberBinding> Bindings {
-			get { return bindings; }
-		}
-
-		internal MemberMemberBinding (MemberInfo member, ReadOnlyCollection<MemberBinding> bindings)
-			: base (MemberBindingType.MemberBinding, member)
-		{
-			this.bindings = bindings;
-		}
-
-#if !FULL_AOT_RUNTIME
-		internal override void Emit (EmitContext ec, LocalBuilder local)
-		{
-			var member = EmitLoadMember (ec, local);
-
-			foreach (var binding in bindings)
-				binding.Emit (ec, member);
-		}
-#endif
-	}
-}

+ 0 - 78
mcs/class/System.Core/System.Linq.Expressions/MethodCallExpression.cs

@@ -1,78 +0,0 @@
-//
-// MethodCallExpression.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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;
-using System.Collections.ObjectModel;
-using System.Reflection;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-
-namespace System.Linq.Expressions {
-
-	public sealed class MethodCallExpression : Expression {
-
-		Expression obj;
-		MethodInfo method;
-		ReadOnlyCollection<Expression> arguments;
-
-		public Expression Object {
-			get { return obj; }
-		}
-
-		public MethodInfo Method {
-			get { return method; }
-		}
-
-		public ReadOnlyCollection<Expression> Arguments {
-			get { return arguments; }
-		}
-
-		internal MethodCallExpression (MethodInfo method, ReadOnlyCollection<Expression> arguments)
-			: base (ExpressionType.Call, method.ReturnType)
-		{
-			this.method = method;
-			this.arguments = arguments;
-		}
-
-		internal MethodCallExpression (Expression obj, MethodInfo method, ReadOnlyCollection<Expression> arguments)
-			: base (ExpressionType.Call, method.ReturnType)
-		{
-			this.obj = obj;
-			this.method = method;
-			this.arguments = arguments;
-		}
-
-#if !FULL_AOT_RUNTIME
-		internal override void Emit (EmitContext ec)
-		{
-			ec.EmitCall (obj, arguments, method);
-		}
-#endif
-	}
-}

+ 0 - 115
mcs/class/System.Core/System.Linq.Expressions/NewArrayExpression.cs

@@ -1,115 +0,0 @@
-//
-// NewArrayExpression.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Reflection;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-
-namespace System.Linq.Expressions {
-
-	public sealed class NewArrayExpression : Expression {
-
-		ReadOnlyCollection<Expression> expressions;
-
-		public ReadOnlyCollection<Expression> Expressions {
-			get { return expressions; }
-		}
-
-		internal NewArrayExpression (ExpressionType et, Type type, ReadOnlyCollection<Expression> expressions)
-			: base (et, type)
-		{
-			this.expressions = expressions;
-		}
-
-#if !FULL_AOT_RUNTIME
-		void EmitNewArrayInit (EmitContext ec, Type type)
-		{
-			var size = expressions.Count;
-
-			ec.ig.Emit (OpCodes.Ldc_I4, size);
-			ec.ig.Emit (OpCodes.Newarr, type);
-
-			for (int i = 0; i < size; i++) {
-				ec.ig.Emit (OpCodes.Dup);
-				ec.ig.Emit (OpCodes.Ldc_I4, i);
-				expressions [i].Emit (ec);
-				ec.ig.Emit (OpCodes.Stelem, type);
-			}
-		}
-
-		void EmitNewArrayBounds (EmitContext ec, Type type)
-		{
-			int rank = expressions.Count;
-
-			ec.EmitCollection (expressions);
-
-			if (rank == 1) {
-				ec.ig.Emit (OpCodes.Newarr, type);
-				return;
-			}
-
-			ec.ig.Emit(OpCodes.Newobj, GetArrayConstructor (type, rank));
-		}
-
-		static ConstructorInfo GetArrayConstructor (Type type, int rank)
-		{
-			return CreateArray (type, rank).GetConstructor (CreateTypeParameters (rank));
-		}
-
-		static Type [] CreateTypeParameters (int rank)
-		{
-			return Enumerable.Repeat (typeof (int), rank).ToArray ();
-		}
-
-		static Type CreateArray (Type type, int rank)
-		{
-			return type.MakeArrayType (rank);
-		}
-
-		internal override void Emit (EmitContext ec)
-		{
-			var type = this.Type.GetElementType ();
-
-			switch (this.NodeType) {
-			case ExpressionType.NewArrayInit:
-				EmitNewArrayInit (ec, type);
-				return;
-			case ExpressionType.NewArrayBounds:
-				EmitNewArrayBounds (ec, type);
-				return;
-			default:
-				throw new NotSupportedException ();
-			}
-		}
-#endif
-	}
-}

+ 0 - 103
mcs/class/System.Core/System.Linq.Expressions/NewExpression.cs

@@ -1,103 +0,0 @@
-//
-// NewExpression.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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;
-using System.Collections.ObjectModel;
-using System.Reflection;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-
-namespace System.Linq.Expressions {
-
-	public sealed class NewExpression : Expression {
-
-		ConstructorInfo constructor;
-		ReadOnlyCollection<Expression> arguments;
-		ReadOnlyCollection<MemberInfo> members;
-
-		public ConstructorInfo Constructor {
-			get { return constructor; }
-		}
-
-		public ReadOnlyCollection<Expression> Arguments {
-			get { return arguments; }
-		}
-
-		public ReadOnlyCollection<MemberInfo> Members {
-			get { return members; }
-		}
-
-		internal NewExpression (Type type, ReadOnlyCollection<Expression> arguments)
-			: base (ExpressionType.New, type)
-		{
-			this.arguments = arguments;
-		}
-
-		internal NewExpression (ConstructorInfo constructor, ReadOnlyCollection<Expression> arguments, ReadOnlyCollection<MemberInfo> members)
-			: base (ExpressionType.New, constructor.DeclaringType)
-		{
-			this.constructor = constructor;
-			this.arguments = arguments;
-			this.members = members;
-		}
-
-#if !FULL_AOT_RUNTIME
-		internal override void Emit (EmitContext ec)
-		{
-			var ig = ec.ig;
-			var type = this.Type;
-
-			LocalBuilder local = null;
-			if (type.IsValueType) {
-				local = ig.DeclareLocal (type);
-				ig.Emit (OpCodes.Ldloca, local);
-
-				if (constructor == null) {
-					ig.Emit (OpCodes.Initobj, type);
-					ig.Emit (OpCodes.Ldloc, local);
-					return;
-				}
-			}
-
-			ec.EmitCollection (arguments);
-
-			if (type.IsValueType) {
-				ig.Emit (OpCodes.Call, constructor);
-				ig.Emit (OpCodes.Ldloc, local);
-			} else
-				ig.Emit (OpCodes.Newobj, constructor ?? GetDefaultConstructor (type));
-		}
-#endif
-
-		static ConstructorInfo GetDefaultConstructor (Type type)
-		{
-			return type.GetConstructor (Type.EmptyTypes);
-		}
-	}
-}

+ 0 - 90
mcs/class/System.Core/System.Linq.Expressions/ParameterExpression.cs

@@ -1,90 +0,0 @@
-//
-// ParameterExpression.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2008 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;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-
-namespace System.Linq.Expressions {
-
-	public sealed class ParameterExpression : Expression {
-
-		string name;
-
-		public string Name {
-			get { return name; }
-		}
-
-		internal ParameterExpression (Type type, string name)
-			: base (ExpressionType.Parameter, type)
-		{
-			this.name = name;
-		}
-
-#if !FULL_AOT_RUNTIME
-		void EmitLocalParameter (EmitContext ec, int position)
-		{
-			ec.ig.Emit (OpCodes.Ldarg, position);
-		}
-
-		void EmitHoistedLocal (EmitContext ec, int level, int position)
-		{
-			ec.EmitScope ();
-
-			for (int i = 0; i < level; i++)
-				ec.EmitParentScope ();
-
-			ec.EmitLoadLocals ();
-
-			ec.ig.Emit (OpCodes.Ldc_I4, position);
-			ec.ig.Emit (OpCodes.Ldelem, typeof (object));
-
-			ec.EmitLoadStrongBoxValue (Type);
-		}
-
-		internal override void Emit (EmitContext ec)
-		{
-			int position = -1;
-			if (ec.IsLocalParameter (this, ref position)) {
-				EmitLocalParameter (ec, position);
-				return;
-			}
-
-			int level = 0;
-			if (ec.IsHoistedLocal (this, ref level, ref position)) {
-				EmitHoistedLocal (ec, level, position);
-				return;
-			}
-
-			throw new InvalidOperationException ("Parameter out of scope");
-		}
-#endif
-	}
-}

+ 0 - 71
mcs/class/System.Core/System.Linq.Expressions/TypeBinaryExpression.cs

@@ -1,71 +0,0 @@
-//
-// TypeBinaryExpression.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-
-namespace System.Linq.Expressions {
-
-	public sealed class TypeBinaryExpression : Expression {
-
-		Expression expression;
-		Type type_operand;
-
-		public Expression Expression {
-			get { return expression; }
-		}
-
-		public Type TypeOperand {
-			get { return type_operand; }
-		}
-
-		internal TypeBinaryExpression (ExpressionType node_type, Expression expression, Type type_operand, Type type)
-			: base (node_type, type)
-		{
-			this.expression = expression;
-			this.type_operand = type_operand;
-		}
-
-#if !FULL_AOT_RUNTIME
-		internal override void Emit (EmitContext ec)
-		{
-			if (expression.Type == typeof (void)) {
-				ec.ig.Emit (OpCodes.Ldc_I4_0);
-				return;
-			}
-
-			ec.EmitIsInst (expression, type_operand);
-
-			ec.ig.Emit (OpCodes.Ldnull);
-			ec.ig.Emit (OpCodes.Cgt_Un);
-		}
-#endif
-	}
-}

+ 0 - 439
mcs/class/System.Core/System.Linq.Expressions/UnaryExpression.cs

@@ -1,439 +0,0 @@
-//
-// UnaryExpression.cs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// (C) 2008 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;
-using System.Reflection;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-
-namespace System.Linq.Expressions {
-
-	public sealed class UnaryExpression : Expression {
-
-		Expression operand;
-		MethodInfo method;
-		bool is_lifted;
-
-		public Expression Operand {
-			get { return operand; }
-		}
-
-		public MethodInfo Method {
-			get { return method; }
-		}
-
-		public bool IsLifted {
-			get { return is_lifted; }
-		}
-
-		public bool IsLiftedToNull {
-			get { return is_lifted && this.Type.IsNullable (); }
-		}
-
-		internal UnaryExpression (ExpressionType node_type, Expression operand, Type type)
-			: base (node_type, type)
-		{
-			this.operand = operand;
-		}
-
-		internal UnaryExpression (ExpressionType node_type, Expression operand, Type type, MethodInfo method, bool is_lifted)
-			: base (node_type, type)
-		{
-			this.operand = operand;
-			this.method = method;
-			this.is_lifted = is_lifted;
-		}
-
-#if !FULL_AOT_RUNTIME
-		void EmitArrayLength (EmitContext ec)
-		{
-			operand.Emit (ec);
-			ec.ig.Emit (OpCodes.Ldlen);
-		}
-
-		void EmitTypeAs (EmitContext ec)
-		{
-			var type = this.Type;
-
-			ec.EmitIsInst (operand, type);
-
-			if (type.IsNullable ())
-				ec.ig.Emit (OpCodes.Unbox_Any, type);
-		}
-
-		void EmitLiftedUnary (EmitContext ec)
-		{
-			var ig = ec.ig;
-
-			var from = ec.EmitStored (operand);
-			var to = ig.DeclareLocal (Type);
-
-			var has_value = ig.DefineLabel ();
-			var done = ig.DefineLabel ();
-
-			ec.EmitNullableHasValue (from);
-			ig.Emit (OpCodes.Brtrue, has_value);
-
-			// if not has value
-			ec.EmitNullableInitialize (to);
-
-			ig.Emit (OpCodes.Br, done);
-
-			ig.MarkLabel (has_value);
-			// if has value
-			ec.EmitNullableGetValueOrDefault (from);
-
-			EmitUnaryOperator (ec);
-
-			ec.EmitNullableNew (Type);
-
-			ig.MarkLabel (done);
-		}
-
-		void EmitUnaryOperator (EmitContext ec)
-		{
-			var ig = ec.ig;
-
-			switch (NodeType) {
-			case ExpressionType.Not:
-				if (operand.Type.GetNotNullableType () == typeof (bool)) {
-					ig.Emit (OpCodes.Ldc_I4_0);
-					ig.Emit (OpCodes.Ceq);
-				} else
-					ig.Emit (OpCodes.Not);
-				break;
-			case ExpressionType.Negate:
-				ig.Emit (OpCodes.Neg);
-				break;
-			case ExpressionType.NegateChecked:
-				ig.Emit (OpCodes.Ldc_I4_M1);
-				ig.Emit (IsUnsigned (operand.Type) ? OpCodes.Mul_Ovf_Un : OpCodes.Mul_Ovf);
-				break;
-			case ExpressionType.Convert:
-			case ExpressionType.ConvertChecked:
-				// Called when converting from nullable from nullable
-				EmitPrimitiveConversion (ec,
-					operand.Type.GetNotNullableType (),
-					Type.GetNotNullableType ());
-				break;
-			}
-		}
-
-		void EmitConvert (EmitContext ec)
-		{
-			var from = operand.Type;
-			var target = Type;
-
-			if (from == target)
-				operand.Emit (ec);
-			else if (from.IsNullable () && !target.IsNullable ())
-				EmitConvertFromNullable (ec);
-			else if (!from.IsNullable () && target.IsNullable ())
-				EmitConvertToNullable (ec);
-			else if (from.IsNullable () && target.IsNullable ())
-				EmitConvertFromNullableToNullable (ec);
-			else if (IsReferenceConversion (from, target))
-				EmitCast (ec);
-			else if (IsPrimitiveConversion (from, target))
-				EmitPrimitiveConversion (ec);
-			else
-				throw new NotImplementedException ();
-		}
-
-		void EmitConvertFromNullableToNullable (EmitContext ec)
-		{
-			EmitLiftedUnary (ec);
-		}
-
-		void EmitConvertToNullable (EmitContext ec)
-		{
-			ec.Emit (operand);
-
-			if (IsUnBoxing ()) {
-				EmitUnbox (ec);
-				return;
-			}
-
-			if (operand.Type != Type.GetNotNullableType ()) {
-				EmitPrimitiveConversion (ec,
-					operand.Type,
-					Type.GetNotNullableType ());
-			}
-
-			ec.EmitNullableNew (Type);
-		}
-
-		void EmitConvertFromNullable (EmitContext ec)
-		{
-			if (IsBoxing ()) {
-				ec.Emit (operand);
-				EmitBox (ec);
-				return;
-			}
-
-			ec.EmitCall (operand, operand.Type.GetMethod ("get_Value"));
-
-			if (operand.Type.GetNotNullableType () != Type) {
-				EmitPrimitiveConversion (ec,
-					operand.Type.GetNotNullableType (),
-					Type);
-			}
-		}
-
-		bool IsBoxing ()
-		{
-			return operand.Type.IsValueType && !Type.IsValueType;
-		}
-
-		void EmitBox (EmitContext ec)
-		{
-			ec.ig.Emit (OpCodes.Box, operand.Type);
-		}
-
-		bool IsUnBoxing ()
-		{
-			return !operand.Type.IsValueType && Type.IsValueType;
-		}
-
-		void EmitUnbox (EmitContext ec)
-		{
-			ec.ig.Emit (OpCodes.Unbox_Any, Type);
-		}
-
-		void EmitCast (EmitContext ec)
-		{
-			operand.Emit (ec);
-
-			if (IsBoxing ()) {
-				EmitBox (ec);
-			} else if (IsUnBoxing ()) {
-				EmitUnbox (ec);
-			} else
-				ec.ig.Emit (OpCodes.Castclass, Type);
-		}
-
-		void EmitPrimitiveConversion (EmitContext ec, bool is_unsigned,
-			OpCode signed, OpCode unsigned, OpCode signed_checked, OpCode unsigned_checked)
-		{
-			if (this.NodeType != ExpressionType.ConvertChecked)
-				ec.ig.Emit (is_unsigned ? unsigned : signed);
-			else
-				ec.ig.Emit (is_unsigned ? unsigned_checked : signed_checked);
-		}
-
-		void EmitPrimitiveConversion (EmitContext ec)
-		{
-			operand.Emit (ec);
-
-			EmitPrimitiveConversion (ec, operand.Type, Type);
-		}
-
-		void EmitPrimitiveConversion (EmitContext ec, Type from, Type to)
-		{
-			var is_unsigned = IsUnsigned (from);
-
-			switch (Type.GetTypeCode (to)) {
-			case TypeCode.SByte:
-				EmitPrimitiveConversion (ec,
-					is_unsigned,
-					OpCodes.Conv_I1,
-					OpCodes.Conv_U1,
-					OpCodes.Conv_Ovf_I1,
-					OpCodes.Conv_Ovf_I1_Un);
-				return;
-			case TypeCode.Byte:
-				EmitPrimitiveConversion (ec,
-					is_unsigned,
-					OpCodes.Conv_I1,
-					OpCodes.Conv_U1,
-					OpCodes.Conv_Ovf_U1,
-					OpCodes.Conv_Ovf_U1_Un);
-				return;
-			case TypeCode.Int16:
-				EmitPrimitiveConversion (ec,
-					is_unsigned,
-					OpCodes.Conv_I2,
-					OpCodes.Conv_U2,
-					OpCodes.Conv_Ovf_I2,
-					OpCodes.Conv_Ovf_I2_Un);
-				return;
-			case TypeCode.UInt16:
-				EmitPrimitiveConversion (ec,
-					is_unsigned,
-					OpCodes.Conv_I2,
-					OpCodes.Conv_U2,
-					OpCodes.Conv_Ovf_U2,
-					OpCodes.Conv_Ovf_U2_Un);
-				return;
-			case TypeCode.Int32:
-				EmitPrimitiveConversion (ec,
-					is_unsigned,
-					OpCodes.Conv_I4,
-					OpCodes.Conv_U4,
-					OpCodes.Conv_Ovf_I4,
-					OpCodes.Conv_Ovf_I4_Un);
-				return;
-			case TypeCode.UInt32:
-				EmitPrimitiveConversion (ec,
-					is_unsigned,
-					OpCodes.Conv_I4,
-					OpCodes.Conv_U4,
-					OpCodes.Conv_Ovf_U4,
-					OpCodes.Conv_Ovf_U4_Un);
-				return;
-			case TypeCode.Int64:
-				EmitPrimitiveConversion (ec,
-					is_unsigned,
-					OpCodes.Conv_I8,
-					OpCodes.Conv_U8,
-					OpCodes.Conv_Ovf_I8,
-					OpCodes.Conv_Ovf_I8_Un);
-				return;
-			case TypeCode.UInt64:
-				EmitPrimitiveConversion (ec,
-					is_unsigned,
-					OpCodes.Conv_I8,
-					OpCodes.Conv_U8,
-					OpCodes.Conv_Ovf_U8,
-					OpCodes.Conv_Ovf_U8_Un);
-				return;
-			case TypeCode.Single:
-				if (is_unsigned)
-					ec.ig.Emit (OpCodes.Conv_R_Un);
-				ec.ig.Emit (OpCodes.Conv_R4);
-				return;
-			case TypeCode.Double:
-				if (is_unsigned)
-					ec.ig.Emit (OpCodes.Conv_R_Un);
-				ec.ig.Emit (OpCodes.Conv_R8);
-				return;
-			default:
-				throw new NotImplementedException (this.Type.ToString ());
-			}
-		}
-
-		void EmitArithmeticUnary (EmitContext ec)
-		{
-			if (!IsLifted) {
-				operand.Emit (ec);
-				EmitUnaryOperator (ec);
-			} else
-				EmitLiftedUnary (ec);
-		}
-
-		void EmitUserDefinedLiftedToNullOperator (EmitContext ec)
-		{
-			var ig = ec.ig;
-			var local = ec.EmitStored (operand);
-
-			var ret = ig.DefineLabel ();
-			var done = ig.DefineLabel ();
-
-			ec.EmitNullableHasValue (local);
-			ig.Emit (OpCodes.Brfalse, ret);
-
-			ec.EmitNullableGetValueOrDefault (local);
-			ec.EmitCall (method);
-			ec.EmitNullableNew (Type);
-			ig.Emit (OpCodes.Br, done);
-
-			ig.MarkLabel (ret);
-
-			var temp = ig.DeclareLocal (Type);
-			ec.EmitNullableInitialize (temp);
-
-			ig.MarkLabel (done);
-		}
-
-		void EmitUserDefinedLiftedOperator (EmitContext ec)
-		{
-			var local = ec.EmitStored (operand);
-			ec.EmitNullableGetValue (local);
-			ec.EmitCall (method);
-		}
-
-		void EmitUserDefinedOperator (EmitContext ec)
-		{
-			if (!IsLifted) {
-				ec.Emit (operand);
-				ec.EmitCall (method);
-			} else if (IsLiftedToNull) {
-				EmitUserDefinedLiftedToNullOperator (ec);
-			} else
-				EmitUserDefinedLiftedOperator (ec);
-		}
-
-		void EmitQuote (EmitContext ec)
-		{
-			ec.EmitScope ();
-
-			ec.EmitReadGlobal (operand, typeof (Expression));
-
-			if (ec.HasHoistedLocals)
-				ec.EmitLoadHoistedLocalsStore ();
-			else
-				ec.ig.Emit (OpCodes.Ldnull);
-
-			ec.EmitIsolateExpression ();
-		}
-
-		internal override void Emit (EmitContext ec)
-		{
-			if (method != null) {
-				EmitUserDefinedOperator (ec);
-				return;
-			}
-
-			switch (this.NodeType) {
-			case ExpressionType.ArrayLength:
-				EmitArrayLength (ec);
-				return;
-			case ExpressionType.TypeAs:
-				EmitTypeAs (ec);
-				return;
-			case ExpressionType.Convert:
-			case ExpressionType.ConvertChecked:
-				EmitConvert (ec);
-				return;
-			case ExpressionType.Not:
-			case ExpressionType.Negate:
-			case ExpressionType.NegateChecked:
-			case ExpressionType.UnaryPlus:
-				EmitArithmeticUnary (ec);
-				return;
-			case ExpressionType.Quote:
-				EmitQuote (ec);
-				return;
-			default:
-				throw new NotImplementedException (this.NodeType.ToString ());
-			}
-		}
-#endif
-	}
-}

+ 0 - 27
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/ChangeLog

@@ -1,27 +0,0 @@
-2010-04-15  Jérémie Laval  <[email protected]>
-
-	* QueryBaseNode.cs:
-	* QueryCastNode.cs:
-	* QueryChildNode.cs:
-	* QueryConcatNode.cs:
-	* QueryDefaultEmptyNode.cs:
-	* QueryGroupByNode.cs:
-	* QueryMuxNode.cs:
-	* QueryOptionNode.cs:
-	* QueryOrderByNode.cs:
-	* QueryOrderGuardNode.cs:
-	* QueryOrderedStreamNode.cs:
-	* QueryReverseNode.cs:
-	* QuerySelectManyNode.cs:
-	* QuerySelectNode.cs:
-	* QuerySetNode.cs:
-	* QueryStartNode.cs:
-	* QueryStreamNode.cs:
-	* QueryWhereNode.cs:
-	* QueryZipNode.cs:
-	* WrapHelper.cs: Initial check-in of PLinq
-
-2010-04-15  Jérémie Laval  <[email protected]>
-
-	* SetInclusion.cs: Initial check-in of PLinq (enum)
-

+ 0 - 51
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryBaseNode.cs

@@ -1,51 +0,0 @@
-//
-// QueryBaseNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Threading.Tasks;
-using System.Collections.Generic;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal interface QueryBaseNode : IVisitableNode
-	{
-	}
-
-	internal abstract class QueryBaseNode<T> : QueryBaseNode
-	{
-		public virtual void Visit (INodeVisitor visitor)
-		{
-			visitor.Visit (this);
-		}
-
-		internal abstract IList<IEnumerable<T>> GetEnumerables (QueryOptions options);
-
-		internal abstract IList<IEnumerable<KeyValuePair<long, T>>> GetOrderedEnumerables (QueryOptions options);
-
-		internal abstract IEnumerable<T> GetSequential ();
-	}
-}

+ 0 - 62
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryCastNode.cs

@@ -1,62 +0,0 @@
-//
-// QueryCastNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Threading.Tasks;
-using System.Collections.Generic;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal class QueryCastNode<T> : QueryStreamNode<object, T>
-	{
-		public QueryCastNode (QueryBaseNode<T> source)
-			: base (source, false)
-		{
-
-		}
-		
-		internal override IEnumerable<object> GetSequential ()
-		{
-			return Parent.GetSequential ().Cast<object> ();
-		}
-		
-		internal override IList<IEnumerable<KeyValuePair<long, object>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			return Parent.GetOrderedEnumerables (options)
-				.Select ((i) => i.Select ((e) => new KeyValuePair<long, object> (e.Key, (object)e.Value)))
-				.ToList ();
-		}
-		
-		internal override IList<IEnumerable<object>> GetEnumerables (QueryOptions options)
-		{
-			return Parent.GetEnumerables (options)
-				.Select ((i) => i.Cast<object> ())
-				.ToList ();
-		}
-	}
-}
-

+ 0 - 60
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryChildNode.cs

@@ -1,60 +0,0 @@
-//
-// QueryChildNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Parallel.QueryNodes
-{
-	internal interface QueryChildNode : IVisitableNode {
-		QueryBaseNode Parent { get; }
-	}
-
-	internal abstract class QueryChildNode<T, TParent> : QueryBaseNode<T>, QueryChildNode
-	{
-		QueryBaseNode<TParent> parent;
-
-		internal QueryChildNode (QueryBaseNode<TParent> parent)
-		//	: base (isOrdered, true)
-		{
-			this.parent = parent;
-		}
-
-		QueryBaseNode QueryChildNode.Parent {
-			get { return parent; }
-		}
-
-		internal QueryBaseNode<TParent> Parent {
-			get {
-				return parent;
-			}
-		}
-
-		public override void Visit (INodeVisitor visitor)
-		{
-			visitor.Visit ((QueryChildNode)this);
-		}
-	}
-}

+ 0 - 76
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryConcatNode.cs

@@ -1,76 +0,0 @@
-//
-// QueryConcatNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal class QueryConcatNode<TSource> : QueryMuxNode<TSource, TSource, TSource>
-	{
-		public QueryConcatNode (QueryBaseNode<TSource> first, QueryBaseNode<TSource> second)
-			: base (first, second)
-		{
-		}
-
-		internal override IList<IEnumerable<TSource>> GetEnumerables (QueryOptions options)
-		{
-			var second = Second.GetEnumerables (options);
-
-			return Parent.GetEnumerables (options)
-				.Select ((f, i) => CombineEnumerables (f, second[i]))
-				.ToList ();
-		}
-
-		internal override IList<IEnumerable<KeyValuePair<long, TSource>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			var second = Second.GetOrderedEnumerables (options);
-
-			return Parent.GetOrderedEnumerables (options)
-				.Select ((f, i) => CombineEnumerables (f, second[i]))
-				.ToList ();
-		}
-
-		internal override IEnumerable<TSource> GetSequential ()
-		{
-			IEnumerable<TSource> first = Parent.GetSequential ();
-			IEnumerable<TSource> second = Second.GetSequential ();
-
-			return first.Concat (second);
-		}
-
-		IEnumerable<TResult> CombineEnumerables<TResult> (IEnumerable<TResult> f, IEnumerable<TResult> s)
-		{
-			foreach (var e in f)
-				yield return e;
-			foreach (var e in s)
-				yield return e;
-		}
-	}
-}
-

+ 0 - 89
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryDefaultEmptyNode.cs

@@ -1,89 +0,0 @@
-//
-// QueryDefaultEmptyNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal class QueryDefaultEmptyNode<TSource> : QueryStreamNode<TSource, TSource>
-	{
-		TSource defaultValue;
-		
-		internal QueryDefaultEmptyNode (QueryBaseNode<TSource> parent, TSource defaultValue)
-			: base (parent, false)
-		{
-			this.defaultValue = defaultValue;
-		}
-		
-		internal override IEnumerable<TSource> GetSequential ()
-		{
-			return Parent.GetSequential ().DefaultIfEmpty (defaultValue);
-		}
-		
-		internal override IList<IEnumerable<TSource>> GetEnumerables (QueryOptions options)
-		{
-			IList<IEnumerable<TSource>> enumerables = Parent.GetEnumerables (options);
-			CountdownEvent evt = new CountdownEvent (enumerables.Count);
-
-			return enumerables
-				.Select ((e) => GetEnumerableInternal<TSource> (e,
-				                                                evt,
-				                                                (s) => s))
-				.ToList ();
-		}
-		
-		internal override IList<IEnumerable<KeyValuePair<long, TSource>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			IList<IEnumerable<KeyValuePair<long, TSource>>> enumerables = Parent.GetOrderedEnumerables (options);
-			CountdownEvent evt = new CountdownEvent (enumerables.Count);
-
-			return enumerables
-				.Select ((e) => GetEnumerableInternal<KeyValuePair<long, TSource>> (e,
-				                                                                    evt,
-				                                                                    (s) => new KeyValuePair<long, TSource> (0, s)))
-				.ToList ();
-		}
-		
-		IEnumerable<TSecond> GetEnumerableInternal<TSecond> (IEnumerable<TSecond> source, 
-		                                                     CountdownEvent evt,
-		                                                     Func<TSource, TSecond> converter)
-		{
-			bool processed = false;
-			
-			foreach (TSecond second in source) {
-				processed = true;
-				yield return second;
-			}
-			
-			if (!processed && evt.Signal ())
-				yield return converter (defaultValue);
-		}
-	}
-}
-

+ 0 - 88
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryGroupByNode.cs

@@ -1,88 +0,0 @@
-//
-// QueryOrderByNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal class QueryGroupByNode<TSource, TKey, TElement> : QueryStreamNode<IGrouping<TKey, TElement>, TSource>
-	{
-		Func<TSource, TKey> keySelector;
-		Func<TSource, TElement> elementSelector;
-		IEqualityComparer<TKey> comparer;
-		
-		public QueryGroupByNode (QueryBaseNode<TSource> parent,
-		                         Func<TSource, TKey> keySelector, 
-		                         Func<TSource, TElement> elementSelector,
-		                         IEqualityComparer<TKey> comparer)
-			: base (parent, false)
-		{
-			this.keySelector = keySelector;
-			this.elementSelector = elementSelector;
-			this.comparer = comparer;
-		}
-		
-		internal override IEnumerable<IGrouping<TKey, TElement>> GetSequential ()
-		{
-			IEnumerable<TSource> src =  Parent.GetSequential ();
-			
-			return src.GroupBy (keySelector, elementSelector, comparer);
-		}
-
-		internal override IList<IEnumerable<IGrouping<TKey, TElement>>> GetEnumerables (QueryOptions options)
-		{			
-			return ParallelPartitioner.CreateForChunks (GetGroupedElements ()).GetPartitions (options.PartitionCount).Wrap ();
-		}
-		
-		internal override IList<IEnumerable<KeyValuePair<long, IGrouping<TKey, TElement>>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			return ParallelPartitioner.CreateForChunks (GetGroupedElements ()).GetOrderablePartitions (options.PartitionCount).Wrap ();
-		}
-
-		internal IEnumerable<IGrouping<TKey, TElement>> GetGroupedElements ()
-		{
-			return (IEnumerable<System.Linq.IGrouping<TKey,TElement>>)GetStore ().Select (e => (IGrouping<TKey,TElement>)new ConcurrentGrouping<TKey, TElement> (e.Key, e.Value));
-		}
-
-		internal ConcurrentDictionary<TKey, ConcurrentQueue<TElement>> GetStore ()
-		{
-			var store = new ConcurrentDictionary<TKey, ConcurrentQueue<TElement>> ();
-			Func<TKey, ConcurrentQueue<TElement>> queueFactory = (_) => new ConcurrentQueue<TElement> ();
-
-			ParallelExecuter.ProcessAndBlock (Parent, (e, c) => {
-				ConcurrentQueue<TElement> queue = store.GetOrAdd (keySelector (e), queueFactory);
-				queue.Enqueue (elementSelector (e));
-			});
-
-			return store;
-		}
-	}
-}
-

+ 0 - 148
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryHeadWorkerNode.cs

@@ -1,148 +0,0 @@
-//
-// QueryConcatNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal interface QueryHeadWorkerNode : IVisitableNode {
-		int? Count { get; }
-	}
-	/* This is the QueryNode used by Take(While) operator
-	 * it symbolize operators that are preferably working on the head elements of a query and can prematurely
-	 * stop providing elements following the one they were processing is of a greater value in a specific 
-	 * order to be defined by the instance (e.g. simple numerical order when working on indexes).
-	 */
-	internal class QueryHeadWorkerNode<TSource> : QueryStreamNode<TSource, TSource>, QueryHeadWorkerNode
-	{
-		/* This variable will receive an index value that represent the "stop point"
-		 * when used with GetOrderedEnumerables i.e. values that are above the indexes are discarded
-		 * (if the partitioner is ordered in a partition it even stop the processing) and value below are still tested just
-		 * in case and can still lower this gap limit.
-		 */
-		readonly int count;
-		readonly Func<TSource, int, bool> predicate;
-		
-		internal QueryHeadWorkerNode (QueryBaseNode<TSource> parent, int count)
-			: base (parent, false)
-		{
-			this.count = count;
-		}
-
-		internal QueryHeadWorkerNode (QueryBaseNode<TSource> parent, Func<TSource, int, bool> predicate, bool indexed)
-			: base (parent, indexed)
-		{
-			this.predicate = predicate;
-		}
-
-		public int? Count {
-			get {
-				return predicate == null ? count : (int?)null;
-			}
-		}
-
-		internal override IEnumerable<TSource> GetSequential ()
-		{
-			IEnumerable<TSource> parent = Parent.GetSequential ();
-
-			return predicate == null ? parent.Take (count) : parent.TakeWhile (predicate);
-		}
-
-		public override void Visit (INodeVisitor visitor)
-		{
-			visitor.Visit ((QueryHeadWorkerNode)this);
-		}
-
-		internal override IList<IEnumerable<TSource>> GetEnumerablesIndexed (QueryOptions options)
-		{	
-			return Parent.GetOrderedEnumerables (options)
-				.Select ((i) => i.TakeWhile ((e) => predicate (e.Value, (int)e.Key)).Select ((e) => e.Value))
-				.ToList ();
-		}
-
-		internal override IList<IEnumerable<TSource>> GetEnumerablesNonIndexed (QueryOptions options)
-		{
-			return Parent.GetEnumerables (options)
-				.Select (GetSelector (count))
-				.ToList ();
-		}
-
-		Func<IEnumerable<TSource>, IEnumerable<TSource>> GetSelector (int c)
-		{
-			if (predicate == null)
-				return (i) => i.TakeWhile ((e) => c > 0 && Interlocked.Decrement (ref c) >= 0);
-			else
-				return (i) => i.TakeWhile ((e) => predicate (e, -1));
-		}
-
-		internal override IList<IEnumerable<KeyValuePair<long, TSource>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			return Parent.GetOrderedEnumerables (options)
-				.Select ((i) => GetEnumerableInternal (i, options))
-				.ToList ();
-		}
-
-		IEnumerable<KeyValuePair<long, TSource>> GetEnumerableInternal (IEnumerable<KeyValuePair<long, TSource>> source, QueryOptions options)
-		{
-			IEnumerator<KeyValuePair<long, TSource>> current = source.GetEnumerator ();
-			long gapIndex = predicate == null ? count : long.MaxValue;
-			Func<KeyValuePair<long, TSource>, bool> cond;
-			if (predicate == null)
-				cond = (kv) => kv.Key < count;
-			else
-				cond = (kv) => predicate (kv.Value, (int)kv.Key);
-			
-			try {
-				while (current.MoveNext ()) {
-					KeyValuePair<long, TSource> kvp = current.Current;
-
-					/* When filtering is based on a predicate, this short-circuit is only valid 
-					 * if the partitioner used ensure items are ordered in each partition 
-					 * (valid w/ default partitioners)
-					 */
-					if (kvp.Key >= gapIndex && options.PartitionerSettings.Item2)
-						break;
-
-					if (!cond (kvp)) {
-						if (gapIndex > kvp.Key && predicate != null)
-							gapIndex = kvp.Key;
-
-						continue;
-					}
-					
-					yield return kvp;
-				}
-			} finally {
-				current.Dispose ();
-			}
-		}
-	}
-
-}
-

+ 0 - 186
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryJoinNode.cs

@@ -1,186 +0,0 @@
-//
-// QueryJoinNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal class QueryJoinNode<TFirst, TSecond, TKey, TResult> : QueryMuxNode<TFirst, TSecond, TResult>
-	{
-		struct VSlot<T>
-		{
-			public readonly bool HasValue;
-			public readonly T Value;
-
-			public VSlot (T value)
-			{
-				HasValue = true;
-				Value = value;
-			}
-		}
-
-		Func<TFirst, TKey> firstKeySelector;
-		Func<TSecond, TKey> secondKeySelector;
-		Func<TFirst, TSecond, TResult> resultSelector;
-		IEqualityComparer<TKey> comparer;
-
-		internal QueryJoinNode (QueryBaseNode<TFirst> first,
-		                        QueryBaseNode<TSecond> second, 
-		                        Func<TFirst, TKey> firstKeySelector,
-		                        Func<TSecond, TKey> secondKeySelector,
-		                        Func<TFirst, TSecond, TResult> resultSelector,
-		                        IEqualityComparer<TKey> comparer) : base (first, second)
-		{
-			this.firstKeySelector = firstKeySelector;
-			this.secondKeySelector = secondKeySelector;
-			this.resultSelector = resultSelector;
-			this.comparer = comparer;
-		}
-
-		internal override IEnumerable<TResult> GetSequential ()
-		{
-			return Parent.GetSequential ().Join (Second.GetSequential (), 
-			                                     firstKeySelector, 
-			                                     secondKeySelector, 
-			                                     resultSelector, 
-			                                     comparer);
-		}
-
-		internal override IList<IEnumerable<TResult>> GetEnumerables (QueryOptions options)
-		{
-			var first = Parent.GetEnumerables (options);
-			var second = Second.GetEnumerables (options);
-
-			if (first.Count != second.Count)
-				throw new InvalidOperationException ("Internal size mismatch");
-
-			var store = new TemporaryArea<TKey, Tuple<VSlot<TFirst>, VSlot<TSecond>>> (comparer);
-
-			return first
-				.Select ((f, i) => GetEnumerable (f, second[i], store, firstKeySelector, secondKeySelector, resultSelector))
-				.ToList ();
-
-		}		
-
-		internal override IList<IEnumerable<KeyValuePair<long, TResult>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			var first = Parent.GetOrderedEnumerables (options);
-			var second = Second.GetOrderedEnumerables (options);
-
-			if (first.Count != second.Count)
-				throw new InvalidOperationException ("Internal size mismatch");
-
-			var store = new TemporaryArea<TKey, Tuple<VSlot<KeyValuePair<long, TFirst>>, VSlot<KeyValuePair<long, TSecond>>>> (comparer);
-			
-			return first
-				.Select ((f, i) => GetEnumerable<KeyValuePair<long, TFirst>, KeyValuePair<long, TSecond>, KeyValuePair<long, TResult>> (f, 
-				                                  second[i], 
-				                                  store,
-				                                  (e) => firstKeySelector (e.Value),
-				                                  (e) => secondKeySelector (e.Value),
-				                                  (e1, e2) => new KeyValuePair<long, TResult> (e1.Key, resultSelector (e1.Value, e2.Value))))
-				.ToList ();
-		}
-
-		IEnumerable<T> GetEnumerable<U, V, T> (IEnumerable<U> first, 
-		                                       IEnumerable<V> second,
-		                                       TemporaryArea<TKey, Tuple<VSlot<U>, VSlot<V>>> store,
-		                                       Func<U, TKey> fKeySelect,
-		                                       Func<V, TKey> sKeySelect,
-		                                       Func<U, V, T> resultor)
-		{
-			IEnumerator<U> eFirst = first.GetEnumerator ();
-			IEnumerator<V> eSecond = second.GetEnumerator ();
-
-			try {
-				bool fstHasCurrent = false, sndHasCurrent = false;
-				Tuple<VSlot<U>, VSlot<V>> kvp;
-
-				while ((fstHasCurrent = eFirst.MoveNext ()) & (sndHasCurrent = eSecond.MoveNext ())) {
-
-					U e1 = eFirst.Current;
-					V e2 = eSecond.Current;
-
-					TKey key1 = fKeySelect (e1);
-					TKey key2 = sKeySelect (e2);
-
-					if (comparer.Equals (key1, key2)) {
-						yield return resultor (e1, e2);
-						continue;
-					}
-					
-					do {
-						if (store.TryRemove (key1, out kvp) && kvp.Item2.HasValue) {
-							yield return resultor (e1, kvp.Item2.Value);
-							break;
-						}
-					} while (!store.TryAdd (key1, Tuple.Create (new VSlot<U> (e1), new VSlot<V> ())));
-							
-					do {
-						if (store.TryRemove (key2, out kvp) && kvp.Item1.HasValue) {
-							yield return resultor (kvp.Item1.Value, e2);
-							break;
-						}
-					} while (!store.TryAdd (key2, Tuple.Create (new VSlot<U> (), new VSlot<V> (e2))));
-				}
-				if (fstHasCurrent) {
-					do {
-						U e1 = eFirst.Current;
-						TKey key1 = fKeySelect (e1);
-
-						do {
-							if (store.TryRemove (key1, out kvp) && kvp.Item2.HasValue) {
-								yield return resultor (e1, kvp.Item2.Value);
-								break;
-							}
-						} while (!store.TryAdd (key1, Tuple.Create (new VSlot<U> (e1), new VSlot<V> ())));
-					} while (eFirst.MoveNext ());
-				}
-				if (sndHasCurrent) {
-					do {
-						V e2 = eSecond.Current;
-						TKey key2 = sKeySelect (e2);
-
-						do {
-							if (store.TryRemove (key2, out kvp) && kvp.Item1.HasValue) {
-								yield return resultor (kvp.Item1.Value, e2);
-								break;
-							}
-						} while (!store.TryAdd (key2, Tuple.Create (new VSlot<U> (), new VSlot<V> (e2))));
-					} while (eSecond.MoveNext ());
-				}
-			} finally {
-				eFirst.Dispose ();
-				eSecond.Dispose ();
-			}
-		}
-	}
-}
-

+ 0 - 59
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryMuxNode.cs

@@ -1,59 +0,0 @@
-//
-// QueryMuxNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Linq;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal interface QueryMuxNode : IVisitableNode {
-		
-	}
-	internal abstract class QueryMuxNode<TFirst, TSecond, TResult> : QueryChildNode<TResult, TFirst>, QueryMuxNode
-	{
-		QueryBaseNode<TSecond> second;
-
-		internal QueryMuxNode (QueryBaseNode<TFirst> parent, QueryBaseNode<TSecond> second)
-			: base (parent)
-		{
-			this.second = second;
-		}
-
-		internal QueryBaseNode<TSecond> Second {
-			get {
-				return second;
-			}
-		}
-
-		public override void Visit (INodeVisitor visitor)
-		{
-			visitor.Visit ((QueryMuxNode)this);
-		}
-	}
-}
-

+ 0 - 158
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryOptionNode.cs

@@ -1,158 +0,0 @@
-//
-// QueryOptionNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Collections.Generic;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	// The first four elements correspond to the public operator With*
-	// Last CancellationToken parameter is used internally for ImplementerToken
-	using OptionsList = Tuple<ParallelMergeOptions?, ParallelExecutionMode?, CancellationToken?, int, CancellationTokenSource>;
-
-
-	interface QueryOptionNode : IVisitableNode {
-		OptionsList GetOptions ();
-	}
-
-	internal class QueryOptionNode<T> : QueryChildNode<T, T>, QueryOptionNode
-	{
-
-		public QueryOptionNode (QueryBaseNode<T> parent)
-			: base (parent)
-		{
-
-		}
-
-		public virtual OptionsList GetOptions ()
-		{
-			return new OptionsList (null, null, null, -1, null);
-		}
-
-		internal override IList<IEnumerable<T>> GetEnumerables (QueryOptions options)
-		{
-			return Parent.GetEnumerables (options);
-		}
-
-		internal override IList<IEnumerable<KeyValuePair<long, T>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			return Parent.GetOrderedEnumerables (options);
-		}
-
-		internal override IEnumerable<T> GetSequential ()
-		{
-			return Parent.GetSequential ();
-		}
-
-		public override void Visit (INodeVisitor visitor)
-		{
-			visitor.Visit ((QueryOptionNode)this);
-		}
-	}
-
-	internal class ParallelExecutionModeNode<T> : QueryOptionNode<T>
-	{
-		ParallelExecutionMode mode;
-
-		internal ParallelExecutionModeNode (ParallelExecutionMode mode, QueryBaseNode<T> parent)
-			: base (parent)
-		{
-			this.mode = mode;
-		}
-
-		public override OptionsList GetOptions ()
-		{
-			return new OptionsList (null, mode, null, -1, null);
-		}
-	}
-
-
-	internal class ParallelMergeOptionsNode<T> : QueryOptionNode<T>
-	{
-		ParallelMergeOptions opts;
-
-		internal ParallelMergeOptionsNode (ParallelMergeOptions opts, QueryBaseNode<T> parent)
-			: base (parent)
-		{
-			this.opts = opts;
-		}
-
-		public override OptionsList GetOptions ()
-		{
-			return new OptionsList (opts, null, null, -1, null);
-		}
-	}
-
-
-	internal class CancellationTokenNode<T> : QueryOptionNode<T>
-	{
-		CancellationToken token;
-
-		internal CancellationTokenNode (CancellationToken token, QueryBaseNode<T> parent)
-			: base (parent)
-		{
-			this.token = token;
-		}
-
-		public override OptionsList GetOptions ()
-		{
-			return new OptionsList (null, null, token, -1, null);
-		}
-	}
-
-	internal class DegreeOfParallelismNode<T> : QueryOptionNode<T>
-	{
-		int degreeParallelism;
-
-		internal DegreeOfParallelismNode (int degreeParallelism, QueryBaseNode<T> parent)
-			: base (parent)
-		{
-			this.degreeParallelism = degreeParallelism;
-		}
-
-		public override OptionsList GetOptions ()
-		{
-			return new OptionsList (null, null, null, degreeParallelism, null);
-		}
-	}
-
-	internal class ImplementerTokenNode<T> : QueryOptionNode<T>
-	{
-		CancellationTokenSource source;
-
-		internal ImplementerTokenNode (CancellationTokenSource token, QueryBaseNode<T> parent)
-			: base (parent)
-		{
-			this.source = token;
-		}
-
-		public override OptionsList GetOptions ()
-		{
-			return new OptionsList (null, null, null, -1, source);
-		}
-	}
-}

+ 0 - 120
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryOrderByNode.cs

@@ -1,120 +0,0 @@
-//
-// QueryOrderByNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal class QueryOrderByNode<T> : QueryOrderGuardNode<T>
-	{
-		Comparison<T> comparison;
-
-		public QueryOrderByNode (QueryBaseNode<T> parent, Comparison<T> comparison)
-			: base (parent, true)
-		{
-			this.comparison = comparison;
-		}
-
-
-		public QueryOrderByNode (QueryOrderByNode<T> parent, Comparison<T> comparison)
-			: base (parent.Parent, true)
-		{
-			this.comparison = MergeComparison (parent.ComparisonFunc, comparison);
-		}
-
-		public Comparison<T> ComparisonFunc {
-			get {
-				return comparison;
-			}
-		}
-
-		internal override IEnumerable<T> GetSequential ()
-		{
-			return Parent.GetSequential ().OrderBy ((e) => e, new ComparisonComparer (comparison));
-		}
-
-		private class ComparisonComparer : IComparer<T>
-		{
-			Comparison<T> comparison;
-
-			internal ComparisonComparer (Comparison<T> comparison)
-			{
-				this.comparison = comparison;
-			}
-
-			int IComparer<T>.Compare (T x, T y)
-			{
-				return comparison (x, y);
-			}
-		}
-
-		internal override IList<IEnumerable<T>> GetEnumerables (QueryOptions options)
-		{
-			throw new InvalidOperationException ("Shouldn't be called");
-		}
-
-		internal override IList<IEnumerable<KeyValuePair<long, T>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			int partitionCount;
-			IList<T> aggregList = GetAggregatedList (out partitionCount);
-			IList<T> result = ParallelQuickSort<T>.Sort (aggregList, comparison);
-
-			OrderablePartitioner<T> partitioner = ParallelPartitioner.CreateForStrips (result, 1);
-
-			return WrapHelper.Wrap (partitioner.GetOrderablePartitions (options.PartitionCount));
-		}
-
-		IList<T> GetAggregatedList (out int partitionCount)
-		{
-			AggregationList<T> result = null;
-			partitionCount = -1;
-
-			ParallelExecuter.ProcessAndAggregate<T, IList<T>> (Parent, () => new List<T> (),
-			                                                   LocalCall,
-			                                                   (ls) => { result = new AggregationList<T> (ls); });
-
-			return result;
-		}
-
-		IList<T> LocalCall (IList<T> list, T element)
-		{
-			list.Add (element);
-			return list;
-		}
-
-		static Comparison<T> MergeComparison (Comparison<T> source, Comparison<T> other)
-		{
-			return (e1, e2) => {
-				int result = source (e1, e2);
-				return result == 0 ? other (e1, e2) : result;
-			};
-		}
-	}
-}

+ 0 - 101
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryOrderGuardNode.cs

@@ -1,101 +0,0 @@
-// QueryOrderGuardNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Collections.Generic;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal interface QueryOrderGuardNode : IVisitableNode {
-		bool EnsureOrder { get; }
-	}
-
-	internal abstract class QueryOrderGuardNode<T> : QueryStreamNode<T, T>, QueryOrderGuardNode
-	{
-		bool ensureOrder;
-
-		internal QueryOrderGuardNode (QueryBaseNode<T> parent, bool ensureOrder)
-			: base (parent, ensureOrder)
-		{
-			this.ensureOrder = ensureOrder;
-		}
-
-		public bool EnsureOrder {
-			get {
-				return ensureOrder;
-			}
-		}
-
-		internal override IEnumerable<T> GetSequential ()
-		{
-			return Parent.GetSequential ();
-		}
-
-		public override void Visit (INodeVisitor visitor)
-		{
-			visitor.Visit ((QueryOrderGuardNode)this);
-		}
-	}
-
-	internal class QueryAsUnorderedNode<T> : QueryOrderGuardNode<T>
-	{
-		internal QueryAsUnorderedNode (QueryBaseNode<T> parent)
-			: base (parent, false)
-		{
-
-		}
-
-		internal override IList<IEnumerable<T>> GetEnumerables (QueryOptions options)
-		{
-			return Parent.GetEnumerables (options);
-		}
-
-		internal override IList<IEnumerable<KeyValuePair<long, T>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			return Parent.GetOrderedEnumerables (options);
-		}
-
-	}
-
-	internal class QueryAsOrderedNode<T> : QueryOrderGuardNode<T>
-	{
-		internal QueryAsOrderedNode (QueryBaseNode<T> parent)
-			: base (parent, true)
-		{
-
-		}
-
-		internal override IList<IEnumerable<T>> GetEnumerables (QueryOptions options)
-		{
-			return Parent.GetEnumerables (options);
-		}
-
-		internal override IList<IEnumerable<KeyValuePair<long, T>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			return Parent.GetOrderedEnumerables (options);
-		}
-
-	}
-}

+ 0 - 38
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryOrderedStreamNode.cs

@@ -1,38 +0,0 @@
-//
-// QueryOrderedStreamNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Parallel.QueryNodes
-{
-	internal abstract class QueryOrderedStreamNode<T, TParent> : QueryStreamNode<T, TParent>
-	{
-		internal QueryOrderedStreamNode (QueryBaseNode<TParent> parent, bool isIndexed)
-			: base (parent, isIndexed)
-		{
-		}
-	}
-}

+ 0 - 65
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryReverseNode.cs

@@ -1,65 +0,0 @@
-//
-// QueryReverseNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Linq;
-using System.Threading;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal class QueryReverseNode<TSource> : QueryStreamNode<TSource, TSource>
-	{
-		ParallelQuery<TSource> source;
-
-		public QueryReverseNode (ParallelQuery<TSource> source)
-			: base (source.Node, false)
-		{
-			this.source = source;
-		}
-
-		internal override IEnumerable<TSource> GetSequential ()
-		{
-			return Parent.GetSequential ().Reverse ();
-		}
-
-		// As stated in the doc, in this case we do nothing
-		internal override IList<IEnumerable<TSource>> GetEnumerables (QueryOptions options)
-		{
-			return Parent.GetEnumerables (options);
-		}
-
-		internal override IList<IEnumerable<KeyValuePair<long, TSource>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			ReverseList<TSource> reversed = new ReverseList<TSource> (source.ToListOrdered ());
-			OrderablePartitioner<TSource> partitioner = ParallelPartitioner.CreateForStrips (reversed, 1);
-
-			return WrapHelper.Wrap (partitioner.GetOrderablePartitions (options.PartitionCount));
-		}
-	}
-}
-

+ 0 - 205
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QuerySelectManyNode.cs

@@ -1,205 +0,0 @@
-//
-// QueryConcatNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal class QuerySelectManyNode<TSource, TCollection, TResult> : QueryStreamNode<TResult, TSource>
-	{
-		Func<TSource, IEnumerable<TCollection>> collectionSelector;
-		Func<TSource, int, IEnumerable<TCollection>> collectionSelectorIndexed;
-		Func<TSource, TCollection, TResult> resultSelector;
-		
-		internal QuerySelectManyNode (QueryBaseNode<TSource> parent,
-		                              Func<TSource, int, IEnumerable<TCollection>> collectionSelectorIndexed,
-		                              Func<TSource, TCollection, TResult> resultSelector)
-			: base (parent, true)
-		{
-			this.collectionSelectorIndexed = collectionSelectorIndexed;
-			this.resultSelector = resultSelector;
-		}
-		
-		internal QuerySelectManyNode (QueryBaseNode<TSource> parent,
-		                              Func<TSource, IEnumerable<TCollection>> collectionSelector,
-		                              Func<TSource, TCollection, TResult> resultSelector)
-			: base (parent, false)
-		{
-			this.collectionSelector = collectionSelector;
-			this.resultSelector = resultSelector;
-		}
-		
-		internal override IEnumerable<TResult> GetSequential ()
-		{
-			IEnumerable<TSource> source = Parent.GetSequential ();
-			
-			return IsIndexed ?
-				source.SelectMany (collectionSelectorIndexed, resultSelector) :
-				source.SelectMany (collectionSelector, resultSelector);
-		}
-		
-		internal override IList<IEnumerable<TResult>> GetEnumerablesIndexed (QueryOptions options)
-		{
-			return Parent.GetOrderedEnumerables (options)
-				.Select ((i) => GetEnumerableInternal (i,
-				                                       (kv) => collectionSelectorIndexed (kv.Value, (int)kv.Key),
-				                                       (e, c) => resultSelector (e.Value, c)))
-				.ToList ();
-		}
-
-		internal override IList<IEnumerable<TResult>> GetEnumerablesNonIndexed (QueryOptions options)
-		{
-			return Parent.GetEnumerables (options)
-				.Select ((i) => GetEnumerableInternal (i,
-				                                       collectionSelector,
-				                                       (e, c) => resultSelector (e, c)))
-				.ToList ();
-		}
-
-		internal override IList<IEnumerable<KeyValuePair<long, TResult>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			var source = Parent.GetOrderedEnumerables (options);
-			var sizeRequests = new SizeRequest[source.Count];
-			long deviation = 0;
-
-			Barrier barrier = new Barrier (source.Count, delegate (Barrier b) {
-					Array.Sort (sizeRequests, KeyComparator);
-					for (int i = 0; i < b.ParticipantCount; ++i) {
-						if (sizeRequests[i].Key == -1)
-							continue;
-						sizeRequests[i].Key = deviation;
-						deviation += sizeRequests[i].Size;
-					}
-				});
-
-			return source
-				.Select ((i, ind) => GetOrderedEnumerableInternal (i, sizeRequests, ind, barrier))
-				.ToList ();
-		}
-		
-		IEnumerable<TResult> GetEnumerableInternal<T> (IEnumerable<T> source,
-		                                               Func<T, IEnumerable<TCollection>> collectionner,
-		                                               Func<T, TCollection, TResult> packer)
-		{
-			foreach (T element in source)
-				foreach (TCollection item in collectionner (element))
-					yield return packer (element, item);
-		}
-		
-		IEnumerable<KeyValuePair<long, TResult>> GetOrderedEnumerableInternal (IEnumerable<KeyValuePair<long, TSource>> source,
-		                                                                       SizeRequest[] sizeRequests,
-		                                                                       int index,
-		                                                                       Barrier barrier)
-		{
-			IEnumerator<KeyValuePair<long, TSource>> enumerator = source.GetEnumerator ();
-			bool isIndexed = IsIndexed;
-
-			try {
-				while (true) {
-					KeyValuePair<long, TSource> element;
-					IEnumerable<TCollection> collection;
-
-					if (enumerator.MoveNext ()) {
-						element = enumerator.Current;
-						collection = isIndexed ?
-							collectionSelectorIndexed (element.Value, (int)element.Key) :
-							collectionSelector (element.Value);
-
-						var count = GetCount (ref collection);
-
-						sizeRequests[index].Update (element.Key, count, collection, element.Value);
-					}
-
-					barrier.SignalAndWait ();
-
-					long i = sizeRequests[index].Key;
-					collection = sizeRequests[index].Collection;
-					var elementValue = sizeRequests[index].ElementValue;
-
-					sizeRequests[index].Clear ();
-
-					if (i == -1)
-						break;
-
-					foreach (TCollection item in collection)
-						yield return new KeyValuePair<long, TResult> (i++, resultSelector (elementValue, item));
-				}
-			} finally {
-				barrier.RemoveParticipant ();
-				enumerator.Dispose ();
-			}
-		}
-
-		/* If getting Count is a O(1) operation (i.e. actual is a ICollection) then return it immediatly
-		 * if not process the IEnumerable into a List and return the Count from that (i.e. enumerable
-		 * processing will only happen once in case of e.g. a Linq query)
-		 */
-		static int GetCount<T> (ref IEnumerable<T> actual)
-		{
-			ICollection coll = actual as ICollection;
-			if (coll != null)
-				return coll.Count;
-
-			var foo = actual.ToList ();
-			actual = foo;
-
-			return foo.Count;
-		}
-
-		static int KeyComparator (SizeRequest e1, SizeRequest e2)
-		{
-			return e1.Key.CompareTo (e2.Key);
-		}
-
-		struct SizeRequest
-		{
-			public long Key;
-			public int Size;
-			public IEnumerable<TCollection> Collection;
-			public TSource ElementValue;
-
-			public void Update (long k, int s, IEnumerable<TCollection> c, TSource ev)
-			{
-				Key = k;
-				Size = s;
-				Collection = c;
-				ElementValue = ev;
-			}
-
-			public void Clear ()
-			{
-				Key = -1;
-				Size = 0;
-				Collection = null;
-				ElementValue = default (TSource);
-			}
-		}
-	}
-}
-

+ 0 - 82
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QuerySelectNode.cs

@@ -1,82 +0,0 @@
-//
-// QuerySelectNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Linq;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal class QuerySelectNode<TResult, TSource> : QueryStreamNode<TResult, TSource>
-	{
-		Func<TSource, int, TResult> indexedSelector;
-		Func<TSource, TResult> selector;
-
-		internal QuerySelectNode (QueryBaseNode<TSource> parent, Func<TSource, TResult> selector)
-			: base (parent, false)
-		{
-			this.selector = selector;
-		}
-
-		internal QuerySelectNode (QueryBaseNode<TSource> parent, Func<TSource, int, TResult> selector)
-			: base (parent, true)
-		{
-			this.indexedSelector = selector;
-		}
-
-		internal override IEnumerable<TResult> GetSequential ()
-		{
-			return IsIndexed ?
-				Parent.GetSequential ().Select (indexedSelector) :
-				Parent.GetSequential ().Select (selector);
-		}
-
-		internal override IList<IEnumerable<TResult>> GetEnumerablesIndexed (QueryOptions options)
-		{
-			return Parent.GetOrderedEnumerables (options)
-				.Select ((i) => i.Select ((e) => indexedSelector (e.Value, (int)e.Key)))
-				.ToList ();
-		}
-
-		internal override IList<IEnumerable<TResult>> GetEnumerablesNonIndexed (QueryOptions options)
-		{
-			return Parent.GetEnumerables (options)
-				.Select ((i) => i.Select (selector))
-				.ToList ();
-		}
-
-		internal override IList<IEnumerable<KeyValuePair<long, TResult>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			return Parent.GetOrderedEnumerables (options)
-				.Select ((i) => 
-				         IsIndexed ? 
-				         i.Select ((e) => new KeyValuePair<long, TResult> (e.Key, indexedSelector (e.Value, (int)e.Key))) :
-				         i.Select ((e) => new KeyValuePair<long, TResult> (e.Key, selector (e.Value))))
-				.ToList ();
-		}
-	}
-}

+ 0 - 142
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QuerySetNode.cs

@@ -1,142 +0,0 @@
-//
-// QueryMuxNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Linq;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal class QuerySetNode<TSource> : QueryMuxNode<TSource, TSource, TSource>
-	{
-		readonly SetInclusion setInclusion;
-		readonly IEqualityComparer<TSource> comparer;
-
-		internal QuerySetNode (SetInclusion setInclusion, IEqualityComparer<TSource> comparer,
-		                       QueryBaseNode<TSource> first, QueryBaseNode<TSource> second)
-			: base (first, second)
-		{
-			this.setInclusion = setInclusion;
-			this.comparer = comparer;
-		}
-
-		internal override IEnumerable<TSource> GetSequential ()
-		{
-			var first = Parent.GetSequential ();
-			var second = Second == null ? null : Second.GetSequential ();
-
-			// We try to do some guessing based on the default
-			switch (setInclusion) {
-			case SetInclusionDefaults.Union:
-				return first.Union (second, comparer);
-			case SetInclusionDefaults.Intersect:
-				return first.Intersect (second, comparer);
-			case SetInclusionDefaults.Except:
-				return first.Except (second, comparer);
-			case SetInclusionDefaults.Distinct:
-				return first.Distinct (comparer);
-			}
-
-			// Default is we return the bare source enumerable
-			return first;
-		}
-
-		internal override IList<IEnumerable<TSource>> GetEnumerables (QueryOptions options)
-		{
-			var first = Parent.GetEnumerables (options);
-			var second = Second.GetEnumerables (options);
-			
-			var checker = new ConcurrentDictionary<TSource, object> (comparer);
-			InitConcurrentDictionary (checker, second, (e) => e);
-
-			return first
-				.Select ((f, i) => GetEnumerable<TSource> (f, second[i], checker, (e) => e))
-				.ToList ();
-		}
-
-		internal override IList<IEnumerable<KeyValuePair<long, TSource>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			var first = Parent.GetOrderedEnumerables (options);
-			var second = Second.GetOrderedEnumerables (options);
-
-			var checker = new ConcurrentDictionary<TSource, object> (comparer);
-			InitConcurrentDictionary (checker, second, (e) => e.Value);
-
-			return first
-				.Select ((f, i) => GetEnumerable<KeyValuePair<long, TSource>> (f, second[i], checker, (e) => e.Value))
-				.ToList ();
-		}
-				
-		void InitConcurrentDictionary<TExtract> (ConcurrentDictionary<TSource, object> checker,
-		                                         IList<IEnumerable<TExtract>> feeds,
-		                                         Func<TExtract, TSource> extractor)
-		{
-			if ((setInclusion & SetInclusion.Preload) == 0)
-				return;
-			
-			foreach (IEnumerable<TExtract> feed in feeds)
-				foreach (TExtract item in feed)
-					checker.TryAdd (extractor (item), null);
-		}
-
-		IEnumerable<TExtract> GetEnumerable<TExtract> (IEnumerable<TExtract> first,
-		                                               IEnumerable<TExtract> second,
-		                                               ConcurrentDictionary<TSource, object> checker,
-		                                               Func<TExtract, TSource> extractor)
-		{
-			IEnumerator<TExtract> eFirst = first.GetEnumerator ();
-			IEnumerator<TExtract> eSecond = second == null ? null : second.GetEnumerator ();
-
-			IEnumerator<TExtract> current = eFirst;
-			bool outInclusion = (setInclusion & SetInclusion.Out) > 0;
-			bool preload = (setInclusion & SetInclusion.Preload) > 0;
-			bool relaxed = (setInclusion & SetInclusion.Relaxed) > 0;
-
-			try {
-				while (current != null) {
-					while (current.MoveNext ()) {
-						bool result = relaxed ?
-							checker.ContainsKey (extractor (current.Current)) : checker.TryAdd (extractor (current.Current), null);
-
-						if ((result && outInclusion)
-						    || (!result && !outInclusion))
-							yield return current.Current;
-					}
-
-					if (current == eFirst && !preload)
-						current = eSecond;
-					else
-						break;
-				}
-			} finally {
-				eFirst.Dispose ();
-				eSecond.Dispose ();
-			}
-		}
-	}
-}
-

+ 0 - 125
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryStartNode.cs

@@ -1,125 +0,0 @@
-//
-// QueryStartNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Collections;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal interface QueryStartNode : IVisitableNode {
-		int Count { get; }
-	}
-
-	internal class QueryStartNode<T> : QueryBaseNode<T>, QueryStartNode
-	{
-		readonly IEnumerable<T> source;
-		readonly Partitioner<T> customPartitioner;
-
-		internal QueryStartNode (IEnumerable<T> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			this.source = source;
-		}
-
-		internal QueryStartNode (Partitioner<T> custom)
-		{
-			if (custom == null)
-				throw new ArgumentNullException ("custom");
-
-			this.customPartitioner = custom;
-		}
-
-		// If possible, this property will return the number of element the query
-		// is going to process. If that number if pretty low, executing the query
-		// sequentially is better
-		public int Count {
-			get {
-				if (source == null)
-					return -1;
-
-				ICollection coll = source as ICollection;
-				return coll == null ? -1 : coll.Count;
-			}
-		}
-
-		public override void Visit (INodeVisitor visitor)
-		{
-			visitor.Visit ((QueryStartNode)this);
-		}
-
-		internal override IEnumerable<T> GetSequential ()
-		{
-			if (source != null)
-				return source;
-
-			return WrapHelper.Wrap (customPartitioner.GetPartitions (1))[0];
-		}
-
-		internal override IList<IEnumerable<T>> GetEnumerables (QueryOptions options)
-		{
-			if (customPartitioner != null) {
-				return WrapHelper.Wrap (customPartitioner.GetPartitions (options.PartitionCount));
-			}
-
-			Partitioner<T> partitioner
-				= (options.UseStrip) ? ParallelPartitioner.CreateForStrips (source, 1) : ParallelPartitioner.CreateBest (source);
-
-			return WrapHelper.Wrap (partitioner.GetPartitions (options.PartitionCount));
-		}
-
-		internal override IList<IEnumerable<KeyValuePair<long, T>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			OrderablePartitioner<T> partitioner = null;
-			if (customPartitioner != null) {
-				partitioner = customPartitioner as OrderablePartitioner<T>;
-				if (partitioner == null)
-					throw new InvalidOperationException ("The partitionner you are using doesn't support ordered partitionning");
-			} else {
-				partitioner =
-					(options.UseStrip) ? ParallelPartitioner.CreateForStrips (source, 1) : ParallelPartitioner.CreateBest (source);
-			}
-
-			options.PartitionerSettings = Tuple.Create (partitioner.KeysOrderedAcrossPartitions,
-			                                            partitioner.KeysOrderedInEachPartition,
-			                                            partitioner.KeysNormalized);
-
-			// We only support one style of partitioning at the moment.
-			// Standard partitioners follow this style.
-			if (options.UseStrip && (!partitioner.KeysOrderedInEachPartition || partitioner.KeysOrderedAcrossPartitions))
-				throw new NotImplementedException ("Partitioner must have KeysOrderedInEachPartition "
-				                                   + "and !KeysOrderedAcrossPartitions"
-				                                   + "to be used with indexed operators");
-
-			return WrapHelper.Wrap (partitioner.GetOrderablePartitions (options.PartitionCount));
-		}
-	}
-}

+ 0 - 77
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryStreamNode.cs

@@ -1,77 +0,0 @@
-//
-// QueryStreamNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Threading.Tasks;
-using System.Collections.Generic;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal interface QueryStreamNode : IVisitableNode {
-		bool IsIndexed { get; }
-	}
-
-	internal abstract class QueryStreamNode<T, TParent> : QueryChildNode<T, TParent>, QueryStreamNode
-	{
-		bool isIndexed;
-
-		internal QueryStreamNode (QueryBaseNode<TParent> parent, bool isIndexed)
-			: base (parent)
-		{
-			this.isIndexed = isIndexed;
-		}
-
-		internal override IList<IEnumerable<T>> GetEnumerables (QueryOptions options)
-		{
-			if (IsIndexed)
-				return GetEnumerablesIndexed (options);
-			else
-				return GetEnumerablesNonIndexed (options);
-		}
-
-		internal virtual IList<IEnumerable<T>> GetEnumerablesIndexed (QueryOptions options)
-		{
-			return null;
-		}
-
-		internal virtual IList<IEnumerable<T>> GetEnumerablesNonIndexed (QueryOptions options)
-		{
-			return null;
-		}
-
-		public override void Visit (INodeVisitor visitor)
-		{
-			visitor.Visit ((QueryStreamNode)this);
-		}
-
-		public bool IsIndexed {
-			get {
-				return isIndexed;
-			}
-		}
-	}
-}

+ 0 - 165
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryWhereNode.cs

@@ -1,165 +0,0 @@
-//
-// QueryWhereNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Linq;
-using System.Threading;
-using System.Collections.Generic;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-
-	internal class QueryWhereNode<TSource> : QueryStreamNode<TSource, TSource>
-	{
-		Func<TSource, int, bool> indexedPredicate;
-		Func<TSource, bool> predicate;
-
-		internal QueryWhereNode (QueryBaseNode<TSource> parent, Func<TSource, bool> predicate)
-			: base (parent, false)
-		{
-			this.predicate = predicate;
-		}
-
-		internal QueryWhereNode (QueryBaseNode<TSource> parent, Func<TSource, int, bool> predicate)
-			: base (parent, true)
-		{
-			this.indexedPredicate = predicate;
-		}
-
-		internal override IEnumerable<TSource> GetSequential ()
-		{
-			IEnumerable<TSource> parent = Parent.GetSequential ();
-
-			if (indexedPredicate != null)
-				return parent.Where (indexedPredicate);
-			else
-				return parent.Where (predicate);
-		}
-
-		internal override IList<IEnumerable<TSource>> GetEnumerablesIndexed (QueryOptions options)
-		{
-			return Parent.GetOrderedEnumerables (options)
-				.Select (i => i.Where (e => indexedPredicate (e.Value, (int)e.Key)).Select (e => e.Value))
-				.ToList ();
-		}
-
-		internal override IList<IEnumerable<TSource>> GetEnumerablesNonIndexed (QueryOptions options)
-		{
-			return Parent.GetEnumerables (options)
-				.Select (i => i.Where (predicate))
-				.ToList ();
-		}
-
-		internal override IList<IEnumerable<KeyValuePair<long, TSource>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			IList<IEnumerable<KeyValuePair<long, TSource>>> sources = Parent.GetOrderedEnumerables (options);
-
-			ProcessingSlot[] store = new ProcessingSlot[sources.Count];
-			Comparison<ProcessingSlot> arrayComparison = ArraySortMethod;
-			long lastIndex = 0;
-
-			Barrier barrier = new Barrier (sources.Count, delegate (Barrier b) {
-				// Sort the store
-				Array.Sort (store, arrayComparison);
-
-				// Reassign a good index
-				int i = 0;
-				for (i = 0; i < store.Length && store[i].IsValid; ++i)
-					store[i].Index = lastIndex + i;
-
-				// Update lastIndex for next round
-				lastIndex += i;
-			});
-
-			return sources
-				.Select ((s, i) => GetEnumerator (s, barrier, options.MergedToken, store, i))
-				.ToList ();
-		}
-
-		static int ArraySortMethod (ProcessingSlot lhs, ProcessingSlot rhs)
-		{
-			if (lhs.IsValid && !rhs.IsValid)
-				return -1;
-			if (!lhs.IsValid && rhs.IsValid)
-				return 1;
-			if (!lhs.IsValid && !rhs.IsValid)
-				return 0;
-
-			return lhs.Index < rhs.Index ? -1 : 1;
-		}
-
-		IEnumerable<KeyValuePair<long, TSource>> GetEnumerator (IEnumerable<KeyValuePair<long, TSource>> source,
-		                                                        Barrier barrier,
-		                                                        CancellationToken token,
-		                                                        ProcessingSlot[] store, int index)
-		{
-			IEnumerator<KeyValuePair<long, TSource>> current = source.GetEnumerator ();
-			bool isIndexed = IsIndexed;
-
-			try {
-				while (current.MoveNext ()) {
-					KeyValuePair<long, TSource> curr = current.Current;
-
-					bool result = isIndexed ? indexedPredicate (curr.Value, (int)curr.Key) : predicate (curr.Value);
-					store[index].Update (curr.Value, curr.Key, result);
-
-					barrier.SignalAndWait (token);
-
-					var value = store [index];
-
-					if (value.IsValid)
-						yield return new KeyValuePair<long, TSource> (value.Index, value.Value);
-
-					// Reset
-					store[index].Clear ();
-				}
-			} finally {
-				// Remove our participation
-				barrier.RemoveParticipant ();
-				current.Dispose ();
-			}
-		}
-
-		struct ProcessingSlot
-		{
-			public TSource Value;
-			public long Index;
-			public bool IsValid;
-
-			public void Update (TSource v, long i, bool t)
-			{
-				Value = v;
-				Index = i;
-				IsValid = t;
-			}
-
-			public void Clear ()
-			{
-				Update (default (TSource), long.MaxValue, false);
-			}
-		}
-	}
-}

+ 0 - 158
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryZipNode.cs

@@ -1,158 +0,0 @@
-//
-// QueryZipNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Linq;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal class QueryZipNode<TFirst, TSecond, TResult> : QueryMuxNode<TFirst, TSecond, TResult>
-	{
-		Func<TFirst, TSecond, TResult> resultSelector;
-
-		public QueryZipNode (Func<TFirst, TSecond, TResult> resultSelector, QueryBaseNode<TFirst> first, QueryBaseNode<TSecond> second)
-			: base (first, second)
-		{
-			this.resultSelector = resultSelector;
-		}
-
-		// If strict is set to `true', the zip'ing process will throw if sequences length mistmatches
-		public bool Strict {
-			get;
-			set;
-		}
-
-		internal override IEnumerable<TResult> GetSequential ()
-		{
-			IEnumerable<TFirst> first = Parent.GetSequential ();
-			IEnumerable<TSecond> second = Second.GetSequential ();
-
-			return first.Zip (second, resultSelector);
-		}
-
-		internal override IList<IEnumerable<TResult>> GetEnumerables (QueryOptions options)
-		{
-			var first = Parent.GetEnumerables (options);
-			var second = Second.GetEnumerables (options);
-
-			if (first.Count != second.Count)
-				throw new InvalidOperationException ("Internal size mismatch");
-
-			return first
-				.Select ((f, i) => GetEnumerable (f, second[i]))
-				.ToList ();
-		}
-
-		IEnumerable<TResult> GetEnumerable (IEnumerable<TFirst> first, IEnumerable<TSecond> second)
-		{
-			IEnumerator<TFirst> eFirst = first.GetEnumerator ();
-			IEnumerator<TSecond> eSecond = second.GetEnumerator ();
-
-			try {
-				while (eFirst.MoveNext ()) {
-					if (!eSecond.MoveNext ()) {
-						if (Strict)
-							throw new QueryZipException ();
-						else
-							yield break;
-					}
-
-					yield return resultSelector (eFirst.Current, eSecond.Current);
-				}
-				if (Strict && eSecond.MoveNext ())
-					throw new QueryZipException ();
-			} finally {
-				eFirst.Dispose ();
-				eSecond.Dispose ();
-			}
-		}
-
-		internal override IList<IEnumerable<KeyValuePair<long, TResult>>> GetOrderedEnumerables (QueryOptions options)
-		{
-			var first = Parent.GetOrderedEnumerables (options);
-			var second = Second.GetOrderedEnumerables (options);
-
-			if (first.Count != second.Count)
-				throw new InvalidOperationException ("Internal size mismatch");
-
-			var store1 = new KeyValuePair<long, TFirst>[first.Count];
-			var store2 = new KeyValuePair<long, TSecond>[second.Count];
-
-			var barrier = new Barrier (first.Count, delegate {
-				Array.Sort (store1, (e1, e2) => e1.Key.CompareTo (e2.Key));
-				Array.Sort (store2, (e1, e2) => e1.Key.CompareTo (e2.Key));
-			});
-
-			return first
-				.Select ((f, i) => GetEnumerable (f, second[i], i , store1, store2, barrier))
-				.ToList ();
-		}
-
-		IEnumerable<KeyValuePair<long, TResult>> GetEnumerable (IEnumerable<KeyValuePair<long, TFirst>> first,
-		                                                        IEnumerable<KeyValuePair<long, TSecond>> second,
-		                                                        int index,
-		                                                        KeyValuePair<long, TFirst>[] store1,
-		                                                        KeyValuePair<long, TSecond>[] store2,
-		                                                        Barrier barrier)
-		{
-			var eFirst = first.GetEnumerator ();
-			var eSecond = second.GetEnumerator ();
-
-			try {
-				while (eFirst.MoveNext ()) {
-					if (!eSecond.MoveNext ()) {
-						if (Strict)
-							throw new QueryZipException ();
-						else
-							break;
-					}
-
-					store1[index] = eFirst.Current;
-					store2[index] = eSecond.Current;
-
-					barrier.SignalAndWait ();
-
-					yield return new KeyValuePair<long, TResult> (store1[index].Key,
-					                                              resultSelector (store1[index].Value, store2[index].Value));
-				}
-				if (Strict && eSecond.MoveNext ())
-					throw new QueryZipException ();
-			} finally {
-				barrier.RemoveParticipant ();
-				eFirst.Dispose ();
-				eSecond.Dispose ();
-			}
-		}
-	}
-
-	internal class QueryZipException : Exception
-	{
-	}
-}
-

+ 0 - 50
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/SetInclusion.cs

@@ -1,50 +0,0 @@
-//
-// SetInclusion.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Linq;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	[Flags]
-	internal enum SetInclusion {
-		In = 0, // Element should already be in checker
-		Out = 1, // Element shouldn't be already in checker
-		Preload = 2, // Preload second node content and only do real work on first node content
-		Relaxed = 4, // first node content isn't added to checker allowing duplicates
-	}
-
-	internal static class SetInclusionDefaults
-	{
-		public const SetInclusion Union = SetInclusion.Out;
-		public const SetInclusion Intersect = SetInclusion.In;
-		public const SetInclusion Except = SetInclusion.In | SetInclusion.Preload | SetInclusion.Relaxed;
-		public const SetInclusion Distinct = SetInclusion.Out | SetInclusion.Preload;
-	}
-}
-

+ 0 - 64
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/WrapHelper.cs

@@ -1,64 +0,0 @@
-//
-// WrapHelper.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Linq;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace System.Linq.Parallel.QueryNodes
-{
-	internal static class WrapHelper
-	{
-		class EnumeratorWrapper<TEnum> : IEnumerable<TEnum>
-		{
-			IEnumerator<TEnum> enumerator;
-
-			public EnumeratorWrapper (IEnumerator<TEnum> enumerator)
-			{
-				this.enumerator = enumerator;
-			}
-
-			public IEnumerator<TEnum> GetEnumerator ()
-			{
-				return enumerator;
-			}
-
-			IEnumerator IEnumerable.GetEnumerator ()
-			{
-				return (IEnumerator)enumerator;
-			}
-		}
-
-		internal static IList<IEnumerable<TEnum>> Wrap<TEnum> (this IList<IEnumerator<TEnum>> src)
-		{
-			var list = new List<IEnumerable<TEnum>> (src.Count);
-			foreach (var iterator in src)
-				list.Add (new EnumeratorWrapper<TEnum> (iterator));
-			return list;
-		}
-	}
-}

+ 0 - 133
mcs/class/System.Core/System.Linq.Parallel/AggregationList.cs

@@ -1,133 +0,0 @@
-//
-// AggregationList.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Collections;
-using System.Collections.Generic;
-
-namespace System.Linq.Parallel
-{
-	internal class AggregationList<T> : IList<T>
-	{
-		readonly IList<IList<T>> listes;
-		readonly int count;
-
-		internal AggregationList (IList<IList<T>> listes)
-		{
-			this.listes = listes;
-			foreach (var l in listes)
-				count += l.Count;
-		}
-
-		public int IndexOf (T item)
-		{
-			throw new NotImplementedException();
-		}
-
-		public void Insert (int index, T item)
-		{
-			throw new NotImplementedException();
-		}
-
-		public void RemoveAt (int index)
-		{
-			throw new NotImplementedException();
-		}
-
-		public T this[int index] {
-			get {
-				int listIndex, newIndex;
-				GetModifiedIndexes (index, out listIndex, out newIndex);
-
-				return listes[listIndex][newIndex];
-			}
-			set {
-				throw new NotImplementedException();
-			}
-		}
-
-		void GetModifiedIndexes (int index, out int listIndex, out int newIndex)
-		{
-			listIndex = 0;
-			newIndex = index;
-
-			while (newIndex >= listes[listIndex].Count) {
-				newIndex -= listes[listIndex].Count;
-				listIndex++;
-
-				if (listIndex > listes.Count)
-					throw new ArgumentOutOfRangeException ();
-			}
-		}
-
-		public void Add (T item)
-		{
-			throw new NotImplementedException();
-		}
-
-		public void Clear ()
-		{
-			throw new NotImplementedException();
-		}
-
-		public bool Contains (T item)
-		{
-			throw new NotImplementedException();
-		}
-
-		public void CopyTo (T[] array, int arrayIndex)
-		{
-			throw new NotImplementedException();
-		}
-
-		public bool Remove (T item)
-		{
-			throw new NotImplementedException();
-		}
-
-		public int Count {
-			get {
-				return count;
-			}
-		}
-
-		public bool IsReadOnly {
-			get {
-				return true;
-			}
-		}
-
-		IEnumerator<T> IEnumerable<T>.GetEnumerator ()
-		{
-			return null;
-		}
-
-		IEnumerator IEnumerable.GetEnumerator ()
-		{
-			return null;
-		}
-	}
-}

+ 0 - 17
mcs/class/System.Core/System.Linq.Parallel/ChangeLog

@@ -1,17 +0,0 @@
-2010-04-29  Jérémie Laval  <[email protected]>
-
-	* OrderingEnumerator.cs: Use new non-blocking collection
-	for storing indexed elements.
-
-2010-04-15  Jérémie Laval  <[email protected]>
-
-	* AggregationList.cs:
-	* ConcurrentGrouping.cs:
-	* ConcurrentLookup.cs:
-	* OrderingEnumerator.cs:
-	* ParallelQuickSort.cs:
-	* RangeList.cs:
-	* RepeatList.cs:
-	* ReverseList.cs:
-	* StripPartitioner.cs: Initial check-in of PLinq
-

+ 0 - 63
mcs/class/System.Core/System.Linq.Parallel/ConcurrentGrouping.cs

@@ -1,63 +0,0 @@
-//
-// ConcurrentGrouping.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-
-namespace System.Linq.Parallel
-{
-	internal class ConcurrentGrouping<TKey, TElement> : IGrouping<TKey, TElement>
-	{
-		TKey key;
-		IEnumerable<TElement> elements;
-
-		internal ConcurrentGrouping (TKey key, IEnumerable<TElement> elements)
-		{
-			this.key = key;
-			this.elements = elements;
-		}
-
-		public TKey Key {
-			get {
-				return key;
-			}
-		}
-
-		IEnumerator IEnumerable.GetEnumerator ()
-		{
-			return ((IEnumerable)elements).GetEnumerator ();
-		}
-
-		IEnumerator<TElement> IEnumerable<TElement>.GetEnumerator ()
-		{
-			return elements.GetEnumerator ();
-		}
-	}
-}
-

+ 0 - 115
mcs/class/System.Core/System.Linq.Parallel/ConcurrentLookup.cs

@@ -1,115 +0,0 @@
-//
-// ConcurrentLookup.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-
-namespace System.Linq.Parallel
-{
-	internal class ConcurrentLookup<TKey, TElement> : ILookup<TKey, TElement>
-	{
-		ConcurrentDictionary<TKey, IEnumerable<TElement>> dictionary;
-
-		private class AddSlot
-		{
-			TElement element;
-
-			internal AddSlot (TElement element)
-			{
-				this.element = element;
-			}
-
-			internal IEnumerable<TElement> AddMethod (TKey key)
-			{
-				List<TElement> list = new List<TElement> ();
-				list.Add (element);
-
-				return list;
-			}
-
-			internal IEnumerable<TElement> UpdateMethod (TKey key, IEnumerable<TElement> old)
-			{
-				ICollection<TElement> coll = (ICollection<TElement>)old;
-				coll.Add (element);
-
-				return coll;
-			}
-		}
-
-		internal ConcurrentLookup (IEqualityComparer<TKey> comparer)
-		{
-			this.dictionary = new ConcurrentDictionary<TKey, IEnumerable<TElement>> (comparer);
-		}
-
-		internal void Add (TKey key, TElement element)
-		{
-			AddSlot slot = new AddSlot (element);
-			dictionary.AddOrUpdate (key, slot.AddMethod, slot.UpdateMethod);
-		}
-
-		public bool Contains (TKey key)
-		{
-			return dictionary.ContainsKey (key);
-		}
-
-		public IEnumerable<TElement> this[TKey key] {
-			get {
-				return dictionary[key];
-			}
-		}
-
-		public int Count {
-			get {
-				return dictionary.Count;
-			}
-		}
-		
-		public IList<TKey> Keys {
-			get {
-				return (IList<TKey>)dictionary.Keys;
-			}
-		}
-
-		IEnumerator IEnumerable.GetEnumerator ()
-		{
-			return (IEnumerator)GetEnumeratorInternal ();
-		}
-
-		IEnumerator<IGrouping<TKey, TElement>> IEnumerable<IGrouping<TKey, TElement>>.GetEnumerator ()
-		{
-			return GetEnumeratorInternal ();
-		}
-
-		IEnumerator<IGrouping<TKey, TElement>> GetEnumeratorInternal ()
-		{
-			return (IEnumerator<System.Linq.IGrouping<TKey,TElement>>) dictionary.Select ((pair) => new ConcurrentGrouping<TKey, TElement> (pair.Key, pair.Value)).GetEnumerator ();
-		}
-	}
-}
-

+ 0 - 43
mcs/class/System.Core/System.Linq.Parallel/INodeVisitor.cs

@@ -1,43 +0,0 @@
-//
-// INodeVisitor.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Linq.Parallel.QueryNodes;
-
-namespace System.Linq.Parallel
-{
-	internal interface INodeVisitor
-	{
-		void Visit (QueryBaseNode node);
-		void Visit (QueryChildNode node);
-		void Visit (QueryOptionNode node);
-		void Visit (QueryStartNode node);
-		void Visit (QueryStreamNode node);
-		void Visit (QueryOrderGuardNode node);
-		void Visit (QueryMuxNode node);
-		void Visit (QueryHeadWorkerNode node);
-	}
-}

+ 0 - 35
mcs/class/System.Core/System.Linq.Parallel/IVisitableNode.cs

@@ -1,35 +0,0 @@
-//
-// IVisitableNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Parallel
-{
-	internal interface IVisitableNode
-	{
-		void Visit (INodeVisitor visitor);
-	}
-}

+ 0 - 217
mcs/class/System.Core/System.Linq.Parallel/OrderingEnumerator.cs

@@ -1,217 +0,0 @@
-//
-// OrderingEnumerator.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-
-namespace System.Linq.Parallel
-{
-	internal class OrderingEnumerator<T> : IEnumerator<T>
-	{
-		internal class SlotBucket
-		{
-			readonly TemporaryArea<long, T> temporaryArea = new TemporaryArea<long, T> ();
-			readonly KeyValuePair<long, T>[] stagingArea;
-			
-			long currentIndex;
-			readonly int count;
-
-			CountdownEvent stagingCount;
-			CountdownEvent participantCount;
-
-			CancellationTokenSource src = new CancellationTokenSource ();
-			CancellationToken mergedToken;
-
-			public SlotBucket (int count, CancellationToken token)
-			{
-				this.count = count;
-				stagingCount = new CountdownEvent (count);
-				participantCount = new CountdownEvent (count);
-				stagingArea = new KeyValuePair<long, T>[count];
-				currentIndex = -count;
-				mergedToken = CancellationTokenSource.CreateLinkedTokenSource (src.Token, token).Token;
-			}
-
-			public void Add (KeyValuePair<long, T> value)
-			{
-				long index = value.Key;
-				
-				if (index >= currentIndex && index < currentIndex + count) {
-					stagingArea[index % count] = value;
-					stagingCount.Signal ();
-				} else {
-					temporaryArea.TryAdd (index, value.Value);
-					if (index >= currentIndex && index < currentIndex + count) {
-						T dummy;
-						if (temporaryArea.TryRemove (index, out dummy)) {
-							stagingArea[index % count] = value;
-							stagingCount.Signal ();
-						}
-					}
-				}
-			}
-			
-			// Called by each worker's endAction
-			public void EndParticipation ()
-			{
-				if (participantCount.Signal ())
-					src.Cancel ();
-			}
-
-			// Called at the end with ContinueAll
-			public void Stop ()
-			{
-				src.Cancel ();
-			}
-
-			bool Skim ()
-			{
-				bool result = false;
-
-				for (int i = 0; i < count; i++) {
-					T temp;
-					int index = i + (int)currentIndex;
-					
-					if (stagingArea[i].Key != -1)
-						continue;
-
-					if (!temporaryArea.TryRemove (index, out temp))
-						continue;
-
-					result = true;
-					stagingArea [i] = new KeyValuePair<long, T> (index, temp);
-					if (stagingCount.Signal ())
-						break;
-				}
-
-				return result;
-			}
-			
-			void Clean ()
-			{
-				for (int i = 0; i < stagingArea.Length; i++)
-					stagingArea[i] = new KeyValuePair<long, T> (-1, default (T));
-			}
-
-			public KeyValuePair<long, T>[] Wait ()
-			{
-				Clean ();
-				stagingCount.Reset ();
-				
-				Interlocked.Add (ref currentIndex, count);
-
-				Skim ();
-
-				while (!stagingCount.IsSet) {
-					if (!participantCount.IsSet) {
-						try {
-							stagingCount.Wait (mergedToken);
-						} catch {
-							Skim ();
-						}
-					}
-
-					if (participantCount.IsSet) {
-						if (Skim ())
-							continue;
-						// Totally finished
-						if (stagingArea[0].Key != -1)
-							break;
-						else
-							return null;
-					}
-				}
-
-				return stagingArea;
-			}
-		}
-
-		SlotBucket slotBucket;
-		
-		KeyValuePair<long, T>[] slot;
-		int current;
-
-		internal OrderingEnumerator (int num, CancellationToken token)
-		{
-			slotBucket = new SlotBucket (num, token);
-		}
-
-		public void Dispose ()
-		{
-			slotBucket.Stop ();
-		}
-
-		public void Reset ()
-		{
-
-		}
-
-		public bool MoveNext ()
-		{
-			do {
-				if (slot == null || ++current >= slot.Length) {
-					if ((slot = slotBucket.Wait ()) == null)
-						return false;
-					current = 0;
-				}
-			} while (slot[current].Key == -1);
-
-			return true;
-		}
-
-		public T Current {
-			get {
-				return slot[current].Value;
-			}
-		}
-
-		object IEnumerator.Current {
-			get {
-				return slot[current].Value;
-			}
-		}
-		
-		public void Add (KeyValuePair<long, T> value, CancellationToken token)
-		{
-			slotBucket.Add (value);
-		}
-			
-		// Called by each worker's endAction
-		public void EndParticipation ()
-		{
-			slotBucket.EndParticipation ();
-		}
-		
-		// Called at the end with ContinueAll
-		public void Stop ()
-		{
-			slotBucket.Stop ();
-		}
-	}
-}

+ 0 - 268
mcs/class/System.Core/System.Linq.Parallel/ParallelExecuter.cs

@@ -1,268 +0,0 @@
-//
-// ParallelExecuter.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Threading.Tasks;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-using System.Linq.Parallel.QueryNodes;
-
-namespace System.Linq.Parallel
-{
-	internal static class ParallelExecuter
-	{
-		internal static QueryOptions CheckQuery<T> (QueryBaseNode<T> startingNode)
-		{
-			return CheckQuery<T> (startingNode, false);
-		}
-
-		internal static QueryOptions CheckQuery<T> (QueryBaseNode<T> startingNode, bool blocking)
-		{
-			return CheckQuery (startingNode, GetBestWorkerNumber (blocking));
-		}
-
-		internal static QueryOptions CheckQuery<T> (QueryBaseNode<T> startingNode, int partitionCount)
-		{
-			QueryCheckerVisitor visitor = new QueryCheckerVisitor (partitionCount);
-			startingNode.Visit (visitor);
-
-			return visitor.Options;
-		}
-
-		internal static CancellationToken Chain (this CancellationToken self, CancellationTokenSource other)
-		{
-			CancellationTokenSource linked = CancellationTokenSource.CreateLinkedTokenSource (self, other.Token);
-			return linked.Token;
-		}
-
-		internal static bool IsOrdered<TSource> (this QueryBaseNode<TSource> source)
-		{
-			QueryIsOrderedVisitor visitor = new QueryIsOrderedVisitor ();
-			source.Visit (visitor);
-
-			return visitor.BehindOrderGuard;
-		}
-
-		internal static int GetBestWorkerNumber ()
-		{
-			return GetBestWorkerNumber (false);
-		}
-
-		internal static int GetBestWorkerNumber (bool blocking)
-		{
-			return blocking && Task.CurrentId == null ? Environment.ProcessorCount + 1 : Environment.ProcessorCount;
-		}
-
-		internal static Task[] Process<TSource, TElement> (QueryBaseNode<TSource> node,
-		                                                   Action<TElement, CancellationToken> call,
-		                                                   Func<QueryBaseNode<TSource>, QueryOptions, IList<IEnumerable<TElement>>> acquisitionFunc,
-		                                                   QueryOptions options)
-		{
-			return Process<TSource, TElement> (node, call, acquisitionFunc, null, options);
-		}
-
-		internal static Task[] Process<TSource, TElement> (QueryBaseNode<TSource> node,
-		                                                   Action<TElement, CancellationToken> call,
-		                                                   Func<QueryBaseNode<TSource>, QueryOptions, IList<IEnumerable<TElement>>> acquisitionFunc,
-		                                                   Action endAction,
-		                                                   QueryOptions options)
-		{
-			CancellationTokenSource src
-				= CancellationTokenSource.CreateLinkedTokenSource (options.ImplementerToken, options.Token);
-
-			IList<IEnumerable<TElement>> enumerables = acquisitionFunc (node, options);
-
-			Task[] tasks = new Task[enumerables.Count];
-
-			for (int i = 0; i < tasks.Length; i++) {
-				int index = i;
-				tasks[i] = Task.Factory.StartNew (() => {
-					try {
-						foreach (TElement item in enumerables[index]) {
-							if (!CheckTokens (options))
-								break;
-
-							try {
-								call (item, src.Token);
-							} catch (OperationCanceledException canceledException) {
-								if (canceledException.CancellationToken != src.Token)
-									throw canceledException;
-							}
-
-							if (!CheckTokens (options))
-								break;
-						}
-					} finally {
-						if (endAction != null)
-							endAction ();
-					}
-				}, options.Token, TaskCreationOptions.AttachedToParent | TaskCreationOptions.LongRunning, TaskScheduler.Default);
-			}
-
-			return tasks;
-		}
-
-		static bool CheckTokens (QueryOptions options)
-		{
-			// This is from specific operators
-			if (options.ImplementerToken.IsCancellationRequested)
-				return false;
-			if (options.Token.IsCancellationRequested)
-				throw new OperationCanceledException (options.Token);
-			return true;
-		}
-
-		internal static void ProcessAndBlock<T> (QueryBaseNode<T> node, Action<T, CancellationToken> call)
-		{
-			QueryOptions options = CheckQuery (node, true);
-
-			Task[] tasks = Process (node, call, new QueryBaseNodeHelper<T> ().GetEnumerables, options);
-			Task.WaitAll (tasks, options.Token);
-		}
-
-		internal static Action ProcessAndCallback<T> (QueryBaseNode<T> node, Action<T, CancellationToken> call,
-		                                              Action callback, QueryOptions options)
-		{
-			Task[] tasks = Process (node, call, new QueryBaseNodeHelper<T> ().GetEnumerables, options);
-			if (callback != null)
-				Task.Factory.ContinueWhenAll (tasks,  (_) => callback ());
-
-			return () => Task.WaitAll (tasks, options.Token);
-		}
-
-		internal static Action ProcessAndCallback<T> (QueryBaseNode<T> node, Action<KeyValuePair<long, T>, CancellationToken> call,
-		                                              Action endAction,
-		                                              Action callback, QueryOptions options)
-		{
-			Task[] tasks = Process (node, call, new QueryBaseNodeHelper<T> ().GetOrderedEnumerables, endAction, options);
-			if (callback != null)
-				Task.Factory.ContinueWhenAll (tasks,  (_) => callback ());
-
-			return () => Task.WaitAll (tasks, options.Token);
-		}
-
-		internal static void ProcessAndAggregate<T, U> (QueryBaseNode<T> node,
-		                                                Func<U> seedFunc,
-		                                                Func<U, T, U> localCall,
-		                                                Action<IList<U>> call)
-		{
-			QueryOptions options = CheckQuery (node, true);
-
-			IList<IEnumerable<T>> enumerables = node.GetEnumerables (options);
-			U[] locals = new U[enumerables.Count];
-			Task[] tasks = new Task[enumerables.Count];
-
-			if (seedFunc != null) {
-				for (int i = 0; i < locals.Length; i++)
-					locals[i] = seedFunc ();
-			}
-
-			for (int i = 0; i < tasks.Length; i++) {
-				var procSlot = new AggregateProcessSlot<T, U> (options,
-				                                               i,
-				                                               enumerables[i].GetEnumerator (),
-				                                               locals,
-				                                               localCall,
-				                                               seedFunc);
-
-				tasks[i] = Task.Factory.StartNew (procSlot.Process, options.Token);
-			}
-
-			Task.WaitAll (tasks, options.Token);
-
-			if (call != null)
-				call (locals);
-		}
-
-		class AggregateProcessSlot<T, U>
-		{
-			readonly QueryOptions options;
-			readonly int index;
-			readonly IEnumerator<T> enumerator;
-			readonly U[] locals;
-			readonly Func<U, T, U> localCall;
-			readonly Func<U> seedFunc;
-
-			public AggregateProcessSlot (QueryOptions options,
-			                             int index,
-			                             IEnumerator<T> enumerator,
-			                             U[] locals,
-			                             Func<U, T, U> localCall,
-			                             Func<U> seedFunc)
-			{
-				this.options = options;
-				this.index = index;
-				this.enumerator = enumerator;
-				this.locals = locals;
-				this.localCall = localCall;
-				this.seedFunc = seedFunc;
-			}
-
-			public void Process ()
-			{
-				var token = options.Token;
-				var implementerToken = options.ImplementerToken;
-
-				try {
-					// Avoid cache thrashing of locals array
-					var local = locals [index];
-
-					if (seedFunc == null) {
-						if (!enumerator.MoveNext ())
-							return;
-						local = (U)(object)enumerator.Current;
-					}
-
-					while (enumerator.MoveNext ()) {
-						if (implementerToken.IsCancellationRequested)
-							break;
-						token.ThrowIfCancellationRequested ();
-						local = localCall (local, enumerator.Current);
-					}
-
-					locals [index] = local;
-				} finally {
-					enumerator.Dispose ();
-				}
-			}
-		}
-
-		class QueryBaseNodeHelper<T>
-		{
-			internal IList<IEnumerable<T>> GetEnumerables (QueryBaseNode<T> source, QueryOptions options)
-			{
-				return source.GetEnumerables (options);
-			}
-
-			internal IList<IEnumerable<KeyValuePair<long,T>>> GetOrderedEnumerables (QueryBaseNode<T> source, QueryOptions options)
-			{
-				return source.GetOrderedEnumerables (options);
-			}
-		}
-	}
-}

+ 0 - 75
mcs/class/System.Core/System.Linq.Parallel/ParallelPartitioner.cs

@@ -1,75 +0,0 @@
-//
-// ParallelPartitioner.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Collections.Generic;
-using System.Collections.Concurrent;
-using System.Collections.Concurrent.Partitioners;
-
-namespace System.Linq.Parallel
-{
-	internal static class ParallelPartitioner
-	{
-		internal static OrderablePartitioner<T> CreateForChunks<T> (IEnumerable<T> source)
-		{
-			return Partitioner.Create (source);
-		}
-
-		internal static OrderablePartitioner<T> CreateForRange<T> (IList<T> source)
-		{
-			return Partitioner.Create (source, true);
-		}
-
-		internal static OrderablePartitioner<T> CreateBest<T> (IEnumerable<T> source)
-		{
-			IList<T> temp = source as IList<T>;
-			if (temp != null)
-				return CreateForRange (temp);
-
-			return CreateForChunks (source);
-		}
-
-		internal static OrderablePartitioner<T> CreateForStrips<T> (IEnumerable<T> source, int stripSize)
-		{
-			IList<T> temp = source as IList<T>;
-			if (temp != null)
-				return new StripPartitioner<T> (temp);
-
-			return new EnumerablePartitioner<T> (source, stripSize, 1);
-		}
-
-		internal static OrderablePartitioner<int> CreateForRange (int start, int count)
-		{
-			return CreateForRange<int> (new RangeList (start, count));
-		}
-
-		internal static OrderablePartitioner<T> CreateForRepeat<T> (T obj, int count)
-		{
-			return CreateForRange<T> (new RepeatList<T> (obj, count));
-		}
-	}
-}

+ 0 - 129
mcs/class/System.Core/System.Linq.Parallel/ParallelQueryEnumerator.cs

@@ -1,129 +0,0 @@
-//
-// ParallelEnumerator.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-using System.Linq.Parallel.QueryNodes;
-
-namespace System.Linq.Parallel
-{
-	internal class ParallelQueryEnumerator<T> : IEnumerator<T>
-	{
-		readonly int DefaultBufferSize = ParallelExecuter.GetBestWorkerNumber () * 50;
-
-		BlockingCollection<T> buffer;
-		IEnumerator<T> loader;
-		QueryOptions options;
-		OrderingEnumerator<T> ordEnumerator;
-
-		T current;
-
-		Action waitAction;
-
-		internal ParallelQueryEnumerator (QueryBaseNode<T> node)
-		{
-			this.options = ParallelExecuter.CheckQuery (node);
-
-			if (options.ShouldBeSequential && options.Mode != ParallelExecutionMode.ForceParallelism) {
-				IEnumerable<T> buffer = node.GetSequential ();
-				loader = buffer.GetEnumerator ();
-			} else {
-				Setup ();
-
-				// Launch adding to the buffer asynchronously via Tasks
-				if (options.BehindOrderGuard.Value) {
-					waitAction = ParallelExecuter.ProcessAndCallback (node,
-					                                                  ordEnumerator.Add,
-					                                                  ordEnumerator.EndParticipation,
-					                                                  ordEnumerator.Stop,
-					                                                  options);
-				} else {
-					waitAction = ParallelExecuter.ProcessAndCallback (node,
-					                                                  buffer.Add,
-					                                                  buffer.CompleteAdding,
-					                                                  options);
-				}
-
-				if (options.Options.HasValue && options.Options.Value == ParallelMergeOptions.FullyBuffered)
-					waitAction ();
-			}
-		}
-
-		void Setup ()
-		{
-			if (!options.BehindOrderGuard.Value) {
-				if (options.Options.HasValue && (options.Options.Value == ParallelMergeOptions.NotBuffered
-				                                 || options.Options.Value == ParallelMergeOptions.FullyBuffered)) {
-					buffer = new BlockingCollection<T> ();
-				} else {
-					buffer = new BlockingCollection<T> (DefaultBufferSize);
-				}
-
-				IEnumerable<T> source = buffer.GetConsumingEnumerable (options.MergedToken);
-				loader = source.GetEnumerator ();
-			} else {
-				loader = ordEnumerator = new OrderingEnumerator<T> (options.PartitionCount, options.MergedToken);
-			}
-		}
-
-		public void Dispose ()
-		{
-
-		}
-
-		public void Reset ()
-		{
-			throw new NotSupportedException ();
-		}
-
-		public bool MoveNext ()
-		{
-			// If there are no stuff in the buffer
-			// but CompleteAdding hasn't been called,
-			// MoveNext blocks until further results are produced
-			if (!loader.MoveNext ())
-				return false;
-
-			current = loader.Current;
-			return true;
-		}
-
-		public T Current {
-			get {
-				return current;
-			}
-		}
-
-		object IEnumerator.Current {
-			get {
-				return current;
-			}
-		}
-	}
-}

+ 0 - 283
mcs/class/System.Core/System.Linq.Parallel/ParallelQuickSort.cs

@@ -1,283 +0,0 @@
-//
-// ParallelQuickSort.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Linq;
-using System.Collections;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Collections.Generic;
-
-namespace System.Linq.Parallel
-{
-	// HACK: ATM: parallelization of the sort is disabled as task
-	// add more overhead than gain
-	internal class ParallelQuickSort<T>
-	{
-		readonly Comparison<T> comparison;
-		readonly IList<T> list;
-		readonly int[] indexes;
-
-		class SortedCollection : IList<T>
-		{
-			int[] indexes;
-			IList<T> source;
-
-			public SortedCollection (IList<T> source, int[] indexes)
-			{
-				this.indexes = indexes;
-				this.source = source;
-			}
-
-			public int IndexOf (T item)
-			{
-				throw new NotImplementedException();
-			}
-
-			public void Insert (int index, T item)
-			{
-				throw new NotImplementedException();
-			}
-
-			public void RemoveAt (int index)
-			{
-				throw new NotImplementedException();
-			}
-
-			public T this[int index] {
-				get {
-					return source[indexes[index]];
-				}
-				set {
-					throw new NotImplementedException();
-				}
-			}
-
-			public void Add (T item)
-			{
-				throw new NotImplementedException();
-			}
-
-			public void Clear ()
-			{
-				throw new NotImplementedException();
-			}
-
-			public bool Contains (T item)
-			{
-				throw new NotImplementedException();
-			}
-
-			public void CopyTo (T[] array, int arrayIndex)
-			{
-				throw new NotImplementedException();
-			}
-
-			public bool Remove (T item)
-			{
-				throw new NotImplementedException();
-			}
-
-			public int Count {
-				get {
-					return source.Count;
-				}
-			}
-
-			public bool IsReadOnly {
-				get {
-					return true;
-				}
-			}
-
-			IEnumerator<T> IEnumerable<T>.GetEnumerator ()
-			{
-				return null;
-			}
-
-			IEnumerator IEnumerable.GetEnumerator ()
-			{
-				return null;
-			}
-		}
-
-		private ParallelQuickSort (IList<T> list, Comparison<T> comparison)
-		{
-			this.comparison = comparison;
-			this.list = list;
-			this.indexes = CreateIndexes (list.Count);
-		}
-
-		static int[] CreateIndexes (int length)
-		{
-			var indexes = new int[length];
-			for (int i = 0; i < length; i++)
-				indexes [i] = i;
-
-			return indexes;
-		}
-
-		SortedCollection DoSort ()
-		{
-			if (list.Count > 1) {
-				if (list.Count < 5)
-					InsertionSort (0, list.Count - 1);
-				else
-					Sort (0, list.Count - 1);
-			}
-
-			return new SortedCollection (list, indexes);
-		}
-
-		int Comparison (int index1, int index2)
-		{
-			return comparison (list[index1], list[index2]);
-		}
-
-		void Sort (int left, int right)
-		{
-			if (left + 3 <= right) {
-				int l = left, r = right - 1, pivot = MedianOfThree (left, right);
-				while (true) {
-					while (Comparison (indexes [++l], pivot) < 0) { }
-					while (Comparison (indexes [--r], pivot) > 0) { }
-					if (l < r)
-						Swap (l, r);
-					else
-						break;
-				}
-
-				// Restore pivot
-				Swap (l, right - 1);
-				// Partition and sort
-				Sort (left, l - 1);
-				Sort (l + 1, right);
-			} else
-				// If there are three items in the subarray, insertion sort is better
-				InsertionSort (left, right);
-		}
-
-		/*void Sort (int left, int right, int depth)
-		{
-			int l = left, r = right - 1, pivot = MedianOfThree (left, right);
-			while (true) {
-				while (Comparison (indexes[++l], pivot) < 0);
-				while (Comparison (indexes[--r], pivot) > 0);
-				if (l < r)
-					Swap (l, r);
-				else
-					break;
-			}
-
-			// Restore pivot
-			Swap (l, right - 1);
-
-			// Partition and sort in parallel if appropriate
-			/*if (depth < maxDepth) {
-				depth <<= 1;
-				Task t = Task.Factory.StartNew (() => Sort (left, l - 1, depth));
-				Sort (l + 1, right, depth);
-
-				t.Wait ();
-			} else {*/
-				// Sequential
-		/*		Sort (left, l - 1);
-				Sort (l + 1, right);
-			//}
-		}*/
-
-		/*void ShellSort (int left, int right)
-		{
-			int[] gaps = new int[] { 4, 1};
-
-			for (int ic = 0; ic < gaps.Length; ic++) {
-				int inc = gaps[ic];
-				int l = left + inc;
-				for (int i = l; i <= right; i++) {
-					T temp = list[i];
-					int j = i;
-					for (; j >= l && comparison (list[j - inc], temp) > 1; j -= inc)
-						list[j] = list[j - inc];
-					list[j] = temp;
-				}
-			}
-		}*/
-
-		void InsertionSort (int left, int right)
-		{
-			for (int i = left + 1; i <= right; i++) {
-				int j, tmp = indexes [i];
-
-				for (j = i; j > left && Comparison (tmp, indexes [j - 1]) < 0; j--)
-					indexes [j] = indexes [j - 1];
-
-				indexes [j] = tmp;
-			}
-		}
-
-		/*
-		void InsertionSort (int left, int right)
-		{
-			for (int i = left + 1; i <= right; i++) {
-				int j;
-				T tmp = list[i];
-
-				for (j = i; j > left && comparison (tmp, list [j - 1]) < 0; j--)
-					list [j] = list [j - 1];
-
-				list [j] = tmp;
-			}
-		}*/
-
-		void Swap (int left, int right)
-		{
-			int temp = indexes [right];
-			indexes [right] = indexes [left];
-			indexes [left] = temp;
-		}
-
-		int MedianOfThree (int left, int right)
-		{
-			int center = (left + right) >> 1;
-			if (Comparison (indexes[center], indexes[left]) < 0)
-				Swap (left, center);
-			if (Comparison (indexes[right], indexes[left]) < 0)
-				Swap (left, right);
-			if (Comparison (indexes[right], indexes[center]) < 0)
-				Swap (center, right);
-			Swap (center, right - 1);
-
-			return indexes[right - 1];
-		}
-
-		public static IList<T> Sort (IList<T> list, Comparison<T> comparison)
-		{
-			ParallelQuickSort<T> qs = new ParallelQuickSort<T> (list, comparison);
-
-			return qs.DoSort ();
-		}
-	}
-}

+ 0 - 186
mcs/class/System.Core/System.Linq.Parallel/QueryCheckerVisitor.cs

@@ -1,186 +0,0 @@
-//
-// QueryCheckerVisitor.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Linq.Parallel.QueryNodes;
-
-namespace System.Linq.Parallel
-{
-	using OptionsList = Tuple<ParallelMergeOptions?, ParallelExecutionMode?, CancellationToken?, int, CancellationTokenSource>;
-
-	internal class QueryCheckerVisitor : INodeVisitor
-	{
-		const int minSequentialThreshold = 20;
-
-		// Information gathering
-		ParallelMergeOptions? options = null;
-		ParallelExecutionMode? mode = null;
-		CancellationToken? token = null;
-		int? degreeOfParallelism = null;
-		CancellationToken implementerToken = CancellationToken.None;
-
-		int partitionCount;
-		bool? behindOrderGuard = null;
-
-		internal QueryCheckerVisitor (int partitionCount)
-		{
-			this.partitionCount = partitionCount;
-		}
-
-		#region INodeVisitor implementation
-		public void Visit (QueryBaseNode node)
-		{
-			// Nothing to do atm. Later we can check if the node is a
-			// Take or a Skip and set accordingly UseStrip
-		}
-
-		public void Visit (QueryChildNode node)
-		{
-			node.Parent.Visit (this);
-		}
-
-		public void Visit (QueryOptionNode node)
-		{
-			MergeOptions (node.GetOptions ());
-
-			Visit ((QueryChildNode)node);
-		}
-
-		public void Visit (QueryStartNode node)
-		{
-			if (behindOrderGuard == null)
-				behindOrderGuard = false;
-			if (degreeOfParallelism != null)
-				partitionCount = degreeOfParallelism.Value;
-
-			int count;
-			if ((count = node.Count) != -1 && count < minSequentialThreshold)
-				ShouldBeSequential = true;
-		}
-
-		public void Visit (QueryStreamNode node)
-		{
-			if (node.IsIndexed)
-				UseStrip = true;
-
-			Visit ((QueryChildNode)node);
-		}
-
-		public void Visit (QueryOrderGuardNode node)
-		{
-			if (behindOrderGuard == null) {
-				if (node.EnsureOrder) {
-					behindOrderGuard = true;
-					//UseStrip = true;
-				} else {
-					behindOrderGuard = false;
-				}
-			}
-
-			Visit ((QueryStreamNode)node);
-		}
-
-		public void Visit (QueryMuxNode node)
-		{
-			Visit ((QueryChildNode)node);
-		}
-
-		public void Visit (QueryHeadWorkerNode node)
-		{
-			// Wouldn't it be better with standard Linq?
-			if (node.Count.HasValue && node.Count < partitionCount)
-				ShouldBeSequential = true;
-
-			Visit ((QueryStreamNode)node);
-		}
-		#endregion
-
-		internal QueryOptions Options {
-			get {
-				return new QueryOptions (options, mode, token == null ? CancellationToken.None : token.Value,
-				                         UseStrip, behindOrderGuard, partitionCount, implementerToken, ShouldBeSequential);
-			}
-		}
-
-		internal bool UseStrip {
-			get;
-			private set;
-		}
-
-		internal bool BehindOrderGuard {
-			get {
-				return behindOrderGuard.Value;
-			}
-		}
-
-		internal bool ShouldBeSequential {
-			get;
-			private set;
-		}
-
-		void MergeOptions (OptionsList list)
-		{
-			if (list.Item1 != null) {
-				if (options == null)
-					options = list.Item1;
-				else
-					Throw ("WithMergeOptions");
-			}
-
-			if (list.Item2 != null) {
-				if (mode == null)
-					mode = list.Item2;
-				else
-					Throw ("WithExecutionMode");
-			}
-
-			if (list.Item3 != null) {
-				if (token == null)
-					token = list.Item3;
-				else
-					Throw ("WithCancellationToken");
-			}
-
-			if (list.Item4 != -1) {
-				if (degreeOfParallelism == null)
-					degreeOfParallelism = list.Item4;
-				else
-					Throw ("WithDegreeOfParallelism");
-			}
-
-			// That one is treated specially
-			if (list.Item5 != null) {
-				implementerToken = implementerToken.Chain (list.Item5);
-			}
-		}
-
-		void Throw (string methName)
-		{
-			throw new InvalidOperationException ("You can't have more than one " + methName + " node in a query");
-		}
-	}
-}

+ 0 - 81
mcs/class/System.Core/System.Linq.Parallel/QueryIsOrderedVisitor.cs

@@ -1,81 +0,0 @@
-//
-// QueryIsOrderedVisitor.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Linq.Parallel.QueryNodes;
-
-namespace System.Linq.Parallel
-{
-	internal class QueryIsOrderedVisitor : INodeVisitor
-	{
-		internal bool BehindOrderGuard {
-			get;
-			private set;
-		}
-
-		#region INodeVisitor implementation
-		public void Visit (QueryBaseNode node)
-		{
-
-		}
-
-		public void Visit (QueryChildNode node)
-		{
-			node.Parent.Visit (this);
-		}
-
-		public void Visit (QueryOptionNode node)
-		{
-			Visit ((QueryChildNode)node);
-		}
-
-		public void Visit (QueryStartNode node)
-		{
-		}
-
-		public void Visit (QueryStreamNode node)
-		{
-			Visit ((QueryChildNode)node);
-		}
-
-		public void Visit (QueryOrderGuardNode node)
-		{
-			BehindOrderGuard = node.EnsureOrder;
-		}
-
-		public void Visit (QueryMuxNode node)
-		{
-			Visit ((QueryChildNode)node);
-		}
-
-		public void Visit (QueryHeadWorkerNode node)
-		{
-			Visit ((QueryStreamNode)node);
-		}
-		#endregion
-	}
-}

+ 0 - 127
mcs/class/System.Core/System.Linq.Parallel/QueryOptions.cs

@@ -1,127 +0,0 @@
-//
-// QueryOptions.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-
-namespace System.Linq.Parallel
-{
-	internal class QueryOptions
-	{
-		public ParallelMergeOptions? Options {
-			get;
-			private set;
-		}
-
-		public ParallelExecutionMode? Mode {
-			get;
-			private set;
-		}
-
-		public CancellationToken Token {
-			get;
-			private set;
-		}
-		/* This token is to be used by some operator (like Take) to tell that
-		 * the execution of the query can be prematurly stopped
-		 *
-		 * It is set when passing QueryOptions to the different node's Get method
-		 * and ParallelExecuter should check after the call to this method is this guy has been
-		 * set. Operator may chain up multiple cancellation token that way.
-		 * When checking for this token, the task body should simply return.
-		 */
-		public CancellationToken ImplementerToken {
-			get;
-			private set;
-		}
-
-		public bool UseStrip {
-			get;
-			private set;
-		}
-
-		public bool? BehindOrderGuard {
-			get;
-			private set;
-		}
-
-		public int PartitionCount {
-			get;
-			private set;
-		}
-
-		public Tuple<bool, bool, bool> PartitionerSettings {
-			get;
-			internal set;
-		}
-
-		public CancellationToken MergedToken {
-			get;
-			private set;
-		}
-
-		public bool ShouldBeSequential {
-			get;
-			private set;
-		}
-
-		public QueryOptions (ParallelMergeOptions? options,
-		                     ParallelExecutionMode? mode,
-		                     CancellationToken token,
-		                     bool useStrip,
-		                     bool? behindOrderGuard,
-		                     int partitionCount,
-		                     CancellationToken implementerToken,
-		                     bool shouldBeSequential)
-		{
-			Options = options;
-			Mode = mode;
-			Token = token;
-			UseStrip = useStrip;
-			BehindOrderGuard = behindOrderGuard;
-			PartitionCount = partitionCount;
-			PartitionerSettings = null;
-			ImplementerToken = implementerToken;
-			ShouldBeSequential = shouldBeSequential;
-
-			MergeTokens (token, implementerToken);
-		}
-
-		void MergeTokens (CancellationToken token, CancellationToken implementerToken)
-		{
-			bool implementedNone = implementerToken == CancellationToken.None;
-			bool tokenNone = token == CancellationToken.None;
-			if (!implementedNone && !tokenNone)
-				MergedToken = CancellationTokenSource.CreateLinkedTokenSource (implementerToken, token).Token;
-			else if (implementedNone && !tokenNone)
-				MergedToken = token;
-			else if (!implementedNone && tokenNone)
-				MergedToken = implementerToken;
-			else
-				MergedToken = CancellationToken.None;
-		}
-	}
-}

+ 0 - 123
mcs/class/System.Core/System.Linq.Parallel/RangeList.cs

@@ -1,123 +0,0 @@
-//
-// RangeList.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Collections;
-using System.Collections.Generic;
-
-namespace System.Linq.Parallel
-{
-	internal class RangeList : IList<int>
-	{
-		readonly int start;
-		readonly int count;
-
-		public RangeList (int start, int count)
-		{
-			this.start = start;
-			this.count = count;
-		}
-
-		public int IndexOf (int item)
-		{
-			if (!Contains(item))
-				return -1;
-
-			return item - start;
-		}
-
-		public void Insert (int index, int item)
-		{
-			throw new NotImplementedException();
-		}
-
-		public void RemoveAt (int index)
-		{
-			throw new NotImplementedException();
-		}
-
-		public int this[int index] {
-			get {
-				if (index <= count)
-					return start + index;
-
-				return -1;
-			}
-			set {
-				throw new NotImplementedException();
-			}
-		}
-
-		public void Add (int item)
-		{
-			throw new NotImplementedException();
-		}
-
-		public void Clear ()
-		{
-			throw new NotImplementedException();
-		}
-
-		public bool Contains (int item)
-		{
-			return start <= item && item <= start + count - 1;
-		}
-
-		public void CopyTo (int[] array, int arrayIndex)
-		{
-			int counter = start;
-			for (int i = arrayIndex; i < array.Length && i < (i - arrayIndex) + count; i++)
-				array[i] = counter++;
-		}
-
-		public bool Remove (int item)
-		{
-			throw new NotImplementedException();
-		}
-
-		public int Count {
-			get {
-				return count;
-			}
-		}
-
-		public bool IsReadOnly {
-			get {
-				return true;
-			}
-		}
-
-		IEnumerator<int> IEnumerable<int>.GetEnumerator ()
-		{
-			return null;
-		}
-
-		IEnumerator IEnumerable.GetEnumerator ()
-		{
-			return null;
-		}
-	}
-}

+ 0 - 117
mcs/class/System.Core/System.Linq.Parallel/RepeatList.cs

@@ -1,117 +0,0 @@
-//
-// RepeatList.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Collections;
-using System.Collections.Generic;
-
-namespace System.Linq.Parallel
-{
-	internal class RepeatList<T> : IList<T>
-	{
-		readonly int count;
-		readonly T element;
-
-		public RepeatList (T element, int count)
-		{
-			this.element = element;
-			this.count = count;
-		}
-
-		public int IndexOf (T item)
-		{
-			// No real index, we may just be interested if the value is different from -1
-			return Contains(item) ? 1 : -1;
-		}
-
-		public void Insert (int index, T item)
-		{
-			throw new NotImplementedException();
-		}
-
-		public void RemoveAt (int index)
-		{
-			throw new NotImplementedException();
-		}
-
-		public T this[int index] {
-			get {
-				return index < count ? element : default(T);
-			}
-			set {
-				throw new NotImplementedException();
-			}
-		}
-
-		public void Add (T item)
-		{
-			throw new NotImplementedException();
-		}
-
-		public void Clear ()
-		{
-			throw new NotImplementedException();
-		}
-
-		public bool Contains (T item)
-		{
-			return item.Equals(element);
-		}
-
-		public void CopyTo (T[] array, int arrayIndex)
-		{
-			for (int i = arrayIndex; i < array.Length && i < (i - arrayIndex) + count; i++)
-				array[i] = element;
-		}
-
-		public bool Remove (T item)
-		{
-			throw new NotImplementedException();
-		}
-
-		public int Count {
-			get {
-				return count;
-			}
-		}
-
-		public bool IsReadOnly {
-			get {
-				return true;
-			}
-		}
-
-		IEnumerator<T> IEnumerable<T>.GetEnumerator ()
-		{
-			return null;
-		}
-
-		IEnumerator IEnumerable.GetEnumerator ()
-		{
-			return null;
-		}
-	}
-}

+ 0 - 117
mcs/class/System.Core/System.Linq.Parallel/ReverseList.cs

@@ -1,117 +0,0 @@
-//
-// QueryReverseNode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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;
-using System.Threading;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace System.Linq.Parallel
-{
-	internal class ReverseList<T> : IList<T>
-	{
-		readonly IList<T> backend;
-		readonly int count;
-
-		internal ReverseList (IList<T> backend)
-		{
-			this.backend = backend;
-			this.count = backend.Count;
-		}
-
-		public int IndexOf (T item)
-		{
-			throw new NotImplementedException();
-		}
-
-		public void Insert (int index, T item)
-		{
-			throw new NotImplementedException();
-		}
-
-		public void RemoveAt (int index)
-		{
-			throw new NotImplementedException();
-		}
-
-		public T this[int index] {
-			get {
-				return backend[count - 1 - index];
-			}
-			set {
-				throw new NotImplementedException();
-			}
-		}
-
-		public void Add (T item)
-		{
-			throw new NotImplementedException();
-		}
-
-		public void Clear ()
-		{
-			throw new NotImplementedException();
-		}
-
-		public bool Contains (T item)
-		{
-			throw new NotImplementedException();
-		}
-
-		public void CopyTo (T[] array, int arrayIndex)
-		{
-			throw new NotImplementedException();
-		}
-
-		public bool Remove (T item)
-		{
-			throw new NotImplementedException();
-		}
-
-		public int Count {
-			get {
-				return count;
-			}
-		}
-
-		public bool IsReadOnly {
-			get {
-				return true;
-			}
-		}
-
-		IEnumerator<T> IEnumerable<T>.GetEnumerator ()
-		{
-			return null;
-		}
-
-		IEnumerator IEnumerable.GetEnumerator ()
-		{
-			return null;
-		}
-	}
-}
-

+ 0 - 60
mcs/class/System.Core/System.Linq.Parallel/StripPartitioner.cs

@@ -1,60 +0,0 @@
-//
-// StripPartitioner.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-
-namespace System.Linq.Parallel
-{
-	internal class StripPartitioner<T> : OrderablePartitioner<T>
-	{
-		IList<T> source;
-
-		public StripPartitioner (IList<T> source) : base (true, false, true)
-		{
-			this.source = source;
-		}
-
-		public override IList<IEnumerator<KeyValuePair<long, T>>> GetOrderablePartitions (int partitionCount)
-		{
-			IEnumerator<KeyValuePair<long, T>>[] array = new IEnumerator<KeyValuePair<long, T>>[partitionCount];
-			for (int i = 0; i < array.Length; i++)
-				array[i] = GetStripEnumerator (i, partitionCount);
-
-			return array;
-		}
-
-		IEnumerator<KeyValuePair<long, T>> GetStripEnumerator (int start, int partitionCount)
-		{
-			for (int i = start; i < source.Count; i += partitionCount) {
-				//Console.WriteLine ("Num {0} yielding [{1} : {2}]", start, i, source[i]);
-				yield return new KeyValuePair<long, T> (i, source [i]);
-			}
-		}
-	}
-}

+ 0 - 69
mcs/class/System.Core/System.Linq.Parallel/TemporaryArea.cs

@@ -1,69 +0,0 @@
-//
-// TemporaryArea.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2012 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;
-using System.Threading;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-
-namespace System.Linq.Parallel
-{
-	internal class TemporaryArea<TKey, TValue>
-	{
-		Dictionary<TKey, TValue> dict;
-
-		public TemporaryArea () : this (EqualityComparer<TKey>.Default)
-		{
-
-		}
-
-		public TemporaryArea (IEqualityComparer<TKey> comparer)
-		{
-			this.dict = new Dictionary<TKey, TValue> (comparer);
-		}
-
-		public bool TryAdd (TKey index, TValue value)
-		{
-			lock (dict) {
-				if (dict.ContainsKey (index))
-					return false;
-				dict.Add (index, value);
-				return true;
-			}
-		}
-
-		public bool TryRemove (TKey index, out TValue value)
-		{
-			lock (dict) {
-				if (!dict.TryGetValue (index, out value))
-					return false;
-				return dict.Remove (index);
-			}
-		}
-	}
-}
-

+ 0 - 58
mcs/class/System.Core/System.Linq/OrderedParallelQuery.cs

@@ -1,58 +0,0 @@
-//
-// ParallelQuery.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-using System.Linq.Parallel.QueryNodes;
-
-namespace System.Linq
-{
-	// Only returned after OrderBy and ThenBy.
-	public class OrderedParallelQuery<TSource> : ParallelQuery<TSource>
-	{
-		QueryOrderByNode<TSource> node;
-
-		internal OrderedParallelQuery (QueryOrderByNode<TSource> node)
-			: base (node)
-		{
-			this.node = node;
-		}
-
-		internal new QueryOrderByNode<TSource> Node {
-			get {
-				return node;
-			}
-		}
-
-		public override IEnumerator<TSource> GetEnumerator ()
-		{
-			return base.GetEnumerator ();
-		}
-	}
-}

+ 0 - 2330
mcs/class/System.Core/System.Linq/ParallelEnumerable.cs

@@ -1,2330 +0,0 @@
-//
-// ParallelEnumerable.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-using System.Linq.Parallel;
-using System.Linq.Parallel.QueryNodes;
-
-namespace System.Linq
-{
-	public static class ParallelEnumerable
-	{
-		#region Range & Repeat
-		public static ParallelQuery<int> Range (int start, int count)
-		{
-			if (int.MaxValue - start < count - 1)
-				throw new ArgumentOutOfRangeException ("count", "start + count - 1 is larger than Int32.MaxValue");
-			if (count < 0)
-				throw new ArgumentOutOfRangeException ("count", "count is less than 0");
-
-			return (new RangeList (start, count)).AsParallel ();
-		}
-
-		public static ParallelQuery<TResult> Repeat<TResult> (TResult element, int count)
-		{
-			if (count < 0)
-				throw new ArgumentOutOfRangeException ("count", "count is less than 0");
-
-			return (new RepeatList<TResult> (element, count)).AsParallel ();
-		}
-		#endregion
-
-		#region Empty
-		public static ParallelQuery<TResult> Empty<TResult> ()
-		{
-			return Repeat<TResult> (default (TResult), 0);
-		}
-		#endregion
-
-		#region AsParallel
-		public static ParallelQuery<TSource> AsParallel<TSource> (this IEnumerable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			/* Someone might be trying to use AsParallel a bit too much, if the query was in fact
-			 * already a ParallelQuery, just cast it
-			 */
-			ParallelQuery<TSource> query = source as ParallelQuery<TSource>;
-
-			return query ?? new ParallelQuery<TSource> (new QueryStartNode<TSource> (source));
-		}
-
-		public static ParallelQuery<TSource> AsParallel<TSource> (this Partitioner<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			/* Someone might be trying to use AsParallel a bit too much, if the query was in fact
-			 * already a ParallelQuery, just cast it
-			 */
-			ParallelQuery<TSource> query = source as ParallelQuery<TSource>;
-
-			return query ?? new ParallelQuery<TSource> (new QueryStartNode<TSource> (source));
-		}
-
-		public static ParallelQuery AsParallel (this IEnumerable source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			/* Someone might be trying to use AsParallel a bit too much, if the query was in fact
-			 * already a ParallelQuery, just cast it
-			 */
-			ParallelQuery query = source as ParallelQuery;
-
-			return query ?? new ParallelQuery<object> (new QueryStartNode<object> (source.Cast<object> ()));
-		}
-
-		public static IEnumerable<TSource> AsEnumerable<TSource> (this ParallelQuery<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.AsSequential ();
-		}
-
-		public static IEnumerable<TSource> AsSequential<TSource> (this ParallelQuery<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Node.GetSequential ();
-		}
-		#endregion
-
-		#region AsOrdered / AsUnordered
-		public static ParallelQuery<TSource> AsOrdered<TSource> (this ParallelQuery<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return new ParallelQuery<TSource> (new QueryAsOrderedNode<TSource> (source.Node));
-		}
-
-		public static ParallelQuery<TSource> AsUnordered<TSource> (this ParallelQuery<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return new ParallelQuery<TSource> (new QueryAsUnorderedNode<TSource> (source.Node));
-		}
-
-		public static ParallelQuery AsOrdered (this ParallelQuery source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.TypedQuery.AsOrdered ();
-		}
-		#endregion
-
-		#region With*
-		public static ParallelQuery<TSource> WithExecutionMode<TSource> (this ParallelQuery<TSource> source,
-		                                                                 ParallelExecutionMode executionMode)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return new ParallelQuery<TSource> (new ParallelExecutionModeNode<TSource> (executionMode, source.Node));
-		}
-
-		public static ParallelQuery<TSource> WithCancellation<TSource> (this ParallelQuery<TSource> source,
-		                                                                CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return new ParallelQuery<TSource> (new CancellationTokenNode<TSource> (cancellationToken, source.Node));
-		}
-
-		public static ParallelQuery<TSource> WithMergeOptions<TSource> (this ParallelQuery<TSource> source,
-		                                                                ParallelMergeOptions mergeOptions)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return new ParallelQuery<TSource> (new ParallelMergeOptionsNode<TSource> (mergeOptions, source.Node));
-		}
-
-		public static ParallelQuery<TSource> WithDegreeOfParallelism<TSource> (this ParallelQuery<TSource> source,
-		                                                                       int degreeOfParallelism)
-		{
-			if (degreeOfParallelism < 1 || degreeOfParallelism > 63)
-				throw new ArgumentException ("degreeOfParallelism is less than 1 or greater than 63", "degreeOfParallelism");
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return new ParallelQuery<TSource> (new DegreeOfParallelismNode<TSource> (degreeOfParallelism, source.Node));
-		}
-
-		internal static ParallelQuery<TSource> WithImplementerToken<TSource> (this ParallelQuery<TSource> source,
-		                                                                      CancellationTokenSource token)
-		{
-			return new ParallelQuery<TSource> (new ImplementerTokenNode<TSource> (token, source.Node));
-		}
-		#endregion
-
-		#region Select
-		public static ParallelQuery<TResult> Select<TSource, TResult> (this ParallelQuery<TSource> source, Func<TSource, TResult> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return new ParallelQuery<TResult> (new QuerySelectNode<TResult, TSource> (source.Node, selector));
-		}
-
-		public static ParallelQuery<TResult> Select<TSource, TResult> (this ParallelQuery<TSource> source, Func<TSource, int, TResult> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return new ParallelQuery<TResult> (new QuerySelectNode<TResult, TSource> (source.Node, selector));
-		}
-		#endregion
-		
-		#region SelectMany
-		public static ParallelQuery<TResult> SelectMany<TSource, TResult> (this ParallelQuery<TSource> source,
-		                                                                   Func<TSource, IEnumerable<TResult>> selector)
-		{
-			return source.SelectMany (selector, (s, e) => e);
-		}
-
-		public static ParallelQuery<TResult> SelectMany<TSource, TResult> (this ParallelQuery<TSource> source,
-		                                                                   Func<TSource, int, IEnumerable<TResult>> selector)
-		{
-			return source.SelectMany (selector, (s, e) => e);
-		}
-		
-		public static ParallelQuery<TResult> SelectMany<TSource, TCollection, TResult> (this ParallelQuery<TSource> source,
-		                                                                                Func<TSource, IEnumerable<TCollection>> collectionSelector,
-		                                                                                Func<TSource, TCollection, TResult> resultSelector)
-		{
-			return new ParallelQuery<TResult> (new QuerySelectManyNode<TSource, TCollection, TResult> (source.Node,
-			                                                                                           collectionSelector,
-			                                                                                           resultSelector));
-		}
-		
-		public static ParallelQuery<TResult> SelectMany<TSource, TCollection, TResult> (this ParallelQuery<TSource> source,
-		                                                                                Func<TSource, int, IEnumerable<TCollection>> collectionSelector,
-		                                                                                Func<TSource, TCollection, TResult> resultSelector)
-		{
-			return new ParallelQuery<TResult> (new QuerySelectManyNode<TSource, TCollection, TResult> (source.Node,
-			                                                                                           collectionSelector,
-			                                                                                           resultSelector));
-		}
-		#endregion
-
-		#region Where
-		public static ParallelQuery<TSource> Where<TSource> (this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (predicate == null)
-				throw new ArgumentNullException ("predicate");
-
-			return new ParallelQuery<TSource> (new QueryWhereNode<TSource> (source.Node, predicate));
-		}
-
-		public static ParallelQuery<TSource> Where<TSource> (this ParallelQuery<TSource> source, Func<TSource, int, bool> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (predicate == null)
-				throw new ArgumentNullException ("predicate");
-
-			return new ParallelQuery<TSource> (new QueryWhereNode<TSource> (source.Node, predicate));
-		}
-		#endregion
-
-		#region Aggregate
-		public static TSource Aggregate<TSource> (this ParallelQuery<TSource> source, Func<TSource, TSource, TSource> func)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (func == null)
-				throw new ArgumentNullException ("func");
-
-			return source.Aggregate<TSource, TSource, TSource> ((Func<TSource>)null,
-			                                                    func,
-			                                                    func,
-			                                                    (e) => e);
-		}
-
-		public static TAccumulate Aggregate<TSource, TAccumulate> (this ParallelQuery<TSource> source,
-		                                                             TAccumulate seed,
-		                                                             Func<TAccumulate, TSource, TAccumulate> func)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (func == null)
-				throw new ArgumentNullException ("func");
-
-			return source.Aggregate (seed, func, (e) => e);
-		}
-
-		public static TResult Aggregate<TSource, TAccumulate, TResult> (this ParallelQuery<TSource> source,
-		                                                                  TAccumulate seed,
-		                                                                  Func<TAccumulate, TSource, TAccumulate> func,
-		                                                                  Func<TAccumulate, TResult> resultSelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (func == null)
-				throw new ArgumentNullException ("func");
-			if (resultSelector == null)
-				throw new ArgumentNullException ("resultSelector");
-
-			TAccumulate accumulator = seed;
-
-			foreach (TSource value in source)
-				accumulator = func (accumulator, value);
-
-			return resultSelector (accumulator);
-		}
-
-		public static TResult Aggregate<TSource, TAccumulate, TResult> (this ParallelQuery<TSource> source,
-		                                                                  TAccumulate seed,
-		                                                                  Func<TAccumulate, TSource, TAccumulate> updateAccumulatorFunc,
-		                                                                  Func<TAccumulate, TAccumulate, TAccumulate> combineAccumulatorsFunc,
-		                                                                  Func<TAccumulate, TResult> resultSelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (updateAccumulatorFunc == null)
-				throw new ArgumentNullException ("updateAccumulatorFunc");
-			if (combineAccumulatorsFunc == null)
-				throw new ArgumentNullException ("combineAccumulatorsFunc");
-			if (resultSelector == null)
-				throw new ArgumentNullException ("resultSelector");
-
-			return source.Aggregate (() => seed, updateAccumulatorFunc, combineAccumulatorsFunc, resultSelector);
-		}
-
-		public static TResult Aggregate<TSource, TAccumulate, TResult> (this ParallelQuery<TSource> source,
-		                                                                  Func<TAccumulate> seedFactory,
-		                                                                  Func<TAccumulate, TSource, TAccumulate> updateAccumulatorFunc,
-		                                                                  Func<TAccumulate, TAccumulate, TAccumulate> combineAccumulatorsFunc,
-		                                                                  Func<TAccumulate, TResult> resultSelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (seedFactory == null)
-				throw new ArgumentNullException ("seedFactory");
-			if (updateAccumulatorFunc == null)
-				throw new ArgumentNullException ("updateAccumulatorFunc");
-			if (combineAccumulatorsFunc == null)
-				throw new ArgumentNullException ("combineAccumulatorsFunc");
-			if (resultSelector == null)
-				throw new ArgumentNullException ("resultSelector");
-
-			TAccumulate accumulator = default (TAccumulate);
-
-			ParallelExecuter.ProcessAndAggregate<TSource, TAccumulate> (source.Node, seedFactory, updateAccumulatorFunc, (list) => {
-				accumulator = list [0];
-				for (int i = 1; i < list.Count; i++)
-					accumulator = combineAccumulatorsFunc (accumulator, list[i]);
-			});
-
-			return resultSelector (accumulator);;
-		}
-		#endregion
-
-		#region ForAll
-		public static void ForAll<TSource> (this ParallelQuery<TSource> source, Action<TSource> action)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (action == null)
-				throw new ArgumentNullException ("action");
-
-			ParallelExecuter.ProcessAndBlock (source.Node, (e, c) => action (e));
-		}
-		#endregion
-
-		#region OrderBy
-		public static OrderedParallelQuery<TSource> OrderByDescending<TSource, TKey> (this ParallelQuery<TSource> source,
-		                                                                              Func<TSource, TKey> keySelector,
-		                                                                              IComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (keySelector == null)
-				throw new ArgumentNullException ("keySelector");
-			if (comparer == null)
-				comparer = Comparer<TKey>.Default;
-
-			Comparison<TSource> comparison = (e1, e2) => -comparer.Compare (keySelector (e1), keySelector (e2));
-
-			return new OrderedParallelQuery<TSource> (new QueryOrderByNode<TSource> (source.Node, comparison));
-		}
-
-		public static OrderedParallelQuery<TSource> OrderByDescending<TSource, TKey> (this ParallelQuery<TSource> source,
-		                                                                              Func<TSource, TKey> keySelector)
-		{
-			return OrderByDescending (source, keySelector, Comparer<TKey>.Default);
-		}
-
-		public static OrderedParallelQuery<TSource> OrderBy<TSource, TKey> (this ParallelQuery<TSource> source,
-		                                                                    Func<TSource, TKey> keySelector)
-		{
-			return OrderBy (source, keySelector, Comparer<TKey>.Default);
-		}
-
-		public static OrderedParallelQuery<TSource> OrderBy<TSource, TKey> (this ParallelQuery<TSource> source,
-		                                                                    Func<TSource, TKey> keySelector,
-		                                                                    IComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (keySelector == null)
-				throw new ArgumentNullException ("keySelector");
-			if (comparer == null)
-				comparer = Comparer<TKey>.Default;
-
-			Comparison<TSource> comparison = (e1, e2) => comparer.Compare (keySelector (e1), keySelector (e2));
-
-			return new OrderedParallelQuery<TSource> (new QueryOrderByNode<TSource> (source.Node, comparison));
-		}
-		#endregion
-
-		#region ThenBy
-		public static OrderedParallelQuery<TSource> ThenBy<TSource, TKey> (this OrderedParallelQuery<TSource> source,
-		                                                                   Func<TSource, TKey> keySelector)
-		{
-			return ThenBy (source, keySelector, Comparer<TKey>.Default);
-		}
-
-		public static OrderedParallelQuery<TSource> ThenBy<TSource, TKey> (this OrderedParallelQuery<TSource> source,
-		                                                                   Func<TSource, TKey> keySelector,
-		                                                                   IComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (keySelector == null)
-				throw new ArgumentNullException ("keySelector");
-			if (comparer == null)
-				comparer = Comparer<TKey>.Default;
-
-			Comparison<TSource> comparison = (e1, e2) => comparer.Compare (keySelector (e1), keySelector (e2));
-
-			return new OrderedParallelQuery<TSource> (new QueryOrderByNode<TSource> (source.Node, comparison));
-		}
-
-		public static OrderedParallelQuery<TSource> ThenByDescending<TSource, TKey> (this OrderedParallelQuery<TSource> source,
-		                                                                             Func<TSource, TKey> keySelector)
-		{
-			return ThenByDescending (source, keySelector, Comparer<TKey>.Default);
-		}
-
-		public static OrderedParallelQuery<TSource> ThenByDescending<TSource, TKey> (this OrderedParallelQuery<TSource> source,
-		                                                                             Func<TSource, TKey> keySelector,
-		                                                                             IComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (keySelector == null)
-				throw new ArgumentNullException ("keySelector");
-			if (comparer == null)
-				comparer = Comparer<TKey>.Default;
-
-			Comparison<TSource> comparison = (e1, e2) => -comparer.Compare (keySelector (e1), keySelector (e2));
-
-			return new OrderedParallelQuery<TSource> (new QueryOrderByNode<TSource> (source.Node, comparison));
-		}
-		#endregion
-
-		#region All
-		public static bool All<TSource> (this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (predicate == null)
-				throw new ArgumentNullException ("predicate");
-
-			CancellationTokenSource src = new CancellationTokenSource ();
-			ParallelQuery<TSource> innerQuery = source.WithImplementerToken (src);
-
-			bool result = true;
-			try {
-				innerQuery.ForAll ((e) => {
-						if (!predicate (e)) {
-							result = false;
-							src.Cancel ();
-						}
-					});
-			} catch (OperationCanceledException e) {
-				if (e.CancellationToken != src.Token)
-					throw e;
-			}
-
-			return result;
-		}
-		#endregion
-
-		#region Any
-		public static bool Any<TSource> (this ParallelQuery<TSource> source)
-		{
-			return Any<TSource> (source, (_) => true);
-		}
-
-		public static bool Any<TSource> (this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (predicate == null)
-				throw new ArgumentNullException ("predicate");
-
-			return !source.All ((e) => !predicate (e));
-		}
-		#endregion
-
-		#region Contains
-		public static bool Contains<TSource> (this ParallelQuery<TSource> source, TSource value)
-		{
-			return Contains<TSource> (source, value, EqualityComparer<TSource>.Default);
-		}
-
-		public static bool Contains<TSource> (this ParallelQuery<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (comparer == null)
-				comparer = EqualityComparer<TSource>.Default;
-
-			return Any<TSource> (source, (e) => comparer.Equals (value, e));
-		}
-		#endregion
-
-		#region SequenceEqual
-		public static bool SequenceEqual<TSource> (this ParallelQuery<TSource> first,
-		                                           ParallelQuery<TSource> second)
-		{
-			if (first == null)
-				throw new ArgumentNullException ("first");
-			if (second == null)
-				throw new ArgumentNullException ("second");
-
-			return first.SequenceEqual (second, EqualityComparer<TSource>.Default);
-		}
-
-		public static bool SequenceEqual<TSource> (this ParallelQuery<TSource> first,
-		                                           ParallelQuery<TSource> second,
-		                                           IEqualityComparer<TSource> comparer)
-		{
-			if (first == null)
-				throw new ArgumentNullException ("first");
-			if (second == null)
-				throw new ArgumentNullException ("second");
-			if (comparer == null)
-				comparer = EqualityComparer<TSource>.Default;
-
-			var source = new CancellationTokenSource ();
-			var zip = new QueryZipNode<TSource, TSource, bool> (comparer.Equals, first.Node, second.Node) {	Strict = true };
-			var innerQuery = new ParallelQuery<bool> (zip).WithImplementerToken (source);
-
-			bool result = true;
-
-			try {
-				innerQuery.ForAll (value => {
-					if (!value) {
-						result = false;
-						source.Cancel ();
-					}
-				});
-			} catch (AggregateException ex) {
-				if (ex.InnerException is QueryZipException)
-					return false;
-				else
-					throw ex;
-			} catch (OperationCanceledException e) {
-				if (e.CancellationToken != source.Token)
-					throw e;
-			}
-
-			return result;
-		}
-
-		[ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather "
-		                   + "than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() "
-		                   + "extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
-		public static bool SequenceEqual<TSource> (this ParallelQuery<TSource> first, IEnumerable<TSource> second)
-		{
-			throw new NotSupportedException ();
-		}
-
-		[ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather "
-		                   + "than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() "
-		                   + "extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
-		public static bool SequenceEqual<TSource> (this ParallelQuery<TSource> first,
-		                                              IEnumerable<TSource> second,
-		                                              IEqualityComparer<TSource> comparer)
-		{
-			throw new NotSupportedException ();
-		}
-
-		#endregion
-		
-		#region GroupBy
-		public static ParallelQuery<IGrouping<TKey, TSource>> GroupBy<TSource, TKey> (this ParallelQuery<TSource> source,
-		                                                                              Func<TSource, TKey> keySelector)
-		{
-			return source.GroupBy (keySelector, EqualityComparer<TKey>.Default);
-		}
-		
-		public static ParallelQuery<IGrouping<TKey, TSource>> GroupBy<TSource, TKey> (this ParallelQuery<TSource> source,
-		                                                                              Func<TSource, TKey> keySelector,
-		                                                                              IEqualityComparer<TKey> comparer)
-		{
-			return source.GroupBy (keySelector, new Identity<TSource> ().Apply, comparer);
-		}
-		
-		public static ParallelQuery<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement> (this ParallelQuery<TSource> source,
-		                                                                                         Func<TSource, TKey> keySelector,
-		                                                                                         Func<TSource, TElement> elementSelector)
-		{
-			return source.GroupBy (keySelector, elementSelector, EqualityComparer<TKey>.Default);
-		}
-		
-		public static ParallelQuery<TResult> GroupBy<TSource, TKey, TResult> (this ParallelQuery<TSource> source,
-		                                                                      Func<TSource, TKey> keySelector,
-		                                                                      Func<TKey, IEnumerable<TSource>, TResult> resultSelector)
-		{
-			return source.GroupBy (keySelector)
-				.Select ((g) => resultSelector (g.Key, (IEnumerable<TSource>)g));
-		}
-		
-		public static ParallelQuery<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement> (this ParallelQuery<TSource> source,
-		                                                                                         Func<TSource, TKey> keySelector,
-		                                                                                         Func<TSource, TElement> elementSelector,
-		                                                                                         IEqualityComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (keySelector == null)
-				throw new ArgumentNullException ("keySelector");
-			if (elementSelector == null)
-				throw new ArgumentNullException ("elementSelector");
-			if (comparer == null)
-				comparer = EqualityComparer<TKey>.Default;
-
-			return new ParallelQuery<IGrouping<TKey, TElement>> (new QueryGroupByNode<TSource, TKey, TElement> (source.Node, keySelector, elementSelector, comparer));
-		}
-		
-		public static ParallelQuery<TResult> GroupBy<TSource, TKey, TElement, TResult> (this ParallelQuery<TSource> source,
-		                                                                                Func<TSource, TKey> keySelector,
-		                                                                                Func<TSource, TElement> elementSelector,
-		                                                                                Func<TKey, IEnumerable<TElement>, TResult> resultSelector)
-		{
-			return source.GroupBy (keySelector, elementSelector)
-				.Select ((g) => resultSelector (g.Key, (IEnumerable<TElement>)g));
-		}
-		
-		public static ParallelQuery<TResult> GroupBy<TSource, TKey, TResult> (this ParallelQuery<TSource> source,
-		                                                                      Func<TSource, TKey> keySelector,
-		                                                                      Func<TKey, IEnumerable<TSource>, TResult> resultSelector,
-		                                                                      IEqualityComparer<TKey> comparer)
-		{
-			return source.GroupBy (keySelector, comparer)
-				.Select ((g) => resultSelector (g.Key, (IEnumerable<TSource>)g));
-		}
-		
-		public static ParallelQuery<TResult> GroupBy<TSource, TKey, TElement, TResult> (this ParallelQuery<TSource> source,
-		                                                                                Func<TSource, TKey> keySelector,
-		                                                                                Func<TSource, TElement> elementSelector,
-		                                                                                Func<TKey, IEnumerable<TElement>, TResult> resultSelector,
-		                                                                                IEqualityComparer<TKey> comparer)
-		{
-			return source.GroupBy (keySelector, elementSelector, comparer)
-				.Select ((g) => resultSelector (g.Key, (IEnumerable<TElement>)g));
-		}
-		#endregion
-
-		#region GroupJoin
-		public static ParallelQuery<TResult> GroupJoin<TOuter, TInner, TKey, TResult> (this ParallelQuery<TOuter> outer,
-		                                                                               ParallelQuery<TInner> inner,
-		                                                                               Func<TOuter, TKey> outerKeySelector,
-		                                                                               Func<TInner, TKey> innerKeySelector,
-		                                                                               Func<TOuter, IEnumerable<TInner>, TResult> resultSelector)
-		{
-			return outer.GroupJoin (inner, outerKeySelector, innerKeySelector, resultSelector, EqualityComparer<TKey>.Default);
-		}
-		
-		public static ParallelQuery<TResult> GroupJoin<TOuter, TInner, TKey, TResult> (this ParallelQuery<TOuter> outer,
-		                                                                               ParallelQuery<TInner> inner,
-		                                                                               Func<TOuter, TKey> outerKeySelector,
-		                                                                               Func<TInner, TKey> innerKeySelector,
-		                                                                               Func<TOuter, IEnumerable<TInner>, TResult> resultSelector,
-		                                                                               IEqualityComparer<TKey> comparer)
-		{
-			return outer.Join (inner.GroupBy (innerKeySelector, (e) => e), outerKeySelector, (e) => e.Key, (e1, e2) => resultSelector (e1, e2), comparer);
-		}
-		
-		[ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather "
-		                   + "than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() "
-		                   + "extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
-		public static ParallelQuery<TResult> GroupJoin<TOuter, TInner, TKey, TResult> (this ParallelQuery<TOuter> outer,
-		                                                                               IEnumerable<TInner> inner,
-		                                                                               Func<TOuter, TKey> outerKeySelector,
-		                                                                               Func<TInner, TKey> innerKeySelector,
-		                                                                               Func<TOuter, IEnumerable<TInner>, TResult> resultSelector)
-		{
-			throw new NotSupportedException ();
-		}
-		
-		[ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather "
-		                   + "than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() "
-		                   + "extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
-		public static ParallelQuery<TResult> GroupJoin<TOuter, TInner, TKey, TResult> (this ParallelQuery<TOuter> outer,
-		                                                                               IEnumerable<TInner> inner,
-		                                                                               Func<TOuter, TKey> outerKeySelector,
-		                                                                               Func<TInner, TKey> innerKeySelector,
-		                                                                               Func<TOuter, IEnumerable<TInner>, TResult> resultSelector,
-		                                                                               IEqualityComparer<TKey> comparer)
-		{
-			throw new NotSupportedException ();
-		}
-		#endregion
-
-		#region ElementAt
-		public static TSource ElementAt<TSource> (this ParallelQuery<TSource> source, int index)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (index < 0)
-				throw new ArgumentOutOfRangeException ("index");
-			if (index == 0) {
-				try {
-					return source.First ();
-				} catch (InvalidOperationException) {
-					throw new ArgumentOutOfRangeException ("index");
-				}
-			}
-
-			TSource result = default (TSource);
-
-			ParallelQuery<TSource> innerQuery = source.Where ((e, i) => i == index);
-
-			try {
-				result = innerQuery.First ();
-			} catch (InvalidOperationException) {
-				throw new ArgumentOutOfRangeException ("index");
-			}
-
-			return result;
-		}
-
-		public static TSource ElementAtOrDefault<TSource> (this ParallelQuery<TSource> source, int index)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			try {
-				return source.ElementAt (index);
-			} catch (ArgumentOutOfRangeException) {
-				return default (TSource);
-			}
-		}
-		#endregion
-
-		#region Intersect
-		public static ParallelQuery<TSource> Intersect<TSource> (this ParallelQuery<TSource> first,
-		                                                         ParallelQuery<TSource> second)
-		{
-			return Intersect<TSource> (first, second, EqualityComparer<TSource>.Default);
-		}
-
-		public static ParallelQuery<TSource> Intersect<TSource> (this ParallelQuery<TSource> first,
-		                                                         ParallelQuery<TSource> second,
-		                                                         IEqualityComparer<TSource> comparer)
-		{
-			if (first == null)
-				throw new ArgumentNullException ("first");
-			if (second == null)
-				throw new ArgumentNullException ("second");
-			if (comparer == null)
-				comparer = EqualityComparer<TSource>.Default;
-
-			return new ParallelQuery<TSource> (new QuerySetNode<TSource> (SetInclusionDefaults.Intersect, comparer, first.Node, second.Node));
-		}
-
-		[ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather "
-		                   + "than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() "
-		                   + "extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
-		public static ParallelQuery<TSource> Intersect<TSource> (this ParallelQuery<TSource> first, IEnumerable<TSource> second)
-		{
-			throw new NotSupportedException ();
-		}
-
-		[ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather "
-		                   + "than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() "
-		                   + "extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
-		public static ParallelQuery<TSource> Intersect<TSource> (this ParallelQuery<TSource> first,
-		                                                         IEnumerable<TSource> second,
-		                                                         IEqualityComparer<TSource> comparer)
-		{
-			throw new NotSupportedException ();
-		}
-		#endregion
-
-		#region Join
-		public static ParallelQuery<TResult> Join<TOuter, TInner, TKey, TResult> (this ParallelQuery<TOuter> outer,
-		                                                                          ParallelQuery<TInner> inner,
-		                                                                          Func<TOuter, TKey> outerKeySelector,
-		                                                                          Func<TInner, TKey> innerKeySelector,
-		                                                                          Func<TOuter, TInner, TResult> resultSelector)
-		{
-			return outer.Join (inner, outerKeySelector, innerKeySelector, resultSelector, EqualityComparer<TKey>.Default);
-		}
-		
-		public static ParallelQuery<TResult> Join<TOuter, TInner, TKey, TResult> (this ParallelQuery<TOuter> outer,
-		                                                                          ParallelQuery<TInner> inner,
-		                                                                          Func<TOuter, TKey> outerKeySelector,
-		                                                                          Func<TInner, TKey> innerKeySelector,
-		                                                                          Func<TOuter, TInner, TResult> resultSelector,
-		                                                                          IEqualityComparer<TKey> comparer)
-		{
-			return new ParallelQuery<TResult> (new QueryJoinNode<TOuter, TInner, TKey, TResult> (outer.Node, inner.Node, outerKeySelector, innerKeySelector, resultSelector, comparer));
-		}
-		
-		[ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather "
-		                   + "than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() "
-		                   + "extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
-		public static ParallelQuery<TResult> Join<TOuter, TInner, TKey, TResult> (this ParallelQuery<TOuter> outer,
-		                                                                          IEnumerable<TInner> inner,
-		                                                                          Func<TOuter, TKey> outerKeySelector,
-		                                                                          Func<TInner, TKey> innerKeySelector,
-		                                                                          Func<TOuter, TInner, TResult> resultSelector)
-		{
-			throw new NotSupportedException ();
-		}
-
-		[ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather "
-		                   + "than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() "
-		                   + "extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
-		public static ParallelQuery<TResult> Join<TOuter, TInner, TKey, TResult> (this ParallelQuery<TOuter> outer,
-		                                                                          IEnumerable<TInner> inner,
-		                                                                          Func<TOuter, TKey> outerKeySelector,
-		                                                                          Func<TInner, TKey> innerKeySelector,
-		                                                                          Func<TOuter, TInner, TResult> resultSelector,
-		                                                                          IEqualityComparer<TKey> comparer)
-		{
-			throw new NotSupportedException ();
-		}
-		#endregion
-
-		#region Except
-		public static ParallelQuery<TSource> Except<TSource> (this ParallelQuery<TSource> first,
-		                                                      ParallelQuery<TSource> second)
-		{
-			return Except<TSource> (first, second, EqualityComparer<TSource>.Default);
-		}
-
-		public static ParallelQuery<TSource> Except<TSource> (this ParallelQuery<TSource> first,
-		                                                      ParallelQuery<TSource> second,
-		                                                      IEqualityComparer<TSource> comparer)
-		{
-			if (first == null)
-				throw new ArgumentNullException ("first");
-			if (second == null)
-				throw new ArgumentNullException ("second");
-			if (comparer == null)
-				comparer = EqualityComparer<TSource>.Default;
-
-			return new ParallelQuery<TSource> (new QuerySetNode<TSource> (SetInclusionDefaults.Except,
-			                                                              comparer, first.Node, second.Node));
-		}
-
-		[ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather "
-		                   + "than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() "
-		                   + "extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
-		public static ParallelQuery<TSource> Except<TSource> (this ParallelQuery<TSource> first,
-		                                                      IEnumerable<TSource> second)
-		{
-			throw new NotSupportedException ();
-		}
-
-		[ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather "
-		                   + "than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() "
-		                   + "extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
-		public static ParallelQuery<TSource> Except<TSource> (this ParallelQuery<TSource> first,
-		                                                      IEnumerable<TSource> second,
-		                                                      IEqualityComparer<TSource> comparer)
-		{
-			throw new NotSupportedException ();
-		}
-		#endregion
-
-		#region Distinct
-		public static ParallelQuery<TSource> Distinct<TSource> (this ParallelQuery<TSource> source)
-		{
-			return Distinct<TSource> (source, EqualityComparer<TSource>.Default);
-		}
-
-		public static ParallelQuery<TSource> Distinct<TSource> (this ParallelQuery<TSource> source, IEqualityComparer<TSource> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (comparer == null)
-				comparer = EqualityComparer<TSource>.Default;
-
-			return new ParallelQuery<TSource> (new QuerySetNode<TSource> (SetInclusionDefaults.Distinct, comparer,
-			                                                              source.Node, null));
-		}
-		#endregion
-
-		#region Union
-		[ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather "
-		                   + "than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() "
-		                   + "extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
-		public static ParallelQuery<TSource> Union<TSource> (this ParallelQuery<TSource> first,
-		                                                     IEnumerable<TSource> second)
-		{
-			throw new NotSupportedException ();
-		}
-
-		[ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather "
-		                   + "than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() "
-		                   + "extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
-		public static ParallelQuery<TSource> Union<TSource>(this ParallelQuery<TSource> first,
-		                                                    IEnumerable<TSource> second,
-		                                                    IEqualityComparer<TSource> comparer)
-		{
-			throw new NotSupportedException ();
-		}
-
-		public static ParallelQuery<TSource> Union<TSource> (this ParallelQuery<TSource> first,
-		                                                     ParallelQuery<TSource> second)
-		{
-			return first.Union (second, EqualityComparer<TSource>.Default);
-		}
-
-		public static ParallelQuery<TSource> Union<TSource> (this ParallelQuery<TSource> first,
-		                                                     ParallelQuery<TSource> second,
-		                                                     IEqualityComparer<TSource> comparer)
-		{
-			if (first == null)
-				throw new ArgumentNullException ("first");
-			if (second == null)
-				throw new ArgumentNullException ("second");
-			if (comparer == null)
-				comparer = EqualityComparer<TSource>.Default;
-
-			return new ParallelQuery<TSource> (new QuerySetNode<TSource> (SetInclusionDefaults.Union, comparer, first.Node, second.Node));
-		}
-		#endregion
-
-		#region Take
-		public static ParallelQuery<TSource> Take<TSource> (this ParallelQuery<TSource> source, int count)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return new ParallelQuery<TSource> (new QueryHeadWorkerNode<TSource> (source.Node, count));
-		}
-
-		public static ParallelQuery<TSource> TakeWhile<TSource> (this ParallelQuery<TSource> source,
-		                                                         Func<TSource, bool> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (predicate == null)
-				throw new ArgumentNullException ("predicate");
-
-			return new ParallelQuery<TSource> (new QueryHeadWorkerNode<TSource> (source.Node, (e, _) => predicate (e), false));
-		}
-
-		public static ParallelQuery<TSource> TakeWhile<TSource> (this ParallelQuery<TSource> source,
-		                                                         Func<TSource, int, bool> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (predicate == null)
-				throw new ArgumentNullException ("predicate");
-
-			return new ParallelQuery<TSource> (new QueryHeadWorkerNode<TSource> (source.Node, predicate, true));
-		}
-		#endregion
-
-		#region Skip
-		public static ParallelQuery<TSource> Skip<TSource> (this ParallelQuery<TSource> source, int count)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Node.IsOrdered () ?
-				source.Where ((e, i) => i >= count) :
-				source.Where ((e) => count < 0 || Interlocked.Decrement (ref count) < 0);
-
-		}
-
-		public static ParallelQuery<TSource> SkipWhile<TSource> (this ParallelQuery<TSource> source,
-		                                                         Func<TSource, bool> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (predicate == null)
-				throw new ArgumentNullException ("predicate");
-
-			return source.Node.IsOrdered () ?
-				source.SkipWhile ((e, i) => predicate (e)) :
-				source.Where ((e) => !predicate (e));
-		}
-
-		public static ParallelQuery<TSource> SkipWhile<TSource> (this ParallelQuery<TSource> source,
-		                                                         Func<TSource, int, bool> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (predicate == null)
-				throw new ArgumentNullException ("predicate");
-
-			int indexCache = int.MaxValue;
-
-			return source.Where ((e, i) => i >= indexCache || (!predicate (e, i) && (indexCache = i) == i));
-		}
-		#endregion
-
-		#region Single
-		static TSource SingleInternal<TSource> (this ParallelQuery<TSource> source, params TSource[] init)
-		{
-			TSource result = default(TSource);
-			bool hasValue = false;
-
-			foreach (TSource element in source) {
-				if (hasValue)
-					throw new InvalidOperationException ("The input sequence contains more than one element.");
-
-				result = element;
-				hasValue = true;
-			}
-
-			if (!hasValue && init.Length != 0) {
-				result = init[0];
-				hasValue = true;
-			}
-
-			if (!hasValue)
-				throw new InvalidOperationException ("The input sequence is empty.");
-
-			return result;
-		}
-
-		public static TSource Single<TSource> (this ParallelQuery<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return SingleInternal<TSource> (source);
-		}
-
-		public static TSource Single<TSource> (this ParallelQuery<TSource> source,
-		                                       Func<TSource, bool> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (predicate == null)
-				throw new ArgumentNullException ("predicate");
-
-			return source.Where (predicate).Single ();
-		}
-
-		public static TSource SingleOrDefault<TSource> (this ParallelQuery<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return SingleInternal<TSource> (source, default (TSource));
-		}
-
-		public static TSource SingleOrDefault<TSource> (this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (predicate == null)
-				throw new ArgumentNullException ("predicate");
-
-			return source.Where (predicate).SingleOrDefault ();
-		}
-		#endregion
-
-		#region Count
-		public static int Count<TSource> (this ParallelQuery<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			var helper = new CountAggregateHelper<TSource> ();
-			return source.Aggregate<TSource, int, int> (helper.Seed,
-			                                            helper.Intermediate,
-			                                            helper.Reducer,
-			                                            helper.Final);
-		}
-
-		public static int Count<TSource> (this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (predicate == null)
-				throw new ArgumentNullException ("predicate");
-
-			return source.Where (predicate).Count ();
-		}
-
-		class CountAggregateHelper<TSource>
-		{
-			public int Seed ()
-			{
-				return 0;
-			}
-
-			public int Intermediate (int acc, TSource e)
-			{
-				return acc + 1;
-			}
-
-			public int Reducer (int acc1, int acc2)
-			{
-				return acc1 + acc2;
-			}
-
-			public int Final (int acc)
-			{
-				return acc;
-			}
-		}
-
-		public static long LongCount<TSource> (this ParallelQuery<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			var helper = new LongCountAggregateHelper<TSource> ();
-			return source.Aggregate<TSource, long, long> (helper.Seed,
-			                                              helper.Intermediate,
-			                                              helper.Reducer,
-			                                              helper.Final);
-		}
-
-		public static long LongCount<TSource> (this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (predicate == null)
-				throw new ArgumentNullException ("predicate");
-
-			return source.Where (predicate).LongCount ();
-		}
-
-		class LongCountAggregateHelper<TSource>
-		{
-			public long Seed ()
-			{
-				return 0;
-			}
-
-			public long Intermediate (long acc, TSource e)
-			{
-				return acc + 1;
-			}
-
-			public long Reducer (long acc1, long acc2)
-			{
-				return acc1 + acc2;
-			}
-
-			public long Final (long acc)
-			{
-				return acc;
-			}
-		}
-		#endregion
-
-		#region Average
-		public static double Average (this ParallelQuery<int> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Aggregate (() => new int[2],
-			                        (acc, e) => { acc[0] += e; acc[1]++; return acc; },
-			                        (acc1, acc2) => { acc1[0] += acc2[0]; acc1[1] += acc2[1]; return acc1; },
-			                        (acc) => acc[0] / ((double)acc[1]));
-		}
-
-		public static double Average (this ParallelQuery<long> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Aggregate (() => new long[2],
-			                        (acc, e) => { acc[0] += e; acc[1]++; return acc; },
-			                        (acc1, acc2) => { acc1[0] += acc2[0]; acc1[1] += acc2[1]; return acc1; },
-			                        (acc) => acc[0] / ((double)acc[1]));
-		}
-
-		public static decimal Average (this ParallelQuery<decimal> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Aggregate (() => new decimal[2],
-			                        (acc, e) => { acc[0] += e; acc[1]++; return acc; },
-			                        (acc1, acc2) => { acc1[0] += acc2[0]; acc1[1] += acc2[1]; return acc1; },
-			                        (acc) => acc[0] / acc[1]);
-		}
-
-		public static double Average (this ParallelQuery<double> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Aggregate (() => new double[2],
-			                        (acc, e) => { acc[0] += e; acc[1]++; return acc; },
-			                        (acc1, acc2) => { acc1[0] += acc2[0]; acc1[1] += acc2[1]; return acc1; },
-			                        (acc) => acc[0] / ((double)acc[1]));
-		}
-
-		public static float Average (this ParallelQuery<float> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Aggregate (() => new float[2],
-			                        (acc, e) => { acc[0] += e; acc[1]++; return acc; },
-			                        (acc1, acc2) => { acc1[0] += acc2[0]; acc1[1] += acc2[1]; return acc1; },
-			                        (acc) => acc[0] / acc[1]);
-		}
-		#endregion
-
-		#region More Average
-		public static double? Average (this ParallelQuery<int?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : 0).Average ();;
-		}
-
-		public static double? Average (this ParallelQuery<long?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : 0).Average ();
-		}
-
-		public static decimal? Average (this ParallelQuery<decimal?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : 0).Average ();
-		}
-
-		public static double? Average (this ParallelQuery<double?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : 0).Average ();
-		}
-
-		public static float? Average (this ParallelQuery<float?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : 0).Average ();
-		}
-
-		public static double Average<TSource> (this ParallelQuery<TSource> source, Func<TSource, int> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Average ();
-		}
-
-		public static double Average<TSource> (this ParallelQuery<TSource> source, Func<TSource, long> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Average ();
-		}
-
-		public static float Average<TSource> (this ParallelQuery<TSource> source, Func<TSource, float> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Average ();
-		}
-
-		public static double Average<TSource> (this ParallelQuery<TSource> source, Func<TSource, double> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Average ();
-		}
-
-		public static decimal Average<TSource> (this ParallelQuery<TSource> source, Func<TSource, decimal> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Average ();
-		}
-
-		public static double? Average<TSource> (this ParallelQuery<TSource> source, Func<TSource, int?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Average ();
-		}
-
-		public static double? Average<TSource> (this ParallelQuery<TSource> source, Func<TSource, long?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Average ();
-		}
-
-		public static float? Average<TSource> (this ParallelQuery<TSource> source, Func<TSource, float?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Average ();
-		}
-
-		public static double? Average<TSource> (this ParallelQuery<TSource> source, Func<TSource, double?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Average ();
-		}
-
-		public static decimal? Average<TSource> (this ParallelQuery<TSource> source, Func<TSource, decimal?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Average ();
-		}
-		#endregion
-
-		#region Sum
-		public static int Sum (this ParallelQuery<int> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Aggregate (0, (e1, e2) => e1 + e2, (sum1, sum2) => sum1 + sum2, (sum) => sum);
-		}
-
-		public static long Sum (this ParallelQuery<long> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Aggregate ((long)0, (e1, e2) => e1 + e2, (sum1, sum2) => sum1 + sum2, (sum) => sum);
-		}
-
-		public static float Sum (this ParallelQuery<float> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Aggregate (0.0f, (e1, e2) => e1 + e2, (sum1, sum2) => sum1 + sum2, (sum) => sum);
-		}
-
-		public static double Sum (this ParallelQuery<double> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Aggregate (0.0, (e1, e2) => e1 + e2, (sum1, sum2) => sum1 + sum2, (sum) => sum);
-		}
-
-		public static decimal Sum (this ParallelQuery<decimal> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Aggregate ((decimal)0, (e1, e2) => e1 + e2, (sum1, sum2) => sum1 + sum2, (sum) => sum);
-		}
-
-		public static int? Sum (this ParallelQuery<int?> source)
-		{
-			return source.Select ((e) => e.HasValue ? e.Value : 0).Sum ();
-		}
-
-		public static long? Sum (this ParallelQuery<long?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : 0).Sum ();
-		}
-
-		public static float? Sum (this ParallelQuery<float?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : 0).Sum ();
-		}
-
-		public static double? Sum (this ParallelQuery<double?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : 0).Sum ();
-		}
-
-		public static decimal? Sum (this ParallelQuery<decimal?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : 0).Sum ();
-		}
-
-		public static int Sum<TSource> (this ParallelQuery<TSource> source, Func<TSource, int> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Sum ();
-		}
-
-		public static long Sum<TSource> (this ParallelQuery<TSource> source, Func<TSource, long> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Sum ();
-		}
-
-		public static decimal Sum<TSource> (this ParallelQuery<TSource> source, Func<TSource, decimal> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Sum ();
-		}
-
-		public static float Sum<TSource> (this ParallelQuery<TSource> source, Func<TSource, float> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Sum ();
-		}
-
-		public static double Sum<TSource> (this ParallelQuery<TSource> source, Func<TSource, double> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Sum ();
-		}
-
-		public static int? Sum<TSource> (this ParallelQuery<TSource> source, Func<TSource, int?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Sum ();
-		}
-
-		public static long? Sum<TSource> (this ParallelQuery<TSource> source, Func<TSource, long?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Sum ();
-		}
-
-		public static decimal? Sum<TSource> (this ParallelQuery<TSource> source, Func<TSource, decimal?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Sum ();
-		}
-
-		public static float? Sum<TSource> (this ParallelQuery<TSource> source, Func<TSource, float?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Sum ();
-		}
-
-		public static double? Sum<TSource> (this ParallelQuery<TSource> source, Func<TSource, double?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Sum ();
-		}
-		#endregion
-
-		#region Min-Max
-		static T BestOrder<T> (ParallelQuery<T> source, BestOrderComparer<T> bestOrderComparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			T best = source.Aggregate (bestOrderComparer.Seed,
-			                           bestOrderComparer.Intermediate,
-			                           bestOrderComparer.Intermediate,
-			                           new Identity<T> ().Apply);
-			return best;
-		}
-
-		class BestOrderComparer<T>
-		{
-			IComparer<T> comparer;
-			int inverter;
-			T seed;
-
-			public BestOrderComparer (IComparer<T> comparer, int inverter, T seed)
-			{
-				this.comparer = comparer;
-				this.inverter = inverter;
-				this.seed = seed;
-			}
-
-			public T Seed ()
-			{
-				return seed;
-			}
-
-			public T Intermediate (T first, T second)
-			{
-				return Better (first, second) ? first : second;
-			}
-
-			bool Better (T first, T second)
-			{
-				return (inverter * comparer.Compare (first, second)) > 0;
-			}
-		}
-
-		public static int Min (this ParallelQuery<int> source)
-		{
-			return BestOrder (source, new BestOrderComparer<int> (Comparer<int>.Default, -1, int.MaxValue));
-		}
-
-		public static long Min (this ParallelQuery<long> source)
-		{
-			return BestOrder (source, new BestOrderComparer<long> (Comparer<long>.Default, -1, long.MaxValue));
-		}
-
-		public static float Min (this ParallelQuery<float> source)
-		{
-			return BestOrder (source, new BestOrderComparer<float> (Comparer<float>.Default, -1, float.MaxValue));
-		}
-
-		public static double Min (this ParallelQuery<double> source)
-		{
-			return BestOrder (source, new BestOrderComparer<double> (Comparer<double>.Default, -1, double.MaxValue));
-		}
-
-		public static decimal Min (this ParallelQuery<decimal> source)
-		{
-			return BestOrder (source, new BestOrderComparer<decimal> (Comparer<decimal>.Default, -1, decimal.MaxValue));
-		}
-
-		public static TSource Min<TSource> (this ParallelQuery<TSource> source)
-		{
-			IComparer<TSource> comparer = Comparer<TSource>.Default;
-			return BestOrder (source, new BestOrderComparer<TSource> (comparer, -1, default (TSource)));
-		}
-
-		public static TResult Min<TSource, TResult> (this ParallelQuery<TSource> source, Func<TSource, TResult> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Min ();
-		}
-
-		public static int? Min (this ParallelQuery<int?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : int.MaxValue).Min ();
-		}
-
-		public static long? Min (this ParallelQuery<long?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : long.MaxValue).Min ();
-		}
-
-		public static float? Min (this ParallelQuery<float?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : float.MaxValue).Min ();
-		}
-
-		public static double? Min (this ParallelQuery<double?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : double.MaxValue).Min ();
-		}
-
-		public static decimal? Min (this ParallelQuery<decimal?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : decimal.MaxValue).Min ();
-		}
-
-		public static int Min<TSource> (this ParallelQuery<TSource> source, Func<TSource, int> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Min ();
-		}
-
-		public static long Min<TSource> (this ParallelQuery<TSource> source, Func<TSource, long> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Min ();
-		}
-
-		public static float Min<TSource> (this ParallelQuery<TSource> source, Func<TSource, float> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Min ();
-		}
-
-		public static double Min<TSource> (this ParallelQuery<TSource> source, Func<TSource, double> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Min ();
-		}
-
-		public static decimal Min<TSource> (this ParallelQuery<TSource> source, Func<TSource, decimal> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Min ();
-		}
-
-		public static int? Min<TSource> (this ParallelQuery<TSource> source, Func<TSource, int?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Min ();
-		}
-
-		public static long? Min<TSource> (this ParallelQuery<TSource> source, Func<TSource, long?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Min ();
-		}
-
-		public static float? Min<TSource> (this ParallelQuery<TSource> source, Func<TSource, float?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Min ();
-		}
-
-		public static double? Min<TSource> (this ParallelQuery<TSource> source, Func<TSource, double?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Min ();
-		}
-
-		public static decimal? Min<TSource> (this ParallelQuery<TSource> source, Func<TSource, decimal?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Min ();
-		}
-
-		public static int Max (this ParallelQuery<int> source)
-		{
-			return BestOrder (source, new BestOrderComparer<int> (Comparer<int>.Default, 1, int.MinValue));
-		}
-
-		public static long Max (this ParallelQuery<long> source)
-		{
-			return BestOrder (source, new BestOrderComparer<long> (Comparer<long>.Default, 1, long.MinValue));
-		}
-
-		public static float Max (this ParallelQuery<float> source)
-		{
-			return BestOrder (source, new BestOrderComparer<float> (Comparer<float>.Default, 1, float.MinValue));
-		}
-
-		public static double Max (this ParallelQuery<double> source)
-		{
-			return BestOrder (source, new BestOrderComparer<double> (Comparer<double>.Default, 1, double.MinValue));
-		}
-
-		public static decimal Max (this ParallelQuery<decimal> source)
-		{
-			return BestOrder (source, new BestOrderComparer<decimal> (Comparer<decimal>.Default, 1, decimal.MinValue));
-		}
-
-		public static TSource Max<TSource> (this ParallelQuery<TSource> source)
-		{
-			IComparer<TSource> comparer = Comparer<TSource>.Default;
-			return BestOrder (source, new BestOrderComparer<TSource> (comparer, 1, default (TSource)));
-		}
-
-		public static TResult Max<TSource, TResult> (this ParallelQuery<TSource> source, Func<TSource, TResult> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Max ();
-		}
-
-		public static int? Max (this ParallelQuery<int?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : int.MinValue).Max ();
-		}
-
-		public static long? Max (this ParallelQuery<long?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : long.MinValue).Max ();
-		}
-
-		public static float? Max (this ParallelQuery<float?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : float.MinValue).Max ();
-		}
-
-		public static double? Max (this ParallelQuery<double?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : double.MinValue).Max ();
-		}
-
-		public static decimal? Max (this ParallelQuery<decimal?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.Select ((e) => e.HasValue ? e.Value : decimal.MinValue).Max ();
-		}
-
-		public static int Max<TSource> (this ParallelQuery<TSource> source, Func<TSource, int> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Max ();
-		}
-
-		public static long Max<TSource> (this ParallelQuery<TSource> source, Func<TSource, long> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Max ();
-		}
-
-		public static float Max<TSource> (this ParallelQuery<TSource> source, Func<TSource, float> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Max ();
-		}
-
-		public static double Max<TSource> (this ParallelQuery<TSource> source, Func<TSource, double> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Max ();
-		}
-
-		public static decimal Max<TSource> (this ParallelQuery<TSource> source, Func<TSource, decimal> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Max ();
-		}
-
-		public static int? Max<TSource> (this ParallelQuery<TSource> source, Func<TSource, int?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Max ();
-		}
-
-		public static long? Max<TSource> (this ParallelQuery<TSource> source, Func<TSource, long?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Max ();
-		}
-
-		public static float? Max<TSource> (this ParallelQuery<TSource> source, Func<TSource, float?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Max ();
-		}
-
-		public static double? Max<TSource> (this ParallelQuery<TSource> source, Func<TSource, double?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Max ();
-		}
-
-		public static decimal? Max<TSource> (this ParallelQuery<TSource> source, Func<TSource, decimal?> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (selector == null)
-				throw new ArgumentNullException ("selector");
-
-			return source.Select (selector).Max ();
-		}
-		#endregion
-
-		#region Cast / OfType
-		public static ParallelQuery<TResult> Cast<TResult> (this ParallelQuery source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.TypedQuery.Select ((e) => (TResult)e);
-		}
-
-		public static ParallelQuery<TResult> OfType<TResult> (this ParallelQuery source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return source.TypedQuery.Where ((e) => e is TResult).Cast<TResult> ();
-		}
-		#endregion
-
-		#region Reverse
-		public static ParallelQuery<TSource> Reverse<TSource> (this ParallelQuery<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			return new ParallelQuery<TSource> (new QueryReverseNode<TSource> (source));
-		}
-		#endregion
-
-		#region ToArray - ToList - ToDictionary - ToLookup
-		public static List<TSource> ToList<TSource> (this ParallelQuery<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			if (source.Node.IsOrdered ())
-				return ToListOrdered (source);
-
-			var helper = new ListAggregateHelper<TSource> ();
-			List<TSource> temp = source.Aggregate (helper.Seed,
-			                                       helper.Intermediate,
-			                                       helper.Reducer,
-			                                       helper.Final);
-			return temp;
-		}
-
-		class ListAggregateHelper<TSource>
-		{
-			public List<TSource> Seed ()
-			{
-				return new List<TSource> (50);
-			}
-
-			public List<TSource> Intermediate (List<TSource> list, TSource e)
-			{
-				list.Add (e);
-				return list;
-			}
-
-			public List<TSource> Reducer (List<TSource> list, List<TSource> list2)
-			{
-				list.AddRange (list2);
-				return list;
-			}
-
-			public List<TSource> Final (List<TSource> list)
-			{
-				return list;
-			}
-		}
-
-		internal static List<TSource> ToListOrdered<TSource> (this ParallelQuery<TSource> source)
-		{
-			List<TSource> result = new List<TSource> ();
-
-			foreach (TSource element in source)
-				result.Add (element);
-
-			return result;
-		}
-
-		public static TSource[] ToArray<TSource> (this ParallelQuery<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-
-			if (source.Node.IsOrdered ())
-				return ToListOrdered (source).ToArray ();
-
-			var helper = new ArrayAggregateHelper<TSource> ();
-			ParallelExecuter.ProcessAndAggregate<TSource, List<TSource>> (source.Node,
-			                                                              helper.Seed,
-			                                                              helper.Intermediate,
-			                                                              helper.Final);
-
-			return helper.Result;
-		}
-
-		class ArrayAggregateHelper<TSource>
-		{
-			TSource[] result;
-
-			public TSource[] Result {
-				get {
-					return result;
-				}
-			}
-
-			internal List<TSource> Seed ()
-			{
-				return new List<TSource> ();
-			}
-
-			internal List<TSource> Intermediate (List<TSource> list, TSource e)
-			{
-				list.Add (e);
-				return list;
-			}
-
-			internal void Final (IList<List<TSource>> list)
-			{
-				int count = 0;
-
-				for (int i = 0; i < list.Count; i++)
-					count += list[i].Count;
-
-				result = new TSource[count];
-				int insertIndex = -1;
-
-				for (int i = 0; i < list.Count; i++)
-					for (int j = 0; j < list[i].Count; j++)
-						result [++insertIndex] = list[i][j];
-			}
-		}
-
-		public static Dictionary<TKey, TSource> ToDictionary<TSource, TKey> (this ParallelQuery<TSource> source,
-		                                                                     Func<TSource, TKey> keySelector,
-		                                                                     IEqualityComparer<TKey> comparer)
-		{
-			return ToDictionary<TSource, TKey, TSource> (source, keySelector, (e) => e, comparer);
-		}
-
-		public static Dictionary<TKey, TSource> ToDictionary<TSource, TKey> (this ParallelQuery<TSource> source,
-		                                                                     Func<TSource, TKey> keySelector)
-		{
-			return ToDictionary<TSource, TKey, TSource> (source, keySelector, (e) => e, EqualityComparer<TKey>.Default);
-		}
-
-		public static Dictionary<TKey, TElement> ToDictionary<TSource, TKey, TElement> (this ParallelQuery<TSource> source,
-		                                                                                  Func<TSource, TKey> keySelector,
-		                                                                                  Func<TSource, TElement> elementSelector)
-		{
-			return ToDictionary<TSource, TKey, TElement> (source, keySelector, elementSelector, EqualityComparer<TKey>.Default);
-		}
-
-		public static Dictionary<TKey, TElement> ToDictionary<TSource, TKey, TElement> (this ParallelQuery<TSource> source,
-		                                                                                  Func<TSource, TKey> keySelector,
-		                                                                                  Func<TSource, TElement> elementSelector,
-		                                                                                  IEqualityComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (keySelector == null)
-				throw new ArgumentNullException ("keySelector");
-			if (comparer == null)
-				comparer = EqualityComparer<TKey>.Default;
-			if (elementSelector == null)
-				throw new ArgumentNullException ("elementSelector");
-
-			var helper = new DictionaryAggregateHelper<TSource, TKey, TElement> (comparer, keySelector, elementSelector);
-			return source.Aggregate (helper.Seed,
-			                         helper.Intermediate,
-			                         helper.Reducer,
-			                         helper.Final);
-		}
-
-		class DictionaryAggregateHelper<TSource, TKey, TElement>
-		{
-			IEqualityComparer<TKey> comparer;
-			Func<TSource, TKey> keySelector;
-			Func<TSource, TElement> elementSelector;
-
-			public DictionaryAggregateHelper (IEqualityComparer<TKey> comparer,
-			                                  Func<TSource, TKey> keySelector,
-			                                  Func<TSource, TElement> elementSelector)
-			{
-				this.comparer = comparer;
-				this.keySelector = keySelector;
-				this.elementSelector = elementSelector;
-			}
-
-			public Dictionary<TKey, TElement> Seed ()
-			{
-				return new Dictionary<TKey, TElement> (comparer);
-			}
-
-			public Dictionary<TKey, TElement> Intermediate (Dictionary<TKey, TElement> d, TSource e)
-			{
-				d.Add (keySelector (e), elementSelector (e));
-				return d;
-			}
-
-			public Dictionary<TKey, TElement> Reducer (Dictionary<TKey, TElement> d1, Dictionary<TKey, TElement> d2)
-			{
-				foreach (var couple in d2) d1.Add (couple.Key, couple.Value);
-				return d1;
-			}
-
-			public Dictionary<TKey, TElement> Final (Dictionary<TKey, TElement> d)
-			{
-				return d;
-			}
-		}
-
-		public static ILookup<TKey, TSource> ToLookup<TSource, TKey> (this ParallelQuery<TSource> source,
-		                                                              Func<TSource, TKey> keySelector)
-		{
-			return ToLookup<TSource, TKey, TSource> (source, keySelector, (e) => e, EqualityComparer<TKey>.Default);
-		}
-
-		public static ILookup<TKey, TSource> ToLookup<TSource, TKey> (this ParallelQuery<TSource> source,
-		                                                              Func<TSource, TKey> keySelector,
-		                                                              IEqualityComparer<TKey> comparer)
-		{
-			return ToLookup<TSource, TKey, TSource> (source, keySelector, (e) => e, comparer);
-		}
-
-		public static ILookup<TKey, TElement> ToLookup<TSource, TKey, TElement> (this ParallelQuery<TSource> source,
-		                                                                         Func<TSource, TKey> keySelector,
-		                                                                         Func<TSource, TElement> elementSelector)
-		{
-			return ToLookup<TSource, TKey, TElement> (source, keySelector, elementSelector, EqualityComparer<TKey>.Default);
-		}
-
-		public static ILookup<TKey, TElement> ToLookup<TSource, TKey, TElement> (this ParallelQuery<TSource> source,
-		                                                                         Func<TSource, TKey> keySelector,
-		                                                                         Func<TSource, TElement> elementSelector,
-		                                                                         IEqualityComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException ("source");
-			if (keySelector == null)
-				throw new ArgumentNullException ("keySelector");
-			if (comparer == null)
-				comparer = EqualityComparer<TKey>.Default;
-			if (elementSelector == null)
-				throw new ArgumentNullException ("elementSelector");
-
-			ConcurrentLookup<TKey, TElement> lookup = new ConcurrentLookup<TKey, TElement> (comparer);
-			source.ForAll ((e) => lookup.Add (keySelector (e), elementSelector (e)));
-
-			return lookup;
-		}
-		#endregion
-
-		#region Concat
-		[ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than "
-		                   + "System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method "
-		                   + "to convert the right data source to System.Linq.ParallelQuery<T>.")]
-		public static ParallelQuery<TSource> Concat<TSource>(this ParallelQuery<TSource> first,
-		                                                     IEnumerable<TSource> second)
-		{
-			throw new NotSupportedException ();
-		}
-
-		public static ParallelQuery<TSource> Concat<TSource> (this ParallelQuery<TSource> first, ParallelQuery<TSource> second)
-		{
-			return new ParallelQuery<TSource> (new QueryConcatNode<TSource> (first.Node, second.Node));
-		}
-		#endregion
-		
-		#region DefaultIfEmpty
-		public static ParallelQuery<TSource> DefaultIfEmpty<TSource> (this ParallelQuery<TSource> source)
-		{
-			return source.DefaultIfEmpty (default (TSource));
-		}
-		
-		public static ParallelQuery<TSource> DefaultIfEmpty<TSource> (this ParallelQuery<TSource> source, TSource defaultValue)
-		{
-			return new ParallelQuery<TSource> (new QueryDefaultEmptyNode<TSource> (source.Node, defaultValue));
-		}
-		#endregion
-		
-		#region First
-		public static TSource First<TSource> (this ParallelQuery<TSource> source)
-		{
-			CancellationTokenSource src = new CancellationTokenSource ();
-			IEnumerator<TSource> enumerator = source.WithImplementerToken (src).GetEnumerator ();
-			
-			if (enumerator == null || !enumerator.MoveNext ())
-				throw new InvalidOperationException ("source contains no element");
-			
-			TSource result = enumerator.Current;
-			src.Cancel ();
-			enumerator.Dispose ();
-			
-			return result;
-		}
-		
-		public static TSource First<TSource> (this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
-		{
-			return source.Where (predicate).First ();
-		}
-		
-		public static TSource FirstOrDefault<TSource> (this ParallelQuery<TSource> source)
-		{
-			return source.DefaultIfEmpty ().First ();
-		}
-		
-		public static TSource FirstOrDefault<TSource> (this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
-		{
-			return source.Where (predicate).FirstOrDefault ();
-		}
-		#endregion
-		
-		#region Last
-		public static TSource Last<TSource> (this ParallelQuery<TSource> source)
-		{
-			return source.Reverse ().First ();
-		}
-		
-		public static TSource Last<TSource> (this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
-		{
-			return source.Reverse ().First (predicate);
-		}
-		
-		public static TSource LastOrDefault<TSource> (this ParallelQuery<TSource> source)
-		{
-			return source.Reverse ().FirstOrDefault ();
-		}
-		
-		public static TSource LastOrDefault<TSource> (this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
-		{
-			return source.Reverse ().FirstOrDefault (predicate);
-		}
-		#endregion
-
-		#region Zip
-		public static ParallelQuery<TResult> Zip<TFirst, TSecond, TResult> (this ParallelQuery<TFirst> first,
-		                                                                      ParallelQuery<TSecond> second,
-		                                                                      Func<TFirst, TSecond, TResult> resultSelector)
-		{
-			if (first == null)
-				throw new ArgumentNullException ("first");
-			if (second == null)
-				throw new ArgumentNullException ("second");
-			if (resultSelector == null)
-				throw new ArgumentNullException ("resultSelector");
-
-			return new ParallelQuery<TResult> (new QueryZipNode<TFirst, TSecond, TResult> (resultSelector, first.Node, second.Node));
-		}
-
-		[ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather "
-		                   + "than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() "
-		                   + "extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
-		public static ParallelQuery<TResult> Zip<TFirst, TSecond, TResult> (this ParallelQuery<TFirst> first,
-		                                                                      IEnumerable<TSecond> second,
-		                                                                      Func<TFirst, TSecond, TResult> resultSelector)
-		{
-			throw new NotSupportedException ();
-		}
-		#endregion
-
-		#region Helpers
-
-		class Identity<T>
-		{
-			public T Apply (T input)
-			{
-				return input;
-			}
-		}
-		#endregion
-	}
-}

+ 0 - 36
mcs/class/System.Core/System.Linq/ParallelExecutionMode.cs

@@ -1,36 +0,0 @@
-//
-// ParallelExecutionMode.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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
-{
-	public enum ParallelExecutionMode
-	{
-		Default = 0,
-		ForceParallelism = 1
-	}
-}

+ 0 - 38
mcs/class/System.Core/System.Linq/ParallelMergeOptions.cs

@@ -1,38 +0,0 @@
-//
-// ParallelMergeOptions.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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
-{
-	public enum ParallelMergeOptions
-	{
-		Default = 0,
-		NotBuffered,
-		AutoBuffered,
-		FullyBuffered
-	}
-}

+ 0 - 125
mcs/class/System.Core/System.Linq/ParallelQuery.cs

@@ -1,125 +0,0 @@
-//
-// ParallelQuery.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-using System.Linq.Parallel;
-using System.Linq.Parallel.QueryNodes;
-
-namespace System.Linq
-{
-	public class ParallelQuery : IEnumerable
-	{
-		ParallelExecutionMode execMode = ParallelExecutionMode.Default;
-		ParallelMergeOptions mergeOptions = ParallelMergeOptions.Default;
-
-		internal ParallelQuery ()
-		{
-
-		}
-
-		internal ParallelMergeOptions MergeOptions {
-			get {
-				return mergeOptions;
-			}
-			set {
-				mergeOptions = value;
-			}
-		}
-
-		internal ParallelExecutionMode ExecMode {
-			get {
-				return execMode;
-			}
-			set {
-				execMode = value;
-			}
-		}
-
-		IEnumerator IEnumerable.GetEnumerator ()
-		{
-			return GetEnumeratorTrick ();
-		}
-
-		// Trick to get the correct IEnumerator from ParallelQuery<TSource>
-		internal virtual IEnumerator GetEnumeratorTrick ()
-		{
-			return null;
-		}
-		
-		internal virtual ParallelQuery<object> TypedQuery {
-			get {
-				return null;
-			}
-		}
-	}
-
-	public class ParallelQuery<TSource> : ParallelQuery, IEnumerable<TSource>, IEnumerable
-	{
-		QueryBaseNode<TSource> node;
-
-		internal ParallelQuery (QueryBaseNode<TSource> node)
-		{
-			this.node = node;
-		}
-
-		internal QueryBaseNode<TSource> Node {
-			get {
-				return node;
-			}
-		}
-
-		public virtual IEnumerator<TSource> GetEnumerator ()
-		{
-			return GetEnumeratorInternal ();
-		}
-
-		IEnumerator IEnumerable.GetEnumerator ()
-		{
-			return (IEnumerator)GetEnumeratorInternal ();
-		}
-
-		IEnumerator<TSource> GetEnumeratorInternal ()
-		{
-			return new ParallelQueryEnumerator<TSource> (node);
-		}
-
-		internal override IEnumerator GetEnumeratorTrick ()
-		{
-			return (IEnumerator)GetEnumeratorInternal ();
-		}
-		
-		internal override ParallelQuery<object> TypedQuery {
-			get {
-				return new ParallelQuery<object> (new QueryCastNode<TSource> (node));
-			}
-		}
-	}
-}

+ 0 - 43
mcs/class/System.Core/System.Runtime.CompilerServices/ChangeLog

@@ -1,43 +0,0 @@
-2010-06-18  Rolf Bjarne Kvinge  <[email protected]>
-
-	* ExecutionScope.cs: This class exists in Moonlight, but isn't supported.
-
-	* StrongBox_T.cs:
-	* DynamicAttribute.cs: Include in Moonlight.
-
-2009-12-02  Marek Safar <[email protected]>
-
-	* DynamicAttribute.cs: Add arguments check.
-
-2009-11-14  Jb Evain  <[email protected]>
-
-	* ExecutionScope.cs: implement IsolateExpression.
-
-2009-07-02  Marek Safar <[email protected]>
-
-	* StrongBox_T.cs: Add 4.0 bits.
-
-2009-06-29  Marek Safar <[email protected]>
-
-	* DynamicAttribute.cs: Add DynamicAttribute.
-
-2009-03-05  Jb Evain  <[email protected]>
-
-	* ExecutionScope.cs: add support for hoisted locals.
-
-2008-06-20  Jb Evain  <[email protected]>
-
-	* ExecutionScope.cs (CreateDelegate): implement.
-
-2008-04-19  Jb Evain  <[email protected]>
-
-	* ExecutionScope.cs: change the constructor to take a list
-	of globals.
-
-2008-02-24  Jb Evain  <[email protected]>
-
-	* ExecutionScope.cs: update API.
-
-2007-01-19  Marek Safar <[email protected]>
-
-	* ChangeLog: Added

+ 0 - 63
mcs/class/System.Core/System.Runtime.CompilerServices/DynamicAttribute.cs

@@ -1,63 +0,0 @@
-//
-// DynamicAttribute.cs
-//
-// Authors:
-//	Marek Safar  <[email protected]>
-//
-// Copyright (C) 2009, 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;
-using System.Collections.Generic;
-
-namespace System.Runtime.CompilerServices
-{
-
-	[AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
-	public sealed class DynamicAttribute : Attribute
-	{
-		static readonly IList<bool> empty = Array.AsReadOnly (new [] { true });
-		
-		IList<bool> transformFlags;
-
-		public DynamicAttribute ()
-		{
-			transformFlags = empty;
-		}
-
-		public DynamicAttribute (bool[] transformFlags)
-		{
-			if (transformFlags == null)
-				throw new ArgumentNullException ();
-
-			this.transformFlags = transformFlags;
-		}
-
-		public IList<bool> TransformFlags {
-			get {
-				return transformFlags;
-			}
-		}
-	}
-}
-

+ 0 - 100
mcs/class/System.Core/System.Runtime.CompilerServices/ExecutionScope.cs

@@ -1,100 +0,0 @@
-//
-// ExecutionScope.cs
-//
-// Authors:
-//	Marek Safar  <[email protected]>
-//	Jb Evain  <[email protected]>
-//
-// Copyright (C) 2007 - 2008, 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.
-//
-
-#if !FULL_AOT_RUNTIME
-using System;
-using System.Linq.Expressions;
-
-namespace System.Runtime.CompilerServices {
-
-#if MOBILE_DYNAMIC
-	[Obsolete ("do not use this type", true)]
-#endif
-	public class ExecutionScope {
-
-		public object [] Globals;
-		public object [] Locals;
-		public ExecutionScope Parent;
-
-#if !MOBILE_DYNAMIC
-		internal CompilationContext context;
-#endif
-		internal int compilation_unit;
-
-#if !MOBILE_DYNAMIC
-		ExecutionScope (CompilationContext context, int compilation_unit)
-		{
-			this.context = context;
-			this.compilation_unit = compilation_unit;
-			this.Globals = context.GetGlobals ();
-		}
-
-		internal ExecutionScope (CompilationContext context)
-			: this (context, 0)
-		{
-		}
-
-		internal ExecutionScope (CompilationContext context, int compilation_unit, ExecutionScope parent, object [] locals)
-			: this (context, compilation_unit)
-		{
-			this.Parent = parent;
-			this.Locals = locals;
-		}
-#endif
-		public Delegate CreateDelegate (int indexLambda, object [] locals)
-		{
-#if MOBILE_DYNAMIC
-			throw new NotSupportedException ();
-#else
-			return context.CreateDelegate (
-				indexLambda,
-				new ExecutionScope (context, indexLambda, this, locals));
-#endif
-		}
-
-		public object [] CreateHoistedLocals ()
-		{
-#if MOBILE_DYNAMIC
-			throw new NotSupportedException ();
-#else
-			return context.CreateHoistedLocals (compilation_unit);
-#endif
-		}
-
-		public Expression IsolateExpression (Expression expression, object [] locals)
-		{
-#if MOBILE_DYNAMIC
-			throw new NotSupportedException ();
-#else
-			return context.IsolateExpression (this, locals, expression);
-#endif
-		}
-	}
-}
-#endif

+ 0 - 34
mcs/class/System.Core/System.Runtime.CompilerServices/ExtensionAttribute.cs

@@ -1,34 +0,0 @@
-//
-// ExtensionAttribute.cs
-//
-// Authors:
-//	Alejandro Serrano "Serras" ([email protected])
-//	Marek Safar  <[email protected]>
-//
-// Copyright (C) 2011 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.
-//
-
-
-using System.Runtime.CompilerServices;
-
-[assembly: TypeForwardedTo (typeof (ExtensionAttribute))]
-

+ 0 - 34
mcs/class/System.Core/System.Runtime.CompilerServices/IStrongBox.cs

@@ -1,34 +0,0 @@
-//
-// IStrongBox.cs
-//
-// Authors:
-//	Marek Safar  <[email protected]>
-//
-// Copyright (C) 2007 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.
-//
-
-namespace System.Runtime.CompilerServices {
-
-	public interface IStrongBox {
-		object Value { get; set; }
-	}
-}

+ 0 - 50
mcs/class/System.Core/System.Runtime.CompilerServices/StrongBox_T.cs

@@ -1,50 +0,0 @@
-//
-// StrongBox<T>.cs
-//
-// Authors:
-//	Marek Safar  <[email protected]>
-//
-// Copyright (C) 2007 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.
-//
-
-namespace System.Runtime.CompilerServices {
-
-	public class StrongBox<T> : IStrongBox {
-
-		public T Value;
-
-		public StrongBox ()
-		{
-		}
-
-		public StrongBox (T value)
-		{
-			Value = value;
-		}
-
-		object IStrongBox.Value
-		{
-			get { return Value; }
-			set { Value = (T) value; }
-		}
-	}
-}

+ 0 - 130
mcs/class/System.Core/System.Security.Cryptography/AesManaged.cs

@@ -1,130 +0,0 @@
-//
-// System.Security.Cryptography.AesManaged.cs
-//
-// Authors:
-//	Mark Crichton ([email protected])
-//	Andrew Birkett ([email protected])
-//	Sebastien Pouliot ([email protected])
-//	Kazuki Oikawa ([email protected])
-//
-// (C) 2002
-// Portions (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005,2008 Novell, Inc (http://www.novell.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.
-//
-
-using System.Security.Permissions;
-
-using Mono.Security.Cryptography;
-
-namespace System.Security.Cryptography {
-	
-	// References:
-	// a.	FIPS PUB 197: Advanced Encryption Standard
-	//	http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
-	// b.	Aes Specification
-	//	http://csrc.nist.gov/CryptoToolkit/aes/Aes/Aes-ammended.pdf
-	
-	[HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort=true)]
-	public sealed class AesManaged : Aes {
-		
-		public AesManaged ()
-		{
-		}
-		
-		public override void GenerateIV ()
-		{
-			IVValue = KeyBuilder.IV (BlockSizeValue >> 3);
-		}
-		
-		public override void GenerateKey ()
-		{
-			KeyValue = KeyBuilder.Key (KeySizeValue >> 3);
-		}
-		
-		public override ICryptoTransform CreateDecryptor (byte[] key, byte[] iv) 
-		{
-			return new AesTransform (this, false, key, iv);
-		}
-		
-		public override ICryptoTransform CreateEncryptor (byte[] key, byte[] iv) 
-		{
-			return new AesTransform (this, true, key, iv);
-		}
-
-		// I suppose some attributes differs ?!? because this does not look required
-
-		public override byte[] IV {
-			get { return base.IV; }
-			set { base.IV = value; }
-		}
-
-		public override byte[] Key {
-			get { return base.Key; }
-			set { base.Key = value; }
-		}
-
-		public override int KeySize {
-			get { return base.KeySize; }
-			set { base.KeySize = value; }
-		}
-
-		public override int FeedbackSize {
-			get { return base.FeedbackSize; }
-			set { base.FeedbackSize = value; }
-		}
-
-		public override CipherMode Mode {
-			get { return base.Mode; }
-			set {
-				switch (value) {
-				case CipherMode.CBC:
-				case CipherMode.ECB:
-					base.Mode = value;
-					break;
-				default:
-					throw new CryptographicException ("CipherMode is not supported");
-				}
-			}
-		}
-
-		public override PaddingMode Padding {
-			get { return base.Padding; }
-			set { base.Padding = value; }
-		}
-
-		public override ICryptoTransform CreateDecryptor () 
-		{
-			return CreateDecryptor (Key, IV);
-		}
-
-		public override ICryptoTransform CreateEncryptor() 
-		{
-			return CreateEncryptor (Key, IV);
-		}
-
-		protected override void Dispose (bool disposing) 
-		{
-			base.Dispose (disposing);
-		}
-	}
-}

+ 0 - 23
mcs/class/System.Core/System.Threading/ChangeLog

@@ -1,23 +0,0 @@
-2009-06-15  Atsushi Enomoto  <[email protected]>
-
-	* ReaderWriterLockSlim.cs : fix deadlock when entered
-	  read lock -> entered writer lock -> exited writer lock
-	  -> exited read lock and then entered reader lock.
-	  Fixed bug #512485, patch by Kazuki Oikawa.
-
-2009-06-10  Marek Safar  <[email protected]>
-
-	* LockRecursionException.cs: Updated to 4.0 changes.
-
-2009-01-18  Marek Safar <[email protected]>
-
-	* ReaderWriterLockSlim.cs: Implemented all properties.
-
-2008-12-02  Marek Safar <[email protected]>
-
-	* ReaderWriterLockSlim.cs: Initial merge.
-
-2008-09-05  Marek Safar <[email protected]>
-
-	* ChangeLog: Added
-

+ 0 - 32
mcs/class/System.Core/System.Threading/LockRecursionException.cs

@@ -1,32 +0,0 @@
-/*
- * System.Threading.LockRecursionException
- *
- * Author(s)
- * 	Marek Safar <[email protected]>
- *
- * 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.Runtime.CompilerServices;
-
-[assembly:TypeForwardedTo (typeof(System.Threading.LockRecursionException))]
-

+ 0 - 45
mcs/class/System.Core/System.Threading/ReaderWriterLockSlimExtensions.cs

@@ -1,45 +0,0 @@
-//
-// ReaderWriterLockSlimExtensions.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading
-{
-	internal static class ReaderWriterLockSlimExtensions
-	{
-		internal static bool Has (this LockState state, LockState value)
-		{
-			return (state & value) > 0;
-		}
-
-		internal static bool IsSet (this ManualResetEventSlim self)
-		{
-			return self.IsSet;
-		}
-	}
-}

+ 0 - 51
mcs/class/System.Core/System.Threading/ThreadLockState.cs

@@ -1,51 +0,0 @@
-//
-// ThreadLockState.cs
-//
-// Author:
-//       Jérémie "Garuma" Laval <[email protected]>
-//
-// Copyright (c) 2010 Jérémie "Garuma" Laval
-//
-// 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.Threading
-{
-	[Flags]
-	internal enum LockState
-	{
-		None = 0,
-		Upgradable = 1,
-		Read = 2,
-		Write = 4,
-		UpgradedRead = Upgradable | Read,
-		UpgradedWrite = Upgradable | Write
-	}
-
-	internal class ThreadLockState
-	{
-		public LockState LockState;
-		public int ReaderRecursiveCount;
-		public int WriterRecursiveCount;
-		public int UpgradeableRecursiveCount;
-	}
-}

+ 0 - 63
mcs/class/System.Core/System/Actions.cs

@@ -1,63 +0,0 @@
-//
-// Actions.cs
-//
-// Authors:
-//	Marek Safar  <[email protected]>
-//
-// Copyright (C) 2007, 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;
-using System.Runtime.CompilerServices;
-
-[assembly:TypeForwardedTo (typeof(Action<>))]
-[assembly:TypeForwardedTo (typeof(Action<,>))]
-[assembly:TypeForwardedTo (typeof(Action<,,>))]
-[assembly:TypeForwardedTo (typeof(Action<,,,>))]
-[assembly:TypeForwardedTo (typeof (Action))]
-
-namespace System
-{
-	public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9> (
-		T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9);
-
-	public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10> (
-		T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10);
-
-	public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11> (
-		T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11);
-
-	public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12> (
-		T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12);
-
-	public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13> (
-		T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13);
-
-	public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14> (
-		T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14);
-
-	public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, in T15> (
-		T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15);
-
-	public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, in T15, in T16> (
-		T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16);
-}

+ 0 - 62
mcs/class/System.Core/System/Funcs.cs

@@ -1,62 +0,0 @@
-//
-// System.Func.cs
-//
-// Authors:
-//      Alejandro Serrano "Serras" ([email protected])
-//	Marek Safar ([email protected])
-//
-
-// 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 TArg 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
-//
-
-using System;
-using System.Runtime.CompilerServices;
-
-[assembly:TypeForwardedTo (typeof(Func<>))]
-[assembly:TypeForwardedTo (typeof(Func<,>))]
-[assembly:TypeForwardedTo (typeof(Func<,,>))]
-[assembly:TypeForwardedTo (typeof(Func<,,,>))]
-[assembly:TypeForwardedTo (typeof(Func<,,,,>))]
-
-namespace System
-{
-	public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, out TResult> (
-		T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9);
-
-	public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, out TResult> (
-		T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10);
-
-	public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, out TResult> (
-		T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11);
-
-	public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, out TResult> (
-		T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12);
-
-	public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, out TResult> (
-		T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13);
-
-	public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, out TResult> (
-		T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14);
-
-	public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, in T15, out TResult> (
-		T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15);
-
-	public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, in T15, in T16, out TResult> (
-		T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16);
-}

+ 0 - 32
mcs/class/System.Core/System/InvalidTimeZoneException.cs

@@ -1,32 +0,0 @@
-/*
- * System.InvalidTimeZoneException
- *
- * Author(s)
- * 	Stephane Delcroix <[email protected]>
- *
- * 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.Runtime.CompilerServices;
-
-[assembly:TypeForwardedTo (typeof(InvalidTimeZoneException))]
-

+ 0 - 32
mcs/class/System.Core/System/TimeZoneNotFoundException.cs

@@ -1,32 +0,0 @@
-/*
- * System.TimeZoneNotFoundException
- *
- * Author(s)
- * 	Stephane Delcroix <[email protected]>
- *
- * 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.Runtime.CompilerServices;
-
-[assembly:TypeForwardedTo (typeof(TimeZoneNotFoundException))]
-

+ 20 - 17
mcs/class/System.Core/common_System.Core.dll.sources

@@ -1,15 +1,7 @@
 ../../build/common/SR.cs
 
 Assembly/AssemblyInfo.cs
-System/Actions.cs
-System/Funcs.cs
-System/InvalidTimeZoneException.cs
-System/TimeZoneNotFoundException.cs
 System/Util.cs
-System.Runtime.CompilerServices/DynamicAttribute.cs
-System.Runtime.CompilerServices/ExtensionAttribute.cs
-System.Runtime.CompilerServices/IStrongBox.cs
-System.Runtime.CompilerServices/StrongBox_T.cs
 System.Linq/Check.cs
 System.Linq/Enumerable.cs
 System.Linq/QueryableEnumerable.cs
@@ -31,23 +23,15 @@ System.Linq/SortContext.cs
 System.Linq/SortDirection.cs
 System.Linq/SortSequenceContext.cs
 System.Linq/IQueryProvider.cs
-System.Security.Cryptography/AesManaged.cs
-System.Threading/ThreadLockState.cs
-System.Threading/ReaderWriterLockSlimExtensions.cs
 System.Linq/EnumerableExecutor.cs
 System.Linq/EnumerableExecutor_T.cs
 System.Linq/EnumerableQuery.cs
 System.Linq/EnumerableQuery_T.cs
 System.IO.MemoryMappedFiles/MemoryMappedFile.cs
-System.IO.MemoryMappedFiles/MemoryMappedFileAccess.cs
-System.IO.MemoryMappedFiles/MemoryMappedFileOptions.cs
-System.IO.MemoryMappedFiles/MemoryMappedFileRights.cs
-System.IO.MemoryMappedFiles/MemoryMappedFileSecurity.cs
 System.IO.MemoryMappedFiles/MemoryMappedViewStream.cs
 System.IO.MemoryMappedFiles/MemoryMappedViewAccessor.cs
 Microsoft.Win32.SafeHandles/SafeMemoryMappedFileHandle.cs
 Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs
-System.IO/HandleInheritability.cs
 System.Linq.Expressions/Extensions.cs
 System.Linq.Expressions/ExpressionTransformer.cs
 System.Linq.Expressions/DynamicExpressionVisitor.cs
@@ -55,12 +39,25 @@ System.Linq.Expressions/DynamicExpressionVisitor.cs
 ReferenceSources/Set.cs
 ReferenceSources/SR.cs
 
+../../../external/referencesource/System.Core/Microsoft/Scripting/Utils/Action.cs
+../../../external/referencesource/System.Core/Microsoft/Scripting/Utils/Extension.cs
+../../../external/referencesource/System.Core/Microsoft/Scripting/Utils/Function.cs
+../../../external/referencesource/System.Core/Microsoft/Scripting/Utils/StrongBox.cs
+
+../../../external/referencesource/System.Core/System/FuncAndAction.cs
+../../../external/referencesource/System.Core/System/InvalidTimeZoneException.cs
+../../../external/referencesource/System.Core/System/TimeZoneInfo.cs
+../../../external/referencesource/System.Core/System/TimeZoneNotFoundException.cs
+
 ../../../external/referencesource/System.Core/System/Collections/Generic/BitHelper.cs
 ../../../external/referencesource/System.Core/System/Collections/Generic/HashSet.cs
 ../../../external/referencesource/System.Core/System/Collections/Generic/HashSetDebugView.cs
 ../../../external/referencesource/System.Core/System/Collections/Generic/HashSetEqualityComparer.cs
 
-../../../external/referencesource/System.Core/System/Runtime/CompilerServices/ExecutionScope.cs
+../../../external/referencesource/System.Core/System/IO/Enums.cs
+
+../../../external/referencesource/System.Core/System/IO/MemoryMappedFiles/Enums.cs
+../../../external/referencesource/System.Core/System/IO/MemoryMappedFiles/MemoryMappedFileSecurity.cs
 
 ../../../external/referencesource/System.Core/System/Linq/ParallelEnumerable.cs
 ../../../external/referencesource/System.Core/System/Linq/ParallelMergeOptions.cs
@@ -198,6 +195,12 @@ ReferenceSources/SR.cs
 ../../../external/referencesource/System.Core/System/Linq/Parallel/Utils/Wrapper.cs
 ../../../external/referencesource/System.Core/System/Linq/Parallel/Utils/WrapperEqualityComparer.cs
 
+../../../external/referencesource/System.Core/System/Runtime/CompilerServices/DynamicAttribute.cs
+../../../external/referencesource/System.Core/System/Runtime/CompilerServices/ExecutionScope.cs
+
+../../../external/referencesource/System.Core/System/Security/Cryptography/Aes.cs
+../../../external/referencesource/System.Core/System/Security/Cryptography/AesManaged.cs
+
 ../../../external/referencesource/System.Core/System/threading/ReaderWriterLockSlim/ReaderWriterLockSlim.cs
 
 ../../../external/referencesource/System.Core/System/threading/Tasks/TaskExtensions.cs

Некоторые файлы не были показаны из-за большого количества измененных файлов