Merge pull request #819 from brendanzagaeski/patch-1
[mono.git] / mcs / class / dlr / Runtime / Microsoft.Scripting.Core / Compiler / DelegateHelpers.cs
index ac8b05bec6e0f0e21fd861d34de1a5a6589219cf..a2e5ca0a4c157c1d6e97c17d340b90375fbbaef3 100644 (file)
@@ -2,31 +2,28 @@
  *
  * Copyright (c) Microsoft Corporation. 
  *
- * This source code is subject to terms and conditions of the Microsoft Public License. A 
+ * This source code is subject to terms and conditions of the Apache License, Version 2.0. A 
  * copy of the license can be found in the License.html file at the root of this distribution. If 
- * you cannot locate the  Microsoft Public License, please send an email to 
+ * you cannot locate the  Apache License, Version 2.0, please send an email to 
  * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
- * by the terms of the Microsoft Public License.
+ * by the terms of the Apache License, Version 2.0.
  *
  * You must not remove this notice, or any other, from this software.
  *
  *
  * ***************************************************************************/
-using System; using Microsoft;
 
-
-#if CODEPLEX_40
+using System;
 using System.Dynamic.Utils;
-#else
-using Microsoft.Scripting.Utils;
-#endif
 using System.Reflection;
+#if FEATURE_REFEMIT
 using System.Reflection.Emit;
+#endif
 
-#if CODEPLEX_40
-namespace System.Linq.Expressions.Compiler {
+#if !FEATURE_CORE_DLR
+namespace Microsoft.Scripting.Ast.Compiler {
 #else
-namespace Microsoft.Linq.Expressions.Compiler {
+namespace System.Linq.Expressions.Compiler {
 #endif
     internal static partial class DelegateHelpers {
         private const MethodAttributes CtorAttributes = MethodAttributes.RTSpecialName | MethodAttributes.HideBySig | MethodAttributes.Public;
@@ -35,6 +32,7 @@ namespace Microsoft.Linq.Expressions.Compiler {
         private static readonly Type[] _DelegateCtorSignature = new Type[] { typeof(object), typeof(IntPtr) };
 
         private static Type MakeNewCustomDelegate(Type[] types) {
+#if FEATURE_REFEMIT
             Type returnType = types[types.Length - 1];
             Type[] parameters = types.RemoveLast();
 
@@ -42,6 +40,9 @@ namespace Microsoft.Linq.Expressions.Compiler {
             builder.DefineConstructor(CtorAttributes, CallingConventions.Standard, _DelegateCtorSignature).SetImplementationFlags(ImplAttributes);
             builder.DefineMethod("Invoke", InvokeAttributes, returnType, parameters).SetImplementationFlags(ImplAttributes);
             return builder.CreateType();
+#else
+            throw new NotSupportedException("Method signature not supported on this platform");
+#endif
         }
     }
 }